/*
====================
Layout: Header, Navigation, Footer, Mobile Menu
====================
*/

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.site-header.header-hidden {
    transform: translateY(-100%);
}

.site-header.sticky {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.header-top {
    padding: 12px 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.site-logo-gw {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
}

.site-logo-gw:hover {
    opacity: 0.9;
    color: #ffffff;
}

.site-logo-gw svg {
    width: 24px;
    height: 24px;
    fill: #ffffff;
}

.header-home-link,
.header-search-link {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

.header-home-link:hover,
.header-search-link:hover {
    opacity: 0.8;
    color: #ffffff;
}

.header-search-link i {
    margin-right: 4px;
}

button.header-search-link {
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

button.header-search-link:hover {
    opacity: 0.8;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-search-gw {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    overflow: hidden;
    width: 280px;
}

.search-field-gw {
    flex: 1;
    border: none;
    padding: 8px 16px;
    font-size: 14px;
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.search-field-gw::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-submit-gw {
    background: none;
    border: none;
    padding: 8px 16px;
    color: #ffffff;
    cursor: pointer;
    transition: color 0.2s;
}

.search-submit-gw:hover {
    color: var(--color-primary-light);
}

/* ===================================
   Header User Menu & Buttons
   =================================== */

.header-user-menu-gw {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    padding: 8px 24px;
    border: none;
    transition: all 0.2s;
    letter-spacing: 0.5px;
    border-radius: 50px;
}

.header-btn[href*="register"],
.header-user-menu-gw a[href*="register"] {
    background: linear-gradient(90deg, #006AE3 0%, #0027C4 100%);
    color: #ffffff;
}

.header-btn[href*="register"]:hover,
.header-user-menu-gw a[href*="register"]:hover {
    background: linear-gradient(90deg, #0056C4 0%, #001F9E 100%);
    box-shadow: 0 4px 8px rgba(0, 106, 227, 0.3);
    color: #ffffff;
}

.header-btn[href*="login"]:not([href*="logout"]) {
    background: transparent;
    color: #00BBFF;
    border: 3px solid #00BBFF;
}

.header-btn[href*="login"]:not([href*="logout"]):hover {
    background: rgba(0, 187, 255, 0.1);
    border-color: #00BBFF;
    color: #00BBFF;
}

.header-btn[href*="logout"] {
    background: transparent;
    color: #00BBFF;
    border: 3px solid #00BBFF;
}

.header-btn[href*="logout"]:hover {
    background: rgba(0, 187, 255, 0.1);
    border-color: #00BBFF;
    color: #00BBFF;
}

.header-btn i {
    font-size: 12px;
}

/* ===================================
   Header Subtext & Ad Notice
   =================================== */

.header-subtext {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-subtext .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #ffffff;
}

.header-subtext p {
    color: #ffffff;
    margin: 0;
}

.ad-notice {
    margin: 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
}

/* ===================================
   Main Navigation
   =================================== */

.main-navigation-gw {
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-links-gw {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0;
    padding: 0;
}

.nav-links-gw li {
    margin: 0;
}

.nav-links-gw a {
    display: block;
    padding: 14px 20px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.nav-links-gw a:hover {
    background: rgba(255, 255, 255, 0.1);
    border-bottom-color: var(--color-primary);
    text-decoration: none;
    color: #ffffff;
}

/* ===================================
   Mobile Hamburger Menu
   =================================== */

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    -webkit-tap-highlight-color: transparent;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.2s ease;
}

.hamburger-line:nth-child(1) { margin-bottom: 6px; }
.hamburger-line:nth-child(3) { margin-top: 6px; }

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Mobile Overlay */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Drawer Menu */
.mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    height: 100dvh;
    background: #111827;
    z-index: 9999;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.mobile-drawer.open {
    transform: translateX(0);
    visibility: visible;
}

body.menu-open {
    overflow: hidden;
    touch-action: none;
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.mobile-drawer-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.mobile-drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.mobile-drawer-close:hover,
.mobile-drawer-close:active {
    background: rgba(255, 255, 255, 0.15);
}

.mobile-drawer-body {
    padding: 8px 0;
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-list li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px;
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    text-decoration: none;
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-list li a:hover,
.mobile-nav-list li a:active {
    background: rgba(255, 255, 255, 0.06);
    text-decoration: none;
}

.mobile-nav-list li a i {
    width: 22px;
    text-align: center;
    color: var(--color-primary-light);
    font-size: 15px;
    flex-shrink: 0;
}

.mobile-nav-platforms {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 0 8px;
}

.mobile-nav-platforms li a {
    font-size: 14px;
    padding: 11px 12px;
    color: var(--color-text-light);
    border-radius: var(--radius-sm);
}

.mobile-nav-platforms li a:hover,
.mobile-nav-platforms li a:active {
    background: rgba(65, 105, 225, 0.1);
    color: var(--color-primary-light);
}

.mobile-nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 8px 20px;
}

.mobile-nav-label {
    padding: 16px 20px 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-lighter);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.mobile-nav-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 20px;
    flex-shrink: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.mobile-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-btn:hover {
    opacity: 0.9;
    text-decoration: none;
}

.mobile-nav-btn:active {
    transform: scale(0.98);
}

.mobile-nav-btn.btn-register {
    background: var(--gradient-primary);
    color: #fff;
}

.mobile-nav-btn.btn-login {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* ===================================
   Footer
   =================================== */

.site-footer-gw {
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid var(--color-border);
}

.footer-sitemap {
    padding: 40px 0 32px;
    border-bottom: 1px solid var(--color-border);
}

.sitemap-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
}

.sitemap-heading {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-primary);
}

.sitemap-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sitemap-links li {
    margin-bottom: 8px;
}

.sitemap-links a {
    color: #d1d5db;
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s;
}

.sitemap-links a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.footer-bottom {
    padding: 24px 0 20px;
    text-align: center;
}

.footer-nav-main {
    margin-bottom: 16px;
}

.footer-links-main {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 24px;
}

.footer-links-main li {
    margin: 0;
}

.footer-links-main a {
    color: #ffffff;
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
}

.footer-links-main a:hover {
    text-decoration: underline;
}

.footer-nav-sub {
    margin-bottom: 16px;
}

.footer-links-sub {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 16px;
}

.footer-links-sub li {
    margin: 0;
}

.footer-links-sub a {
    color: #ffffff;
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
}

.footer-links-sub a:hover {
    text-decoration: underline;
}

.footer-copyright-gw {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.footer-copyright-gw p {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-light);
}

/* ===================================
   Back to Top Button
   =================================== */

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(90deg, #00BBFF 0%, #118AE6 99.99%);
    color: #fff;
    border: none;
    cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 999;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: linear-gradient(90deg, #33CCFF 0%, #2A9AF0 99.99%);
}

.back-to-top i {
    font-size: 20px;
}

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

@media screen and (max-width: 900px) {
    .header-content {
        flex-wrap: wrap;
    }

    .header-search-gw {
        width: 200px;
    }

    .header-home-link,
    .header-search-link {
        font-size: 12px;
    }

    .header-btn {
        padding: 4px 8px;
        font-size: 12px;
    }

    .nav-links-gw {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links-gw a {
        padding: 12px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    .sitemap-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
}

@media screen and (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .header-user-menu-gw {
        display: none;
    }

    .header-home-link {
        display: none;
    }

    .main-navigation-gw {
        display: none;
    }

    .header-subtext {
        display: none;
    }

    .footer-links-main {
        gap: 12px 16px;
    }

    .footer-links-main a,
    .footer-links-sub a {
        font-size: 12px;
    }

    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
    }

    .footer-sitemap {
        padding: 24px 0 20px;
    }

    .sitemap-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px 16px;
    }

    .sitemap-heading {
        font-size: 13px;
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

    .sitemap-links a {
        font-size: 12px;
    }

    .sitemap-links li {
        margin-bottom: 6px;
    }

    /* Mobile: show nav as horizontal scroll on non-front pages */
    .main-navigation-gw {
        display: block !important;
    }

    .nav-links-gw {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        scrollbar-width: none;
    }

    .nav-links-gw::-webkit-scrollbar {
        display: none;
    }

    .nav-links-gw a {
        padding: 10px 14px;
        font-size: 12px;
        white-space: nowrap;
    }
}