/* ============================================================
   CheckVault — Main CSS
   Dark corporate aesthetic with teal/amber accents
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
    --bg-base:      #080c12;
    --bg-surface:   #0d1420;
    --bg-elevated:  #131c2b;
    --bg-hover:     #1a2538;
    --bg-border:    #1e2d42;

    --text-primary: #e8edf5;
    --text-secondary: #7a8fa8;
    --text-muted:   #4a5d75;

    --accent:       #00c8a0;
    --accent-dim:   rgba(0,200,160,.15);
    --accent-glow:  rgba(0,200,160,.3);
    --accent2:      #f5a623;
    --accent2-dim:  rgba(245,166,35,.15);

    --danger:       #e04545;
    --danger-dim:   rgba(224,69,69,.15);
    --warning:      #f5a623;
    --warning-dim:  rgba(245,166,35,.15);
    --success:      #00c8a0;
    --success-dim:  rgba(0,200,160,.15);

    --risk-low:     #00c8a0;
    --risk-medium:  #f5a623;
    --risk-high:    #e04545;

    --radius-sm:    6px;
    --radius:       12px;
    --radius-lg:    18px;
    --radius-xl:    24px;

    --shadow:       0 4px 24px rgba(0,0,0,.4);
    --shadow-lg:    0 8px 48px rgba(0,0,0,.6);

    --font-main:    'Space Grotesk', sans-serif;
    --font-mono:    'JetBrains Mono', monospace;

    --nav-height:   64px;
    --transition:   .2s ease;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-main);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--bg-border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── NAVBAR ─── */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-height);
    background: rgba(8,12,18,.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--bg-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 24px;
    z-index: 1000;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.nav-logo {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), #007a62);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    box-shadow: 0 0 16px var(--accent-glow);
}

.nav-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -.3px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-elevated); }
.nav-link.active { color: var(--accent); background: var(--accent-dim); }
.nav-link i { font-size: 14px; }

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.nav-avatar {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, #1a2d45, #0d1e2f);
    border: 1px solid var(--bg-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}

.nav-user-info {
    display: flex;
    flex-direction: column;
}
.nav-user-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.nav-user-role { font-size: 11px; color: var(--text-muted); }

.nav-logout {
    width: 34px; height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition);
    font-size: 14px;
}
.nav-logout:hover { color: var(--danger); background: var(--danger-dim); }

/* ─── MAIN CONTENT ─── */
.main-content {
    padding-top: calc(var(--nav-height) + 32px);
    padding-bottom: 48px;
    padding-left: 32px;
    padding-right: 32px;
    max-width: 1300px;
    margin: 0 auto;
}

/* ─── PAGE HEADER ─── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 32px;
    gap: 16px;
}

.page-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -.5px;
}
.page-title i { color: var(--accent); font-size: 22px; }

.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

.header-badge, .admin-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--bg-border);
    border-radius: 99px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.admin-badge { color: var(--accent2); border-color: var(--accent2-dim); background: var(--accent2-dim); }
.admin-badge i { color: var(--accent2); }

/* ─── BUTTONS ─── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    background: linear-gradient(135deg, var(--accent), #00a882);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius);
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
}
.btn-secondary:hover { color: var(--text-primary); border-color: var(--text-muted); }

.btn-full { width: 100%; justify-content: center; }

.btn-icon {
    width: 32px; height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}
.btn-icon:hover { color: var(--text-primary); border-color: var(--text-muted); }
.btn-icon.danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-dim); }
.btn-icon.warning:hover { color: var(--warning); border-color: var(--warning); background: var(--warning-dim); }
.btn-icon.success:hover { color: var(--success); border-color: var(--success); background: var(--success-dim); }

/* ─── FORM ELEMENTS ─── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.form-label i { color: var(--accent); font-size: 11px; }

.form-input {
    padding: 11px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 14px;
    transition: all var(--transition);
    outline: none;
    width: 100%;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-input::placeholder { color: var(--text-muted); }

select.form-input { cursor: pointer; }
option { background: var(--bg-elevated); }

/* ─── ALERTS ─── */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
}
.alert-error { background: var(--danger-dim); border: 1px solid rgba(224,69,69,.3); color: #ff7070; }
.alert-warning { background: var(--warning-dim); border: 1px solid rgba(245,166,35,.3); color: var(--warning); }
.alert-success { background: var(--success-dim); border: 1px solid rgba(0,200,160,.3); color: var(--accent); }

/* ─── BADGES & PILLS ─── */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    background: var(--bg-border);
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: 8px;
}

.type-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
}
.type-badge.pdf { background: rgba(239,68,68,.15); color: #ef4444; }
.type-badge.image { background: rgba(99,102,241,.15); color: #818cf8; }

.risk-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
}
.risk-pill.low { background: rgba(0,200,160,.15); color: var(--risk-low); }
.risk-pill.medium { background: rgba(245,166,35,.15); color: var(--risk-medium); }
.risk-pill.high { background: rgba(224,69,69,.2); color: var(--risk-high); }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
}
.status-pill i { font-size: 8px; }
.status-pill.active { color: var(--accent); }
.status-pill.inactive { color: var(--text-muted); }

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
}
.role-badge.admin { background: var(--accent2-dim); color: var(--accent2); border: 1px solid rgba(245,166,35,.2); }
.role-badge.user { background: var(--bg-border); color: var(--text-secondary); }

/* ─── TABLES ─── */
.files-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--bg-border);
}

.files-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.files-table th {
    padding: 12px 16px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--bg-border);
}
.files-table th i { margin-right: 5px; color: var(--accent); font-size: 10px; }
.files-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(30,45,66,.5);
    vertical-align: middle;
}
.files-table tr:last-child td { border-bottom: none; }
.files-table tbody tr { transition: background var(--transition); }
.files-table tbody tr:hover { background: var(--bg-hover); }
.files-table .row-inactive { opacity: .5; }

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

.file-icon-sm {
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.file-icon-sm.pdf { background: rgba(239,68,68,.15); color: #ef4444; }
.file-icon-sm.img { background: rgba(99,102,241,.15); color: #818cf8; }

.file-name-text { color: var(--text-primary); font-weight: 500; }

.action-btns { display: flex; align-items: center; gap: 6px; }

.date-text { color: var(--text-secondary); font-family: var(--font-mono); font-size: 12px; }
.mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }

.download-count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
    font-size: 13px;
}
.download-count i { font-size: 11px; color: var(--accent); }

/* ─── SECTIONS ─── */
.files-section, .admin-section { margin-top: 32px; }
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.section-title {
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title i { color: var(--accent); }
.section-sub { font-size: 13px; color: var(--text-muted); }

/* ─── EMPTY STATE ─── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 15px; }

/* ─── USER CELL ─── */
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--bg-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}
.user-avatar.admin { background: var(--accent2-dim); color: var(--accent2); }
.user-name { font-size: 13px; font-weight: 600; }
.user-login { font-size: 11px; color: var(--text-muted); }

/* ─── TOAST ─── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 13px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all .3s cubic-bezier(.34,1.56,.64,1);
    z-index: 9999;
    pointer-events: none;
}
.toast.show {
    transform: translateY(0);
    opacity: 1;
}
.toast.success { border-color: var(--accent); color: var(--accent); }
.toast.error { border-color: var(--danger); color: var(--danger); }

/* ─── MODAL ─── */
.modal-overlay[hidden] {
    display: none !important;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    backdrop-filter: blur(8px);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-card {
    background: var(--bg-elevated);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.modal-header h3 i { color: var(--accent); }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    transition: color var(--transition);
    padding: 4px;
}
.modal-close:hover { color: var(--text-primary); }
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ─── ANIMATIONS ─── */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

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

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
    .main-content { padding-left: 16px; padding-right: 16px; }
    .page-title { font-size: 20px; }
    .nav-user-info { display: none; }
}
