/* =========================================================
   [CSS UTAMA NAVBAR - DESKTOP & MOBILE INTEGRATED]
   ========================================================= */

/* Navbar Utama */
.navbar {
    background: #008751 !important;
    height: 80px;
    display: flex;
    justify-content: center; 
    align-items: center;
    font-size: 1rem;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%; 
}

.nav-container {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    height: 100%;
    width: 100%;
    max-width: 1200px; 
    padding: 0 20px;
    margin: 0 auto; 
    position: relative; /* Menjaga kestabilan elemen absolut di dalam navbar */
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 50px;
    width: auto;
    cursor: pointer;
    display: block; 
}

.nav-menu {
    display: flex;
    list-style: none;
    text-align: center;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-menu li {
    height: 80px;
    display: flex;
    align-items: center;
}

/* Teks dan Icon Default untuk Desktop */
.nav-menu li a {
    color: #ffffff !important;
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: 0 1.2rem; 
    height: 100%;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap; 
}

.nav-menu li a i {
    margin-right: 8px;
    color: #ffffff !important;
}

.nav-menu li a:hover,
.nav-menu li a:hover i {
    color: #ff9800 !important;
}

/* Penyelarasan Elemen Khusus */
.nav-user-header,
.nav-divider,
.admin-login-item {
    display: none; 
}

.menu-toggle {
    display: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #ffffff !important;
}

.nav-overlay {
    display: none;
}

/* =========================================================
   [PERBAIKAN TOTAL DROPDOWN MATA UANG & LOCK POSITION]
   ========================================================= */
.currency-dropdown-nav {
    position: relative !important; /* WAJIB: Mengunci dropdown agar mengacu pada tombol */
    display: inline-block !important;
}

.currency-btn-trigger {
    background-color: #ffffff !important;
    color: #008751 !important;
    border: none;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 14px;
    height: 38px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: background 0.2s;
}

.currency-btn-trigger:hover {
    background-color: #f4f6f8 !important;
}

/* Kontainer Utama Dropdown - Diproteksi ketat agar tidak bocor keluar */
.currency-dropdown-content {
    display: none !important; /* Tersembunyi mutlak sebelum di-hover */
    visibility: hidden;
    position: absolute !important;
    right: 0 !important;
    top: 100% !important;
    left: auto !important; /* Mencegah bentrokan dengan float left teks */
    margin-top: 5px;
    background-color: #ffffff !important;
    min-width: 190px !important;
    box-shadow: 0px 8px 24px rgba(0,0,0,0.2) !important;
    z-index: 99999 !important;
    border-radius: 8px !important;
    border: 1px solid #eef2f5 !important;
    padding: 8px 0 !important;
    box-sizing: border-box;
}

/* Trigger Hover Tampilkan Dropdown */
.currency-dropdown-nav:hover .currency-dropdown-content {
    display: block !important;
    visibility: visible !important;
}

.dropdown-section-title {
    font-size: 10px !important;
    font-weight: 800 !important;
    color: #888888 !important;
    padding: 6px 14px !important;
    display: block !important;
    text-align: left !important;
    letter-spacing: 0.8px;
    background: #f9fbfd !important;
    border-top: 1px solid #edf2f7 !important;
    border-bottom: 1px solid #edf2f7 !important;
    margin: 6px 0 !important;
}

.dropdown-section-title:first-child {
    border-top: none !important;
    margin-top: 0 !important;
}

/* Link Pilihan Mata Uang di Dalam Kontainer Dropdown */
.currency-dropdown-content a {
    color: #333333 !important;
    padding: 8px 16px !important;
    text-decoration: none !important;
    display: block !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.5 !important;
    text-align: left !important;
    background: transparent !important;
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box;
}

.currency-dropdown-content a:hover {
    background-color: #f4f6f8 !important;
    color: #008751 !important;
}

.currency-btn-group {
    display: flex !important;
    gap: 6px !important;
    padding: 4px 12px 6px 12px !important;
    box-sizing: border-box;
}

.currency-item-btn {
    flex: 1 !important;
    text-align: center !important;
    background: #f4f6f8 !important;
    border: 1px solid #e2e8f0 !important;
    padding: 6px 0 !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    color: #4a5568 !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.currency-item-btn.active-currency {
    background: #008751 !important;
    color: #ffffff !important;
    border-color: #008751 !important;
}

/* =========================================================
   [MEDIA QUERY 1: LAYAR DESKTOP (PC/LAPTOP)]
   ========================================================= */
@media screen and (min-width: 769px) {
    .nav-actions-wrapper {
        display: none !important;
    }
    .desktop-currency-item {
        display: inline-flex !important;
        align-items: center;
        margin-left: 15px;
    }

    /* Active Link Menu Utama Desktop */
    .nav-container .nav-menu li a.active,
    .nav-container .nav-menu li a.active i {
        color: #ff9800 !important; 
        font-weight: 700 !important;
        position: relative !important;
    }

    .nav-container .nav-menu li a.active::after {
        content: "";
        position: absolute;
        bottom: 0px; 
        left: 1.2rem; 
        right: 1.2rem; 
        height: 4px;
        background-color: #ff9800 !important; 
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;
        display: block !important;
    }
}

/* =========================================================
   [MEDIA QUERY 2: LAYAR MOBILE & SIDEBAR]
   ========================================================= */
@media screen and (max-width: 768px) {
    .nav-container {
        padding: 0 12px !important; 
    }

    .nav-actions-wrapper {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important; 
    }
    
    .desktop-currency-item {
        display: none !important;
    }

    .logo {
        flex: unset !important;
        max-width: 180px !important;
    }

    .logo img {
        height: 40px !important;
        width: auto !important;
    }

    .currency-btn-trigger {
        height: 34px !important;
        font-size: 11px !important; 
        padding: 0 8px !important;
        border-radius: 8px !important;
    }
            
    .menu-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 24px !important; 
        color: #ffffff !important;
        margin-left: 4px !important;
        height: 38px;
        width: 38px;
    }

    /* Sidebar Mobile Configuration */
    .nav-menu {
        display: flex;
        flex-direction: column;
        width: 280px;
        height: 100vh;
        position: fixed;
        top: 0;
        left: -100%;
        transition: all 0.4s ease;
        background: #ffffff;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        padding: 0 !important; 
        margin: 0 !important; 
        z-index: 1000;
        overflow-y: auto;
        align-items: flex-start; 
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu li {
        width: 100%;
        height: auto !important;
        display: block !important;
    }

    .nav-menu li a {
        padding: 15px 25px !important;
        width: 100% !important;
        justify-content: flex-start !important;
        font-weight: 600;
        color: #444444 !important;
        border-bottom: 1px solid #f1f1f1 !important;
        box-sizing: border-box;
        height: auto !important;
    }

    .nav-menu li a i {
        width: 25px;
        font-size: 1.1rem;
        color: #008751 !important;
    }

    .nav-user-header {
        display: flex !important;
        background: #008751; 
        padding: 35px 20px 20px 20px !important; 
        color: #ffffff;
        align-items: center;
        gap: 12px;
        width: 100%; 
        box-sizing: border-box; 
    }

    .user-avatar i {
        font-size: 45px;
        color: rgba(255, 255, 255, 0.9);
    }

    .user-info strong {
        display: block;
        font-size: 1rem;
        text-align: left;
    }

    .user-info span {
        display: block;
        font-size: 0.8rem;
        opacity: 0.8;
        text-align: left;
    }

    .nav-divider {
        display: block !important;
        height: 1px;
        background: #eeeeee;
        margin: 10px 0 !important; 
        width: 100%;
    }

    .admin-login-item {
        display: block !important;
        background: #f8fdfb;
        width: 100%;
    }

    .admin-login-item a {
        color: #008751 !important;
        border-bottom: none !important;
    }

    .nav-overlay.active {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    /* Active Menu Sidebar Mobile */
    .nav-container .nav-menu li a.active {
        color: #008751 !important; 
        background-color: #f0faf5 !important; 
        font-weight: 700 !important;
        border-left: 6px solid #008751 !important; 
        padding-left: 19px !important; 
    }

    .nav-container .nav-menu li a.active i {
        color: #008751 !important;
    }
}