/* ============================================
   Modern White Navbar Styles
   ============================================ */

.navbar-grundee {
    background-color: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.75rem 0;
}

.navbar-grundee.scrolled {
    background-color: rgba(255, 255, 255, 0.98) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    padding: 0.5rem 0;
}

.navbar-brand {
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.navbar-brand:hover {
    transform: scale(1.02);
    opacity: 0.95;
}

/* Navigation Links */
.navbar-grundee .nav-link {
    color: #4a4a4a !important;
    font-weight: 500;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    /* Subtle hover background */
}

.navbar-grundee .nav-link:hover {
    background-color: rgba(84, 163, 0, 0.08);
    /* Light green tint */
    color: #54A300 !important;
    transform: translateY(-1px);
}

.navbar-grundee .nav-link:active {
    transform: translateY(0);
}

.navbar-grundee .nav-link i {
    font-size: 1.1rem;
    color: #54A300;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy transition */
}

.navbar-grundee .nav-link:hover i {
    transform: scale(1.15) rotate(5deg);
}

/* User Avatar */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-avatar:hover {
    border-color: #54A300;
    transform: scale(1.05);
    box-shadow: 0 0 0 4px rgba(84, 163, 0, 0.1);
}

.user-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #54A300 0%, #468a00 100%);
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-avatar-placeholder:hover {
    transform: scale(1.05);
    box-shadow: 0 0 0 4px rgba(84, 163, 0, 0.1);
}

/* User Info Header in Profile Dropdown */
.user-info-header {
    padding: 1rem 1rem 0.75rem;
    background: linear-gradient(135deg, #f8fdf4 0%, #f0f9f0 100%);
    border-radius: 8px;
    margin: 0.25rem 0.5rem 0.5rem;
    border: 1px solid #e8f5e8;
}

.user-info-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #54A300;
    flex-shrink: 0;
}

.user-info-avatar-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #54A300 0%, #468a00 100%);
    border: 2px solid #54A300;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.user-info-name {
    font-weight: 700;
    font-size: 1rem;
    color: #333;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.user-info-email {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.3;
}

/* ============================================
   Dropdown Menus
   ============================================ */

.nav-item .dropdown-menu {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    padding: 0.5rem;
    margin-top: 0.8rem;
    min-width: 250px;
    animation: dropdownFadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.nav-item .dropdown-item {
    border-radius: 10px;
    padding: 0.7rem 1rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #4a4a4a;
    font-weight: 500;
}

.nav-item .dropdown-item:hover {
    background-color: #f0f9f0;
    color: #54A300;
    transform: translateX(4px);
}

.nav-item .dropdown-item-danger {
    color: #dc3545 !important;
}

.nav-item .dropdown-item-danger:hover {
    background-color: #fce8e6 !important;
    /* Light red bg */
    color: #dc3545 !important;
}

.nav-item .dropdown-item i {
    width: 20px;
    text-align: center;
    color: #54A300;
    transition: transform 0.2s ease;
    opacity: 0.8;
}

.nav-item .dropdown-item:hover i {
    transform: scale(1.1);
    opacity: 1;
}

.nav-item .dropdown-item-danger i {
    color: #dc3545;
}

.dropdown-divider {
    margin: 0.5rem 0;
    opacity: 0.08;
    border-top: 1px solid #000;
}

/* Dropdown widths */
.user-dropdown {
    min-width: 300px;
}

.notification-dropdown {
    min-width: 350px !important;
    max-width: 400px !important;
}

@media (max-width: 576px) {
    .notification-dropdown {
        min-width: auto;
        width: 100%;
        max-width: 100%;
        margin-top: 0;
    }
}

@media (max-width: 400px) {
    .notification-dropdown {
        position: fixed !important;
        top: 100px !important;
        /* Position below the navbar */
        left: 50% !important;
        transform: translateX(-50%) !important;
        /* Center horizontally only */
        right: auto !important;
        bottom: auto !important;
        margin: 0 !important;

        width: 90% !important;
        max-width: 380px;
        height: auto !important;
        max-height: calc(100vh - 90px);
        /* Prevent overflow */

        overflow-y: auto;
        z-index: 1055;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
        border-radius: 12px;
    }
}

/* ============================================
   Notification Badge & Items
   ============================================ */

.notification-badge {
    position: absolute;
    top: 4px;
    /* Adjusted position */
    right: 4px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
    border: 2px solid white;
    /* White border to separate from icon */
}

.notification-item {
    padding: 0.8rem 1rem;
    border-radius: 10px;
    transition: background-color 0.2s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
    text-decoration: none;
    display: block;
    margin-bottom: 2px;
}

.notification-item:hover {
    background-color: #f8f9fa;
}

.notification-item.unread {
    background-color: #f0f8ff;
    /* User-friendly light blue */
    border-left-color: #007bff;
}

.notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #2c3e50;
    margin-bottom: 0.2rem;
}

.notification-message {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-bottom: 0.2rem;
}

.notification-time {
    font-size: 0.7rem;
    color: #bdc3c7;
}

.see-all-btn {
    display: block;
    text-align: center;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 10px;
    color: #54A300 !important;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.see-all-btn:hover {
    background: #54A300;
    color: white;
}

/* ============================================
   Unified Utility & Mobile Actions
   ============================================ */

/* Container for Desktop Utility + Mobile Toggle */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem !important;
    /* Enforce consistent gap */
    padding: 0.25rem;
}

.navbar-actions .nav-link {
    color: #333 !important;
    padding: 0.5rem;
    border-radius: 50%;
    /* Circular hover effect for icons */
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background-color: transparent;
}

.navbar-actions .nav-link:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
    transform: none;
    /* No lift for these icon buttons, simpler feel */
}

/* Language Selector specifics */
.language-selector {
    border-radius: 20px !important;
    /* Checkbox style tweak */
    width: auto !important;
    padding: 0.5rem 1rem !important;
}

.language-selector:hover {
    background-color: #f8f9fa !important;
}

.language-selector i {
    font-size: 1.1rem;
    color: #54A300;
}

.language-flag {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    margin-left: 0.25rem;
}

/* Language Dropdown Items */
.language-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: all 0.2s ease;
    border-radius: 8px;
    font-weight: 500;
}

.language-item:hover {
    background-color: #f0f9f0;
    color: #54A300;
}

.language-item.active {
    background-color: #e8f5e8;
    color: #54A300;
    font-weight: 600;
}

.language-flag-icon {
    font-size: 1.3rem;
}

/* ============================================
   Navbar Toggler (Hamburger)
   ============================================ */

.navbar-toggler {
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.navbar-toggler:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.navbar-toggler:focus {
    box-shadow: none;
    background-color: rgba(0, 0, 0, 0.08);
}

.navbar-toggler-icon {
    width: 1.4em;
    height: 1.4em;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 0, 0, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ============================================
   Responsive Tweaks
   ============================================ */

@media (min-width: 992px) {

    /* Desktop Spacing */
    .navbar-nav {
        gap: 1.5rem;
        /* More breathing room between links */
    }

    .navbar-actions {
        margin-left: 1rem;
        padding-left: 1rem;
        border-left: 1px solid rgba(0, 0, 0, 0.08);
        /* Divider */
    }
}

/* ============================================
   Enhanced Features Mega Menu
   ============================================ */

/* Desktop Mega Menu Layout */
@media (min-width: 992px) {
    .nav-item.dropdown:hover>.dropdown-menu {
        display: block;
        margin-top: 0;
        /* Align with nav-link */
    }

    .nav-item.dropdown:hover>.dropdown-menu-end {
        right: 0;
        left: auto;
    }

    .features-mega-menu {
        width: 800px;
        left: 50% !important;
        transform: translateX(-50%) !important;
        padding: 1.5rem !important;
        border-radius: 20px !important;
        box-shadow: 0 15px 50px rgba(0, 0, 0, 0.12) !important;
    }

    .mega-menu-content {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

.mega-menu-col {
    padding: 1rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: block;
    border: 1px solid transparent;
}

.mega-menu-col:hover {
    background-color: #f8fdf4;
    border-color: #e8f5e8;
    transform: translateY(-4px);
}

.mega-menu-icon {
    width: 48px;
    height: 48px;
    background-color: rgba(84, 163, 0, 0.1);
    color: #54A300;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.mega-menu-col:hover .mega-menu-icon {
    background-color: #54A300;
    color: white;
    transform: scale(1.1) rotate(5deg);
}

.mega-menu-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.5rem;
    display: block;
}

.mega-menu-desc {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    margin: 0;
    display: block;
}

/* Mobile Tweaks for Mega Menu */
@media (max-width: 991px) {
    .features-mega-menu {
        width: 100%;
        box-shadow: none !important;
        background: transparent !important;
        padding: 0.5rem 0 !important;
        border: none !important;
        backdrop-filter: none !important;
    }

    .mega-menu-content {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        padding: 0 0.5rem;
    }

    .mega-menu-col {
        padding: 1rem;
        display: flex;
        align-items: center;
        gap: 1rem;
        background-color: #f9f9f9;
        border-radius: 12px;
        border: 1px solid rgba(0, 0, 0, 0.03);
        position: relative;
    }

    .mega-menu-col:active {
        background-color: #f0f9f0;
        transform: scale(0.98);
    }

    .mega-menu-col::after {
        content: '\f054';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        position: absolute;
        right: 1.25rem;
        font-size: 0.8rem;
        color: #ccc;
        transition: transform 0.2s ease;
    }

    .mega-menu-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
        margin-bottom: 0;
        flex-shrink: 0;
        border-radius: 10px;
        background-color: white;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    }

    .mega-menu-info {
        flex-grow: 1;
        padding-right: 1.5rem;
    }

    .mega-menu-title {
        font-size: 0.95rem;
        margin-bottom: 0.1rem;
        color: #333;
    }

    .mega-menu-desc {
        font-size: 0.75rem;
        color: #777;
        line-height: 1.3;
    }
}

@media (max-width: 991px) {

    /* Mobile Spacing */
    .navbar-collapse {
        margin-top: 1rem;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
    }

    .navbar-nav .nav-link {
        padding: 0.8rem 1rem;
        /* Bigger touch targets */
    }

    /* Hide language text on mobile if needed, though we enabled it in base.html */
}