/**
 * PGATC Stats Website - Layout Styles
 *
 * Page layouts, containers, grids, and structural components.
 */

/* ============================================================================
   CONTAINERS
   ============================================================================ */

.container {
    width: 100%;
    max-width: var(--container-xl);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

.container-sm {
    max-width: var(--container-sm);
}

.container-md {
    max-width: var(--container-md);
}

.container-lg {
    max-width: var(--container-lg);
}

.container-fluid {
    max-width: 100%;
}

/* ============================================================================
   PAGE WRAPPER
   ============================================================================ */

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.page-content {
    flex: 1;
}

/* ============================================================================
   HEADER
   ============================================================================ */

.header {
    background: linear-gradient(90deg, #00205B 0%, #001a4d 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    border-bottom: 3px solid var(--color-secondary-500);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    max-width: var(--container-xl);
    margin: 0 auto;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: var(--color-white);
}

.header-logo {
    height: 72px;
    width: auto;
}

.header-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-white);
    margin: 0;
}

.header-subtitle {
    font-size: var(--text-xs);
    color: var(--color-secondary-400);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
}

/* Header Navigation */
.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.header-nav-link {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-gray-300);
    text-decoration: none;
    transition: color var(--transition-fast);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--border-radius-md);
}

.header-nav-link:hover {
    color: var(--color-white);
    background-color: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.header-nav-link.active {
    color: var(--color-secondary-400);
    background-color: rgba(50, 205, 50, 0.15);
}

/* ============================================================================
   BANNER
   ============================================================================ */

.banner {
    background: linear-gradient(135deg, var(--color-primary-900), var(--color-primary-700));
    color: var(--color-white);
    text-align: center;
    padding: var(--space-8) var(--space-4);
}

.banner-title {
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-2);
    color: var(--color-white);
}

.banner-subtitle {
    font-size: var(--text-lg);
    opacity: 0.9;
    margin-bottom: var(--space-4);
}

.banner-image {
    max-width: 100%;
    max-height: 120px;
    margin: 0 auto;
}

/* ============================================================================
   PAGE HEADER
   ============================================================================ */

.page-header {
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.page-title {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--color-white);
    margin-bottom: var(--space-2);
}

.page-subtitle {
    font-size: var(--text-lg);
    color: var(--color-gray-400);
}

/* Page Header with Actions */
.page-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.page-header-actions {
    display: flex;
    gap: var(--space-2);
}

/* ============================================================================
   SECTIONS
   ============================================================================ */

.section {
    margin-bottom: var(--space-12);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
}

.section-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--color-white);
    margin: 0;
}

.section-subtitle {
    font-size: var(--text-sm);
    color: var(--color-gray-400);
    margin-top: var(--space-1);
}

/* ============================================================================
   GRID LAYOUTS
   ============================================================================ */

.grid {
    display: grid;
    gap: var(--space-6);
}

/* Auto-fit Grid */
.grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Fixed Column Grids */
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Stat Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

/* Navigation Cards Grid */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-6);
}

/* Generic Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
}

/* Tournament Cards Grid */
.tournament-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-6);
}

/* ============================================================================
   FLEXBOX LAYOUTS
   ============================================================================ */

.flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-col {
    flex-direction: column;
}

.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;
}

.flex-1 { flex: 1; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ============================================================================
   TWO-COLUMN LAYOUT
   ============================================================================ */

.two-column {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-8);
}

@media (min-width: 768px) {
    .two-column {
        grid-template-columns: 1fr 1fr;
    }
}

/* Sidebar Layout */
.sidebar-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-8);
}

@media (min-width: 992px) {
    .sidebar-layout {
        grid-template-columns: 280px 1fr;
    }
}

.sidebar {
    background-color: rgba(0, 32, 91, 0.6);
    border-radius: var(--border-radius-lg);
    padding: var(--space-4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: fit-content;
}

.sidebar-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-white);
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.footer {
    background: linear-gradient(90deg, #00205B 0%, #001a4d 100%);
    color: var(--color-gray-300);
    padding: var(--space-8) var(--space-4);
    margin-top: auto;
    border-top: 3px solid var(--color-secondary-500);
}

.footer-container {
    max-width: var(--container-xl);
    margin: 0 auto;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    align-items: center;
    text-align: center;
}

@media (min-width: 768px) {
    .footer-content {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.footer-logo {
    height: 40px;
    opacity: 0.8;
}

.footer-text {
    font-size: var(--text-sm);
    color: var(--color-gray-400);
}

.footer-links {
    display: flex;
    gap: var(--space-6);
}

.footer-link {
    color: var(--color-gray-400);
    font-size: var(--text-sm);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-link:hover {
    color: var(--color-white);
    text-decoration: none;
}

.footer-bottom {
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-gray-700);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--color-gray-500);
}

/* Simple Footer (for interior pages) */
.footer-simple {
    text-align: center;
    padding: var(--space-6) var(--space-4);
    color: var(--color-gray-500);
    font-size: var(--text-sm);
}

.footer-simple a {
    color: var(--color-primary-600);
}

/* ============================================================================
   BACK NAVIGATION
   ============================================================================ */

.nav-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    margin-bottom: var(--space-6);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-gray-300);
    text-decoration: none;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-full);
    transition: all var(--transition-fast);
}

.nav-back:hover {
    color: var(--color-white);
    background-color: rgba(255, 255, 255, 0.2);
    text-decoration: none;
}

/* ============================================================================
   SPACING UTILITIES
   ============================================================================ */

/* Margin */
.m-0 { margin: 0; }
.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-4 { margin: var(--space-4); }
.m-6 { margin: var(--space-6); }
.m-8 { margin: var(--space-8); }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }

.mx-auto { margin-left: auto; margin-right: auto; }

/* Padding */
.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.pt-3 { padding-top: var(--space-3); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.py-12 { padding-top: var(--space-12); padding-bottom: var(--space-12); }

.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }

/* ============================================================================
   WIDTH & HEIGHT UTILITIES
   ============================================================================ */

.w-full { width: 100%; }
.w-auto { width: auto; }
.max-w-full { max-width: 100%; }

.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* ============================================================================
   VISIBILITY
   ============================================================================ */

.hidden {
    display: none !important;
}

.visible {
    visibility: visible;
}

.invisible {
    visibility: hidden;
}

/* ============================================================================
   DIVIDERS
   ============================================================================ */

.divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: var(--space-6) 0;
}

.divider-vertical {
    width: 1px;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 0 var(--space-4);
}

.border-t {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================================================
   TEXT ALIGNMENT
   ============================================================================ */

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ============================================================================
   TEXT COLOR UTILITIES
   ============================================================================ */

.text-muted { color: var(--color-gray-400); }
.text-white { color: var(--color-white); }
.text-primary { color: var(--color-primary-600); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-warning { color: var(--color-warning); }

/* Text size */
.text-sm { font-size: var(--text-sm); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }

/* Font weight */
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

/* ============================================================================
   PAGE CONTENT ENHANCEMENT (for dark backgrounds)
   ============================================================================ */

.page-content {
    background: transparent;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}

.page-content > .container {
    padding-top: var(--space-6);
    padding-bottom: var(--space-8);
}

/* Page header styling */
.page-header {
    text-align: center;
}

.page-header.text-left {
    text-align: left;
}

/* Section title centering */
.section-title {
    text-align: center;
    margin-bottom: var(--space-6);
}
