/* Navbar - Fixed height for all devices */
.navbar-custom {
    background: transparent;
    border-bottom: 1px solid transparent;
    padding: 1rem 0 !important;
    position: fixed;
    z-index: 1000;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.navbar-custom .container {
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem;
    justify-content: space-between;
    min-width: 0;
}

.navbar-custom.scrolled {
    background: #1E90FF;
    padding: 1rem 0 !important;
    border-bottom: 1px solid #1E90FF;
    box-shadow: 0 2px 10px rgba(30, 144, 255, 0.3);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    min-width: 0;
}

.brand-copy {
    display: grid;
    min-width: 0;
}

.brand-logo {
    width: 46px !important;
    height: 46px !important;
    flex-shrink: 0;
}

.brand-name {
    font-size: 1.5rem !important;
    font-weight: 900;
    color: #1E90FF;
    line-height: 1;
    white-space: normal;
}

.brand-subtitle {
    font-size: 0.9rem !important;
    color: #1E90FF;
    line-height: 1;
    white-space: nowrap;
}

.navbar-custom.scrolled .brand-name,
.navbar-custom.scrolled .brand-subtitle {
    color: white;
}

.btn-menu {
    background: #1E90FF;
    color: white;
    border: none;
    padding: 0.7rem 1.5rem !important;
    margin-right: 0.5rem;
    border-radius: 25px;
    font-weight: 700;
    transition: background 0.3s, transform 0.3s;
    min-height: 44px;
    white-space: nowrap;
}

.btn-menu:hover {
    background: #0080FF;
    transform: scale(1.02);
}

/* Offcanvas Menu */
.offcanvas-menu {
    background: white;
    width: 280px !important;
}

[data-bs-theme="dark"] .offcanvas-menu {
    background: #1a1a1a;
}

.offcanvas-header {
    border-bottom: 2px solid #1E90FF;
    padding: 1.5rem;
}

.menu-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: transparent;
    border-left: 3px solid transparent;
    color: #333;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

[data-bs-theme="dark"] .menu-item {
    color: #fff;
}

.menu-item i {
    font-size: 1.3rem;
    color: #1E90FF;
}

.menu-item:hover,
.menu-item.active {
    background: #f0f8ff;
    border-left-color: #1E90FF;
    color: #1E90FF;
    transform: translateX(5px);
}

[data-bs-theme="dark"] .menu-item:hover,
[data-bs-theme="dark"] .menu-item.active {
    background: #2a2a2a;
}

/* Responsive - Small devices */
@media (max-width: 575.98px) {
    .navbar-custom {
        padding: 0.75rem 0 !important;
    }

    .brand-logo {
        width: 36px !important;
        height: 36px !important;
    }
    
    .brand-name {
        font-size: clamp(0.86rem, 4.1vw, 1.08rem) !important;
        line-height: 1.05;
    }
    
    .brand-subtitle {
        display: none;
    }
    
    .btn-menu {
        padding: 0.5rem 0.85rem !important;
        font-size: 0.9rem;
        flex: 0 0 auto;
        min-width: 88px;
    }
}

@media (max-width: 340px) {
    .brand-logo {
        width: 32px !important;
        height: 32px !important;
    }

    .brand-name {
        font-size: 0.8rem !important;
    }

    .btn-menu {
        min-width: 76px;
        padding: 0.45rem 0.65rem !important;
        font-size: 0.8rem;
    }
}

/* Responsive - Medium devices */
@media (min-width: 576px) and (max-width: 991.98px) {
    .brand-logo {
        width: 40px !important;
        height: 40px !important;
    }
    
    .brand-name {
        font-size: 1.1rem !important;
    }
    
    .brand-subtitle {
        font-size: 0.85rem !important;
    }
}

/* Responsive - Large devices */
@media (min-width: 992px) {
    .brand-logo {
        width: 50px !important;
        height: 50px !important;
    }
    
    .brand-name {
        font-size: 1.35rem !important;
        white-space: nowrap;
    }
    
    .brand-subtitle {
        font-size: 1rem !important;
    }
}

/* Redesigned public navigation */
.navbar-custom {
    left: 0;
    padding: max(0.7rem, env(safe-area-inset-top)) 0.75rem 0.7rem !important;
    right: 0;
    top: 0;
}

.navbar-custom .container {
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(30, 144, 255, 0.16);
    border-radius: 999px;
    box-shadow: 0 18px 50px rgba(4, 38, 83, 0.12);
    max-width: 1120px;
    padding: 0.45rem 0.55rem;
}

.navbar-custom.scrolled {
    background: transparent;
    border-bottom-color: transparent;
    box-shadow: none;
    padding: max(0.7rem, env(safe-area-inset-top)) 0.75rem 0.7rem !important;
}

.brand {
    border-radius: 999px;
    color: #0f172a;
    max-width: calc(100% - 5.8rem);
    padding: 0.25rem 0.35rem;
}

.brand-logo {
    box-shadow: 0 10px 28px rgba(14, 116, 184, 0.2) !important;
}

.brand-name,
.brand-subtitle,
.navbar-custom.scrolled .brand-name,
.navbar-custom.scrolled .brand-subtitle {
    color: #0d8aff;
}

.brand-subtitle {
    color: #2f79b7 !important;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-menu {
    align-items: center;
    background: linear-gradient(135deg, #0d8aff, #0763d9);
    border: 1px solid rgba(255, 255, 255, 0.42) !important;
    border-radius: 999px;
    box-shadow: 0 14px 32px rgba(13, 138, 255, 0.3);
    display: inline-flex;
    gap: 0.35rem;
    justify-content: center;
}

.btn-menu:hover,
.btn-menu:focus-visible {
    background: linear-gradient(135deg, #0b7ce6, #054eb8);
    box-shadow: 0 16px 36px rgba(13, 138, 255, 0.38);
    color: #fff;
    outline: none;
    transform: translateY(-1px);
}

.offcanvas-menu {
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    background: rgba(255, 255, 255, 0.86);
    border-left: 1px solid rgba(30, 144, 255, 0.16);
    box-shadow: -24px 0 80px rgba(15, 23, 42, 0.16);
    width: min(88vw, 340px) !important;
    z-index: 1085;
}

.offcanvas-header {
    align-items: center;
    border-bottom: 1px solid rgba(30, 144, 255, 0.16);
    padding: 1.1rem 1.2rem;
}

.offcanvas-header .btn-close {
    border-radius: 999px;
    min-height: 44px;
    min-width: 44px;
    opacity: 0.82;
}

.offcanvas-header .btn-close:hover,
.offcanvas-header .btn-close:focus-visible {
    background-color: rgba(13, 138, 255, 0.12);
    opacity: 1;
    outline: none;
}

.offcanvas-header h5 {
    letter-spacing: 0;
    margin: 0;
}

.offcanvas-body {
    padding: 1rem;
}

.menu-nav {
    gap: 0.45rem;
    padding: 0;
}

.menu-item {
    border: 1px solid transparent;
    border-left: 1px solid transparent;
    border-radius: 1rem;
    color: #172033;
    gap: 0.85rem;
    min-height: 52px;
    padding: 0.85rem 1rem;
    position: relative;
    transform: none;
}

.menu-item span {
    color: inherit;
    font-weight: 750;
}

.menu-item i {
    align-items: center;
    background: rgba(13, 138, 255, 0.1);
    border-radius: 0.8rem;
    color: #0d8aff;
    display: inline-flex;
    flex: 0 0 36px;
    font-size: 1rem;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.menu-item:hover,
.menu-item:focus-visible,
.menu-item.active {
    background: rgba(13, 138, 255, 0.1);
    border-color: rgba(13, 138, 255, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
    color: #0757bc;
    outline: none;
    transform: translateX(3px);
}

.menu-item:hover i,
.menu-item:focus-visible i,
.menu-item.active i {
    background: #0d8aff;
    color: #fff;
}

.menu-toggle {
    font: inherit;
    text-align: left;
    width: 100%;
}

.menu-divider {
    border-color: rgba(13, 138, 255, 0.18);
    margin: 0.55rem 0;
}

[data-bs-theme="dark"] .navbar-custom .container,
[data-bs-theme="dark"] .offcanvas-menu {
    background: rgba(11, 18, 32, 0.82);
    border-color: rgba(96, 165, 250, 0.2);
}

[data-bs-theme="dark"] .brand-name,
[data-bs-theme="dark"] .navbar-custom.scrolled .brand-name {
    color: #7cc4ff;
}

[data-bs-theme="dark"] .brand-subtitle,
[data-bs-theme="dark"] .navbar-custom.scrolled .brand-subtitle {
    color: #9ccdf4 !important;
}

[data-bs-theme="dark"] .menu-item {
    color: #e5eefb;
}

[data-bs-theme="dark"] .menu-toggle {
    color: #f4f8ff;
}

[data-bs-theme="dark"] .menu-item:hover,
[data-bs-theme="dark"] .menu-item:focus-visible,
[data-bs-theme="dark"] .menu-item.active {
    background: rgba(96, 165, 250, 0.14);
    color: #bfdbfe;
}

@media (max-width: 575.98px) {
    .navbar-custom .container {
        max-width: calc(100vw - 0.8rem);
        min-height: 58px;
        position: relative;
        width: calc(100vw - 0.8rem);
        gap: 0.35rem;
        padding: 0.4rem 0.45rem;
    }

    .brand {
        flex: 1 1 auto;
        max-width: calc(100% - 4.7rem);
        overflow: hidden;
    }

    .btn-menu {
        flex: 0 0 auto;
        min-height: 42px;
        min-width: 66px;
        padding: 0.45rem 0.58rem !important;
        position: absolute;
        right: 0.45rem;
        top: 50%;
        transform: translateY(-50%);
        z-index: 2;
    }

    .btn-menu:hover,
    .btn-menu:focus-visible {
        transform: translateY(-50%);
    }
}

@media (max-width: 360px) {
    .navbar-custom {
        padding-left: 0.35rem !important;
        padding-right: 0.35rem !important;
    }

    .brand-subtitle {
        display: none;
    }

    .brand-name {
        font-size: 0.82rem !important;
        line-height: 1.05;
    }

    .brand-logo {
        height: 34px !important;
        width: 34px !important;
    }

    .btn-menu span {
        display: none;
    }

    .btn-menu {
        min-width: 42px;
        width: 42px;
        margin-right: 0;
    }
}

/* Desktop navigation pass */
.nav-desktop {
    align-items: center;
    display: none;
    gap: 0.35rem;
    margin-left: auto;
}

.nav-desktop a,
.desktop-theme-toggle {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    color: #17466f;
    display: inline-flex;
    font-size: 0.92rem;
    font-weight: 750;
    gap: 0.4rem;
    min-height: 40px;
    padding: 0.55rem 0.85rem;
    text-decoration: none;
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
    white-space: nowrap;
}

.nav-desktop a:hover,
.nav-desktop a:focus-visible,
.desktop-theme-toggle:hover,
.desktop-theme-toggle:focus-visible,
.nav-desktop a.active {
    background: rgba(13, 138, 255, 0.1);
    border-color: rgba(13, 138, 255, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
    color: #0757bc;
    outline: none;
    transform: translateY(-1px);
}

.nav-desktop .nav-login {
    background: linear-gradient(135deg, #0d8aff, #075ed0);
    border-color: transparent;
    box-shadow: 0 12px 28px rgba(13, 138, 255, 0.26);
    color: #fff;
}

.desktop-theme-toggle {
    cursor: pointer;
}

@media (min-width: 992px) {
    .navbar-custom .container {
        gap: 1rem;
        padding: 0.5rem 0.65rem 0.5rem 0.55rem;
    }

    .brand {
        max-width: none;
    }

    .nav-desktop {
        display: flex;
    }

    .btn-menu {
        display: none;
    }
}

@media (min-width: 1200px) {
    .navbar-custom .container {
        max-width: 1180px;
    }

    .nav-desktop a,
    .desktop-theme-toggle {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

[data-bs-theme="dark"] .nav-desktop a,
[data-bs-theme="dark"] .desktop-theme-toggle {
    color: #d9ecff;
}

[data-bs-theme="dark"] .nav-desktop a:hover,
[data-bs-theme="dark"] .nav-desktop a:focus-visible,
[data-bs-theme="dark"] .desktop-theme-toggle:hover,
[data-bs-theme="dark"] .desktop-theme-toggle:focus-visible,
[data-bs-theme="dark"] .nav-desktop a.active {
    background: rgba(96, 165, 250, 0.14);
    border-color: rgba(96, 165, 250, 0.22);
    color: #fff;
}

[data-bs-theme="dark"] .nav-desktop .nav-login {
    color: #fff;
}

@media (max-width: 575.98px) {
    .navbar-custom {
        left: 0;
        right: 0;
        width: 100%;
    }

    .navbar-custom .container {
        max-width: calc(100vw - 2rem) !important;
        width: calc(100vw - 2rem) !important;
    }

    .btn-menu {
        right: 0.35rem;
    }

    .offcanvas-menu {
        max-width: min(340px, 92vw);
    }
}

@media (max-width: 380px) {
    .navbar-custom .container {
        max-width: calc(100vw - 1.25rem) !important;
        width: calc(100vw - 1.25rem) !important;
    }

    .btn-menu {
        right: 0.3rem;
    }
}
