/* ========================================
   Kinder Lernbücher - Styles
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4CAF50;
    --secondary-color: #FF9800;
    --bg-color: #f0f8ff;
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --text-dark: #333;
    --text-light: #666;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
}

.app-footer {
    margin-top: 24px;
    text-align: center;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.9rem;
    letter-spacing: 0.2px;
}

.footer-separator {
    margin: 0 6px;
    opacity: 0.8;
}

.app-footer-link {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.app-footer-link:hover {
    color: #ffffff;
}

.legal-details {
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    color: #ffffff;
    padding: 10px 14px;
    font-size: 0.9rem;
    letter-spacing: 0.2px;
}

.legal-details summary {
    cursor: pointer;
    font-weight: 600;
}

.legal-details p {
    margin-top: 8px;
    line-height: 1.5;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

/* ========================================
   Dashboard Styles
   ======================================== */

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* ========================================
   Language Switcher
   ======================================== */

.lang-switcher {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.4);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
    transform: scale(1.05);
}

.lang-btn.active {
    background: white;
    color: #333;
    border-color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
    padding: 10px;
}

.book-card {
    background: white;
    border-radius: 20px;
    padding: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
}

.book-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.book-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: var(--book-color, var(--primary-color));
}

.book-icon {
    font-size: 4rem;
    text-align: center;
    margin-bottom: 15px;
}

.book-card h3 {
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 10px;
    text-align: center;
}

.book-card p {
    font-size: 0.95rem;
    color: var(--text-light);
    text-align: center;
    line-height: 1.5;
}

.book-pages {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.book-pages::before {
    content: '📄';
    margin-right: 5px;
}

/* ========================================
   Reader Styles
   ======================================== */

.reader-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 15px 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
}

.btn-back {
    background: #f44336;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: #d32f2f;
    transform: scale(1.05);
}

.reader-header h2 {
    color: var(--text-dark);
    font-size: 1.5rem;
}

#page-indicator {
    background: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
}

.reader-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    min-height: 400px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}

.page-content {
    max-width: 800px;
    margin: 0 auto;
}

.page-content h3 {
    color: var(--text-dark);
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
}

.page-content p {
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text-dark);
    text-align: justify;
    margin-bottom: 15px;
}

.page-content .page-icon {
    font-size: 5rem;
    text-align: center;
    margin-bottom: 20px;
}

.page-content p {
    white-space: pre-line;
}

.page-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
}

.nav-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.nav-btn:hover:not(:disabled) {
    background: #388E3C;
    transform: scale(1.05);
}

.nav-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.page-dots {
    display: flex;
    gap: 10px;
}

.page-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-dot.active {
    background: var(--secondary-color);
    transform: scale(1.3);
}

.page-dot:hover {
    background: var(--secondary-color);
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.book-card {
    animation: fadeIn 0.5s ease forwards;
}

.book-card:nth-child(1) { animation-delay: 0.1s; }
.book-card:nth-child(2) { animation-delay: 0.2s; }
.book-card:nth-child(3) { animation-delay: 0.3s; }
.book-card:nth-child(4) { animation-delay: 0.4s; }
.book-card:nth-child(5) { animation-delay: 0.5s; }
.book-card:nth-child(6) { animation-delay: 0.6s; }
.book-card:nth-child(7) { animation-delay: 0.7s; }
.book-card:nth-child(8) { animation-delay: 0.8s; }
.book-card:nth-child(9) { animation-delay: 0.9s; }
.book-card:nth-child(10) { animation-delay: 1.0s; }

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }

    .reader-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .reader-content {
        padding: 20px;
    }

    .page-content p {
        font-size: 1rem;
    }

    .page-navigation {
        flex-wrap: wrap;
    }

    .nav-btn {
        padding: 12px 20px;
        font-size: 1rem;
    }

    .quiz-option-btn {
        padding: 12px 16px;
        font-size: 1rem;
    }
}

/* ========================================
   Quiz Styles
   ======================================== */

.quiz-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    min-height: 400px;
    box-shadow: var(--card-shadow);
    margin-top: 20px;
}

.quiz-container {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.quiz-question {
    margin-bottom: 30px;
}

.quiz-question-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.quiz-question h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    line-height: 1.5;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
}

.quiz-option-btn {
    background: #f5f5f5;
    border: 3px solid #e0e0e0;
    border-radius: 15px;
    padding: 16px 24px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    color: var(--text-dark);
}

.quiz-option-btn:hover:not(:disabled) {
    background: #e3f2fd;
    border-color: #2196F3;
    transform: translateX(5px);
}

.quiz-option-btn:disabled {
    cursor: not-allowed;
}

.quiz-option-btn.correct {
    background: #e8f5e9;
    border-color: #4CAF50;
    color: #2e7d32;
    font-weight: bold;
}

.quiz-option-btn.wrong {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
}

.quiz-feedback {
    padding: 15px;
    border-radius: 12px;
    font-size: 1.1rem;
    margin-bottom: 20px;
    min-height: 20px;
}

.quiz-feedback.correct {
    background: #e8f5e9;
    color: #2e7d32;
}

.quiz-feedback.wrong {
    background: #ffebee;
    color: #c62828;
}

.quiz-next-btn {
    margin-top: 10px;
}

.quiz-result {
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.quiz-result-icon {
    font-size: 6rem;
    margin-bottom: 20px;
}

.quiz-result h3 {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.quiz-result p {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 20px;
    line-height: 1.5;
}

.quiz-result-score {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 30px;
    padding: 15px;
    background: #e8f5e9;
    border-radius: 12px;
}

.quiz-home-btn {
    background: var(--secondary-color);
    margin-left: 10px;
}

.quiz-home-btn:hover {
    background: #e68900;
}

/* ========================================
   RTL Support (Arabic)
   ======================================== */

[dir="rtl"] body {
    font-family: 'Segoe UI', Tahoma, 'Arial', sans-serif;
}

[dir="rtl"] .reader-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .page-content p {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .page-content h3 {
    direction: rtl;
}

[dir="rtl"] .page-navigation {
    flex-direction: row-reverse;
}

[dir="rtl"] .quiz-option-btn {
    text-align: right;
}

[dir="rtl"] .quiz-option-btn:hover:not(:disabled) {
    transform: translateX(-5px);
}

[dir="rtl"] .quiz-home-btn {
    margin-left: 0;
    margin-right: 10px;
}

[dir="rtl"] .book-pages::before {
    margin-right: 0;
    margin-left: 5px;
}
