/**
 * Dominican Bridge Design System - Layout
 * Header, footer, hero sections, grid layouts
 */

/* ==========================================================================
   HEADER
   ========================================================================== */

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-lg);
    background: var(--navy);
    position: sticky;
    top: 0;
    z-index: 500;
    height: var(--header-height);
}

.site-header .logo img {
    height: 40px;
    width: auto;
    filter: brightness(0) invert(1);
}

/* Desktop Navigation */
.desktop-nav {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.desktop-nav a {
    font-size: 16px;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 10px 18px;
    transition: color var(--transition-base), background var(--transition-base);
    border-radius: var(--radius-sm);
}

.desktop-nav a:hover,
.desktop-nav a.active {
    color: var(--white);
    background: rgba(255,255,255,0.1);
}

.user-menu {
    margin-left: var(--space-md);
    padding-left: var(--space-md);
    border-left: 1px solid rgba(255,255,255,0.2);
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--white);
    transition: transform 0.3s, opacity 0.3s;
}

/* Mobile Menu Overlay - hidden for full-screen menu */
.mobile-menu-overlay {
    display: none;
}

/* Mobile Menu - Full Screen */
.mobile-menu {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--navy);
    z-index: 999;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu.open {
    display: flex;
    opacity: 1;
}

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

.mobile-menu-greeting {
    font-family: var(--font-heading);
    font-size: 20px;
    color: var(--white);
}

.mobile-menu-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: var(--white);
    cursor: pointer;
    transition: background 0.2s;
}

.mobile-menu-close:hover {
    background: rgba(255,255,255,0.2);
}

.mobile-menu-nav {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
    padding: 16px;
}

.mobile-nav-item {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 20px;
    background-color: var(--slate);
    background-size: cover;
    background-position: center;
    color: var(--white);
    text-decoration: none;
    font-size: 20px;
    font-weight: 600;
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s;
}

.mobile-nav-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0) 100%);
    transition: background 0.2s;
}

.mobile-nav-item span {
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.mobile-nav-item:hover {
    transform: scale(1.02);
}

.mobile-nav-item:hover::before {
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 50%, rgba(0,0,0,0.1) 100%);
}

.mobile-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--blue);
}

/* Mobile nav background images */
.mobile-nav-item--home {
    background-image: url('https://images.unsplash.com/photo-1529156069898-49953e39b3ac?w=400&q=80');
}

.mobile-nav-item--events {
    background-image: url('https://images.unsplash.com/photo-1511795409834-ef04bbd61622?w=400&q=80');
}

.mobile-nav-item--guides {
    background-image: url('https://images.unsplash.com/photo-1434030216411-0b793f4b4173?w=400&q=80');
}

.mobile-nav-item--content {
    background-image: url('https://images.unsplash.com/photo-1485846234645-a62644f84728?w=400&q=80');
}

.mobile-menu-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.mobile-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 20px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-md);
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
}

.mobile-logout-btn svg {
    width: 20px;
    height: 20px;
}

.mobile-logout-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
    color: var(--white);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer {
    background: var(--navy);
    padding: 0;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 60px var(--space-lg) 40px;
    display: grid;
    grid-template-columns: 1.5fr 2fr auto;
    gap: 60px;
    align-items: start;
}

.footer-brand {
    max-width: 280px;
}

.footer-logo {
    height: 36px;
    width: auto;
    filter: brightness(0) invert(1);
    margin-bottom: 16px;
}

.footer-tagline {
    font-size: 15px;
    color: rgba(255,255,255,0.6);
    line-height: 1.6;
}

.footer-links-section {
    display: flex;
    gap: 80px;
}

.footer-col h4 {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    margin-bottom: 20px;
}

.footer-col a {
    display: block;
    font-size: 15px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 8px 0;
    transition: color var(--transition-base);
}

.footer-col a:hover {
    color: var(--white);
}

.footer-social {
    display: flex;
    gap: 12px;
}

.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    color: rgba(255,255,255,0.7);
    transition: all 0.2s;
}

.footer-social a:hover {
    background: var(--blue);
    color: var(--white);
}

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

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 24px var(--space-lg);
    text-align: center;
}

.footer-bottom p {
    font-size: 14px;
    color: rgba(255,255,255,0.4);
}

/* ==========================================================================
   HERO SECTIONS
   ========================================================================== */

/* Standard Page Hero - Used on listing pages */
.page-hero {
    background: var(--navy);
    padding: 60px var(--space-lg);
    text-align: center;
    height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-hero-inner {
    max-width: var(--max-width-narrow);
}

.page-hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(var(--text-4xl), 5vw, 44px);
    font-weight: 400;
    color: var(--white);
    margin-bottom: var(--space-md);
}

.page-hero p {
    font-size: var(--text-lg);
    color: rgba(255,255,255,0.8);
    max-width: 600px;
    margin: 0 auto var(--space-lg);
}

/* Detail Page Hero - Used on single item pages */
.detail-hero {
    position: relative;
    height: 70vh;
    min-height: 500px;
    max-height: 700px;
    overflow: hidden;
}

.detail-hero-bg {
    position: absolute;
    inset: 0;
}

.detail-hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.3) 50%, rgba(0,0,0,0.1) 100%);
}

.detail-hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 60px var(--space-lg) var(--space-2xl);
    color: var(--white);
}

/* Split Hero - Used on landing pages */
.split-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: calc(100vh - var(--header-height));
}

.split-hero-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--space-3xl);
}

.split-hero-image {
    position: relative;
    overflow: hidden;
}

.split-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   MAIN CONTENT AREAS
   ========================================================================== */

.main-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-lg) var(--space-3xl);
}

.main-content-narrow {
    max-width: var(--max-width-narrow);
    margin: 0 auto;
    padding: 0 var(--space-lg) var(--space-3xl);
}

.main-content-wide {
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: 0 var(--space-lg) var(--space-3xl);
}

/* ==========================================================================
   GRID LAYOUTS
   ========================================================================== */

.grid {
    display: grid;
    gap: var(--space-lg);
}

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

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Auto-fit grids */
.grid-auto-sm {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.grid-auto-md {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-auto-lg {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

/* ==========================================================================
   SIDEBAR LAYOUTS
   ========================================================================== */

.layout-sidebar {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--space-2xl);
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg);
}

.layout-sidebar-right {
    grid-template-columns: 1fr 320px;
}

.sidebar {
    position: sticky;
    top: calc(var(--header-height) + var(--space-lg));
    height: fit-content;
}

/* ==========================================================================
   CONTROLS BAR
   ========================================================================== */

.controls-bar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: var(--space-md) var(--space-lg);
    position: sticky;
    top: var(--header-height);
    z-index: 50;
}

.controls-inner {
    max-width: var(--max-width-wide);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* View Toggle */
.view-toggle {
    display: flex;
    background: var(--bone);
    padding: var(--space-xs);
    gap: var(--space-xs);
}

.view-toggle a {
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-mid);
    text-decoration: none;
    transition: all var(--transition-base);
}

.view-toggle a:hover {
    color: var(--navy);
}

.view-toggle a.active {
    background: var(--white);
    color: var(--navy);
    box-shadow: var(--shadow-sm);
}

/* Breadcrumb styles defined in components.css (.breadcrumb) */

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {
    .layout-sidebar,
    .layout-sidebar-right {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        order: -1;
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .site-header {
        padding: var(--space-sm) var(--space-md);
        position: relative;
    }

    .site-header .logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        flex-shrink: 0;
    }

    .site-header .logo a {
        display: flex;
    }

    .site-header .logo img {
        height: 32px;
        width: auto;
        max-width: none;
    }

    .mobile-menu-toggle {
        position: absolute;
        right: var(--space-md);
    }

    /* Hide desktop nav, show mobile toggle */
    .desktop-nav {
        display: none;
    }

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

    .mobile-menu {
        display: flex;
        opacity: 0;
        pointer-events: none;
    }

    .mobile-menu.open {
        opacity: 1;
        pointer-events: auto;
    }

    .page-hero {
        height: 200px;
        padding: 40px var(--space-md);
    }

    .split-hero {
        grid-template-columns: 1fr;
    }

    .split-hero-content {
        padding: var(--space-2xl) var(--space-lg);
        order: 1;
    }

    .split-hero-image {
        height: 50vh;
        min-height: 300px;
        order: 0;
    }

    .detail-hero {
        height: 50vh;
        min-height: 400px;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .controls-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .view-toggle {
        justify-content: center;
    }

    .main-content,
    .main-content-narrow,
    .main-content-wide {
        padding: 0 var(--space-md) var(--space-2xl);
    }

    /* Footer mobile - horizontal layout */
    .footer-inner {
        grid-template-columns: 1fr auto;
        gap: 24px;
        padding: 32px var(--space-md) 24px;
        align-items: center;
    }

    .footer-brand {
        max-width: 100%;
    }

    .footer-tagline {
        display: none;
    }

    .footer-links-section {
        display: none;
    }

    .footer-social {
        gap: 8px;
    }

    .footer-social a {
        width: 44px;
        height: 44px;
    }

    .footer-bottom {
        padding: 16px var(--space-md);
    }

    .footer-bottom p {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .detail-hero {
        height: 45vh;
        min-height: 350px;
    }

    .detail-hero-content {
        padding: 40px var(--space-md) 80px;
    }
}
