/* =========================================================================
   MODULAR SITE HEADER STYLESHEET
   Location: /static/style/header.css
   Used for: Global top bar, navigation, brand logo & mobile drawer
   ========================================================================= */

header.site {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    max-width: 100%;
    background: rgba(3, 11, 24, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--hair);
    transition: all 0.3s ease;
}

.site-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: 8px 0;
    gap: 16px;
    width: 100%;
    min-width: 0;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
}

.brand-link img.logo-icon {
    display: block;
    height: 36px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(56, 189, 248, 0.3));
}

.brand-link img.logo-wordmark {
    display: block;
    height: 70px;
    width: auto;
    max-width: 280px;
    object-fit: contain;
}

.brand-link img.logo-mobile {
    display: none;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 22px;
}

.nav-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dim);
    position: relative;
    padding: 8px 4px;
    transition: color 0.2s ease;
    text-decoration: none;
}

.nav-link:hover,
.nav-link.active {
    color: #ffffff;
}

.nav-link::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--t), var(--cyan));
    transition: width 0.25s ease;
    border-radius: 2px;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-mobile-menu {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-mobile-menu:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-mobile-menu .icon-close { display: none; }
.btn-mobile-menu.active .icon-menu { display: none; }
.btn-mobile-menu.active .icon-close { display: block; }

.mobile-nav {
    display: none;
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    background: rgba(3, 11, 24, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid transparent;
    transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
}

.mobile-nav.open {
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom-color: var(--hair);
}

.mobile-nav-link {
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-dim);
    border-top: 1px solid var(--hair);
    text-decoration: none;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.04);
}

.mobile-nav-btn {
    margin: 10px 28px 14px;
    width: calc(100% - 56px);
}

/* Responsive Header */
@media (max-width: 860px) {
    .site-nav {
        display: none;
    }

    .btn-mobile-menu {
        display: flex;
    }

    .mobile-nav {
        display: flex;
    }

    /* On mobile viewports, the Server Panel button is available in the mobile drawer */
    .header-actions .header-panel-btn {
        display: none;
    }
}

@media (max-width: 680px) {
    .site-inner {
        min-height: 58px;
        padding: 6px 0;
        gap: 10px;
    }

    .brand-link {
        gap: 8px;
        min-width: 0;
    }

    .brand-link img.logo-icon {
        height: 30px;
        flex-shrink: 0;
    }

    .brand-link img.logo-wordmark {
        display: none;
    }

    .brand-link img.logo-mobile {
        display: block;
        height: 28px;
        max-width: 140px;
        width: auto;
        object-fit: contain;
    }

    .header-actions {
        gap: 8px;
        flex-shrink: 0;
    }

    .btn-header-back {
        padding: 7px 12px;
        font-size: 0.84rem;
        gap: 6px;
    }

    .btn-header-back .back-text-full {
        display: none;
    }
}

@media (max-width: 480px) {
    .site-inner {
        min-height: 52px;
        padding: 4px 0;
        gap: 8px;
    }

    .brand-link img.logo-icon {
        height: 26px;
    }

    .brand-link img.logo-mobile {
        height: 24px;
        max-width: 110px;
    }

    .btn-mobile-menu {
        width: 36px;
        height: 36px;
    }

    .btn-header-back {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    /* On subpages with server panel on small phones, show icon-only to prevent overflow */
    .header-actions .btn-server-panel {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .header-actions .btn-server-panel span {
        display: none;
    }

    .mobile-nav-link {
        padding: 12px 18px;
    }

    .mobile-nav-btn {
        margin: 8px 18px 12px;
        width: calc(100% - 36px);
    }
}

