/* Body & global layout */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: 0 !important;
}

/* FIX: Add proper padding for fixed navbar */
main {
    flex: 1;
    padding-bottom: 2rem;
    margin-top: 100px !important;
}

/* Navbar */
.navbar-custom {
    background-color: #e6f5ea !important;
    border-bottom: 1px solid #c3e6cb;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 2rem;
    position: fixed !important;
    top: 0 !important;
    width: 100% !important;
    z-index: 1030 !important;
    min-height: 80px;
}

/* Navbar container */
.navbar-custom .container-fluid {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-between;
}

/* Logo - stays on left 
.navbar-brand {
    /* No changes needed */


/* DESKTOP: Navbar Menu - MOVED TO RIGHT */
.collapse.navbar-collapse {
    flex-grow: 0; /* Changed from 1 to 0 */
    margin-left: auto; /* Push to right */
    margin-right: 1rem; /* Space before user icon */
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 0;
}

/* User Icon 
.user-icon-container {  */
    /* No special styles needed */


/* Navbar links */
.navbar-custom .nav-link {
    color: #155724 !important;
    font-weight: bold;
    white-space: nowrap;
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem !important;
}

.navbar-custom .nav-link:hover {
    color: #0c3a1a !important;
    background-color: rgba(21, 87, 36, 0.1);
    border-radius: 4px;
}

/* User dropdown */
.navbar .dropdown-menu {
    position: absolute !important;
    right: 0 !important;
    left: auto !important;
    z-index: 2000;
}

/* MOBILE: Icon Buttons */
.mobile-nav-icons {
    display: none;
    margin: 0 1rem;
}

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

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: #155724 !important;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.nav-icon:hover {
    background-color: rgba(21, 87, 36, 0.1);
    color: #0c3a1a !important;
    transform: translateY(-2px);
}

.nav-icon i {
    font-size: 1.2rem;
}

/* Tooltip for mobile icons */
.nav-icon::after {
    content: attr(title);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.nav-icon:hover::after {
    opacity: 1;
}

/* DESKTOP: Show menu on RIGHT side */
@media (min-width: 992px) {
    .collapse.navbar-collapse {
        display: flex !important;
        flex-grow: 0; /* Don't take all space */
        margin-left: auto; /* Push to right */
        margin-right: 1rem; /* Space before user icon */
    }
    
    .navbar-nav {
        flex-direction: row;
    }
    
    .mobile-nav-icons {
        display: none !important;
    }
}
/* MOBILE: Show icons, hide full menu */
@media (max-width: 991.98px) {
    .collapse.navbar-collapse {
        display: none !important;
    }
    
    .mobile-nav-icons {
        display: flex !important;
        margin-left: auto;
        margin-right: 1rem;
        flex-shrink: 0; /* Prevent shrinking */
    }
    
    .nav-icons-container {
        gap: 0.5rem; /* Reduced gap */
        flex-shrink: 0; /* Prevent shrinking */
    }
    
    .nav-icon {
        width: 36px; /* Smaller icons */
        height: 36px;
        flex-shrink: 0; /* Prevent shrinking */
    }
    
    .nav-icon i {
        font-size: 1rem; /* Smaller icons */
    }
    
    /* User icon - ensure it stays on right */
    .user-icon-container {
        flex-shrink: 0; /* Prevent shrinking */
        margin-left: 0 !important; /* Remove any left margin */
    }
    
    /* Navbar container - prevent wrapping */
    .navbar-custom .container-fluid {
        flex-wrap: nowrap; /* Prevent wrapping */
        overflow: hidden; /* Hide overflow if needed */
    }
    
    /* Logo - allow shrinking if needed */
    .navbar-brand {
        flex-shrink: 1; /* Allow logo to shrink if needed */
        min-width: 120px; /* Minimum logo width */
    }
    
    /* Adjust main content margin for mobile */
    main {
        margin-top: 90px !important;
    }
    
    .navbar-custom {
        padding: 0.75rem 0.5rem; /* Reduced padding */
        min-height: 70px;
    }
}

/* EXTRA SMALL SCREENS (375px and below) */
@media (max-width: 375px) {
    .nav-icons-container {
        gap: 0.3rem; /* Even smaller gap */
    }
    
    .nav-icon {
        width: 32px; /* Even smaller icons */
        height: 32px;
    }
    
    .nav-icon i {
        font-size: 0.9rem; /* Even smaller icons */
    }
    
    .navbar-custom {
        padding: 0.5rem 0.25rem; /* Minimal padding */
    }
    
    .navbar-brand img {
        height: 30px !important; /* Smaller logo */
    }
    
    .mobile-nav-icons {
        margin-right: 0.5rem; /* Less margin */
    }
    
    /* Reduce user icon size on very small screens */
    .user-image, .profile-img {
        width: 32px;
        height: 32px;
    }
}

/* SUPER SMALL SCREENS (320px and below) - EMERGENCY FIX */
@media (max-width: 320px) {
    .nav-icons-container {
        gap: 0.2rem;
    }
    
    .nav-icon {
        width: 30px;
        height: 30px;
    }
    
    .nav-icon i {
        font-size: 0.85rem;
    }
    
    .navbar-brand {
        min-width: 100px; /* Even smaller minimum */
    }
    
    .navbar-brand img {
        height: 25px !important; /* Tiny logo */
    }
}
    /* Adjust main content margin for mobile */
    main {
        margin-top: 90px !important;
    }
    
    .navbar-custom {
        padding: 0.75rem 1rem;
        min-height: 70px;
    }


/* EXTRA SMALL SCREENS: Adjust icon spacing */
@media (max-width: 576px) {
    .nav-icons-container {
        gap: 0.5rem;
    }
    
    .nav-icon {
        width: 36px;
        height: 36px;
    }
    
    .nav-icon i {
        font-size: 1rem;
    }
}

/* Footer & other styles */
.footer-custom {
    background-color: #d4edda !important;
    color: #155724 !important;
    padding: 1rem 2rem;
    text-align: center;
}

.user-image, .profile-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* FIX: Add specific padding for settings page */
.settings-page {
    padding-top: 30px !important;
}

.container.settings-page {
    margin-top: 100px !important;
}

/* FIX FOR DROPDOWN NOT SHOWING */
.user-icon-container .dropdown-menu {
    z-index: 9999 !important; /* Very high z-index to ensure it shows */
    position: absolute !important;
    right: 0 !important;
    left: auto !important;
    top: 100% !important;
    margin-top: 0.125rem !important;
}

/* Ensure dropdown toggle works */
.user-icon-container .dropdown-toggle {
    z-index: 10000 !important;
    position: relative;
}

/* Fix for mobile dropdown positioning */
@media (max-width: 991.98px) {
    .user-icon-container .dropdown-menu {
        position: fixed !important; /* Use fixed positioning on mobile */
        top: 70px !important; /* Position below navbar */
        right: 10px !important; /* Position from right edge */
        left: auto !important;
        z-index: 9999 !important;
    }
}

/* Prevent body scroll when dropdown is open */
body.dropdown-open {
    overflow: hidden;
}