:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #f59e0b;
    --accent: #8b5cf6;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-glass: rgba(30, 41, 59, 0.7);
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --gradient: linear-gradient(135deg, #2563eb 0%, #8b5cf6 100%);
    --card-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--background);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.6;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--background);
}
::-webkit-scrollbar-thumb {
    background: var(--surface);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Glassmorphism utility */
.glass {
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
}

/* Layout */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navbar */
nav {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

nav.scrolled {
    height: 70px;
    background: rgba(15, 23, 42, 0.9);
    border-bottom: 1px solid var(--border);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}
.nav-links a:hover { color: var(--text); }

.nav-item { position: relative; }
.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: #0f172a;
    border: 1px solid var(--border);
    border-radius: 12px;
    min-width: 200px;
    padding: 0.5rem;
    display: none;
    z-index: 1000;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}
.nav-item:hover .dropdown { display: block; }
.dropdown-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}
.dropdown-link:hover { background: rgba(37, 99, 235, 0.1); color: var(--primary); }

.navbar-logo-img { 
    max-height: 38px; 
    object-fit: contain; 
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px var(--primary);
}

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

.btn-outline:hover {
    background: var(--border);
    transform: translateY(-2px);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 2001;
    padding: 0.5rem;
}

.nav-toggle span {
    width: 28px;
    height: 3px;
    background: white;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-toggle.open span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

@media (max-width: 992px) {
    .nav-toggle { 
        display: flex !important; 
        min-width: 44px;
        min-height: 44px;
        justify-content: flex-start;
        align-items: center;
        order: 1 !important; /* Tombol Menu KIRI Atas */
        margin: 0 !important;
    }
    .logo { 
        order: 2 !important; /* Logo KANAN Atas */
        margin: 0 !important; 
    } 
    
    .nav-links {
        display: none !important; /* COMPLETELY REMOVE FROM FLOW BY DEFAULT */
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        height: 100vh;
        background: rgba(15, 23, 42, 0.98);
        backdrop-filter: blur(15px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 5rem 2rem 2rem 2rem; /* Tambah padding atas agar tidak nabrak tombol X */
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 2000;
        transform: translateY(-20px);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        overflow-y: auto; /* Allow scroll if many links */
    }
    .nav-links.open { 
        display: flex !important; /* SHOW ONLY WHEN OPEN */
        transform: translateY(0); 
        opacity: 1; 
        visibility: visible; 
        pointer-events: auto; 
    }
    .nav-links .nav-item { width: 100%; margin-bottom: 1rem; }
    .nav-links .nav-item a { 
        font-size: 1.15rem !important; /* Font lebih kecil proporsional */
        font-weight: 500 !important; 
        color: white !important; 
        justify-content: center !important; /* Memaksa flex items ke tengah */
    }
    .nav-links .btn { width: 100%; max-width: 200px; justify-content: center; padding: 0.8rem; font-size: 1rem; margin: 0 auto; }
    .nav-links .dropdown { 
        position: static; background: transparent; 
        box-shadow: none; width: 100%; margin-top: 0.5rem;
        display: block; border: none;
    }
    .nav-links .dropdown-link { color: rgba(255,255,255,0.7) !important; font-size: 1rem; text-align: center; justify-content: center; padding: 0.5rem; }
    
    .logo img, .navbar-logo-img { max-width: 100px !important; margin: 0 !important; }
    
    nav {
        height: 60px !important;
        padding: 0 !important;
    }
    
    nav .container { 
        display: flex !important;
        flex-direction: row !important; /* Kembali sejajar mendatar */
        justify-content: space-between !important; /* Pisahkan ke ujung kiri dan kanan */
        align-items: center !important;
        width: 100% !important;
        max-width: 100vw !important; /* Pastikan tidak melebar dari layar */
        padding: 0 1rem !important; /* Jarak pas di pinggir layar */
        box-sizing: border-box !important;
    }
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 80px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -10%;
    right: -10%;
    width: 50%;
    height: 80%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.15) 0%, transparent 70%);
    z-index: -1;
}

.hero-content {
    flex: 1;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.hero-image img {
    max-width: 100%;
    filter: drop-shadow(0 20px 50px rgba(0,0,0,0.5));
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.badge {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: inline-block;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    font-weight: 800;
}

h1 span {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    max-width: 600px;
}

/* Stats Section */
.stats {
    padding: 5rem 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.stat-card {
    padding: 2rem;
    border-radius: 24px;
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    display: block;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-weight: 500;
}

/* Features */
.features {
    padding: 8rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.feature-card {
    padding: 3rem 2rem;
    border-radius: 32px;
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
}

.feature-icon {
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    color: white;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.feature-card p {
    color: var(--text-muted);
}

/* ===========================
   RESPONSIVE – MOBILE FIRST
   =========================== */

/* Hamburger toggle button */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1100;
}
.nav-toggle span {
    display: block;
    width: 26px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Tablet – 992px */
@media (max-width: 992px) {
    h1 { font-size: 2.8rem; }
    .container { padding: 0 1.5rem; }

    /* Navbar */
    .nav-toggle { display: flex; }
    .nav-links {
        display: none;
        flex-direction: column;
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100vh;
        background: rgba(15, 23, 42, 0.98);
        backdrop-filter: blur(20px);
        justify-content: center;
        align-items: center;
        gap: 2rem;
        z-index: 1050;
        font-size: 1.1rem;
    }
    .nav-links.open { display: flex; }
    .nav-links a { font-size: 1.1rem; }

    /* Hero */
    .hero { flex-direction: column; text-align: center; padding-top: 100px; }
    .hero-content { order: 2; }
    .hero-image { order: 1; max-width: 80%; margin: 0 auto; }
    .hero-image img { max-width: 100%; }
    .hero-desc { margin-left: auto; margin-right: auto; }
    .hero-content > div { justify-content: center; }

    /* Grids */
    .feature-grid { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
    .stats { grid-template-columns: 1fr 1fr; }

    /* Catalog */
    .catalog-layout { grid-template-columns: 1fr !important; padding-top: 100px !important; }
    .filter-section { position: static !important; }

    /* Footer */
    footer > div > div:first-child > div {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* Mobile – 768px */
@media (max-width: 768px) {
    h1 { font-size: 2.2rem; line-height: 1.2; }
    .container { padding: 0 1rem; }

    /* Hero */
    .hero { padding-top: 90px; gap: 2rem; }
    .hero-image { max-width: 100%; }
    .hero-desc { font-size: 1rem; }
    .hero-content > div { flex-wrap: wrap; }

    /* Grids */
    .feature-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .feature-card { padding: 2rem 1.5rem; }

    /* Stats */
    .stats { grid-template-columns: 1fr 1fr; gap: 1rem; padding: 3rem 0; }
    .stat-number { font-size: 2rem; }

    /* Section */
    .features { padding: 5rem 0; }
    .section-header { margin-bottom: 2.5rem; }
    .section-header h2 { font-size: 2rem; }

    /* Navbar mobile dropdown */
    .nav-item .dropdown {
        position: static;
        display: block;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        min-width: unset;
        text-align: center;
    }
    .nav-item:hover .dropdown { display: block; }

    /* Login / Register cards */
    .login-card { padding: 2rem 1.5rem !important; margin: 1rem; }

    /* Catalog */
    .catalog-layout { gap: 2rem !important; }
    .filter-section > div { border-radius: 12px !important; }

    /* Book card grid in catalog */
    .book-grid { grid-template-columns: 1fr 1fr !important; gap: 1rem !important; }

    /* Footer */
    footer { margin-top: 3rem !important; padding: 3rem 0 1.5rem !important; }
}

/* Small Mobile – 480px */
@media (max-width: 480px) {
    h1 { font-size: 1.8rem; }
    .hero-desc { font-size: 0.95rem; }
    .badge { font-size: 0.75rem; padding: 0.4rem 0.8rem; }

    /* Buttons */
    .btn { padding: 0.65rem 1.1rem; font-size: 0.9rem; }

    /* Grids */
    .feature-grid { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr; }
    .book-grid { grid-template-columns: 1fr !important; }

    /* Promotions homepage cards */
    div[style*="grid-template-columns: repeat(auto-fill, minmax(300px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }

    /* Section headers with flex */
    .section-header[style*="flex"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem;
    }

    /* Footer grid */
    footer > div > div:first-child > div {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    /* Catalog filter section in form */
    form.container { padding-top: 90px !important; }

    /* Promo card grid */
    .promo-card { flex-direction: column !important; }
    .promo-img { width: 100% !important; height: 200px !important; }
}
/* Mobile Responsive */
@media (max-width: 992px) {
    .nav-links { display: none; } 
    .hero-container { flex-direction: column !important; text-align: center; gap: 2rem !important; }
    .hero-content { order: 2; }
    .hero-image { order: 1; }
    .hero-image img { max-width: 280px !important; }
    .hero h1 { font-size: 2.2rem !important; }
    .section-header { flex-direction: column; align-items: center !important; text-align: center !important; gap: 1rem; }
}

@media (max-width: 768px) {
    .container { padding: 0 1.25rem; }
    section { padding: 3.5rem 0 !important; }
    .section-header h2 { font-size: 1.8rem !important; }
    
    /* Grids stacking */
    .feature-grid, .team-grid, .blog-grid, .catalog-grid, .promo-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
    
    .hero h1 { font-size: 1.8rem !important; }
}

/* Mobile Menu Helper */
.mobile-menu-active { overflow: hidden; }

