/* ==========================================================
   Presensi Karang Taruna BINAREMAJAGAUM - Modern Premium Design System
   ========================================================== */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --primary-glow: rgba(37, 99, 235, 0.25);
    
    --accent: #0ea5e9;
    --accent-glow: rgba(14, 165, 233, 0.25);
    
    --success: #10b981;
    --success-light: #d1fae5;
    --success-dark: #047857;
    
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    
    --danger: #ef4444;
    --danger-light: #fee2e2;
    
    --bg-dark: #090d16;
    --bg-surface: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #24324a;
    
    --border-subtle: #334155;
    --border-focus: #3b82f6;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #0f172a;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 25px rgba(37, 99, 235, 0.35);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Background subtle ambient glow */
body::before {
    content: '';
    position: fixed;
    top: -20%;
    left: 20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.12) 0%, rgba(0, 0, 0, 0) 70%);
    z-index: -1;
    pointer-events: none;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.container-sm {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header & Nav */
.header-nav {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

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

.brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.brand-icon svg {
    width: 24px;
    height: 24px;
    color: #ffffff;
}

.brand-text h2 {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
}

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

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

/* User pill */
.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 6px 14px 6px 8px;
    border-radius: 9999px;
    border: 1px solid var(--border-subtle);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: white;
}

.user-meta {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    font-weight: 700;
    color: white;
    line-height: 1.2;
}

.user-role {
    font-size: 11px;
    color: var(--accent);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    transition: var(--transition);
    outline: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #1d4ed8);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
    background: linear-gradient(135deg, #34d399, #10b981);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
    color: #ffffff;
}

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

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: #475569;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 15px 28px;
    font-size: 16px;
    border-radius: var(--radius-lg);
    font-weight: 700;
}

.btn-block {
    width: 100%;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    border-color: #475569;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 6px;
}

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

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue { background: rgba(37, 99, 235, 0.15); color: #38bdf8; }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.stat-icon.amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.stat-icon.purple { background: rgba(168, 85, 247, 0.15); color: #c084fc; }

.stat-data .stat-val {
    font-size: 26px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.1;
}

.stat-data .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
.badge-primary { background: rgba(37, 99, 235, 0.2); color: #60a5fa; border: 1px solid rgba(37, 99, 235, 0.4); }

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: #ffffff;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13.5px;
}

.table th {
    background: rgba(15, 23, 42, 0.7);
    color: var(--text-muted);
    font-weight: 600;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid #1f293d;
    vertical-align: middle;
}

.table tr:hover td {
    background: rgba(30, 41, 59, 0.5);
}

/* Camera Component & Overlay */
.camera-box {
    position: relative;
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-subtle);
}

.camera-box video,
.camera-box canvas,
.camera-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.face-guide {
    width: 220px;
    height: 270px;
    border: 2px dashed rgba(255, 255, 255, 0.7);
    border-radius: 50% 50% 45% 45%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
    position: relative;
}

.face-guide::after {
    content: 'Posisikan Wajah Disini';
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* Map Container */
.map-container {
    width: 100%;
    height: 260px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    margin-top: 12px;
    margin-bottom: 12px;
    z-index: 1;
}

/* Alert Notification */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); color: #34d399; }
.alert-danger { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); color: #f87171; }
.alert-warning { background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.3); color: #fbbf24; }
.alert-info { background: rgba(14, 165, 233, 0.15); border: 1px solid rgba(14, 165, 233, 0.3); color: #38bdf8; }

/* Attendance Stepper */
.stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    position: relative;
}

.stepper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 40px;
    right: 40px;
    height: 2px;
    background: var(--border-subtle);
    transform: translateY(-50%);
    z-index: 0;
}

.step-item {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.step-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-muted);
    transition: var(--transition);
}

.step-item.active .step-circle {
    background: var(--primary);
    border-color: #60a5fa;
    color: #ffffff;
    box-shadow: 0 0 16px var(--primary-glow);
}

.step-item.completed .step-circle {
    background: var(--success);
    border-color: #34d399;
    color: #ffffff;
}

.step-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.step-item.active .step-text {
    color: #ffffff;
}

/* Success Checkmark Animation */
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.15);
    border: 3px solid #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #10b981;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
    animation: pulseCheck 1.5s infinite;
}

@keyframes pulseCheck {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { transform: scale(1); box-shadow: 0 0 0 15px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Receipts Card */
.receipt-card {
    background: #0f172a;
    border: 1px dashed #334155;
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 13.5px;
    border-bottom: 1px solid #1e293b;
}

.receipt-row:last-child {
    border-bottom: none;
}

.receipt-label {
    color: var(--text-muted);
}

.receipt-val {
    font-weight: 600;
    color: #ffffff;
    text-align: right;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2000;
}

.modal-backdrop.open {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    max-width: 550px;
    width: 100%;
    padding: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    max-height: 90vh;
    overflow-y: auto;
}

/* Footer */
.app-footer {
    margin-top: auto;
    border-top: 1px solid var(--border-subtle);
    padding: 24px 0;
    text-align: center;
    font-size: 12.5px;
    color: var(--text-muted);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .header-inner {
        height: 60px;
    }
    .card {
        padding: 18px;
    }
}

/* ==========================================================
   Admin 3-Dots Dropdown Menu (Responsive Mobile & Desktop)
   ========================================================== */
.admin-menu-dropdown {
    position: relative;
    display: inline-block;
}

.btn-dots-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    background: #1e293b;
    border: 1px solid #475569;
    color: #f1f5f9;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.2s ease;
}

.btn-dots-menu:hover,
.btn-dots-menu.active {
    background: #334155;
    color: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 14px rgba(59, 130, 246, 0.35);
}

.btn-dots-menu svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.admin-dropdown-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: auto;
    width: 235px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 14px;
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
    padding: 8px 6px;
    z-index: 9999;
    backdrop-filter: blur(20px);
    animation: dropdownFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-dropdown-panel.show {
    display: block;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.admin-dropdown-header {
    padding: 6px 12px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 4px;
}

.admin-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
}

.admin-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.admin-dropdown-item.active {
    background: rgba(37, 99, 235, 0.2);
    color: #60a5fa;
    font-weight: 700;
    border-left: 3px solid #3b82f6;
}

.admin-dropdown-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.admin-dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 6px 4px;
}

.admin-dropdown-item.text-danger {
    color: #f87171;
}

.admin-dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

/* Hide / Show responsive helper */
@media (max-width: 900px) {
    .hide-mobile {
        display: none !important;
    }
    .user-pill .user-meta {
        display: none !important;
    }
    .header-inner {
        gap: 8px;
    }
    .brand-text h2 {
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 170px;
    }
    .brand-text span {
        display: none !important;
    }
    .brand-icon {
        width: 36px;
        height: 36px;
    }
    .brand-icon svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 640px) {
    .btn-dots-text {
        display: none;
    }
    .btn-dots-menu {
        padding: 0;
        width: 38px;
        min-width: 38px;
    }
}
