/* Navbar Styles */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: transparent;
}
.announcement {
    width: 100%;
    padding: 1.5rem;
    background-color: var(--dark-gray);
    text-align: center;
    color: var(--white);
}
[data-theme="dark"] .announcement {
    background-color: var(--orange);
    color: var(--off-white);
}

/* Logo Section */
.nav-logo {
    width: 6rem;
}
.nav-logo img{
    width: 100%;
}

/* Hide both logged-in and logged-out states until auth is ready */
.user-display:not([data-initialized]) .logged-in,
.user-display:not([data-initialized]) .logged-out {
    display: none !important;
}

/* Optional: Add a smooth transition when showing */
.user-display[data-initialized="true"] .logged-in,
.user-display[data-initialized="true"] .logged-out {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Navigation Links */
.nav-links {
    padding-left: 3rem;
    display: flex;
    gap: 1.875rem;
    align-items: center;
    flex: 1;
    justify-content: center
}

.nav-link {
    text-decoration: none;
    color: var(--light-gray);
    text-align: center;
    font-size: 1rem;
    font-weight: 750;
    transition: color 0.3s ease;
    position: relative;
    margin: auto;
}

.nav-link:hover {
    color: var(--dark-turquoise);
}
.nav-link.disabled:hover {
    color: var(--light-gray);
}
.nav-link.active {
    color: var(--dark-turquoise);
}

/* User Section */
.user-section {
    display: flex;
    align-items: center;
    gap: 3rem;
    padding: 0 2.5rem;
}

/* User Display */
.user-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    object-fit: cover;
}

.username {
    font-size: 1rem;
    color: var(--dark-turquoise);
    font-weight: 500;
}

/* Login Button */
.login-btn {
    padding: 0.5rem 1rem;
    border: 0.0625rem solid var(--light-gray);
    border-radius: 1.5625rem;
    background: transparent;
    color: var(--light-gray);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

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

/* Dark Mode Toggle */
.dark-mode-toggle {
    padding: 0.5rem 1rem;
    border: 0.09rem solid var(--light-gray);
    border-radius: 1.5625rem;
    background: transparent;
    color: var(--light-gray);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dark-mode-toggle:hover {
    background-color: var(--light-gray);
    color: var(--white);
}

.toggle-icon {
    width: 1rem;
    height: 1rem;
    border: 0.0625rem solid var(--light-gray);
    border-radius: 50%;
    position: relative;
    overflow: hidden;
}

.toggle-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background-color: var(--light-gray);
}

/* ========== LOGGED OUT STATE ========== */
.user-display[data-loggedin="false"] .logged-in {
    display: none !important;
}

.user-display[data-loggedin="false"] .logged-out {
    display: block;
}

/* ========== LOGGED IN STATE ========== */
.user-display[data-loggedin="true"] .logged-out {
    display: none;
}

.user-display[data-loggedin="true"] .logged-in {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
}

/* User profile container (clickable area) */
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease;
    position: relative;
    z-index: 1001;
}

.user-profile:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .user-profile:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Dropdown arrow */
.dropdown-arrow {
    font-size: 0.7rem;
    color: var(--light-gray);
    transition: transform 0.3s ease;
    margin-left: 0.25rem;
}

.user-profile:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown menu container */
.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

/* Show dropdown on hover or when open */
.user-profile:hover + .user-dropdown,
.user-dropdown:hover,
.user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dark theme dropdown */
[data-theme="dark"] .user-dropdown {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Dropdown items */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.dropdown-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .dropdown-item {
    color: #e5e7eb;
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Logout button specific styles */
.logout-btn {
    color: var(--light-turquoise);
}

.logout-btn:hover {
    background-color: var(--light-turquoise);
    color:white
}
/* Separator between dropdown items */
.dropdown-item:not(:last-child) {
    border-bottom: 1px solid #e5e7eb;
}

[data-theme="dark"] .dropdown-item:not(:last-child) {
    border-bottom-color: #334155;
}

.notification-btn{
    background:none;
    border:none;
}
.search-input{
    padding:0.2rem 2rem;
    border-radius:1rem;
    border:var(--very-light-gray) 0.09rem solid;
    background: none;
    color:var(--very-light-gray);
    width:11rem;
}
.search-input.active{
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.user-search-btn{
   position: relative;
    left: 2rem;
    background: none;
    border: none;
    color: var(--very-light-gray);
}
.search-section{
    align-items: center;
}
.search-input::placeholder{
    color:var(--very-light-gray)
}
.search-dropdown.show{
   width: 11rem;
    overflow: hidden;
    scroll-behavior: smooth;
    display: block;
    position: absolute;
    padding: 0.5rem;
    background-color: var(--off-white);
    color: var(--light-gray);
    border-bottom-left-radius: 1rem;
    border-bottom-right-radius: 1rem;
    margin-left: 1.1rem;
    z-index: 9999;
    box-shadow: -4px 10px 10px #00000090;
}
.search-dropdown{
    display: none;
}
.search-results{
    max-height:5rem;
    overflow-y: auto;
    scroll-behavior: smooth;
}
.search-results::-webkit-scrollbar, .notification-list::-webkit-scrollbar {
    width: 4px;
}

.search-results::-webkit-scrollbar-track, .notification-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.search-results::-webkit-scrollbar-thumb , .notification-list::-webkit-scrollbar-thumb{
    background: #888;
    border-radius: 2px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: #555;
}


.search-result-item{
   display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.3rem;}

.search-user-avatar, .search-rank-image{
    width:1.2rem;
    height:1.2rem;
    border-radius:2rem;
}
.search-result-username, .search-result-name{
    font-size:0.8rem;
}
/* Animation for dropdown items */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-dropdown.open .dropdown-item {
    animation: slideIn 0.3s ease forwards;
}

.user-dropdown.open .dropdown-item:nth-child(1) {
    animation-delay: 0.1s;
}

.user-dropdown.open .dropdown-item:nth-child(2) {
    animation-delay: 0.2s;
}
.notification-dropdown{
    display: none;
}
.notification-dropdown.show{
    box-shadow: -4px 10px 10px #00000090;
    display: block;
    position: absolute;
    background-color: var(--white);
    color:var(--dark-gray);
    padding: 1rem;
    border-radius: 1rem;
    z-index:999;
    width: 22rem;
    margin-top: -0.5rem;
}
.notification-header{
    font-size: 1.3rem;
   display: flex;
   align-items: center;
   justify-content: space-between;
   margin-bottom:1rem
   
}
.notification-item{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap:0.5rem;
}
.notfication-item:hover{
    background: none;
}
.notification-avatar img{
    width:2rem;
    border-radius: 1rem;
}
.notification-list{
    max-height:4rem;
    overflow-y: auto;
    scroll-behavior: smooth;
}
.accept-btn, .decline-btn{
    color:var(--off-white);
}
.notification-content{
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border-radius: 1rem;

}
.notification-content:hover{
    background: none;
}
.notification-text{
    padding: 9px 2px;
     display: flex;
    justify-content: space-between;
    border: 0.01rem solid var(--very-light-gray);
    padding: 0.5rem;
    box-shadow: 1px 1px var(--very-light-gray);
    border-radius: 2rem;
    cursor: pointer;
    width: 100%;
}
.notification-text:hover{
    background: var(--very-light-gray);
    
}

.notification-action{
    width: 70%;
}
.hidden{
    display: none;
}
/* Mobile responsiveness for dropdown */

@media (max-width:500px){
      .notification-dropdown.show{
        width:12rem;
        left: 10rem;
    }
    .notification-header{
        font-size: 0.8rem;
        
    }
}
@media (max-width:360px){
    .notification-dropdown.show{
        left:4rem;
        width:12rem;
    }
}
@media (max-width: 768px) {
  
    .user-profile {
        padding: 0.25rem;
    }
    
    .username {
        font-size: 0.9rem;
    }
    
    /* Show dropdown as bottom sheet on mobile */
    .user-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 1rem 1rem 0 0;
        transform: translateY(100%);
        margin-top: 0;
    }
    
    .user-profile:hover + .user-dropdown,
    .user-dropdown:hover,
    .user-dropdown.open {
        transform: translateY(0);
    }
    
    /* Overlay background for mobile dropdown */
    .user-dropdown::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .user-dropdown.open::before {
        opacity: 1;
    }
}

/* General mobile responsiveness */
@media (max-width: 1300px) {
    .nav-links {
        gap: 0.9375rem;
        flex-wrap: wrap;
        justify-content: center;
        padding-left: 0;
    }
    
    .nav-link {
        font-size: 0.9rem;
    }
    
    .user-section {
        justify-content: center;
        flex-wrap:wrap;
        gap: 0.5rem;
        padding: 0 1.25rem;
    }
}