/**
 * Layout Components
 * Page wrappers, containers, and structural layouts
 */

/* ============================================
   PAGE WRAPPERS
   ============================================ */

/* The auth layout is a two-column split; see 5-pages.css. */

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */

.dashboard-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dashboard-main {
    flex: 1;
    padding: var(--space-xl) var(--space-md);
}

/* ============================================
   PAGE LAYOUT (With Navigation)
   ============================================ */

.page-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-main {
    flex: 1;
    padding: var(--space-xl) var(--space-md);
}

/* ============================================
   NAVIGATION BAR
   ============================================ */

.navbar {
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
    padding: var(--space-md) var(--space-xl);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-xl);
}

/* Logo in navbar */
.navbar-logo {
    flex-shrink: 0;
}

.navbar-logo img {
    height: 40px;
    width: auto;
}

/* User info in navbar */
.navbar-user {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.navbar-username {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

/* Nav actions */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* ============================================
   BREADCRUMBS
   ============================================ */

/*
 * Breadcrumbs sit above the page title, on whichever ground the page uses, so
 * they read through the surface contract rather than assuming cream.
 */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
    font-size: var(--font-size-sm);
    color: var(--surface-text-muted);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.breadcrumb-item a {
    color: inherit;
    text-decoration: none;
    transition: color var(--duration-fast) var(--easing);
}

.breadcrumb-item a:hover {
    color: var(--surface-text);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.breadcrumb-separator {
    opacity: 0.6;
}

/* The page you are on is the one worth marking. */
.breadcrumb-item[aria-current='page'] {
    color: var(--surface-link);
    font-weight: var(--font-weight-semibold);
}

/* ============================================
   CONTENT CONTAINERS
   ============================================ */

/* Standard content container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/*
 * The signed-in page shell: the band between the nav and the end of the page.
 *
 * This was Bootstrap's. Five pages carried `class="container mt-5"` and got
 * their 48px of top spacing from the CDN — .mt-5 is not defined anywhere in
 * this stylesheet — while dashboard and admin-overview set `margin-top: 1.5rem`
 * inline instead. So sibling admin pages started 24px or 48px below the nav
 * depending on which one you were on, three of seven set page layout by inline
 * style, and five of them would lose their top spacing entirely if jsdelivr
 * were slow or blocked.
 *
 * The bottom was worse: create-event and manage-event had no bottom spacing at
 * all. Measured document height minus last card bottom: 0px at 390 and 0px at
 * 1440, so the last card's rounded corners butted into the end of the document
 * and "Save Changes" ran off the bottom edge.
 *
 * Landing is untouched — its main holds .page-landing, not .container, and it
 * ends in its own footer.
 */
main > .container {
    padding-top: var(--space-12);
    padding-bottom: var(--space-16);
}

/* Narrow container */
.container-narrow {
    max-width: 800px;
}

/* Wide container */
.container-wide {
    max-width: 1400px;
}

/* Full width container */
.container-full {
    max-width: 100%;
}

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

.page-title {
    color: var(--color-cream);
    font-family: var(--font-display);
    font-size: 2.625rem;   /* 42px */
    font-weight: var(--font-weight-normal);
    letter-spacing: var(--tracking-display);
    line-height: var(--line-height-display);
    margin-bottom: var(--space-2);
}

.page-subtitle {
    color: var(--text-on-dark-muted);
    font-size: var(--font-size-md);
    margin-bottom: var(--space-6);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* Header with actions (title on left, buttons on right) */
.page-header-split {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-xl);
    margin-bottom: var(--space-2xl);
}

.page-header-split .page-title {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .page-header-split {
        flex-direction: column;
        align-items: stretch;
    }

    .page-actions {
        width: 100%;
    }
}

/* ============================================
   SECTION
   ============================================ */

.section {
    margin-bottom: var(--space-3xl);
}

.section:last-child {
    margin-bottom: 0;
}

.section-header {
    margin-bottom: var(--space-xl);
}

.section-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-sm);
}

.section-description {
    color: var(--color-text-secondary);
}

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

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

.grid-cols-1 {
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Auto-fit grid (responsive without media queries) */
.grid-auto-fit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
}

/* ============================================
   FLEX LAYOUTS
   ============================================ */

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.items-end {
    align-items: flex-end;
}

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

.justify-between {
    justify-content: space-between;
}

.justify-end {
    justify-content: flex-end;
}

.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }
.gap-2xl { gap: var(--space-2xl); }

/* ============================================
   DIVIDER
   ============================================ */

.divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--space-xl) 0;
}

.divider-vertical {
    width: 1px;
    height: auto;
    margin: 0 var(--space-xl);
}

/* ============================================
   SPACER
   ============================================ */

.spacer-xs { height: var(--space-xs); }
.spacer-sm { height: var(--space-sm); }
.spacer-md { height: var(--space-md); }
.spacer-lg { height: var(--space-lg); }
.spacer-xl { height: var(--space-xl); }
.spacer-2xl { height: var(--space-2xl); }
.spacer-3xl { height: var(--space-3xl); }

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

@media (max-width: 640px) {
    .hide-mobile {
        display: none;
    }
}

@media (min-width: 641px) {
    .show-mobile {
        display: none;
    }
}

@media (max-width: 768px) {
    .hide-tablet {
        display: none;
    }
}

@media (min-width: 769px) {
    .show-tablet {
        display: none;
    }
}

@media (max-width: 1024px) {
    .hide-desktop {
        display: none;
    }
}

@media (min-width: 1025px) {
    .show-desktop {
        display: none;
    }
}
