/**
 * Site Header & Footer Styles
 * Shared across all pages (EJS and static HTML)
 * Mimics drivingsimulator.com design
 */

/* =============================================================================
   CSS VARIABLES
   ============================================================================= */
:root {
    --site-header-height: 66px;
    --site-footer-fixed-height: 48px;
    --site-header-bg: #ffffff;
    --site-footer-fixed-bg: #f5f5f5;
    --site-footer-inflow-bg: #e8e8e8;
    --site-text-dark: #333333;
    --site-text-muted: #666666;
    --site-link-color: #333333;
    --site-link-hover: #000000;
    --site-social-color: #555555;
    --site-social-hover: #000000;
}

/* =============================================================================
   BODY PADDING FOR FIXED ELEMENTS
   ============================================================================= */
body.has-site-header-footer {
    padding-top: var(--site-header-height);
    padding-bottom: var(--site-footer-fixed-height);
    overflow-x: hidden;
}

/* =============================================================================
   FIXED HEADER
   ============================================================================= */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--site-header-height);
    background: var(--site-header-bg);
    border-bottom: 1px solid #e0e0e0;
    z-index: 9999;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    padding: 0 12px;
}

/* Logo Section - D2 + Adiona side-by-side */
.site-header-logos {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    flex-shrink: 0;
}

.site-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
}

/* D2 logo in a circular shape with invisible border (40x40 matches drivingsimulator.com) */
.site-logo-d2 {
    height: 40px;
    width: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: transparent;
    border: none;
}

/* Adiona logo sized proportionally to D2 */
.site-logo-adiona {
    height: 36px;
}

/* Desktop Navigation */
.site-header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.site-nav-link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    color: var(--site-text-dark);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.2s, background 0.2s;
    border-radius: 4px;
}

.site-nav-link:hover {
    color: var(--site-link-hover);
    background: rgba(0, 0, 0, 0.05);
}

.site-nav-icon {
    font-size: 14px;
}

.site-nav-label {
    font-size: 13px;
}

/* Mobile Menu Toggle */
.site-header-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--site-text-dark);
}

.site-header-menu-toggle svg {
    width: 24px;
    height: 24px;
}

/* Mobile Navigation */
.site-header-nav-mobile {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--site-header-bg);
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    flex-direction: column;
    padding: 8px 0;
}

.site-header-nav-mobile.open {
    display: flex;
}

.site-nav-link-mobile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    color: var(--site-text-dark);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.site-nav-link-mobile:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* =============================================================================
   IN-FLOW FOOTER (Bottom of content, scrolls with page)
   ============================================================================= */
.site-footer-inflow {
    background: var(--site-footer-inflow-bg);
    padding: 32px 16px;
    margin-top: auto;
}

.site-footer-inflow-inner {
    max-width: 1000px;
    margin: 0 auto;
}

.site-footer-links {
    display: flex;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 24px;
}

.site-footer-links-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.site-footer-link {
    color: var(--site-text-dark);
    text-decoration: underline;
    font-size: 14px;
    transition: color 0.2s;
}

.site-footer-link:hover {
    color: var(--site-link-hover);
}

.site-footer-copyright {
    text-align: center;
    color: var(--site-text-muted);
    font-size: 13px;
}

/* =============================================================================
   FIXED FOOTER (Social Icons - Always visible at bottom)
   ============================================================================= */
.site-footer-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--site-footer-fixed-height);
    background: var(--site-footer-fixed-bg);
    border-top: 1px solid #e0e0e0;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-footer-fixed-inner {
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--site-social-color);
    transition: color 0.2s, transform 0.2s, opacity 0.2s;
}

.site-social-link:hover {
    color: var(--site-social-hover);
    transform: scale(1.1);
}

.site-social-link:hover .site-social-icon {
    opacity: 1;
}

.site-social-link svg {
    width: 20px;
    height: 20px;
}

/* Image-based social icons (from /img/social/) */
.site-social-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    opacity: 0.7;
    transition: opacity 0.2s;
}

/* =============================================================================
   RESPONSIVE STYLES
   ============================================================================= */
@media (max-width: 900px) {
    .site-header-nav {
        display: none;
    }

    .site-header-menu-toggle {
        display: block;
    }
}

@media (max-width: 600px) {
    :root {
        --site-header-height: 60px;
        --site-footer-fixed-height: 50px;
    }

    .site-logo-d2 {
        height: 40px;
        width: 40px;
    }

    .site-logo-adiona {
        height: 32px;
    }

    .site-footer-links {
        flex-direction: column;
        gap: 16px;
    }

    .site-footer-links-column {
        width: 100%;
    }

    .site-footer-copyright {
        text-align: center;
    }
}

/* =============================================================================
   INTEGRATION WITH EXISTING LAYOUTS
   ============================================================================= */

/* Override body.page flex centering when header/footer is present */
body.page.has-site-header-footer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 100vh;
}

/* Center the main container on purchase/static pages */
body.page.has-site-header-footer .container {
    margin: 40px auto;
    flex-shrink: 0;
}

/* Make in-flow footer full width on purchase pages */
body.page.has-site-header-footer .site-footer-inflow {
    width: 100%;
    margin-top: auto;
}

/* Adjust main content container when fixed header/footer is present */
.has-site-header-footer .container,
.has-site-header-footer main.container {
    min-height: auto;
}

/* Ensure in-flow footer sits above the fixed footer */
.site-footer-inflow {
    margin-bottom: 0;
}

/* Fix container styling for injected footer container */
#site-footer-inflow-container {
    width: 100%;
    margin-top: auto;
}

/* Ensure in-flow footer spans full viewport width */
#site-footer-inflow-container .site-footer-inflow {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    box-sizing: border-box;
}

/* =============================================================================
   THIRD-PARTY WIDGET POSITIONING
   ============================================================================= */

/* Move reCAPTCHA badge above fixed footer */
.grecaptcha-badge {
    bottom: 56px !important;  /* 48px footer + 8px spacing */
}
