/* ============================================================
   AFL Sports Performance & Recovery - Global Master Stylesheet
   Pure Vanilla CSS Design System - Mobile First Optimized
   ============================================================ */

/* ------------------------------------------------------------
   1. CSS VARIABLES (DESIGN SYSTEM TOKENS)
   ------------------------------------------------------------ */
:root {
    --bg-dark: #080b09;
    --bg-card: rgba(28, 36, 28, 0.6);
    --bg-card-hover: rgba(40, 52, 40, 0.7);
    --brand-dark: #0f1712;
    --brand-green: #d2f34c;
    --brand-green-hover: #bde32e;
    --brand-text-muted: #9ca3af;
    
    --risk-high: #ff4d4d;
    --risk-med: #ffa64d;
    --risk-low: #4dff88;
    
    --border-color: rgba(255, 255, 255, 0.05);
    --border-highlight: rgba(210, 243, 76, 0.3);
    
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    
    --shadow-glow: 0 0 20px rgba(210, 243, 76, 0.3);
    --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease-in-out;
}

/* ------------------------------------------------------------
   2. RESET & BASE STYLES
   ------------------------------------------------------------ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 50% 0%, #1a2e1a 0%, #080b09 60%);
    background-attachment: fixed;
    color: #ffffff;
    font-family: var(--font-family);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ------------------------------------------------------------
   3. LAYOUT CONTAINERS & MOBILE DIMENSION OPTIMIZATION
   ------------------------------------------------------------ */
.app-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 50px rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    padding-bottom: 90px;
    overflow-x: hidden;
    transition: max-width var(--transition-normal);
}

@media (min-width: 768px) {
    .app-container {
        max-width: 768px;
    }
    .bottom-nav {
        max-width: 768px;
    }
}

@media (min-width: 1024px) {
    .app-container {
        max-width: 1024px;
    }
    .bottom-nav {
        max-width: 1024px;
    }
}

.main-content {
    flex: 1;
    padding: 20px 16px;
}

@media (min-width: 400px) {
    .main-content {
        padding: 24px 20px;
    }
}

/* ------------------------------------------------------------
   4. GLASSMORPHISM CARDS & CONTAINERS
   ------------------------------------------------------------ */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.glass-card:active {
    transform: scale(0.99);
}

.glass-card:hover {
    background: var(--bg-card-hover);
}

.glass-card-sm {
    border-radius: var(--radius-md);
    padding: 12px 16px;
}

/* ------------------------------------------------------------
   5. BUTTONS & TOUCH INTERACTION
   ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    min-height: 48px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    touch-action: manipulation;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background-color: var(--brand-green);
    color: #000000;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    background-color: var(--brand-green-hover);
    transform: translateY(-1px);
}

.btn-glass {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    color: #ffffff;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
    padding: 8px 16px;
    min-height: 38px;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
}

.btn-full {
    width: 100%;
}

/* ------------------------------------------------------------
   6. FORMS & INPUTS (MOBILE FRIENDLY)
   ------------------------------------------------------------ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    color: var(--brand-text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    min-height: 48px;
    background: rgba(15, 23, 18, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: #ffffff;
    font-family: var(--font-family);
    font-size: 0.95rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23d2f34c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px 16px;
    padding-right: 42px;
    cursor: pointer;
}

select.form-control option {
    background-color: #0f1712;
    color: #ffffff;
    padding: 12px 16px;
    font-size: 0.95rem;
}

.form-control:focus, select.form-control:focus {
    outline: none;
    border-color: var(--brand-green);
    box-shadow: 0 0 15px rgba(210, 243, 76, 0.25);
    background-color: rgba(20, 30, 22, 0.9);
}

/* Custom Toggle Switch */
.toggle-wrapper {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-checkbox {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #374151;
    transition: .3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.toggle-checkbox:checked + .toggle-slider {
    background-color: var(--brand-green);
}

.toggle-checkbox:checked + .toggle-slider:before {
    transform: translateX(20px);
    background-color: #000000;
}

/* Range Slider */
.range-slider {
    width: 100%;
    height: 6px;
    accent-color: var(--brand-green);
}

/* ------------------------------------------------------------
   7. BADGES & RISK INDICATORS
   ------------------------------------------------------------ */
.risk-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.risk-dot.high {
    background-color: var(--risk-high);
    box-shadow: 0 0 10px var(--risk-high);
}

.risk-dot.medium {
    background-color: var(--risk-med);
    box-shadow: 0 0 10px var(--risk-med);
}

.risk-dot.low {
    background-color: var(--risk-low);
    box-shadow: 0 0 10px var(--risk-low);
}

.badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-risk-high {
    background: rgba(255, 77, 77, 0.15);
    color: var(--risk-high);
    border: 1px solid rgba(255, 77, 77, 0.3);
}

.badge-risk-med {
    background: rgba(255, 166, 77, 0.15);
    color: var(--risk-med);
    border: 1px solid rgba(255, 166, 77, 0.3);
}

.badge-risk-low {
    background: rgba(77, 255, 136, 0.15);
    color: var(--risk-low);
    border: 1px solid rgba(77, 255, 136, 0.3);
}

/* ------------------------------------------------------------
   8. NAVIGATION & APP BARS
   ------------------------------------------------------------ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: rgba(15, 23, 18, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    border-radius: 24px 24px 0 0;
    padding: 10px 16px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--brand-text-muted);
    font-size: 0.65rem;
    gap: 4px;
    transition: color var(--transition-fast);
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item.active, .nav-item:hover {
    color: var(--brand-green);
}

.top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.icon-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background-color: var(--risk-high);
    border-radius: 50%;
}

/* ------------------------------------------------------------
   9. UTILITIES & SCROLLBAR
   ------------------------------------------------------------ */
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.text-gradient {
    background: linear-gradient(to right, #ffffff, #a3a3a3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-brand-green { color: var(--brand-green); }
.text-muted { color: var(--brand-text-muted); }
.text-risk-high { color: var(--risk-high); }
.text-risk-med { color: var(--risk-med); }

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

@media (min-width: 400px) {
    .grid-2 {
        gap: 16px;
    }
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-6 > * + * { margin-top: 24px; }

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 100%;
    max-width: 440px;
    padding: 24px;
}
