:root {
    --primary-dark: #1e3c72;
    --primary-light: #2a5298;
    --primary-gradient: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
    --accent: #ffd700;
    --accent-hover: #ffed4a;
    --bg-body: #f0f2f5;
    --bg-card: white;
    --bg-card-hover: #f8f9fa;
    --bg-info: #fff3cd;
    --bg-example: #e8f0fe;
    --bg-formula: #f0f2f5;
    --text-primary: #1e3c72;
    --text-secondary: #666;
    --text-dark: #333;
    --text-white: white;
    --border-light: #ddd;
    --border-info: #ffc107;
    --border-lesson: #2a5298;
    --shadow-sm: 0 4px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 12px 25px rgba(0, 0, 0, 0.15);
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html {
    height: 100%;
}
body {
    font-family: 'Vazir', 'Tahoma', 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text-dark);
    direction: rtl;
    transition: all 0.3s ease;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}
.navbar {
    background: var(--primary-gradient);
    padding: 0.8rem 2rem;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.logo {
    color: var(--accent);
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
}
.nav-links {
    display: flex;
    gap: 1rem;
    list-style: none;
}
.nav-links a {
    color: var(--text-white);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: 0.3s;
    font-size: 1rem;
}
.nav-links a:hover,
.nav-links a.active {
    background: var(--accent);
    color: var(--primary-dark);
}
.nav-icons {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.settings-icon a {
    color: var(--text-white);
    font-size: 1.5rem;
    text-decoration: none;
    transition: 0.3s;
    display: inline-block;
}
.settings-icon a:hover {
    color: var(--accent);
    transform: rotate(30deg);
}
.profile-icon a {
    color: var(--text-white);
    font-size: 1.8rem;
    text-decoration: none;
    transition: 0.3s;
}
.profile-icon a:hover {
    color: var(--accent);
}
.profile-dropdown {
    position: relative;
}
.dropdown-content {
    display: none;
    position: absolute;
    left: 0;
    background: var(--bg-card);
    min-width: 150px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    z-index: 101;
}
.dropdown-content a {
    color: var(--primary-dark);
    padding: 10px 15px;
    display: block;
    text-decoration: none;
}
.dropdown-content a:hover {
    background: var(--bg-card-hover);
}
.profile-dropdown:hover .dropdown-content {
    display: block;
}
.settings-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}
.settings-modal-content {
    background: var(--bg-card);
    margin: 15% auto;
    width: 90%;
    max-width: 400px;
    border-radius: 20px;
    direction: rtl;
    overflow: hidden;
}
.settings-header {
    background: var(--primary-gradient);
    color: var(--text-white);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.close-settings {
    font-size: 1.5rem;
    cursor: pointer;
}
.settings-body {
    padding: 1.5rem;
}
.setting-item {
    margin-bottom: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.setting-item label {
    font-weight: bold;
    color: var(--primary-dark);
}
.setting-item select,
.setting-item button {
    padding: 0.4rem 0.8rem;
    border-radius: 10px;
    border: 1px solid var(--border-light);
}
.reset-btn {
    background: #ff4757;
    color: var(--text-white);
    border: none;
    cursor: pointer;
    width: 100%;
    padding: 0.6rem;
    border-radius: 25px;
}
.reset-btn:hover {
    background: #e84118;
}
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    flex: 1;
}
.hero {
    background: linear-gradient(120deg, #667eea, #764ba2);
    color: var(--text-white);
    padding: 3rem;
    border-radius: 30px;
    text-align: center;
    margin-bottom: 2rem;
}
.btn-primary {
    display: inline-block;
    background: var(--accent);
    color: var(--primary-dark);
    padding: 0.8rem 2rem;
    border-radius: 40px;
    text-decoration: none;
    font-weight: bold;
    margin-top: 1rem;
    transition: 0.3s;
}
.btn-primary:hover {
    transform: scale(1.05);
}
.features {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}
.feature-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 20px;
    flex: 1;
    min-width: 200px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.feature-card h3 {
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}
footer {
    background: var(--primary-dark);
    color: var(--text-white);
    text-align: center;
    padding: 1rem;
    margin-top: auto;
}
@media (max-width: 768px) {
    .nav-container {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 0.8rem;
    }
    .nav-links a {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    .settings-icon a {
        font-size: 1.3rem;
    }
    .profile-icon a {
        font-size: 1.5rem;
    }
    .logo {
        font-size: 1.2rem;
    }
    .hero h1 {
        font-size: 1.3rem;
    }
}
.login-box, .contact-box {
    max-width: 500px;
    margin: 2rem auto;
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 30px;
    box-shadow: var(--shadow-lg);
}
.login-box h2, .contact-box h2 {
    color: var(--primary-dark);
    text-align: center;
    margin-bottom: 1.5rem;
}
.input-group {
    margin-bottom: 1.2rem;
}
.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--primary-dark);
}
.input-group input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    font-size: 1rem;
    background: var(--bg-card);
    color: var(--text-dark);
}
.btn-login {
    width: 100%;
    background: var(--primary-gradient);
    color: var(--text-white);
    padding: 0.8rem;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.3s;
}
.btn-login:hover {
    background: var(--accent);
    color: var(--primary-dark);
}
.register-link {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-secondary);
}
.register-link a {
    color: var(--primary-light);
    text-decoration: none;
}
.register-link a:hover {
    color: var(--accent);
}
.contact-box input, .contact-box textarea {
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    color: var(--text-dark);
}
.contact-box textarea {
    resize: vertical;
}
.btn-send {
    background: var(--primary-gradient);
    color: var(--text-white);
    padding: 0.8rem;
    border: none;
    border-radius: 30px;
    width: 100%;
    cursor: pointer;
    transition: 0.3s;
}
.btn-send:hover {
    background: var(--accent);
    color: var(--primary-dark);
}
#loginMessage {
    margin-top: 1rem;
    text-align: center;
}
body[data-theme="dark"] .lesson-card h3,
body[data-theme="dark"] .lesson-card p,
body[data-theme="dark"] .formula-card h3,
body[data-theme="dark"] .formula-card p,
body[data-theme="dark"] .test-card h3,
body[data-theme="dark"] .test-card p {
    color: #e0e0e0;
}

body[data-theme="dark"] .feature-card {
    background: #2d2d44;
}

body[data-theme="dark"] .feature-card h3,
body[data-theme="dark"] .feature-card p {
    color: #e0e0e0;
}

body[data-theme="dark"] .hero {
    background: linear-gradient(135deg, #2d2d44, #1a1a2e);
}

body[data-theme="dark"] .hero h1,
body[data-theme="dark"] .hero p {
    color: var(--accent);
}

body[data-theme="dark"] .btn-primary {
    background: var(--accent);
    color: #1a1a2e;
}

body[data-theme="dark"] .btn-primary:hover {
    background: #ffed4a;
}

body[data-theme="dark"] .settings-modal-content {
    background: #2d2d44;
    color: #e0e0e0;
}

body[data-theme="dark"] .setting-item label {
    color: #e0e0e0;
}

body[data-theme="dark"] .setting-item select {
    background: #1e1e2e;
    color: #e0e0e0;
    border-color: #555;
}
.games-header {
    text-align: center;
    margin-bottom: 2rem;
}
.games-header h1 {
    color: var(--primary-dark);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.games-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}
.game-card {
    background: var(--bg-card);
    border-radius: 25px;
    padding: 1.8rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border-bottom: 4px solid #9b59b6;
    cursor: pointer;
}
.game-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}
.game-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}
.game-card h2 {
    color: var(--primary-dark);
    margin-bottom: 0.8rem;
    font-size: 1.5rem;
}
.game-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
    line-height: 1.6;
}
.game-features {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.8rem;
    color: var(--primary-light);
}
.game-features span {
    background: var(--bg-card-hover);
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
}
.play-btn {
    display: inline-block;
    background: #9b59b6;
    color: white;
    padding: 0.6rem 1.8rem;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    transition: 0.3s;
}
.play-btn:hover {
    background: var(--accent);
    color: var(--primary-dark);
    transform: scale(1.05);
}
.game-card.eratosthenes {
    border-bottom-color: #e74c3c;
}
.game-card.eratosthenes .play-btn {
    background: #e74c3c;
}
.game-card.eratosthenes .play-btn:hover {
    background: var(--accent);
}
.game-card.memory {
    border-bottom-color: #2ecc71;
}
.game-card.memory .play-btn {
    background: #2ecc71;
}
.game-card.memory .play-btn:hover {
    background: var(--accent);
}
@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: 1fr;
    }
}