/* Hardwood Games Navbar Styles */
html, body {
    scrollbar-gutter: stable !important;
}

/* Prevent Bootstrap from injecting padding-right when offcanvas/modal opens */
body.modal-open,
body.offcanvas-active,
body.showing {
    padding-right: 0 !important;
}

/* Hardwood Style Navbar */
.hw-navbar {
    background: rgba(40, 26, 20, 0.8) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(0, 0, 0, 0.3);
    padding: 0.5rem 2rem;
    height: 64px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 1050;

	/* Fixed Position to avoid sticky jitter */
    position: fixed;
    top: 15px;
    left: 20px;
    right: 20px;
    width: auto;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scrolled State */
.hw-navbar.navbar-scrolled {
    top: 0;
    left: 0;
    right: 0;
    border-radius: 0;
}

/* Django CMS Toolbar Adjustment
   When CMS toolbar is visible, Django adds .cms-toolbar-expanded to <html>.
   We use this to push our navbar down by the toolbar height (~46px). */
.cms-toolbar-expanded .hw-navbar {
    top: 61px; /* 46px toolbar + 15px original offset */
}

.cms-toolbar-expanded .hw-navbar.navbar-scrolled {
    top: 46px;
}

.cms-toolbar-expanded .hw-nav-spacer {
    height: 140px; /* 94px + 46px toolbar */
}

/* Spacer to prevent content jump */
.hw-nav-spacer {
    height: 94px;
	/* 64px height + 15px top margin + 15px extra space */
}

.hw-nav-item {
    color: #FDFAEA !important;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    text-decoration: none;
}

/* Intermediate Desktop Adjustments */
@media (min-width: 768px) and (max-width: 1200px) {
    .hw-nav-item {
        padding: 0.5rem 0.6rem !important;
        font-size: 0.9rem;
    }

    .btn-hw-gold {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.9rem;
    }
}

.hw-nav-item:hover,
.hw-nav-item:focus {
    background-color: var(--hw-nav-hover);
    color: var(--hw-accent) !important;
}

/* Keep trigger highlighted while dropdown is open */
.dropdown:hover > .hw-nav-item,
.dropdown.show > .hw-nav-item {
    background-color: var(--hw-nav-hover);
    color: var(--hw-accent) !important;
}

.hw-nav-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--hw-accent);
    margin-right: 8px;
    box-shadow: 0 0 10px rgba(240, 173, 78, 0.3);
}

.hw-dropdown-menu {
    background: rgba(40, 26, 20, 0.95) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid #4d3a31 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
    margin-top: 10px !important;
    border-radius: 12px !important;
    padding: 0.5rem !important;
    animation: dropdownFadeIn 0.2s ease-out;
    transform-origin: top center;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.hw-dropdown-item {
    color: #ccc !important;
    border-radius: 6px !important;
    padding: 0.6rem 1rem !important;
    background: transparent !important;
    text-decoration: none;
    display: block;
    width: 100%;
    border: none;
    text-align: left;
}

.hw-dropdown-item:hover {
    background-color: var(--hw-nav-hover) !important;
    color: #fff !important;
}

/* Auto-expand dropdowns on hover */
.dropdown:hover > .dropdown-menu {
    display: block !important;
    margin-top: 0 !important;
}

.dropdown > .dropdown-toggle:active {
    pointer-events: none;
}

/* Mobile Adjustments */
@media (max-width: 767px) {
    .hw-navbar {
        top: 0;
        left: 0;
        right: 0;
        padding: 0 1rem; /* Removed vertical padding to allow 100% height container to center */
        border-radius: 0;
        height: 64px;
    }

    .hw-navbar .container-fluid {
        height: 100%;
        flex-wrap: nowrap;
    }

    .hw-navbar-brand {
        margin: 0 !important;
        margin-left: 0.75rem !important;
        display: flex !important;
        white-space: nowrap;
        overflow: hidden;
        flex: 1 1 0;
        min-width: 0;
    }

    .hw-navbar-brand span {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .hw-nav-item {
        padding: 0.8rem 1rem !important;
        border-radius: 0;
    }

	/* Offcanvas Styling */
    .hw-offcanvas {
        background-color: var(--hw-nav-bg) !important;
        border: none !important;
        color: #fff;
        width: 280px !important;
        z-index: 1100 !important;
    }

    .hw-offcanvas .offcanvas-header {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        background-color: rgba(0, 0, 0, 0.2);
        height: 64px;
        padding: 0 1rem;
        align-items: center !important;
    }

    .hw-offcanvas .btn-close {
        filter: invert(1);
        opacity: 1;
        background-size: 1.25rem;
        width: 2.5rem;
        height: 2.5rem;
        padding: 0;
        margin: 0;
    }

    .hw-nav-spacer {
        height: 64px;
    }

    .hw-nav-avatar img {
        margin-right: 0 !important;
    }
}
