/* ========================================
   Dashboard 頁面樣式 - 淺色舒適配色
   ======================================== */

/* Dashboard 主容器 */
.dashboard-main {
    min-height: calc(100vh - 120px);
    background: #f5f7fa;
    padding: 2rem 0;
}

/* Breadcrumb 導航 */
.breadcrumb {
    max-width: 1200px;
    margin: 0 auto 2rem;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.breadcrumb-item {
    color: #64748b;
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb-item:hover {
    color: #0ea5e9;
}

.breadcrumb-item.active {
    color: #1e293b;
    font-weight: 600;
}

.breadcrumb-separator {
    color: #cbd5e1;
}

/* Dashboard 容器 */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Dashboard Header */
.dashboard-header {
    margin-bottom: 2.5rem;
    text-align: center;
}

.dashboard-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dashboard-subtitle {
    font-size: 1.1rem;
    color: #64748b;
}

/* Anon ID 區塊 */
.anon-id-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 2rem;
    padding: 1rem 1.5rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    font-size: 0.95rem;
    color: #64748b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.anon-label {
    font-weight: 600;
    color: #1e293b;
}

#anon-id-display {
    background: #f8fafc;
    padding: 4px 8px;
    border-radius: 8px;
    font-family: 'Monaco', 'Courier New', monospace;
    color: #0ea5e9;
    font-weight: 600;
    font-size: 0.9rem;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: #64748b;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    border-radius: 8px;
}

.icon-btn:hover {
    background: #f8fafc;
    color: #0ea5e9;
}

.text-btn-sm {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #0ea5e9;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.text-btn-sm:hover {
    background: #f8fafc;
    border-color: #0ea5e9;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    margin-left: 4px;
    background: #e0f2fe;
    color: #0284c7;
}

/* 短網址列表 */
.links-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.loading-message {
    text-align: center;
    color: #64748b;
    padding: 3rem;
    font-size: 1.1rem;
}

.link-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s;
}

.link-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.12);
    border-color: #0ea5e9;
}

.link-card.disabled {
    opacity: 0.9;
    background: #fff5f5;
    border-color: #fed7d7;
    border-style: dashed;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.short-link {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0ea5e9;
    text-decoration: none;
    font-family: 'Monaco', 'Courier New', monospace;
}

.short-link:hover {
    text-decoration: underline;
}

.card-body {
    margin-bottom: 0.75rem;
}

.long-link {
    color: #64748b;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid #f1f5f9;
    font-size: 0.85rem;
    color: #94a3b8;
}

.meta-info {
    display: flex;
    gap: 1rem;
}

/* 統計按鈕 - 內嵌在 footer */
.stats-btn-inline {
    background: none;
    border: none;
    color: #6f42c1;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

.stats-btn-inline:hover {
    background: #f3ebff;
    color: #5a32a3;
}

.stats-btn-inline svg {
    width: 12px;
    height: 12px;
}

/* 分頁控制 */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.page-btn {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-btn:hover:not(:disabled) {
    border-color: #0ea5e9;
    color: #0ea5e9;
    background: #f0f9ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.1);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8fafc;
}

.page-info {
    font-size: 0.9rem;
    color: #475569;
    font-weight: 600;
    background: #f1f5f9;
    padding: 4px 12px;
    border-radius: 20px;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    padding: 8px 12px;
    font-size: 0.9rem;
    color: #64748b;
    border-radius: 8px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

.action-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
    transform: translateY(-1px);
}

.action-btn.open {
    color: #0ea5e9;
    border-color: #bae6fd;
    background-color: #f0f9ff;
}

.action-btn.copy {
    color: #10b981;
    border-color: #a7f3d0;
    background-color: #f0fdf4;
}

.action-btn.toggle {
    color: #64748b;
}

/* Dashboard Footer Actions */
.dashboard-footer-actions {
    margin-top: 2rem;
    text-align: center;
    padding: 1.5rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
}

.text-btn {
    background: none;
    border: none;
    color: #0ea5e9;
    cursor: pointer;
    font-size: 0.95rem;
    text-decoration: underline;
    margin: 0 1rem;
    padding: 0.5rem 1rem;
    transition: all 0.3s;
}

.text-btn:hover {
    color: #0284c7;
}

/* Modal 樣式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #ffffff;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.merge-modal-content {
    max-width: 600px;
}

.close {
    float: right;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.3s;
}

.close:hover {
    color: #1e293b;
}

.modal h2 {
    color: #1e293b;
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

.modal-desc {
    color: #64748b;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* Form 樣式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #1e293b;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input[type="text"] {
    width: 90%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

/* PIN 輸入格 */
.pin-input-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
    max-width: 360px;
    /* 限制最大寬度避免過大 */
    margin: 0 auto;
    /* 居中 */
}

.pin-digit {
    width: 100% !important;
    height: 3rem;
    /* 固定高度 */
    padding: 0 !important;
    /* 移除 padding 避免影響 calculation，文字置中靠 flex 或 line-height */
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px;
    transition: all 0.3s;
    box-sizing: border-box;
    /* 確保邊框計算在內 */
    line-height: normal;
}

.pin-digit:focus {
    outline: none;
    border-color: #0ea5e9 !important;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

/* 警告訊息 */
.merge-warning {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    color: #92400e;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.merge-result,
.pin-code-result,
.switch-result {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    color: #ffffff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.4);
}

.btn-secondary {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 0 1rem;
    }

    .dashboard-header h1 {
        font-size: 2rem;
    }

    .breadcrumb {
        padding: 0 1rem;
    }

    .anon-id-section {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .card-footer {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .action-buttons {
        width: 100%;
        justify-content: flex-start;
    }

    .pin-input-grid {
        gap: 0.25rem;
    }

    .pin-digit {
        font-size: 1.25rem;
        padding: 0.5rem !important;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    .modal-content {
        margin: 10% auto;
        padding: 1.5rem;
    }
}