/**
 * AP Sports Theme System CSS
 * Implements the official style guide
 * Version 1.0
 */

/* ================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   ================================ */

:root {
    /* Colors */
    --color-primary: #323840;
    --color-accent: #FFB900;
    --color-accent-hover: #e6a700;
    --color-background: #f5f7fa;
    --color-white: #ffffff;
    --color-light-grey: #f8f9fa;
    --color-border: #e0e7ff;
    --color-text-secondary: #555555;
    --color-success: #28a745;
    --color-error: #dc3545;
    --color-warning: #ffc107;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-family-mono: 'Courier New', monospace;
    
    /* Font Sizes - Matched to odds template */
    --font-size-hero: 2.5rem;
    --font-size-title: 2rem;
    --font-size-heading: 1.8rem;
    --font-size-card-title: 1.5rem;
    --font-size-subheading: 1.2rem;
    --font-size-body: 1rem;
    --font-size-small: 0.9rem;
    --font-size-tiny: 0.85rem;

    /* Font Weights */
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Spacing (8px grid) */
    --space-xs: 0.25rem;  /* 4px */
    --space-sm: 0.5rem;   /* 8px */
    --space-md: 1rem;     /* 16px */
    --space-lg: 1.5rem;   /* 24px */
    --space-xl: 2rem;     /* 32px */
    --space-2xl: 3rem;    /* 48px */
    --space-3xl: 4rem;    /* 64px */

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;

    /* Shadows */
    --shadow-light: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-medium: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-heavy: 0 4px 16px rgba(0,0,0,0.15);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* Breakpoints */
    --breakpoint-tablet: 768px;
    --breakpoint-desktop: 1024px;
}

/* ================================
   RESET & BASE STYLES
   ================================ */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-normal);
    line-height: 1.6;
    color: var(--color-primary);
    background-color: var(--color-background);
    margin: 0;
    padding: 0;
}

/* ================================
   TYPOGRAPHY SYSTEM
   ================================ */

.text-hero {
    font-size: var(--font-size-hero);
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
}

.text-title {
    font-size: var(--font-size-title);
    font-weight: var(--font-weight-bold);
    line-height: 1.3;
}

.text-heading {
    font-size: var(--font-size-heading);
    font-weight: var(--font-weight-semibold);
    line-height: 1.4;
}

.text-card-title {
    font-size: var(--font-size-card-title);
    font-weight: var(--font-weight-semibold);
    line-height: 1.4;
}

.text-subheading {
    font-size: var(--font-size-subheading);
    font-weight: var(--font-weight-medium);
    line-height: 1.5;
}

.text-body {
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-normal);
    line-height: 1.6;
}

.text-small {
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-normal);
    line-height: 1.5;
}

.text-tiny {
    font-size: var(--font-size-tiny);
    font-weight: var(--font-weight-normal);
    line-height: 1.4;
}

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

.text-accent {
    color: var(--color-accent);
}

.text-success {
    color: var(--color-success);
}

.text-error {
    color: var(--color-error);
}

.text-warning {
    color: var(--color-warning);
}

/* ================================
   LAYOUT SYSTEM
   ================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.content-wrapper {
    width: 100%;
}

.main-content {
    width: 100%;
}

.content-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl);
}

@media (min-width: 1024px) {
    .content-layout {
        grid-template-columns: 1fr 350px;
    }
}

.content-main {
    width: 100%;
}

.content-sidebar {
    width: 100%;
}

/* ================================
   COMPONENT SYSTEM
   ================================ */

/* Cards */
.card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-light);
    margin-bottom: var(--space-lg);
}

.card-compact {
    padding: var(--space-md);
}

.card-title {
    font-size: var(--font-size-card-title);
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
    margin: 0 0 var(--space-md) 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.card-title i {
    color: var(--color-accent);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--color-accent);
    color: var(--color-primary);
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.btn-secondary {
    background: var(--color-light-grey);
    color: var(--color-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-white);
    border-color: var(--color-accent);
}

.btn-success {
    background: var(--color-success);
    color: var(--color-white);
}

.btn-success:hover {
    background: #218838;
}

.btn-full {
    width: 100%;
}

.btn-compact {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-small);
}

/* Form Elements */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-medium);
    color: var(--color-primary);
    margin-bottom: var(--space-xs);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-body);
    font-family: var(--font-family);
    background: var(--color-white);
    transition: border-color var(--transition-normal);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(255, 185, 0, 0.1);
}

.form-hint {
    font-size: var(--font-size-tiny);
    color: var(--color-text-secondary);
    margin-top: var(--space-xs);
}

/* Hero Sections */
.hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, #1a1d21 100%);
    color: var(--color-white);
    padding: var(--space-2xl) 0;
    text-align: center;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: var(--font-size-hero);
    font-weight: var(--font-weight-bold);
    margin: 0 0 var(--space-md) 0;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: var(--font-size-subheading);
    opacity: 0.9;
    margin: 0 0 var(--space-xl) 0;
    line-height: 1.5;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
    max-width: 600px;
    margin: 0 auto;
}

.hero-stat {
    text-align: center;
}

.hero-stat-value {
    display: block;
    font-size: var(--font-size-subheading);
    font-weight: var(--font-weight-bold);
    color: var(--color-accent);
}

.hero-stat-label {
    display: block;
    font-size: var(--font-size-small);
    opacity: 0.8;
    margin-top: var(--space-xs);
}

/* Results & Alerts */
.result-success {
    background: #d4edda;
    border: 1px solid var(--color-success);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin: var(--space-md) 0;
}

.result-error {
    background: #f8d7da;
    border: 1px solid var(--color-error);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin: var(--space-md) 0;
}

.result-warning {
    background: #fff3cd;
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin: var(--space-md) 0;
}

/* ================================
   UTILITY CLASSES
   ================================ */

/* Spacing */
.m-0 { margin: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.p-0 { padding: 0; }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

/* Flexbox */
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--space-md); }

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

@media (max-width: 767px) {
    :root {
        --font-size-hero: 2rem;
        --font-size-title: 1.75rem;
        --font-size-heading: 1.5rem;
        --font-size-card-title: 1.25rem;
        --font-size-subheading: 1.1rem;
    }
    
    .hero {
        padding: var(--space-xl) 0;
    }
    
    .hero-stats {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 0 var(--space-sm);
    }
}

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

/* ================================
   CALCULATOR-SPECIFIC STYLES
   ================================ */

.calculator-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    margin: var(--space-lg) 0;
}

@media (min-width: 1024px) {
    .calculator-layout {
        grid-template-columns: 1fr 350px;
    }
}

.calculator-main {
    width: 100%;
}

.calculator-sidebar {
    width: 100%;
    position: sticky;
    top: var(--space-lg);
    height: fit-content;
}

.calculator-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-light);
    margin-bottom: var(--space-lg);
}

.calculator-section {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

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

.calculator-section h3 {
    font-size: var(--font-size-card-title);
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
    margin: 0 0 var(--space-md) 0;
}

/* Sidebar Cards */
.sidebar-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: var(--shadow-light);
    margin-bottom: var(--space-md);
}

.sidebar-card:last-child {
    margin-bottom: 0;
}

.sidebar-card h3 {
    font-size: var(--font-size-subheading);
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
    margin: 0 0 var(--space-sm) 0;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.sidebar-card h3 i {
    color: var(--color-accent);
}

.sidebar-card p {
    font-size: var(--font-size-small);
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin: 0;
}