/* 
 * portal.css - Unified Premium Design System for PPUI Bekasi
 * Kardia Executive Style Framework - Ultra-Lightweight Edition (Maximum Performance)
 */

/* 1. TOKENS & UTILITIES */
:root {
    --brand-dark: #052e16;
    --brand-primary: #166534;
    --gold-primary: #fbbf24;
    --gold-dark: #d97706;
}

/* Custom Premium Scrollbar (Lightweight) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f8fafc;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #166534;
}

/* 2. LAYOUT & BACKGROUNDS (Optimized: No fixed attachments or heavy gradients) */
body {
    background-color: #f8fafc;
}

.glass-nav {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.dark-glass {
    background: #052e16;
}

.hero-pattern {
    /* Kept subtle and lightweight */
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23fbbf24' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-premium-overlay {
    background: linear-gradient(to right, rgba(5, 46, 22, 0.95) 0%, rgba(5, 46, 22, 0.6) 100%);
}

.hero-vignette {
    background: rgba(0, 0, 0, 0.2);
}

.glass-card-premium {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
}

/* 3. TEXT & EFFECTS */
.text-gradient-gold {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-gradient-brand {
    background: linear-gradient(135deg, #4ade80 0%, #16a34a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 4. ANIMATIONS & REVEALS (Optimized: No translation or layout reflows) */
.animate-float {
    animation: none; /* Disabled for maximum scrolling/rendering performance */
}

.reveal {
    opacity: 0;
    transition: opacity 0.25s ease-out;
}

.reveal.active {
    opacity: 1;
}

/* 5. HIGH-DENSITY (MOBILE) REFINEMENTS */
@media (max-width: 768px) {
    .glass-nav {
        background: #ffffff;
    }

    .dark-glass {
        background: #052e16;
    }

    .tahfizh-drawer {
        background: #ffffff !important;
    }

    .glass-card-premium {
        background: rgba(255, 255, 255, 0.08);
    }

    .text-gradient-gold {
        background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
}

/* 6. INTERACTIVE COMPONENTS (Optimized: No GPU-heavy translate transforms or box-shadow changes) */
.modern-card,
.activity-item,
.btn-premium {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.modern-card {
    border: 1px solid #e2e8f0;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.modern-card:hover {
    border-color: #cbd5e1;
    background-color: #f8fafc;
}

.activity-item {
    transition: background-color 0.15s ease;
}

.activity-item:hover {
    background-color: #f1f5f9;
}

.btn-premium {
    position: relative;
    overflow: hidden;
    transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

/* 7. PREMIUM ACCORDION & DRAWER REFINEMENTS (Optimized: No shadows or backdrop blurs) */
.tahfizh-drawer {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    transition: border-color 0.2s ease !important;
}

.tahfizh-drawer.active-drawer {
    background: #ffffff !important;
    border-color: #22c55e !important;
}

.drawer-content {
    transition: opacity 0.2s ease-in-out !important;
}

.tahfizh-drawer .fa-chevron-down {
    transition: transform 0.2s ease !important;
}

/* ==========================================
   HERO PORTAL CARDS - ULTRA PREMIUM GLASS
   ========================================== */
.glass-card-hover.hero-portal-card {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Override the default bright white hover */
.glass-card-hover.hero-portal-card:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Card-specific glowing theme accents on hover */
.glass-card-hover.hero-portal-card.card-infaq:hover {
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.12) 0%, rgba(5, 46, 22, 0.4) 100%) !important;
    border-color: rgba(250, 204, 21, 0.45) !important;
    box-shadow: 0 15px 35px -5px rgba(250, 204, 21, 0.2) !important;
}

.glass-card-hover.hero-portal-card.card-wali:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12) 0%, rgba(5, 46, 22, 0.4) 100%) !important;
    border-color: rgba(34, 197, 94, 0.45) !important;
    box-shadow: 0 15px 35px -5px rgba(34, 197, 94, 0.2) !important;
}

.glass-card-hover.hero-portal-card.card-berita:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(5, 46, 22, 0.4) 100%) !important;
    border-color: rgba(59, 130, 246, 0.45) !important;
    box-shadow: 0 15px 35px -5px rgba(59, 130, 246, 0.2) !important;
}

.glass-card-hover.hero-portal-card.card-profil:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(5, 46, 22, 0.4) 100%) !important;
    border-color: rgba(16, 185, 129, 0.45) !important;
    box-shadow: 0 15px 35px -5px rgba(16, 185, 129, 0.2) !important;
}

/* Ensure low-perf (CPU) mode does not force hero portal cards to turn solid white on hover */
.low-perf .glass-card-hover.hero-portal-card:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

.low-perf .glass-card-hover.hero-portal-card.card-infaq:hover {
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.12) 0%, rgba(5, 46, 22, 0.4) 100%) !important;
    border-color: rgba(250, 204, 21, 0.45) !important;
}

.low-perf .glass-card-hover.hero-portal-card.card-wali:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12) 0%, rgba(5, 46, 22, 0.4) 100%) !important;
    border-color: rgba(34, 197, 94, 0.45) !important;
}

.low-perf .glass-card-hover.hero-portal-card.card-berita:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(5, 46, 22, 0.4) 100%) !important;
    border-color: rgba(59, 130, 246, 0.45) !important;
}

.low-perf .glass-card-hover.hero-portal-card.card-profil:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(5, 46, 22, 0.4) 100%) !important;
    border-color: rgba(16, 185, 129, 0.45) !important;
}

/* ==========================================
   DOUBLE-ROW PREMIUM NAVIGATION HEADER
   ========================================== */
#main-nav {
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

#utility-bar {
    max-height: 32px;
    opacity: 1;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, border-color 0.3s ease;
    overflow: hidden;
}

.nav-scrolled #utility-bar {
    max-height: 0;
    opacity: 0;
    border-bottom-width: 0px !important;
}

/* Premium Glass Navigation Bar */
.glass-nav-premium {
    background: rgba(255, 255, 255, 0.72) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5) !important;
    transition: all 0.3s ease !important;
}

.nav-scrolled .glass-nav-premium {
    background: rgba(255, 255, 255, 0.88) !important;
    box-shadow: 0 10px 30px -10px rgba(20, 83, 45, 0.08) !important;
}

/* Premium Nav Link Sliding Underline */
.nav-link-premium {
    position: relative;
    transition: color 0.2s ease;
}

.nav-link-premium::after {
    content: '';
    position: absolute;
    bottom: 22px;
    /* Positioned nicely near the bottom of the py-8 container */
    left: 0;
    width: 100%;
    height: 2.5px;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.nav-link-premium:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

.nav-link-premium:hover {
    color: #14532d !important;
    /* Pondok Green on hover */
}

/* Akses Wali Premium CTA Button */
.btn-akses-wali {
    background: linear-gradient(135deg, #14532d 0%, #052e16 100%);
    border: 1px solid rgba(251, 191, 36, 0.2);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(5, 46, 22, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-akses-wali i {
    color: #fbbf24;
    transition: color 0.3s ease;
}

.btn-akses-wali:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-color: rgba(245, 158, 11, 0.5);
    color: #052e16 !important;
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.45);
}

.btn-akses-wali:hover i {
    color: #052e16;
}

/* Adjust Mega Menu Trigger and Dropdown Pos to prevent overlaps */
#mega-menu {
    top: calc(100% - 10px) !important;
}

/* Portal Switcher Active/Inactive States */
.switcher-active {
    background: #ffffff !important;
    color: #16a34a !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
}
.switcher-inactive {
    background: transparent !important;
    color: #64748b !important;
}

/* ==========================================================================
   MULTI-DEVICE RESPONSIVE SUITE (ANDROID, TABLET, LAPTOP - PORTRAIT & LANDSCAPE)
   ========================================================================== */

/* 0. Base & Desktop Hero Clearance (Fixed 112px Double Navbar) */
#beranda {
    min-height: 100vh;
    min-height: 100svh;
    padding-top: 7rem !important;
}

@media (min-width: 1024px) {
    #beranda {
        padding-top: 9.5rem !important; /* 152px - mutlak bebas tabrakan dari navbar 112px di desktop/laptop */
        padding-bottom: 0 !important;
    }
}

/* 1. Android & Compact Phone Portrait (< 480px) */
@media (max-width: 480px) {
    #beranda {
        min-height: 100svh !important;
        padding-top: 5.5rem !important; /* 88px - bebas tabrakan dari navbar 80px di ponsel */
    }
    
    #beranda h2 {
        font-size: 2rem !important;
        line-height: 1.15 !important;
    }

    #beranda .text-sm,
    #beranda .text-xs {
        font-size: 0.8125rem !important;
        line-height: 1.5 !important;
    }

    #portal-login {
        padding-top: 3.5rem !important;
        padding-bottom: 3.5rem !important;
    }

    #portal-login .p-6 {
        padding: 1.25rem !important;
    }

    #btn-switch-wali,
    #btn-switch-pengurus-select,
    #btn-switch-pengurus-manual {
        font-size: 8.5px !important;
        padding-left: 4px !important;
        padding-right: 4px !important;
    }
}

/* 2. Mobile & Compact Landscape (@media (orientation: landscape) and (max-height: 550px)) */
@media (orientation: landscape) and (max-height: 550px) {
    /* Compact Sticky Navbar */
    #main-nav {
        padding-top: 0.35rem !important;
        padding-bottom: 0.35rem !important;
    }

    #utility-bar {
        display: none !important;
    }

    /* Hero Landscape Compression */
    #beranda {
        min-height: auto !important;
        padding-top: 4.5rem !important;
        padding-bottom: 1rem !important;
    }

    #beranda .py-4 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }

    #beranda h2 {
        font-size: 1.75rem !important;
        line-height: 1.1 !important;
        margin-bottom: 0.5rem !important;
    }

    #beranda p {
        margin-bottom: 0.5rem !important;
        font-size: 0.8rem !important;
    }

    #beranda .space-y-4 {
        margin-top: 0 !important;
    }

    #beranda .inline-flex {
        padding: 0.5rem 0.75rem !important;
        margin-top: 0.25rem !important;
    }

    /* Portal Login Modal in Landscape */
    #portal-login {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }

    #portal-login .glass-card-glow {
        min-height: auto !important;
    }

    #portal-login .p-6,
    #portal-login .p-8 {
        padding: 1.5rem !important;
    }

    #portal-login .space-y-5 {
        gap: 0.75rem !important;
    }
}

/* 3. Tablet Optimization (768px <= width <= 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    #beranda {
        padding-top: 6rem !important;
    }

    #beranda h2 {
        font-size: 2.75rem !important;
    }

    #portal-login {
        padding-top: 4rem !important;
        padding-bottom: 4rem !important;
    }

    #portal-login .p-10,
    #portal-login .p-8 {
        padding: 2rem !important;
    }

    /* Prevent text cutoff on tablet screens */
    .glass-card-glow {
        border-radius: 2rem !important;
    }
}

/* 4. Safe Area Insets for Modern Mobile (iOS Notch & Android Gestures) */
@supports (padding: max(0px)) {
    #beranda {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    #mobile-drawer {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        padding-top: max(0.5rem, env(safe-area-inset-top));
    }
}