/* ==============================================================================
 * Main Stylesheet for 11-1 Group Website
 * Author: Amirhossein Sharifi (with AI assistance)
 * ============================================================================== */

/* ======================= VARIABLES & BASIC SETUP ======================= */
:root {
    /* Light Theme (Default) */
    --primary-color: #005f73;
    --primary-color-rgb: 0, 95, 115;
    --primary-dark: #004a5a;
    --secondary-color: #0a9396;
    --background-color: #edf2f4;
    --surface-color: #ffffff;
    --card-bg: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-color: #1d3557;
    --text-muted: #6c757d;
    --muted-text-color: #6c757d;
    --border-color: #e9ecef;
    --shadow-color: rgba(0, 0, 0, 0.06);
    --slot-bg-color: #f1f5f9;
    --slot-bg-hover-color: #e2e8f0;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --muted-color: #6c757d;
    --container-width: 1140px;
    color-scheme: light;
}

html[data-theme="dark"] {
    /* Dark Theme */
    --primary-color: #94d2bd;
    --primary-color-rgb: 148, 210, 189;
    --primary-dark: #7bb3a0;
    --secondary-color: #ee9b00;
    --background-color: #1a202c;
    --surface-color: #2d3748;
    --card-bg: #2d3748;
    --bg-secondary: #4a5568;
    --text-color: #edf2f4;
    --text-muted: #a0aec0;
    --muted-text-color: #a0aec0;
    --border-color: #4a5568;
    --shadow-color: rgba(237, 242, 244, 0.08);
    --slot-bg-color: #232c3b;
    --slot-bg-hover-color: #4a5568;
    --success-color: #48bb78;
    --warning-color: #ed8936;
    --danger-color: #f56565;
    --muted-color: #a0aec0;
    color-scheme: dark;
}

/* Base Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; overflow-y: scroll; /* Prevents layout jump */ }
body { font-family: 'Vazirmatn', sans-serif; line-height: 1.7; background-color: var(--background-color); color: var(--text-color); direction: rtl; display: flex; flex-direction: column; min-height: 100vh; transition: background-color 0.3s ease, color 0.3s ease; }
.container { max-width: var(--container-width); margin: 0 auto; padding: 0 20px; }
a { color: var(--secondary-color); text-decoration: none; transition: color 0.3s ease; }
a:hover { color: var(--primary-color); }
h2 { color: var(--primary-color); margin-bottom: 20px; font-size: 2rem; font-weight: 700; text-align: center; }

/* ======================= HEADER & NAVIGATION ======================= */
.site-header { background-color: var(--surface-color); color: var(--text-color); padding: 15px 0; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); border-bottom: 3px solid var(--primary-color); transition: background-color 0.3s ease, border-color 0.3s ease; }
.site-header .container { display: flex; justify-content: space-between; align-items: center; }
.site-header .logo a { color: var(--primary-color); font-weight: 700; }
.site-header .logo h1 { font-size: 2rem; margin: 0; }
.main-nav ul { list-style: none; display: flex; gap: 15px; align-items: center; }
.main-nav ul li a { color: var(--text-color); font-weight: 500; padding: 8px 16px; border-radius: 6px; transition: background-color 0.3s ease, color 0.3s ease; }
html[data-theme="light"] .main-nav ul li a:hover, html[data-theme="light"] .main-nav ul li a.active-link { background-color: #e9ecef; color: var(--primary-color); }
html[data-theme="dark"] .main-nav ul li a:hover, html[data-theme="dark"] .main-nav ul li a.active-link { background-color: #4a5568; color: var(--primary-color); }
.main-nav ul li a.active-link { font-weight: 700; }

/* ======================= MAIN CONTENT & SECTIONS ======================= */
.site-content { padding-top: 60px; padding-bottom: 60px; flex: 1; }
.homepage-section { margin-bottom: 60px; }
.hero-section { text-align: center; margin-bottom: 70px; }
.hero-section p { max-width: 650px; margin: 0 auto; font-size: 1.1rem; color: var(--muted-text-color); }
.page-title-section { text-align: center; margin-bottom: 50px; }
.page-title-section p { max-width: 650px; margin: 0 auto; font-size: 1.1rem; color: var(--muted-text-color); }


/* ======================= HOMEPAGE SPECIFIC ======================= */
.quick-links-grid { display: flex; flex-direction: row; gap: 25px; flex-wrap: nowrap; justify-content: space-between; }
.quick-link-card { background: var(--surface-color); padding: 25px; border-radius: 8px; box-shadow: 0 4px 12px var(--shadow-color); transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, background-color 0.3s ease; display: block; color: var(--text-color); border: 1px solid var(--border-color); flex: 1; min-width: 0; }
.quick-link-card:hover { transform: translateY(-5px); box-shadow: 0 7px 20px var(--shadow-color); }
.card-icon { color: var(--primary-color); margin-bottom: 20px; }
.card-icon svg { width: 48px; height: 48px; }
.quick-link-card h3 { font-size: 1.4rem; font-weight: 600; margin-bottom: 8px; color: var(--text-color); }
.card-description { font-size: 0.9rem; color: var(--muted-text-color); line-height: 1.6; }

.key-schedules-grid { display: flex; justify-content: center; gap: 25px; flex-wrap: wrap; }
.schedule-link-btn { display: flex; align-items: center; gap: 15px; background-color: var(--surface-color); color: var(--primary-color); padding: 18px 35px; border-radius: 12px; border: 1px solid var(--border-color); box-shadow: 0 4px 12px var(--shadow-color); font-weight: 600; font-size: 1.1rem; transition: all 0.25s ease-in-out; }
.schedule-link-btn:hover { transform: translateY(-4px) scale(1.02); box-shadow: 0 7px 20px rgba(var(--primary-color-rgb), 0.12); border-color: var(--secondary-color); color: var(--secondary-color); }
.schedule-link-btn svg { width: 28px; height: 28px; }

/* ======================= LESSONS PAGE & TABS ======================= */
.tabs-nav { display: flex; justify-content: center; gap: 10px; margin-bottom: 40px; border-bottom: 2px solid var(--border-color); transition: border-color 0.3s ease; }
.tab-btn { padding: 12px 25px; font-size: 1.1rem; font-weight: 600; cursor: pointer; border: none; background-color: transparent; color: var(--muted-text-color); position: relative; transition: color 0.3s ease; border-bottom: 3px solid transparent; transform: translateY(2px); }
.tab-btn:hover { color: var(--primary-color); }
.tab-btn.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.tab-panel { display: none; animation: fadeIn 0.5s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.panel-title { font-size: 1.25rem; font-weight: 500; color: var(--muted-text-color); margin-bottom: 30px; text-align: center; }
.lessons-grid { display: grid; gap: 25px; grid-template-columns: 1fr; }
.lesson-card { background: var(--surface-color); padding: 25px; border-radius: 8px; box-shadow: 0 4px 12px var(--shadow-color); transition: all 0.25s ease-in-out; display: block; color: var(--text-color); border: 1px solid var(--border-color); border-top: 4px solid var(--border-color); text-align: center; overflow: hidden; }
.lesson-card:hover { transform: translateY(-6px); box-shadow: 0 8px 22px var(--shadow-color); border-top-color: var(--secondary-color); }
.lesson-card .card-icon { color: var(--primary-color); margin-bottom: 20px; }
.lesson-card .card-icon svg { width: 48px; height: 48px; }
.lesson-card h3 { font-size: 1.5rem; font-weight: 600; margin-bottom: 5px; color: var(--text-color); }
.teacher-name { font-size: 0.95rem; color: var(--muted-text-color); margin-bottom: 15px; min-height: 20px; }
.status-badge { display: inline-block; background-color: var(--muted-text-color); color: var(--background-color); padding: 4px 12px; border-radius: 12px; font-size: 0.8rem; font-weight: 500; }
.lesson-card.disabled { opacity: 0.6; pointer-events: none; cursor: not-allowed; filter: grayscale(80%); border-top-color: var(--muted-text-color); }
.lesson-card.disabled:hover { transform: none; box-shadow: 0 4px 12px var(--shadow-color); border-top-color: var(--muted-text-color); }

/* ======================= POWER OUTAGE & SCHEDULE PAGES ======================= */
.page-header-section { text-align: center; margin-bottom: 50px; padding: 20px; background-color: var(--surface-color); border-radius: 12px; border: 1px solid var(--border-color); box-shadow: 0 4px 12px var(--shadow-color); }
.page-header-section h2 { font-size: 2.5rem; font-weight: 800; color: var(--text-color); margin: 0 0 5px 0; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 20px; }
.group-badge { background-color: var(--primary-color); color: var(--surface-color); padding: 10px 25px; border-radius: 12px; font-size: 1.6rem; font-weight: 700; box-shadow: 0 5px 15px rgba(var(--primary-color-rgb), 0.2); white-space: nowrap; }
html[data-theme="dark"] .group-badge { background-color: var(--secondary-color); color: #1a202c; }
.main-subtitle { font-size: 1.1rem; font-weight: 400; color: var(--muted-text-color); margin: 0 0 20px 0; }
.location-subtitle { font-size: 1.2rem; font-weight: 500; color: var(--text-color); margin: 0; }
.details { font-size: 0.9rem; font-weight: 400; color: var(--muted-text-color); margin: 10px auto 0; max-width: 650px; line-height: 1.8; }
.schedule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 25px; }
.schedule-card { background-color: var(--surface-color); border-radius: 12px; border: 1px solid var(--border-color); box-shadow: 0 4px 12px var(--shadow-color); padding: 25px; transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease; display: flex; flex-direction: column; }
.schedule-card:hover { transform: translateY(-8px); border-color: var(--primary-color); box-shadow: 0 8px 25px rgba(var(--primary-color-rgb), 0.15); }
.card-header h3 { font-size: 1.75rem; font-weight: 700; margin: 0 0 20px 0; padding-bottom: 12px; border-bottom: 2px solid var(--primary-color); color: var(--text-color); }
.time-slots { flex-grow: 1; }
.time-slot { display: flex; align-items: center; background-color: var(--slot-bg-color); padding: 12px 15px; border-radius: 8px; margin-bottom: 12px; font-size: 1.1rem; font-weight: 500; border: 1px solid transparent; transition: border-color 0.3s ease, background-color 0.3s ease; }
.time-slot:hover { border-color: var(--primary-color); background-color: var(--slot-bg-hover-color); }
.time-slot svg { width: 20px; height: 20px; margin-left: 12px; color: var(--primary-color); transition: transform 0.3s ease; flex-shrink: 0; }
.time-slot:hover svg { transform: scale(1.1); }
.empty-slot-text { color: var(--muted-text-color); }

/* ======================= FOOTER ======================= */
.site-footer { background-color: var(--surface-color); color: var(--muted-text-color); padding: 25px 0; font-size: 0.9rem; border-top: 1px solid var(--border-color); text-align: center; transition: background-color 0.3s ease, border-color 0.3s ease; }

/* ======================= DARK MODE TOGGLES ======================= */
.theme-toggle-desktop { display: none; }
.theme-toggle-btn { position: relative; background: var(--surface-color); border: 2px solid var(--border-color); border-radius: 50%; width: 42px; height: 42px; cursor: pointer; transition: all 0.25s ease-in-out; display: flex; align-items: center; justify-content: center; color: var(--text-color); box-shadow: 0 2px 6px var(--shadow-color); overflow: hidden; -webkit-tap-highlight-color: transparent; }
.theme-toggle-btn:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 3px; }
.theme-toggle-btn:hover { border-color: var(--primary-color); box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.2); transform: translateY(-2px); }
.theme-toggle-btn:active { transform: translateY(0) scale(0.95); box-shadow: 0 2px 6px var(--shadow-color); }
.theme-icon-container { position: relative; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.theme-icon { position: absolute; transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); transform-origin: center; }
.theme-icon.sun-icon { color: var(--secondary-color); opacity: 1; transform: rotate(0deg) scale(1); }
.theme-icon.moon-icon { color: var(--primary-color); opacity: 0; transform: rotate(90deg) scale(0); }
html[data-theme="dark"] .theme-toggle-btn { border-color: var(--primary-color); }
html[data-theme="dark"] .theme-icon.sun-icon { opacity: 0; transform: rotate(-90deg) scale(0); }
html[data-theme="dark"] .theme-icon.moon-icon { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-toggle-btn::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(var(--primary-color-rgb), 0.1), transparent); transition: left 0.6s ease; }
.theme-toggle-btn:hover::before { left: 100%; }
.theme-toggle-btn.changing { transform: scale(1.1); }
.dark-mode-fab { display: flex; position: fixed; bottom: 20px; left: 20px; z-index: 1000; width: 56px; height: 56px; border-radius: 50%; justify-content: center; align-items: center; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); color: var(--primary-color); background-color: rgba(255, 255, 255, 0.4); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid rgba(0, 0, 0, 0.08); transition: background-color 0.3s ease, transform 0.2s ease, border-color 0.3s ease; }
html[data-theme="dark"] .dark-mode-fab { background-color: rgba(45, 55, 72, 0.4); border-color: rgba(237, 242, 244, 0.15); }
.dark-mode-fab:hover { transform: scale(1.05); }
.dark-mode-fab svg { width: 28px; height: 28px; }
.dark-mode-fab .moon-icon { display: block; }
.dark-mode-fab .sun-icon { display: none; }
html[data-theme="dark"] .dark-mode-fab .moon-icon { display: none; }
html[data-theme="dark"] .dark-mode-fab .sun-icon { display: block; }

/* ======================= MARKDOWN & DYNAMIC PAGE CONTENT ======================= */
.markdown-content { background-color: var(--surface-color); padding: 30px 40px; border-radius: 8px; box-shadow: 0 4px 12px var(--shadow-color); line-height: 1.8; }
.markdown-content h1, .markdown-content h2, .markdown-content h3, .markdown-content h4, .markdown-content h5, .markdown-content h6 { color: var(--primary-color); margin-top: 1.5em; margin-bottom: 0.8em; line-height: 1.3; }
.markdown-content h1 { font-size: 2.5rem; text-align: center; margin-bottom: 30px; }
.markdown-content h2 { font-size: 2rem; border-bottom: 2px solid var(--border-color); padding-bottom: 10px; margin-bottom: 20px; }
.markdown-content h3 { font-size: 1.7rem; }
.markdown-content p { margin-bottom: 1em; }
.markdown-content ul, .markdown-content ol { margin-bottom: 1em; padding-right: 20px; }
.markdown-content li { margin-bottom: 0.5em; }
.markdown-content a { color: var(--secondary-color); text-decoration: underline; }
.markdown-content a:hover { color: var(--primary-color); }
.markdown-content blockquote { border-right: 4px solid var(--border-color); padding-right: 15px; margin-right: 20px; color: var(--muted-text-color); font-style: italic; }
.markdown-content code { background-color: var(--slot-bg-color); padding: 2px 5px; border-radius: 4px; font-family: monospace; font-size: 0.9em; direction: ltr; unicode-bidi: embed; }
.markdown-content pre { background-color: var(--slot-bg-color); padding: 15px; border-radius: 8px; overflow-x: auto; margin-bottom: 1em; direction: ltr; unicode-bidi: embed; }
.markdown-content pre code { background-color: transparent; padding: 0; }
.markdown-content hr { border: none; border-top: 1px solid var(--border-color); margin: 2em 0; }
.markdown-content table { width: 100%; border-collapse: collapse; margin-bottom: 1.5em; direction: rtl; }
.markdown-content th, .markdown-content td { border: 1px solid var(--border-color); padding: 10px 15px; text-align: right; }
.markdown-content th { background-color: var(--slot-bg-color); font-weight: 600; }
.markdown-content tr:nth-child(even) { background-color: var(--slot-bg-color); }

/* ======================= EMPTY STATE STYLES ======================= */
.empty-state-container { text-align: center; padding: 60px 20px; background-color: var(--surface-color); border: 2px dashed var(--border-color); border-radius: 12px; margin-top: 20px; grid-column: 1 / -1; }
.empty-state-container svg { width: 64px; height: 64px; color: var(--muted-text-color); opacity: 0.5; margin-bottom: 20px; }
.empty-state-container p { font-size: 1.2rem; color: var(--muted-text-color); font-weight: 500; }
.empty-state-container small { margin-top: 15px; display: block; }


/* ======================= RESPONSIVE DESIGN ======================= */
@media (min-width: 600px) { .lessons-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 992px) { .lessons-grid { grid-template-columns: 1fr 1fr 1fr; } }
@media (min-width: 1024px) { .schedule-grid .schedule-card:last-child:nth-child(odd) { grid-column: 2 / span 1; } }

@media (min-width: 769px) {
    .theme-toggle-desktop { display: block; }
    .dark-mode-fab { display: none; }
}

@media (max-width: 768px) {
    h2 { font-size: 1.8rem; }
    .site-content { padding-top: 40px; padding-bottom: 40px; }
    .site-header .container { flex-direction: column; gap: 15px; }
    .main-nav ul { justify-content: center; flex-wrap: wrap; }
    .theme-toggle-desktop { display: none; }
    .hero-section { margin-bottom: 50px; }
    .hero-section p { font-size: 1rem; }
    .quick-links-grid { flex-direction: column; gap: 20px; }
    .quick-link-card { padding: 20px; }
    .card-icon svg { width: 40px; height: 40px; }
    .page-header-section h2 { font-size: 2rem; }
    .group-badge { font-size: 1.4rem; padding: 8px 20px; }
}

@media (max-width: 480px) {
    .page-header-section h2 { font-size: 1.8rem; gap: 15px; }
    .location-subtitle { font-size: 1.1rem; }
    .details { font-size: 0.85rem; }
    .card-header h3 { font-size: 1.5rem; }
    .time-slot { font-size: 1rem; }
    .schedule-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}