/*
 * style.css
 * Global stylesheet for the entire website.
 * Contains variables for dark/light themes and styles for all common elements.
 */

/* --- 1. Color and Style Variables --- */
:root {
    /* Dark Theme (Default) */
    --bg-color: #101015;
    --box-bg: #1a1a1f;
    --card-bg: #1f1f23;
    --primary-glow: rgba(0, 214, 170, 0.5);
    --primary-color: #00d6aa;
    --border-color: rgba(255, 255, 255, 0.1);
    --text-color: #e5e7eb;
    --text-muted: #9ca3af;
    --shadow-color: rgba(0,0,0,0.2);
    --chart-grid-color: rgba(255, 255, 255, 0.1);
}

.light-theme {
    /* Light Theme */
    --bg-color: #F8F7F4;
    --box-bg: #FFFFFF;
    --card-bg: #FFFFFF;
    --primary-glow: rgba(0, 169, 157, 0.3);
    --primary-color: #00A99D; 
    --border-color: rgba(0, 0, 0, 0.08);
    --text-color: #3D405B;
    --text-muted: #6b7280;
    --shadow-color: rgba(61, 64, 91, 0.1);
    --chart-grid-color: rgba(0, 0, 0, 0.08);
}

/* --- 2. General Body and Layout Styles --- */
html { 
    scroll-behavior: smooth; 
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.main-container {
     max-width: 1200px;
     margin: 0 auto;
     padding: 50px 1rem;
}

/* --- 3. Shared Component Styles (Headers, Footers, Cards, etc.) --- */

/* Animated Header for Index Page */
#header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-color); 
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    will-change: height, background-color, border-bottom;
}

#header #theme-toggle {
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    visibility: hidden;
}


#logo-container {
    transform-origin: center center;
    will-change: transform;
}

#logo-container img {
    width: 50vw;
    max-width: 450px;
    min-width: 280px;
}

main {
    margin-top: 100vh;
    position: relative;
    background-color: var(--bg-color);
}

/* Static Header for Inner Pages */
.static-header {
    position: sticky; top: 0; z-index: 1000;
    background-color: var(--box-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between; 
    padding: 0 2rem; height: 80px;
    box-shadow: 0 4px 12px var(--shadow-color);
}
.static-header .logo-link {
    display: flex;
    align-items: center;
    flex-shrink: 0; /* Prevents the logo from shrinking */
}
.static-header .logo-link img { height: 50px; }

/* Footer */
footer {
    background-color: var(--box-bg);
    border-top: 1px solid var(--border-color);
}
footer nav a {
    color: var(--text-muted); text-decoration: none;
    padding: 10px 15px; margin: 0 5px; border-radius: 8px;
    font-weight: 700;
    transition: color 0.3s ease, background-color 0.3s ease;
}
footer nav a:hover { color: #fff; background-color: var(--primary-color); }

/* Common Buttons (like theme toggle) */
.header-button {
    background: none; border: 1px solid var(--text-muted); color: var(--text-muted);
    width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
    display: flex; justify-content: center; align-items: center;
    transition: all 0.4s ease;
}
.header-button:hover { color: var(--primary-color); border-color: var(--primary-color); transform: scale(1.1); }
.header-button svg { width: 20px; height: 20px; }

/* Common Card Styles */
.content-box {
    background-color: var(--box-bg);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 3rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px -10px var(--shadow-color);
}
@media (min-width: 768px) {
    .content-box { padding: 3rem; }
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px var(--shadow-color);
    border-radius: 1.5rem;
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
}
.card-link {
    text-decoration: none;
    display: block;
    height: 100%;
}
.card-link:hover .card {
    transform: translateY(-8px);
    box-shadow: 0 10px 20px var(--shadow-color), 0 0 25px var(--primary-glow);
}
.card h3 {
    color: var(--text-color);
    font-weight: 700;
}
.card p { color: var(--text-muted); }


/* --- 4. Page-Specific Styles --- */

/* Index Page: Chart and Title */
.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    color: var(--text-color);
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
}
.chart-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    min-height: 400px;
}

/* Sports Page: Article Button */
.article-button {
    display: block;
    width: 100%;
    border-radius: 1.5rem;
    padding: 2rem;
    text-align: center;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.article-button:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 20px var(--shadow-color), 0 0 25px var(--primary-glow);
}
.article-button h3 {
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.5;
}
.article-button p {
    color: var(--text-muted);
    line-height: 1.8;
    max-width: 80%;
    margin: 0 auto;
}

/* Reps Page: Interactive Elements */
.page-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px var(--shadow-color);
}
.goal-card {
    transition: transform 0.2s, box-shadow 0.2s;
}
.goal-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px var(--shadow-color);
}
.goal-card.active {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px var(--primary-glow);
    border-color: var(--primary-color);
}
.tab-btn { color: var(--text-muted); }
.tab-btn.active { background-color: var(--primary-color); color: white; }
.accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; }
.accordion-btn { background-color: rgba(128,128,128,0.05); }
.accordion-btn:hover { background-color: rgba(128,128,128,0.1); }
.gemini-btn {
    background: var(--primary-color);
    transition: transform 0.2s, box-shadow 0.2s;
}
.gemini-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 10px var(--shadow-color); }
.loader {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%; width: 24px; height: 24px;
    animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Reps Page: Markdown Content Styles */
.prose { color: var(--text-color); }
.prose h1, .prose h2, .prose h3 { font-weight: bold; margin-top: 1em; margin-bottom: 0.5em; color: var(--text-color); }
.prose ul { list-style-type: disc; padding-right: 1.5rem; }
.prose table { width: 100%; border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--border-color); padding: 8px; text-align: right; }
.prose th { background-color: rgba(128,128,128,0.1); }
.prose a { color: var(--primary-color); }

/* FIX: Reps Page Layout Consistency Fixes */
/* This rule reduces the large gap between the header and the title card */
main > .page-card:first-of-type {
    margin-top: -2rem;
}

/* This rule gives the "Goal Selector" section the same card style as other sections */
#goal-selector {
    background-color: var(--box-bg);
    border-radius: 24px;
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px -10px var(--shadow-color);
}
@media (min-width: 768px) {
    #goal-selector {
        padding: 3rem;
    }
}
