/* ============================================================
   ADMIN CSS — Presensi Digital
   Dark Glassmorphism Design System
   ============================================================ */

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

:root {
    --bg-base:       #0a0f1e;
    --bg-surface:    #111827;
    --bg-elevated:   #1f2937;
    --bg-glass:      rgba(255, 255, 255, 0.04);
    --bg-glass-hover:rgba(255, 255, 255, 0.08);

    --border:        rgba(255, 255, 255, 0.08);
    --border-active: rgba(99, 102, 241, 0.6);

    --accent:        #6366f1;
    --accent-light:  #818cf8;
    --accent-glow:   rgba(99, 102, 241, 0.3);
    --success:       #10b981;
    --warning:       #f59e0b;
    --danger:        #ef4444;
    --info:          #3b82f6;

    --text-primary:  #f1f5f9;
    --text-secondary:#94a3b8;
    --text-muted:    #64748b;

    --sidebar-w:     260px;
    --topbar-h:      64px;
    --radius:        12px;
    --radius-sm:     8px;
    --shadow:        0 4px 24px rgba(0,0,0,0.4);
    --transition:    0.2s ease;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    background-image:
        radial-gradient(ellipse at 10% 0%, rgba(99,102,241,0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 90% 100%, rgba(16,185,129,0.06) 0%, transparent 60%);
}

/* ============================================================ LAYOUT */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ============================================================ SIDEBAR */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
    backdrop-filter: blur(20px);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}
.brand-icon {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
}
.brand-text { line-height: 1; }
.brand-name { font-size: 17px; font-weight: 700; color: var(--text-primary); display: block; }
.brand-sub  { font-size: 11px; color: var(--accent-light); font-weight: 500; letter-spacing: 1px; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 20px 12px; }
.nav-section-label {
    font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--text-muted); padding: 0 8px; margin-bottom: 8px;
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px; font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
}
.nav-item:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    transform: translateX(2px);
}
.nav-item.active {
    background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(129,140,248,0.1));
    color: var(--accent-light);
    border: 1px solid rgba(99,102,241,0.25);
}
.nav-icon { width: 20px; text-align: center; font-size: 16px; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
}
.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--success));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    flex-shrink: 0;
}
.user-details { flex: 1; min-width: 0; }
.user-name  { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { display: block; font-size: 11px; color: var(--text-muted); }
.btn-logout {
    background: none; border: 1px solid var(--border);
    color: var(--text-secondary); width: 32px; height: 32px;
    border-radius: var(--radius-sm); cursor: pointer; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}
.btn-logout:hover { background: var(--danger); border-color: var(--danger); color: white; }

/* ============================================================ MAIN */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    height: var(--topbar-h);
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px;
    padding: 0 28px;
    position: sticky; top: 0; z-index: 50;
}
.sidebar-toggle {
    background: none; border: 1px solid var(--border);
    color: var(--text-secondary); width: 36px; height: 36px;
    border-radius: var(--radius-sm); cursor: pointer; font-size: 18px;
    display: none;
    transition: all var(--transition);
}
.page-title { font-size: 16px; font-weight: 600; flex: 1; }
.top-bar-actions { display: flex; gap: 8px; align-items: center; }

.content-area { padding: 28px; flex: 1; }

/* ============================================================ CARDS */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.card.mt-2 { margin-top: 20px; }
.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 24px; }

/* ============================================================ STATS */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex; align-items: center; gap: 16px;
    backdrop-filter: blur(8px);
    transition: all var(--transition);
}
.stat-card:hover { border-color: var(--border-active); background: var(--bg-glass-hover); }
.stat-icon { font-size: 28px; }
.stat-number { font-size: 28px; font-weight: 800; background: linear-gradient(135deg, var(--accent-light), var(--success)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ============================================================ TABLES */
.table-wrapper { overflow-x: auto; }
.data-table {
    width: 100%; border-collapse: collapse;
    font-size: 13px;
}
.data-table thead th {
    padding: 10px 12px;
    text-align: left;
    font-size: 11px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.data-table tbody td {
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--bg-glass); }
.table-link { color: var(--accent-light); text-decoration: none; font-weight: 500; }
.table-link:hover { text-decoration: underline; }

.signature-thumb {
    width: 80px; height: 36px; object-fit: contain;
    background: white; border-radius: 4px; border: 1px solid var(--border);
    cursor: pointer; padding: 2px;
    transition: transform var(--transition);
}
.signature-thumb:hover { transform: scale(2); z-index: 10; position: relative; }

.pagination-wrapper { margin-top: 20px; display: flex; justify-content: center; }
.pagination-wrapper .pagination {
    display: flex; gap: 4px; list-style: none;
}
.pagination-wrapper .page-link {
    display: block; padding: 6px 12px;
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-secondary);
    text-decoration: none; font-size: 13px;
    transition: all var(--transition);
}
.pagination-wrapper .page-link:hover, .pagination-wrapper .active .page-link {
    background: var(--accent); border-color: var(--accent); color: white;
}

/* ============================================================ BUTTONS */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500;
    cursor: pointer; border: none;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary   { background: var(--accent); color: white; box-shadow: 0 4px 12px var(--accent-glow); }
.btn-primary:hover { background: var(--accent-light); }
.btn-secondary { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { color: var(--text-primary); border-color: var(--border-active); }
.btn-warning   { background: rgba(245,158,11,0.15); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.btn-warning:hover { background: var(--warning); color: white; }
.btn-danger    { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover  { background: var(--danger); color: white; }
.btn-success   { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.btn-success:hover { background: var(--success); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn.w-full { width: 100%; justify-content: center; }

.action-btns { display: flex; gap: 4px; }

/* ============================================================ DROPDOWN */
.dropdown-wrapper {
    position: relative;
    display: inline-block;
}
.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-width: 180px;
    box-shadow: var(--shadow);
    z-index: 100;
    padding: 4px 0;
    overflow: hidden;
    /* Bridge the gap so hover isn't lost */
    transform: translateY(4px);
}
.dropdown-content::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}
.dropdown-content a {
    color: var(--text-secondary);
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    font-size: 13px;
    transition: var(--transition);
}
.dropdown-content a:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}
.dropdown-wrapper:hover .dropdown-content,
.dropdown-wrapper.active .dropdown-content {
    display: block;
}

/* ============================================================ BADGES */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
}
.badge-success { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.25); }
.badge-danger  { background: rgba(239,68,68,0.12); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.badge-info    { background: rgba(59,130,246,0.12); color: var(--info); border: 1px solid rgba(59,130,246,0.2); }
.badge-warning { background: rgba(245,158,11,0.12); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }

/* ============================================================ ALERTS */
.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: var(--radius-sm);
    margin-bottom: 20px; font-size: 14px;
}
.alert-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.25); color: var(--success); }
.alert-error   { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.25); color: var(--danger); }

/* ============================================================ FORMS */
.form-card { max-width: 760px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.required { color: var(--danger); }

.form-control {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all var(--transition);
    width: 100%;
}
/* Fix for dropdown options visibility in dark theme */
select.form-control option {
    background-color: var(--bg-surface);
    color: var(--text-primary);
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(99,102,241,0.05);
}
.form-control.is-invalid { border-color: var(--danger); }
.invalid-feedback { font-size: 12px; color: var(--danger); }

.time-group { display: flex; align-items: center; gap: 8px; }
.time-sep { color: var(--text-muted); font-size: 13px; white-space: nowrap; }

.form-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    margin-top: 24px; padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ============================================================ EVENT DETAIL */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
}
.info-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.info-item { display: flex; align-items: flex-start; gap: 12px; }
.info-icon { font-size: 18px; width: 24px; }
.info-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.info-value { font-size: 14px; font-weight: 500; margin-top: 2px; }

.event-meta { display: flex; gap: 8px; flex-wrap: wrap; }

.link-box { background: var(--bg-elevated); border-radius: var(--radius-sm); padding: 14px; }
.link-label { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.link-input-group { display: flex; gap: 8px; }
.link-input {
    flex: 1; background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 12px;
    color: var(--accent-light); font-size: 12px;
    font-family: monospace;
}

.qr-card { position: sticky; top: calc(var(--topbar-h) + 20px); }
.qr-body { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.qr-wrapper {
    background: white; border-radius: var(--radius); padding: 16px;
    box-shadow: var(--shadow);
}
.qr-image { display: block; width: 200px; height: 200px; }
.mt-1 { margin-top: 8px; }

/* ============================================================ MODAL */
.modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity var(--transition);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-box {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0; max-width: 480px; width: 90%;
    box-shadow: var(--shadow);
    transform: scale(0.95);
    transition: transform var(--transition);
}
.modal-overlay.active .modal-box { transform: scale(1); }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; }
.modal-body { padding: 20px; display: flex; justify-content: center; }
.sig-full { max-width: 100%; background: white; border-radius: var(--radius-sm); }

/* ============================================================ EMPTY STATE */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { color: var(--text-secondary); font-size: 14px; }
.empty-state a { color: var(--accent-light); }

/* ============================================================ LOGIN PAGE */
.login-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bg-base);
    background-image:
        radial-gradient(ellipse at 20% 20%, rgba(99,102,241,0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 80%, rgba(16,185,129,0.1) 0%, transparent 60%);
    padding: 20px;
}
.login-card {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: 20px; padding: 48px 40px; width: 100%; max-width: 420px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon {
    width: 80px; height: 80px; margin: 0 auto 12px;
    display: flex; align-items: center; justify-content: center;
}
.login-title { font-size: 22px; font-weight: 700; }
.login-sub   { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.login-form  { display: flex; flex-direction: column; gap: 16px; }
.login-btn   {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white; border: none; border-radius: var(--radius-sm);
    padding: 12px; font-size: 15px; font-weight: 600;
    cursor: pointer; margin-top: 8px;
    box-shadow: 0 4px 16px var(--accent-glow);
    transition: all var(--transition);
}
.login-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* ============================================================ RESPONSIVE */
@media (max-width: 1024px) {
    .detail-grid { grid-template-columns: 1fr; }
    .qr-card { position: static; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: flex; }
    .form-grid { grid-template-columns: 1fr; }
    .top-bar-actions .btn span:last-child { display: none; }
    .content-area { padding: 16px; }
}

/* ============================================================ CUSTOM TIME PICKER */
.time-picker-container {
    display: flex; align-items: center; gap: 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px 8px;
    transition: all var(--transition);
}
.time-picker-container:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(99,102,241,0.05);
}
.time-select {
    background: none; border: none; color: var(--text-primary);
    font-size: 14px; font-weight: 600; padding: 8px 4px;
    cursor: pointer; outline: none; appearance: none;
    -webkit-appearance: none; text-align: center;
}
.time-select option { background: var(--bg-surface); color: var(--text-primary); }
.time-picker-sep { font-weight: 700; color: var(--text-muted); padding: 0 2px; }

/* ============================================================ TOAST */
.toast-container {
    position: fixed; top: 24px; right: 24px;
    display: flex; flex-direction: column; gap: 10px;
    z-index: 9999; pointer-events: none;
}
.toast {
    pointer-events: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.4);
    min-width: 280px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast.show { transform: translateX(0); }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-icon {
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: bold;
}
.toast-success .toast-icon { background: rgba(16,185,129,0.2); color: var(--success); }
.toast-error .toast-icon { background: rgba(239,68,68,0.2); color: var(--danger); }
.toast-message { font-size: 13px; font-weight: 500; color: var(--text-primary); }

/* ============================================================ SEARCH & TOOLS */
.card-tools { display: flex; gap: 12px; align-items: center; }
.search-input-wrapper { position: relative; flex: 1; min-width: 240px; }
.search-input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); opacity: 0.5; font-size: 14px; }
.search-input { padding-left: 38px !important; }

/* ============================================================ RESPONSIVE FIXES */
@media (max-width: 768px) {
    .toast-container { top: auto; bottom: 24px; right: 16px; left: 16px; }
    .toast { min-width: 0; width: 100%; transform: translateY(120%); }
    .toast.show { transform: translateY(0); }
}
