/* ============================================================
   Employee ID Verification System — Admin Panel CSS
   Design: Modern SaaS / Linear-inspired dark-light hybrid
   ============================================================ */

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

/* ─── Reset & Base ────────────────────────────────────────── */

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

:root {
    --sidebar-w: 260px;
    --topbar-h: 64px;

    /* Colors */
    --brand:        #6366f1;
    --brand-dark:   #4f46e5;
    --brand-light:  #e0e7ff;
    --sidebar-bg:   #0f1117;
    --sidebar-text: rgba(255,255,255,0.65);
    --sidebar-hover:#1e2130;
    --sidebar-active:#1a1d2e;
    --bg:           #f8f9fc;
    --surface:      #ffffff;
    --border:       #e5e7eb;
    --text-primary: #111827;
    --text-secondary:#6b7280;
    --text-muted:   #9ca3af;
    --success:      #10b981;
    --warning:      #f59e0b;
    --danger:       #ef4444;
    --info:         #3b82f6;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow:    0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.03);

    --radius:   12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 0.925rem;
}

/* ─── Layout ──────────────────────────────────────────────── */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin 0.3s ease;
}

/* ─── Sidebar ─────────────────────────────────────────────── */

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--brand), #a78bfa);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand { color: #fff; font-weight: 700; font-size: 0.95rem; }
.sidebar-version { color: rgba(255,255,255,0.3); font-size: 0.7rem; }
.sidebar-close {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-section-label {
    color: rgba(255,255,255,0.25);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.5rem 0.5rem 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    margin-bottom: 2px;
}

.nav-link i { font-size: 1rem; flex-shrink: 0; }
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem;
}

.admin-avatar {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--brand), #a78bfa);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
}

.admin-name { color: #fff; font-size: 0.8rem; font-weight: 600; }
.admin-role { color: rgba(255,255,255,0.35); font-size: 0.7rem; }

.btn-logout {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.6);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-logout:hover {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.3);
    color: #fca5a5;
}

/* ─── Topbar ──────────────────────────────────────────────── */

.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.1rem;
    display: none;
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }

/* ─── Page Body ───────────────────────────────────────────── */

.page-body { padding: 1.5rem 1.75rem; flex: 1; }

/* ─── Flash Messages ──────────────────────────────────────── */

.flash-message {
    margin: 0 1.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    position: relative;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.flash-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.flash-error   { background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d; }
.flash-warning { background: #fffbeb; border: 1px solid #fde68a; color: #78350f; }

.flash-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    font-size: 0.9rem;
    padding: 0;
}

/* ─── Cards ───────────────────────────────────────────────── */

.card-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-panel-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-panel-body { padding: 1.5rem; }

/* ─── Dashboard Stat Cards ────────────────────────────────── */

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.1rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.green  { background: #ecfdf5; color: #059669; }
.stat-icon.orange { background: #fff7ed; color: #d97706; }
.stat-icon.red    { background: #fef2f2; color: #dc2626; }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
    font-weight: 500;
}

/* ─── Status Badges ───────────────────────────────────────── */

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-active   { background: #ecfdf5; color: #065f46; }
.badge-expired  { background: #fff7ed; color: #9a3412; }
.badge-suspended{ background: #fef2f2; color: #7f1d1d; }

/* ─── Tables ──────────────────────────────────────────────── */

.table-wrapper { overflow-x: auto; }

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

.data-table th {
    background: #f9fafb;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.875rem;
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f9fafb; }

.employee-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.employee-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), #a78bfa);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
}

/* ─── Forms ───────────────────────────────────────────────── */

.form-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: all 0.15s;
    background: var(--surface);
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
    outline: none;
}

.form-control.is-invalid, .form-select.is-invalid {
    border-color: var(--danger);
    box-shadow: none;
}

.invalid-feedback { font-size: 0.8rem; }

/* ─── Buttons ─────────────────────────────────────────────── */

.btn { border-radius: var(--radius-sm); font-weight: 500; font-size: 0.875rem; transition: all 0.15s; }

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.btn-primary:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

.btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-action:hover { background: #f3f4f6; color: var(--text-primary); }
.btn-action.edit:hover  { background: #ede9fe; color: #7c3aed; border-color: #ddd6fe; }
.btn-action.view:hover  { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.btn-action.delete:hover{ background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.btn-action.qr:hover    { background: #ecfdf5; color: #059669; border-color: #a7f3d0; }

/* ─── Photo Upload ────────────────────────────────────────── */

.photo-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.photo-upload-area:hover, .photo-upload-area.drag-over {
    border-color: var(--brand);
    background: #f5f3ff;
}

.photo-upload-area input[type=file] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.photo-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    display: block;
    margin: 0 auto 0.75rem;
}

/* ─── QR Code Preview ─────────────────────────────────────── */

.qr-preview {
    text-align: center;
    padding: 1rem;
}

.qr-preview img {
    max-width: 200px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* ─── Search Bar ──────────────────────────────────────────── */

.search-box {
    position: relative;
}

.search-box .bi-search {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-box .form-control {
    padding-left: 2.4rem;
}

/* ─── Pagination ──────────────────────────────────────────── */

.pagination .page-link {
    border-radius: 8px;
    margin: 0 2px;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    padding: 0.4rem 0.7rem;
}

.pagination .page-link:hover { background: var(--brand-light); color: var(--brand); border-color: #c7d2fe; }
.pagination .page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ─── Employee Profile View ────────────────────────────────── */

.profile-photo-lg {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
}

.profile-photo-placeholder {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 2rem;
    color: #fff;
}

.detail-row {
    display: flex;
    align-items: center;
    padding: 0.65rem 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.875rem;
}

.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-secondary); width: 150px; flex-shrink: 0; font-weight: 500; }
.detail-value { color: var(--text-primary); font-weight: 500; }

/* ─── Empty State ─────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state-text { color: var(--text-muted); font-size: 0.875rem; }

/* ─── Sidebar Overlay ─────────────────────────────────────── */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* ─── Responsive ──────────────────────────────────────────── */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .topbar-toggle { display: flex !important; }

    .page-body { padding: 1rem; }

    .topbar { padding: 0 1rem; }
    .flash-message { margin: 0 1rem; }
}

@media (max-width: 575.98px) {
    .stat-card { padding: 1rem 1.1rem; }
    .stat-value { font-size: 1.6rem; }
    .card-panel-body { padding: 1rem; }
}
