:root[data-theme="dark"] {
    --bg-base: #0B0D14;
    --bg-surface: #121620;
    --bg-surface-hover: rgba(30, 36, 51, 0.7);
    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --border-color: rgba(255, 255, 255, 0.08);
    --primary: #7C3AED;
    --primary-hover: #6D28D9;
    --secondary: #06B6D4;
    --danger: #EF4444;
    --warning: #F59E0B;
    --success: #10B981;
    --glass-bg: rgba(18, 22, 32, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-highlight: rgba(255, 255, 255, 0.15);
    --shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    --glow: 0 0 20px rgba(124, 58, 237, 0.4);
}

:root[data-theme="light"] {
    --bg-base: #F8FAFC;
    --bg-surface: #FFFFFF;
    --bg-surface-hover: rgba(241, 245, 249, 0.8);
    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --border-color: rgba(15, 23, 42, 0.1);
    --primary: #6366F1;
    --primary-hover: #4F46E5;
    --secondary: #0EA5E9;
    --danger: #E11D48;
    --warning: #D97706;
    --success: #059669;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(15, 23, 42, 0.1);
    --glass-highlight: rgba(255, 255, 255, 0.8);
    --shadow: 0 10px 40px -10px rgba(15, 23, 42, 0.1);
    --glow: 0 0 20px rgba(99, 102, 241, 0.3);
}

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

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

/* Animated Vector Lines & Glowing Mesh Background */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -2;
    background: 
        radial-gradient(circle at 15% 30%, rgba(124, 58, 237, 0.15), transparent 30%),
        radial-gradient(circle at 85% 70%, rgba(6, 182, 212, 0.12), transparent 30%);
    animation: pulseMesh 15s ease-in-out infinite alternate;
}

body::after {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    opacity: 0.3;
    background-image: 
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at center, black, transparent 80%);
    -webkit-mask-image: radial-gradient(circle at center, black, transparent 80%);
    animation: moveLines 40s linear infinite;
    pointer-events: none;
}

:root[data-theme="light"] body::after {
    opacity: 0.6;
    background-image: 
        linear-gradient(rgba(0,0,0,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px);
}

@keyframes pulseMesh {
    0% { transform: scale(1); }
    100% { transform: scale(1.2); }
}

@keyframes moveLines {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

a { text-decoration: none; color: inherit; }
.hidden { display: none !important; }
.text-danger { color: var(--danger); }

/* Typography */
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.02em; }
p { color: var(--text-secondary); line-height: 1.6; }

/* Gradient Text Effect */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Glassmorphism Classes */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-top-color: var(--glass-highlight);
    border-left-color: var(--glass-highlight);
    box-shadow: var(--shadow);
}

/* Login Layout */
.login-mode {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 20px;
    z-index: 10;
}

.login-glass-card {
    border-radius: 28px;
    padding: 45px 40px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.3);
    animation: slideUpFade 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

:root[data-theme="light"] .login-glass-card {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.08);
}

.login-icon {
    width: 64px; height: 64px;
    color: var(--primary);
    margin-bottom: 16px;
    filter: drop-shadow(0 0 10px var(--primary));
    animation: float 3s ease-in-out infinite;
}

/* App Layout */
.app-layout {
    display: flex; height: 100vh; overflow: hidden; z-index: 10; position: relative;
}

.sidebar {
    width: 280px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column;
}

.sidebar-brand {
    padding: 30px 24px; font-size: 22px; font-weight: 700;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-nav {
    flex: 1; padding: 24px 16px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto;
}

.nav-link {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 18px; border-radius: 14px;
    color: var(--text-secondary); font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.nav-link:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    transform: translateX(5px);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(124,58,237,0.1), rgba(124,58,237,0.0));
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: inset 4px 0 0 var(--primary);
}

.sidebar-footer {
    padding: 24px 16px; border-top: 1px solid var(--border-color);
}

.main-content {
    flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

.topbar {
    height: 80px;
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex; align-items: center; justify-content: space-between; padding: 0 40px;
}

.page-container {
    flex: 1; overflow-y: auto; padding: 40px;
}

.view-section { animation: fadeIn 0.4s ease forwards; }

/* Animations */
@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.shake { animation: shake 0.5s; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    /* Admin Layout for Android App Style */
    .app-layout {
        display: block;
        height: 100vh;
        overflow: hidden;
        padding-bottom: 70px;
    }
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 70px;
        background: var(--glass-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-right: none;
        border-top: 1px solid var(--border-color);
        border-bottom: none;
        z-index: 9999;
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        padding: 0;
        box-shadow: 0 -5px 15px rgba(0,0,0,0.3);
    }
    .sidebar-brand {
        display: none;
    }
    .sidebar-nav {
        flex: 1;
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        padding: 0 10px;
        overflow-x: auto;
        overflow-y: hidden;
        border: none;
        -webkit-overflow-scrolling: touch;
        gap: 10px;
    }
    .sidebar-nav::-webkit-scrollbar {
        display: none;
    }
    .nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px 10px;
        font-size: 11px;
        gap: 4px;
        color: var(--text-secondary);
        border-radius: 0;
        border: none;
        flex: 0 0 auto;
        min-width: 75px;
        transition: transform 0.2s;
    }
    .nav-link:hover {
        background: transparent;
        transform: scale(1.05);
    }
    .nav-link.active {
        background: transparent;
        color: var(--primary);
        box-shadow: none;
        position: relative;
    }
    .nav-link.active::after {
        content: '';
        position: absolute;
        top: -2px;
        left: 50%;
        transform: translateX(-50%);
        width: 20px;
        height: 3px;
        background: var(--primary);
        border-radius: 3px;
    }
    .nav-link svg {
        width: 24px;
        height: 24px;
        margin-bottom: 2px;
    }
    .sidebar-footer {
        display: none;
    }
    .main-content {
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .topbar {
        position: sticky;
        top: 0;
        z-index: 9998;
        padding: 15px 20px;
        height: 60px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        background: var(--glass-bg);
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }
    .topbar h2 {
        font-size: 18px;
    }
    .topbar { padding: 10px 15px; }
    .page-container { padding: 10px; padding-bottom: 80px; }
    .data-table th, .data-table td { padding: 10px; }
    
    .layanan-btn {
        padding: 15px !important;
        gap: 10px !important;
    }
    .layanan-btn i {
        width: 24px !important;
        height: 24px !important;
    }
    .layanan-btn .icon-wrapper {
        padding: 10px !important;
    }
    
    .swal2-popup.glass {
        padding: 15px !important;
        width: 95% !important;
    }
    .swal2-title {
        font-size: 1.25rem !important;
    }
    .captcha-box-mobile {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    .captcha-box-mobile img {
        height: 50px !important;
        width: auto !important;
    }
    
    /* Layouts */
    .grid-2, .settings-grid {
        grid-template-columns: 1fr !important;
    }
    .stat-card {
        padding: 15px;
    }
    .stat-icon {
        width: 40px;
        height: 40px;
    }
    .stat-info h3 {
        font-size: 12px;
    }
    .stat-info p {
        font-size: 18px;
    }
    
    /* Tables */
    .table-card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .data-table {
        min-width: 600px;
    }
    
    /* Modals */
    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 10px;
    }
}

/* Prayer Times Widget */
.prayer-widget {
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.1), rgba(245, 158, 11, 0.05));
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 40px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeIn 0.8s ease-out;
}
.prayer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.prayer-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.prayer-countdown {
    font-size: 14px;
    font-weight: 600;
    background: var(--bg-surface);
    padding: 6px 14px;
    border-radius: 20px;
    color: var(--text-primary);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.prayer-list {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
}
.prayer-list::-webkit-scrollbar {
    height: 4px;
}
.prayer-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}
.prayer-card {
    flex: 1;
    min-width: 80px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px 8px;
    text-align: center;
    transition: all 0.3s ease;
}
.prayer-card.active {
    background: linear-gradient(135deg, var(--primary), #0f766e);
    color: white;
    border-color: transparent;
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(13, 148, 136, 0.3);
}
.prayer-name {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    opacity: 0.8;
}
.prayer-card.active .prayer-name {
    opacity: 1;
}
.prayer-time {
    font-size: 16px;
    font-weight: 700;
}
@media (max-width: 768px) {
    .prayer-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
