:root {
    --primary: #F97316; /* Orange */
    --primary-dark: #EA580C;
    --primary-light: #FFF7ED;
    --secondary: #0F172A; /* Hitam / Dark Slate */
    --secondary-light: #1E293B;
    --bg-main: #FFFFFF; /* Putih */
    --bg-page: #F8FAFC;
    --text-main: #334155;
    --text-heading: #0F172A;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

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

html {
    overscroll-behavior-y: none;
    background-color: #FFFFFF;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    color: var(--text-main);
    background-color: #FFFFFF;
    line-height: 1.6;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* Touch & Click Compatibility for iOS Safari & Mobile Browsers */
button, a, input, select, textarea, [onclick], .btn, .nav-link, .top-flash-slide-item, .card, .mobile-toggle, .bottom-nav-item, .mobile-menu-toggle-btn {
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-heading);
    font-weight: 700;
    line-height: 1.2;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: all 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* Typography Utilities */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }

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

.section {
    padding: 5rem 0;
}

.section-title {
    font-size: 2.25rem;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 3rem;
    height: 4px;
    background-color: var(--primary);
    border-radius: var(--radius-full);
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: white;
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-light);
    color: white;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary);
    color: white;
}

/* Custom Cari Program Button on Hero */
.btn-cari-program {
    background-color: #FFFFFF !important;
    color: #0F172A !important;
    border: 2px solid #CBD5E1 !important;
    transition: all 0.25s ease !important;
}
.btn-cari-program:hover {
    background-color: #0F172A !important;
    color: #FFFFFF !important;
    border-color: #0F172A !important;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.25) !important;
    transform: translateY(-2px) !important;
}

/* Navigation */
/* Navbar - Fixed Glassmorphism Header */
.navbar {
    background-color: rgba(255, 255, 255, 0.88) !important;
    backdrop-filter: blur(14px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(14px) saturate(180%) !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8) !important;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08) !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 99999 !important;
    height: 70px;
    display: flex;
    align-items: center;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-logo span {
    color: var(--primary);
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--text-heading);
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    transition: width 0.3s ease;
}

.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary);
}

.nav-actions-mobile {
    display: none;
}

/* Cards & Glassmorphism */
.card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.5);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    padding: 1.5rem;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border-color: rgba(249, 115, 22, 0.3); /* Subtle primary border on hover */
}

.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-heading);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease forwards;
}

/* Responsive Navbar */
@media (max-width: 991px) {
    .nav-menu {
        display: none !important; /* Strictly hidden until toggle is clicked */
        flex-direction: column;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        padding: 1.5rem 1.5rem 2rem;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
        gap: 1.25rem;
        border-bottom: 1px solid #E2E8F0;
        z-index: 99999;
    }
    
    .nav-menu.show {
        display: flex !important;
    }

    .mobile-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        font-size: 1.7rem;
        cursor: pointer;
        color: var(--secondary);
        padding: 0.25rem;
    }
    
    .nav-actions {
        display: none !important; /* Hide desktop actions on mobile/tablet */
    }
    
    .nav-menu .nav-actions-mobile {
        display: flex !important;
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 0.75rem;
        border-top: 1px solid #E2E8F0;
        padding-top: 1.25rem;
    }

    .section {
        padding: 3rem 0;
    }

    .section-title {
        font-size: 1.75rem;
    }
}

/* Global Mobile Safety & Responsive Anti-Overflow Rules */
html, body {
    max-width: 100vw !important;
    overflow-x: hidden !important;
}

table {
    max-width: 100%;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
        max-width: 100vw;
    }
    
    img, video, canvas {
        max-width: 100%;
    }
    
    .card-box, .glass-panel {
        max-width: 100% !important;
        overflow-x: hidden;
    }
}

/* Klien Mobile Header, Drawer & Bottom Navigation Bar */
.mobile-header { display: none; }
.mobile-drawer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99998;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.mobile-drawer-overlay.open,
.mobile-drawer-overlay.active {
    display: block !important;
    opacity: 1 !important;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    width: 290px;
    max-width: 85vw;
    height: 100%;
    height: 100dvh;
    background: white;
    z-index: 99999;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateX(105%);
    box-shadow: -5px 0 30px rgba(15, 23, 42, 0.25);
    display: flex;
    flex-direction: column;
}
.mobile-drawer.open,
.mobile-drawer.active {
    transform: translateX(0) !important;
}

.mobile-drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.5rem; border-bottom: 1px solid #E2E8F0; background: #F8FAFC;
}
.mobile-drawer-body { padding: 1.25rem 0; overflow-y: auto; flex-grow: 1; }
.mobile-drawer-user { padding: 0 1.5rem 1rem 1.5rem; border-bottom: 1px solid #F1F5F9; margin-bottom: 0.75rem; }
.mobile-drawer-menu { list-style: none; padding: 0; margin: 0; }
.mobile-drawer-menu a {
    display: flex; align-items: center; gap: 0.85rem; padding: 0.85rem 1.5rem;
    color: #475569; font-weight: 600; text-decoration: none; font-size: 0.95rem; transition: 0.2s;
}
.mobile-drawer-menu a:hover, .mobile-drawer-menu a.active {
    background: #FFF7ED; color: #F97316; font-weight: 700;
}

@media (max-width: 991px) {
    .dashboard-container { display: block !important; grid-template-columns: 1fr !important; }
    .sidebar { display: none !important; }
    
    .mobile-header {
        display: flex; align-items: center; justify-content: space-between;
        padding: 0.75rem 1.25rem; background: white; border-bottom: 1px solid #E2E8F0;
        position: sticky; top: 0; z-index: 1000; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    }
    .mobile-logo img { max-height: 36px; max-width: 150px; object-fit: contain; }
    .mobile-logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 800; color: #0F172A; font-size: 1.1rem; text-decoration: none; }
    
    .main-content { padding: 1.25rem 1rem 5.5rem 1rem !important; }
    .stats-grid { grid-template-columns: 1fr !important; gap: 1rem !important; }
    .course-grid { grid-template-columns: 1fr !important; gap: 1.25rem !important; }
    .header { flex-direction: column !important; align-items: flex-start !important; gap: 1rem !important; }
    
    .mobile-bottom-nav {
        display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 60px;
        background: white; border-top: 1px solid #E2E8F0; z-index: 9990;
        justify-content: space-around; align-items: center; box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }
    .bottom-nav-item {
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        color: #64748B; font-size: 0.72rem; font-weight: 600; text-decoration: none;
        gap: 0.15rem; flex: 1; height: 100%; transition: color 0.2s;
    }
    .bottom-nav-item i { font-size: 1.3rem; }
    .bottom-nav-item.active { color: #F97316; font-weight: 700; }
    
    /* Comprehensive Klien Mobile Fixes */
    h1 { font-size: 1.35rem !important; word-break: break-word; }
    
    /* Tryout page mini dashboard metrics */
    div[style*="grid-template-columns: repeat(auto-fit"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.75rem !important;
    }
    
    /* Header action bars — hide desktop profile badge on mobile */
    .header > div:last-child { flex-wrap: wrap; gap: 0.5rem !important; }
    .klien-header-profile-badge,
    a[href="pengaturan.php"][style*="border-radius: 30px"] { display: none !important; }
    .header > div:last-child > a.btn { font-size: 0.8rem !important; padding: 0.4rem 0.8rem !important; }
    
    /* Tryout card grids */
    .tryout-card { overflow: hidden; }
    
    /* Settings grid */
    .settings-grid { grid-template-columns: 1fr !important; min-width: 0 !important; }
    .form-row { grid-template-columns: 1fr !important; }
    
    /* Riwayat tables */
    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
    table thead, table tbody, table tr, table td, table th { white-space: nowrap; }
    
    /* General overflow protection */
    .main-content > div { max-width: 100%; overflow-x: hidden; }
    .main-content > div > div[style*="display:flex"][style*="justify-content:space-between"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }
    
    /* Navbar public — compact on mobile */
    .navbar .nav-container { padding: 0.5rem 1.25rem !important; }
    .nav-logo img { max-height: 32px !important; }
    .mobile-toggle { display: flex !important; background: none; border: none; font-size: 1.6rem; color: #0F172A; cursor: pointer; padding: 0.25rem; }
    
    .nav-menu {
        display: none !important;
        position: fixed !important;
        top: 70px !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        background: #FFFFFF !important;
        flex-direction: column !important;
        padding: 1.5rem !important;
        box-shadow: 0 15px 35px rgba(15, 23, 42, 0.15) !important;
        border-bottom: 2px solid #E2E8F0 !important;
        gap: 1.15rem !important;
        z-index: 99998 !important;
        max-height: calc(100vh - 80px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .nav-menu.show {
        display: flex !important;
    }
    .nav-actions-mobile {
        display: flex !important;
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 0.75rem;
        padding-top: 1rem;
        border-top: 1px solid #E2E8F0;
    }
    .nav-actions {
        display: none !important;
    }
}
