/* ═══════════════════════════════════════════════════════════════
   Yaseer LIS — Backup Manager Styles
   ═══════════════════════════════════════════════════════════════ */

:root {
    --bg-primary: #0c0e14;
    --bg-secondary: #12151e;
    --bg-card: #181c28;
    --bg-hover: #1e2333;
    --bg-input: #151820;
    --border: #252a3a;
    --border-light: #2a3045;
    --text-primary: #e8eaf0;
    --text-secondary: #8890a4;
    --text-muted: #565e74;
    --accent: #6c5ce7;
    --accent-light: #a29bfe;
    --accent-glow: rgba(108, 92, 231, 0.15);
    --success: #00cec9;
    --success-glow: rgba(0, 206, 201, 0.15);
    --warning: #fdcb6e;
    --danger: #e17055;
    --danger-glow: rgba(225, 112, 85, 0.15);
    --info: #74b9ff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ─── Login Gate ───────────────────────────────────────────── */
.login-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease;
}
.login-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 48px 40px;
    width: 380px;
    max-width: 90vw;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: fadeInRow 0.4s ease forwards;
}

.login-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--accent), #a29bfe);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 24px rgba(108, 92, 231, 0.3);
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.login-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all var(--transition);
    text-align: center;
    letter-spacing: 2px;
}
.login-input::placeholder { color: var(--text-muted); letter-spacing: 0; }
.login-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-error {
    min-height: 20px;
    margin: 10px 0;
    font-size: 12px;
    color: var(--danger);
}

.btn-login {
    width: 100%;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), #a29bfe);
    color: white;
    padding: 13px 20px;
    font-size: 14px;
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.3);
}
.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(108, 92, 231, 0.4);
}

.app-content-hidden {
    display: none !important;
}

/* ─── Header ───────────────────────────────────────────────── */
.app-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 32px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), #a29bfe);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.3);
}

.brand-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lab-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.lab-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 206, 201, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(0, 206, 201, 0); }
}

/* ─── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-refresh {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-refresh:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent-light);
}
.btn-refresh:active svg { animation: spin 0.6s ease; }

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.btn-restore {
    background: transparent;
    color: var(--accent-light);
    border: 1px solid var(--border);
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 6px;
}
.btn-restore:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.btn-cancel {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-cancel:hover { background: var(--bg-hover); }

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #d63031);
    color: white;
    box-shadow: 0 4px 16px rgba(225, 112, 85, 0.25);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(225, 112, 85, 0.35); }

/* ─── Stats Bar ────────────────────────────────────────────── */
.stats-bar {
    max-width: 1400px;
    margin: 24px auto 0;
    padding: 0 32px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition);
}
.stat-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon--total { background: var(--accent-glow); color: var(--accent-light); }
.stat-icon--latest { background: var(--success-glow); color: var(--success); }
.stat-icon--bucket { background: rgba(116, 185, 255, 0.12); color: var(--info); }

.stat-value {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ─── Search ───────────────────────────────────────────────── */
.search-section {
    max-width: 1400px;
    margin: 20px auto 0;
    padding: 0 32px;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 14px 80px 14px 46px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all var(--transition);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-count {
    position: absolute;
    right: 16px;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 4px 10px;
    border-radius: 12px;
}

/* ─── Main Table ───────────────────────────────────────────── */
.main-content {
    max-width: 1400px;
    margin: 20px auto 40px;
    padding: 0 32px;
}

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.backup-table {
    width: 100%;
    border-collapse: collapse;
}

.backup-table thead {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.backup-table th {
    padding: 14px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    user-select: none;
}

.sortable {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}
.sortable:hover { color: var(--text-secondary); }
.sortable.active { color: var(--accent-light); }
.sort-icon { opacity: 0.3; transition: opacity var(--transition); }
.sortable:hover .sort-icon { opacity: 0.7; }
.sortable.active .sort-icon { opacity: 1; }

.backup-table td {
    padding: 14px 20px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.backup-table tbody tr {
    transition: background var(--transition);
}
.backup-table tbody tr:last-child td { border-bottom: none; }
.backup-table tbody tr:hover { background: var(--bg-hover); }

.th-num { width: 50px; text-align: center; }
.td-num { text-align: center; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.file-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.file-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--accent-glow);
    color: var(--accent-light);
}

.file-key {
    word-break: break-all;
    line-height: 1.4;
}

.file-ext {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(108, 92, 231, 0.1);
    color: var(--accent-light);
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 4px;
}

.td-date {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.td-age {
    white-space: nowrap;
}

.age-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}
.age-badge--recent { background: var(--success-glow); color: var(--success); }
.age-badge--moderate { background: rgba(253, 203, 110, 0.12); color: var(--warning); }
.age-badge--old { background: var(--danger-glow); color: var(--danger); }

/* ─── Empty & Loading ──────────────────────────────────────── */
.empty-state, .loading-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state p, .loading-state p {
    margin-top: 12px;
    font-size: 14px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}

/* ─── Modal ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 460px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease;
}
.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

.modal-body {
    padding: 24px;
}
.modal-body p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

.modal-file-name {
    margin: 16px 0;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    word-break: break-all;
    color: var(--accent-light);
}

.modal-warning {
    color: var(--danger) !important;
    font-size: 13px !important;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* ─── Toast ────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 14px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    transition: transform 0.3s ease;
    white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.toast--success { border-color: var(--success); color: var(--success); }
.toast.toast--error { border-color: var(--danger); color: var(--danger); }
.toast.toast--info { border-color: var(--info); color: var(--info); }

/* ─── Row animation ────────────────────────────────────────── */
@keyframes fadeInRow {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.backup-table tbody tr {
    animation: fadeInRow 0.3s ease forwards;
    opacity: 0;
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .app-header { padding: 14px 16px; }
    .stats-bar, .search-section, .main-content { padding: 0 16px; }
    .brand-subtitle { display: none; }
    .th-age, .td-age { display: none; }
    .backup-table th, .backup-table td { padding: 12px 12px; }
    .stat-card { padding: 16px; }
}
