:root {
    --primary-dark: #222831;
    --secondary-dark: #393E46;
    --accent-blue: #00ADB5;
    --light-gray: #EEEEEE;
    --accent-yellow: #FFD369;
    --paper-texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-opacity='0.03'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z'/%3E%3C/g%3E%3C/svg%3E");
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light-gray);
    background-image: var(--paper-texture);
    color: var(--primary-dark);
    line-height: 1.6;
    padding-bottom: 80px;
    min-height: 100vh;
}

header {
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary-dark));
    color: var(--light-gray);
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

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

.content-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Timeline Styles */
.timeline-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.control-btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: var(--secondary-dark);
    transform: scale(1.1);
}

.control-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.period-info {
    text-align: center;
    flex: 1;
    margin: 0 1rem;
}

.period-info h2 {
    font-size: 1.4rem;
    color: var(--primary-dark);
    margin-bottom: 0.25rem;
}

.period-info span {
    color: var(--secondary-dark);
    font-size: 0.9rem;
}

.timeline-container {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.timeline-events {
    position: relative;
}

.timeline-event {
    background: var(--light-gray);
    border-left: 4px solid var(--accent-blue);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0 8px 8px 0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.timeline-event:hover {
    background: var(--accent-yellow);
    transform: translateX(5px);
}

.timeline-event h3 {
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.timeline-event .event-date {
    color: var(--accent-blue);
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.timeline-event p {
    font-size: 0.95rem;
    color: var(--secondary-dark);
}

.period-details {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.period-description {
    margin-bottom: 1.5rem;
}

.period-description h3 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.period-description p {
    margin-bottom: 1rem;
    text-align: justify;
}

.perspectives {
    margin-top: 1.5rem;
}

.perspective {
    background: var(--light-gray);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--accent-yellow);
}

.perspective h4 {
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.media-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.media-container {
    background: var(--light-gray);
    border-radius: 8px;
    padding: 1rem;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
}

.media-placeholder {
    color: var(--secondary-dark);
    font-size: 3rem;
    margin-bottom: 1rem;
}

.audio-btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    align-self: flex-start;
}

.audio-btn:hover {
    background: var(--secondary-dark);
    transform: translateY(-2px);
}

.audio-btn.playing {
    background: var(--accent-yellow);
    color: var(--primary-dark);
}

.bookmark-btn {
    background: var(--accent-yellow);
    color: var(--primary-dark);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    margin-top: 1rem;
}

.bookmark-btn:hover {
    background: var(--accent-blue);
    color: white;
}

.bookmark-btn.bookmarked {
    background: var(--accent-blue);
    color: white;
}

/* Quiz Styles */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.quiz-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--secondary-dark);
}

.quiz-container {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.quiz-question {
    font-size: 1.2rem;
    color: var(--primary-dark);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.quiz-options {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.quiz-option {
    background: var(--light-gray);
    border: 2px solid transparent;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.quiz-option:hover {
    background: var(--accent-yellow);
    border-color: var(--accent-blue);
}

.quiz-option.selected {
    background: var(--accent-blue);
    color: white;
    border-color: var(--primary-dark);
}

.quiz-option.correct {
    background: #4CAF50;
    color: white;
    border-color: #2E7D32;
}

.quiz-option.incorrect {
    background: #F44336;
    color: white;
    border-color: #C62828;
}

.quiz-feedback {
    background: var(--light-gray);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: none;
}

.quiz-feedback.show {
    display: block;
}

.quiz-feedback.correct {
    background: #E8F5E8;
    border-left: 4px solid #4CAF50;
}

.quiz-feedback.incorrect {
    background: #FFEBEE;
    border-left: 4px solid #F44336;
}

.quiz-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.quiz-btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.quiz-btn:hover {
    background: var(--secondary-dark);
    transform: translateY(-2px);
}

.quiz-btn.primary {
    background: var(--accent-yellow);
    color: var(--primary-dark);
}

.quiz-btn.primary:hover {
    background: var(--accent-blue);
    color: white;
}

.quiz-results {
    text-align: center;
    padding: 2rem;
}

.quiz-results h3 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.score-display {
    font-size: 2rem;
    color: var(--accent-blue);
    margin-bottom: 1rem;
}

/* Bookmarks Styles */
.bookmarks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.clear-btn {
    background: #F44336;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
}

.clear-btn:hover {
    background: #C62828;
    transform: translateY(-2px);
}

.bookmarks-list {
    display: grid;
    gap: 1rem;
}

.bookmark-item {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--accent-blue);
    transition: all 0.3s ease;
}

.bookmark-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.bookmark-item h3 {
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.bookmark-item .bookmark-date {
    color: var(--accent-blue);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.bookmark-item p {
    color: var(--secondary-dark);
    margin-bottom: 1rem;
}

.bookmark-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.bookmark-actions button {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bookmark-actions button:hover {
    background: var(--secondary-dark);
}

.bookmark-actions .remove-btn {
    background: #F44336;
}

.bookmark-actions .remove-btn:hover {
    background: #C62828;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--secondary-dark);
}

.empty-state i {
    font-size: 4rem;
    color: var(--accent-blue);
    margin-bottom: 1rem;
}

.empty-state p {
    margin-bottom: 0.5rem;
}

/* FAQ Styles */
.faq-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.faq-item {
    border-bottom: 1px solid var(--light-gray);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    padding: 1.5rem;
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    color: var(--primary-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.faq-question:hover {
    background: var(--light-gray);
}

.faq-question[aria-expanded="true"] {
    background: var(--accent-blue);
    color: white;
}

.faq-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 1.5rem;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-answer.show {
    padding: 1.5rem;
    max-height: 200px;
}

.faq-answer p {
    color: var(--secondary-dark);
    line-height: 1.6;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--secondary-dark);
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: 8px;
    min-width: 60px;
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    color: var(--accent-blue);
    background: rgba(0, 173, 181, 0.1);
}

/* Footer */
footer {
    background: var(--primary-dark);
    color: var(--light-gray);
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    margin-top: 2rem;
}

/* Responsive Design */
@media (min-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .timeline-controls {
        padding: 1.5rem;
    }
    
    .period-info h2 {
        font-size: 1.8rem;
    }
    
    .quiz-options {
        grid-template-columns: 1fr 1fr;
    }
    
    .bookmarks-list {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    .media-content {
        flex-direction: row;
        align-items: center;
    }
    
    .audio-btn {
        align-self: center;
    }
}

@media (min-width: 1024px) {
    main {
        padding: 2rem;
    }
    
    .timeline-container,
    .period-details,
    .quiz-container {
        padding: 2rem;
    }
    
    .quiz-question {
        font-size: 1.4rem;
    }
    
    .bottom-nav {
        position: relative;
        box-shadow: none;
        background: transparent;
        justify-content: center;
        gap: 2rem;
        margin: 2rem 0;
    }
    
    .nav-item {
        background: white;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        padding: 1rem;
        border-radius: 10px;
        min-width: 120px;
    }
    
    body {
        padding-bottom: 0;
    }
}

/* Loading States */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid var(--light-gray);
    border-top: 4px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus States */
button:focus,
.nav-item:focus,
.quiz-option:focus,
.faq-question:focus {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .bottom-nav,
    .timeline-controls,
    .quiz-controls,
    .bookmark-actions,
    .audio-btn {
        display: none;
    }
    
    .content-section {
        display: block !important;
    }
    
    body {
        background: white;
        color: black;
    }
}
