/* --- 1. Color and Style Variables --- */
:root {
    --bg-color: #101015;
    --box-bg: #1a1a1f;
    --card-bg: #1f1f23;
    --primary-glow: rgba(20, 210, 184, 0.5);
    --primary-color: #14D2B8;
    --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 {
    --bg-color: #F8F7F4;
    --box-bg: #FFFFFF;
    --card-bg: #FFFFFF;
    --primary-glow: rgba(13, 148, 136, 0.3);
    --primary-color: #0D9488;
    --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: 20px 1rem; }
@media (min-width: 768px) { .main-container { padding: 50px 1rem; } }

/* --- 3. Shared Component Styles --- */
.static-header {
    position: sticky; top: 0; z-index: 1000;
    background-color: var(--box-bg); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between; 
    padding: 0 1rem; height: 60px; 
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
}
@media (min-width: 768px) { .static-header { padding: 0 2rem; height: 80px; } }
.static-header.scrolled { box-shadow: 0 4px 12px var(--shadow-color); }

.site-title {
    font-size: 1rem; font-weight: 700; color: var(--text-color);
    margin: 0; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; text-align: center; flex-grow: 1; padding: 0 0.5rem;
}
@media (min-width: 640px) { .site-title { font-size: 1.25rem; } }

.header-actions { display: flex; align-items: center; gap: 0.5rem; }
@media (min-width: 640px) { .header-actions { gap: 0.75rem; } }

footer { background-color: var(--box-bg); border-top: 1px solid var(--border-color); }

.header-button {
    background: none; border: 1px solid var(--text-muted); color: var(--text-muted);
    width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
    display: flex; justify-content: center; align-items: center;
    transition: all 0.4s ease; text-decoration: none;
}
@media (min-width: 640px) { .header-button { width: 40px; height: 40px; } }
.header-button:hover { color: var(--primary-color); border-color: var(--primary-color); transform: scale(1.1); }
.header-button svg { width: 18px; height: 18px; }
@media (min-width: 640px) { .header-button svg { width: 20px; height: 20px; } }

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

/* --- 4. Typography & Content Styles --- */
.prose { color: var(--text-muted); line-height: 1.6; }
.prose h1, .prose h2, .prose h3 { font-weight: bold; margin-top: 1em; margin-bottom: 0.5em; color: var(--text-color); }
.prose h4 { font-weight: 700; font-size: 1.1rem; margin-bottom: 1rem; color: var(--text-color); }
@media (min-width: 768px) { .prose { line-height: 1.7; } .prose h4 { font-size: 1.25rem; } }
.prose p { margin-bottom: 1rem; }
.prose strong { font-weight: 700; color: var(--text-color); }
.prose ul, .prose ol { padding-right: 1.5rem; }
.prose ul { list-style-type: disc; }
.prose li { margin-bottom: 0.5rem; }
.prose a { color: var(--primary-color); text-decoration: none; transition: color 0.2s; }
.prose a:hover { text-decoration: underline; color: var(--primary-glow); }

/* Responsive Tables in Prose */
.prose table { width: 100%; border-collapse: collapse; margin-top: 1.5rem; min-width: 400px; }
.prose th, .prose td { border: 1px solid var(--border-color); padding: 0.75rem; text-align: right; }
.prose th { background-color: rgba(128,128,128,0.1); font-weight: bold; color: var(--text-color); }

/* --- 5. Page-Specific Styles --- */
.page-card { 
    background: var(--card-bg); border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px var(--shadow-color); border-radius: 1.5rem;
    padding: 1.25rem; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column; height: 100%;
}
@media (min-width: 768px) { .page-card { padding: 1.5rem; } }
.page-card:hover { transform: translateY(-5px); box-shadow: 0 10px 15px -3px var(--shadow-color); }

.card {
    background: var(--card-bg); border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px var(--shadow-color); border-radius: 1.5rem;
    padding: 1.5rem; transition: transform 0.3s, box-shadow 0.3s;
    position: relative; overflow: hidden; height: 100%;
}

/* Chart Container Responsive */
.chart-container {
    position: relative; width: 100%; max-width: 500px; margin: 0 auto; height: 300px;
}
@media (min-width: 768px) { .chart-container { max-width: 500px; height: 400px; } }

/* Tab Buttons */
.tab-btn { color: var(--text-muted); white-space: nowrap; border-color: transparent; margin-bottom: -1px; }
.tab-btn.active { 
    background-color: var(--primary-color); color: var(--bg-color); 
    border-radius: 8px; box-shadow: 0 4px 10px var(--primary-glow);
    border-color: transparent;
}

/* Goal Cards Active State */
.goal-card.active {
    border-color: var(--primary-color) !important;
    box-shadow: 0 10px 15px -3px var(--primary-glow), 0 0 25px var(--primary-glow) !important;
    transform: translateY(-1px);
}

/* Accordion */
.accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; }
.accordion-btn { background-color: rgba(128,128,128,0.05); cursor: pointer; width: 100%; text-align: right; }
.accordion-btn:hover { background-color: rgba(128,128,128,0.1); }

/* Gemini Buttons & Loader */
.gemini-btn { background: var(--primary-color); transition: transform 0.2s, box-shadow 0.2s; cursor: pointer; }
.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(--bg-color);
    border-radius: 50%; width: 20px; height: 20px; animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
