.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* gap: 1rem; */
    padding: 1rem 2rem;
    background: #fafafa;
    border-bottom: 1px solid #8d8d8d;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
}

.search-form {
    flex: 1;
    max-width: 600px;
}

.search-bar {
    display: flex;
    /* justify-content: space-around; */
    align-items: center;
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    gap: 0.75rem;
}

.search-bar i {
    flex-shrink: 0;
}

.search-bar input {
    width: 100%;

    min-width: 0;
    border: none;
    background: transparent;
}

.search-bar input:focus {
    outline: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: #2b2b2b;
    font-weight: 400;
}

.profile-dropdown {
    position: relative;
    display: inline-block;
}

.profile-pic-trigger {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.avatar-nav {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}


/* Konten Dropdown (Sembunyi secara default) */
.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%; /* Muncul tepat di bawah trigger */
    background-color: white;
    min-width: 240px;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.1);
    border-radius: 8px;
    border: 1px solid #ddd;
    z-index: 100;
    /* margin-top: 10px; */
    overflow: hidden;
}

/* Menampilkan dropdown saat profil di-hover */
.profile-dropdown:hover .dropdown-content {
    display: block;
}

/* Isi di dalam dropdown */
.dropdown-header {
    padding: 12px 16px;
}

.header-avatar-wrapper {
    display: none; 
}

.dropdown-header strong {
    display: block;
    font-size: 14px;
    color: #333;
}

/* .dropdown-header p {
    font-size: 12px;
    color: #777;
} */

.dropdown-content a, .logout-btn {
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    color: #333;
    font-size: 14px;
    transition: 0.2s;
    border: none;
    background: none;
    cursor: pointer;
    box-sizing: border-box;
}

.dropdown-content a:hover, .logout-btn:hover {
    background-color: #f1f1f1;
    color: #7C3AED;
}

.dropdown-content hr {
    border: 0;
    border-top: 1px solid #eee;
    margin: 5px 0;
}

.logout-btn {
    color: #dc3545;
}

/* .profile-pic img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #7C3AED;
} */

/* Burger menu */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--primary-color);
}

@media (max-width: 992px) {
    .navbar {
        padding: 1rem;
    }

    .search-form {
        max-width: none;
    }
}

@media (max-width: 768px) {
    .navbar {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.75rem 1rem !important;
        position: relative;
    }

    .logo-container {
        flex: none !important;
        order: 1 !important;
    }

    .menu-toggle {
        display: block !important;
        order: 3 !important; 
        flex: none !important;
        font-size: 1.75rem;
    }

    .search-form {
        display: block !important;
        order: 2 !important;
        flex: 1 !important;
        margin: 0 12px !important;
        width: auto !important;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        position: absolute;
        
        top: calc(100% + 8px);
        left: 1rem;
        right: 1rem;

        width: auto;
        background: white;
        padding: 0.5rem 0;
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0,0,0,.1);
        z-index: 1000;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links a {
        width: 100%;
        padding: 0.95rem 1.25rem;
    }

    .profile-dropdown {
        width: 100%;
    }

    .profile-pic {
        display: none !important;
    }

    .dropdown-content {
        position: static;
        display: block;

        min-width: auto;

        border: none;
        box-shadow: none;

        padding-top: 0;
    }

    .dropdown-header {
        display: flex !important;
        align-items: center !important;
        gap: 1rem !important; 
        padding: 1rem 1.25rem !important;
        border-bottom: 1px solid #e2e8f0;
    }

    .header-avatar-wrapper {
        display: block !important;
        flex-shrink: 0;
    }

    .header-avatar-wrapper img {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        object-fit: cover;
        display: block;
        border: 2px solid white;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }

    .header-info-text {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

    .dropdown-header strong {
        font-size: 16px;
        color: #1e293b;
        margin-bottom: 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .dropdown-header span {
        font-size: 13px;
        color: #64748b;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis; /* Truncate email yang kepanjangan */
    }

    .dropdown-content a, .logout-btn {
        padding: 0.95rem 1rem;
        border-bottom: 1px solid #f1f5f9;
    }

    .dropdown-content a:hover, .logout-btn:hover {
        padding-left: 2rem;
    }

    .dropdown-content hr {
        display: none;
    }
}


/* =========================
   MOBILE <= 425px
========================= */

@media (max-width: 425px) {

    .navbar {
        padding: .75rem;
    }

    .logo {
        font-size: 1.15rem;
    }

    .menu-toggle {
        font-size: 1.7rem;
    }

    .search-bar {
        padding: .6rem .75rem;
    }

}

@media (max-width: 320px) {

    .logo {
        font-size: 1rem;
    }

    .menu-toggle {
        font-size: 1.5rem;
    }

    .profile-pic img {
        width: 36px;
        height: 36px;
    }

}