/* Import Google Fonts - Outfit */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* Theme Gelap (Default) */
    --bg-main: #0a0813;
    --bg-card: rgba(18, 14, 32, 0.65);
    --border-card: rgba(138, 92, 246, 0.18);
    --text-primary: #f3f1f7;
    --text-secondary: #a49eb5;
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --secondary: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --sidebar-width: 260px;
    --glass-blur: 16px;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-inset: inset 0 0 12px rgba(138, 92, 246, 0.05);
}

body.light-theme {
    /* Theme Terang */
    --bg-main: #f3f4f6;
    --bg-card: rgba(255, 255, 255, 0.85);
    --border-card: rgba(138, 92, 246, 0.12);
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --primary: #6d28d9;
    --primary-hover: #5b21b6;
    --secondary: #0891b2;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --shadow: 0 8px 32px 0 rgba(138, 92, 246, 0.08);
    --shadow-inset: inset 0 0 12px rgba(138, 92, 246, 0.02);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Layout Dashboard */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.logo-container img {
    width: 40px;
    height: 40px;
}

.logo-container h2 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--primary);
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-menu li a:hover,
.sidebar-menu li.active a {
    background: rgba(139, 92, 246, 0.15);
    color: var(--text-primary);
    box-shadow: var(--shadow-inset);
}

.sidebar-menu li.active a {
    border-left: 3px solid var(--primary);
}

.sidebar-menu li a svg {
    width: 20px;
    height: 20px;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 40px;
    min-height: 100vh;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.header-title h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.header-title p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.theme-toggle-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    color: var(--text-primary);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.theme-toggle-btn:hover {
    transform: scale(1.05);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    padding: 6px 16px;
    border-radius: 30px;
}

.user-profile span {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Grid Panel Statistik */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
}

.stat-card.cyan::before { background: var(--secondary); }
.stat-card.emerald::before { background: var(--success); }
.stat-card.amber::before { background: var(--warning); }
.stat-card.red::before { background: var(--danger); }
.stat-card.rose::before { background: #f43f5e; }
.stat-card.indigo::before { background: #6366f1; }
.stat-card.yellow::before { background: #eab308; }
.stat-card.gray::before { background: #9ca3af; }

.stat-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-info h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 8px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--primary);
}

.stat-card.cyan .stat-icon { background: var(--secondary); }
.stat-card.emerald .stat-icon { background: var(--success); }
.stat-card.amber .stat-icon { background: var(--warning); }
.stat-card.red .stat-icon { background: var(--danger); }
.stat-card.rose .stat-icon { background: #f43f5e; }
.stat-card.indigo .stat-icon { background: #6366f1; }
.stat-card.yellow .stat-icon { background: #eab308; }
.stat-card.gray .stat-icon { background: #9ca3af; }

/* Card Glassmorphism Standard */
.card-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    margin-bottom: 40px;
}

.card-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.card-title-bar h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

/* Tabel Modern */
.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 16px 20px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-card);
}

td {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(138, 92, 246, 0.05);
    font-size: 0.95rem;
}

tr:hover td {
    background: rgba(139, 92, 246, 0.02);
}

/* Status Badges */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.badge.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge.info {
    background: rgba(6, 182, 212, 0.15);
    color: var(--secondary);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

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

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-card);
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
    font-size: 0.95rem;
}

body.light-theme .form-control {
    background: rgba(0, 0, 0, 0.02);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

/* Button Premium */
.btn-premium {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
}

.btn-premium:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-premium.secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    color: var(--text-primary);
    box-shadow: none;
}

.btn-premium.secondary:hover {
    background: rgba(139, 92, 246, 0.08);
}

.btn-premium.danger {
    background: var(--danger);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-premium.danger:hover {
    background: #dc2626;
}

.btn-action {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-action:hover {
    color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

.btn-action.delete:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Login Page Layout */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    text-align: center;
}

.login-logo {
    margin-bottom: 24px;
}

.login-logo img {
    width: 70px;
    height: 70px;
}

.login-card h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

/* UI Peta Mini Map Picker */
#map {
    height: 350px;
    border-radius: 12px;
    border: 1px solid var(--border-card);
    margin-bottom: 20px;
    z-index: 1;
}

/* Log foto absensi */
.absensi-foto-cell {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border-card);
    cursor: pointer;
}

.absensi-foto-cell:hover {
    transform: scale(1.05);
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        width: 80px;
        padding: 20px 10px;
        align-items: center;
    }
    
    .logo-container h2,
    .sidebar-menu li a span {
        display: none;
    }
    
    .logo-container {
        justify-content: center;
    }
    
    .main-content {
        margin-left: 80px;
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 60px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        position: relative;
        padding: 10px 20px;
        border-right: none;
        border-bottom: 1px solid var(--border-card);
    }
    
    .logo-container {
        margin-bottom: 0;
    }
    
    .sidebar-menu {
        flex-direction: row;
        gap: 15px;
    }
    
    .sidebar-menu li a {
        padding: 8px;
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
}
