/**
 * Main Stylesheet - Responsive Design
 */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    padding-bottom: 80px; /* Space for fixed audio player */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: white;
    padding: 1rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

header h1 {
    color: #2c3e50;
    font-size: 1.8rem;
}

/* Navigation */
nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.btn:hover {
    background: #5a6268;
}

.btn-primary {
    background: #007bff;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-view {
    background: #28a745;
}

.btn-view:hover {
    background: #218838;
}

/* Lessons Grid */
.lessons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.lesson-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.lesson-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.lesson-card h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.lesson-card .description {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.lesson-meta {
    margin-bottom: 1rem;
    color: #888;
    font-size: 0.9rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.empty-state h2 {
    color: #666;
    margin-bottom: 1rem;
}

/* Upload Form */
.upload-form {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
}

.form-group small {
    color: #666;
    font-size: 0.8rem;
}

/* Messages */
.message {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Viewer */
.viewer-header {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.lesson-description {
    color: #666;
    margin-top: 0.5rem;
}

.viewer-main {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#pdf-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    flex-wrap: wrap;
}

#page-info {
    font-weight: 600;
    color: #333;
}

/* Fixed Audio Player */
#audio-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2c3e50;
    padding: 1rem;
    z-index: 999;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
}

#audio-element {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: block;
}

/* PDF Viewer */
#pdf-viewer {
    text-align: center;
}

.pdf-page {
    display: inline-block;
    margin: 10px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    header {
        flex-direction: column;
        text-align: center;
    }
    
    .lessons-grid {
        grid-template-columns: 1fr;
    }
    
    #pdf-controls {
        justify-content: center;
    }
    
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .upload-form {
        padding: 1rem;
    }
    
    .viewer-main {
        padding: 1rem;
    }
    
    #pdf-controls {
        gap: 0.5rem;
    }
    
    #audio-player {
        padding: 0.8rem;
    }
}

/* Upload Progress Styles */
.upload-progress {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.progress-header h3 {
    color: #2c3e50;
    margin: 0;
}

.upload-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.stat-item {
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    font-size: 0.9rem;
    color: #495057;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.progress-bar {
    flex: 1;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-weight: bold;
    color: #2c3e50;
    min-width: 50px;
    text-align: center;
}

.progress-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.progress-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-item span {
    min-width: 150px;
    font-size: 0.9rem;
    color: #495057;
}

.file-progress {
    flex: 1;
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}

.file-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #17a2b8);
    border-radius: 6px;
    transition: width 0.3s ease;
    width: 0%;
}

.time-estimate {
    text-align: center;
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    font-size: 0.9rem;
    color: #6c757d;
}

/* Animation for progress bars */
.progress-fill, .file-progress-bar {
    background-size: 200% 100%;
    animation: gradientAnimation 2s ease infinite;
}

@keyframes gradientAnimation {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Responsive design for progress */
@media (max-width: 768px) {
    .progress-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .upload-stats {
        width: 100%;
        justify-content: space-between;
    }
    
    .stat-item {
        flex: 1;
        text-align: center;
        min-width: 120px;
    }
    
    .progress-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .progress-item span {
        min-width: auto;
    }
    
    .file-progress {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .upload-progress {
        padding: 1rem;
    }
    
    .upload-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .stat-item {
        text-align: left;
    }
    
    .progress-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .progress-text {
        order: -1;
    }
}

/* Enhanced PDF Controls */
.pdf-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2c3e50;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-btn {
    background: #34495e;
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.control-btn:hover {
    background: #4a6572;
}

.page-navigation {
    color: white;
}

#page-jumper {
    width: 60px;
    padding: 0.25rem;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    text-align: center;
}

/* Fullscreen Mode */
.fullscreen-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
}

.fullscreen-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 0.5rem;
    z-index: 10001;
}

.fs-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: background-color 0.2s;
}

.fs-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.exit-btn {
    background: rgba(231, 76, 60, 0.8);
}

.exit-btn:hover {
    background: rgba(231, 76, 60, 1);
}

.fullscreen-viewer {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 2rem;
}

.fullscreen-viewer canvas {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Online Class Features */
.online-class-features {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-top: 2rem;
    overflow: hidden;
}

.feature-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 500;
}

.tab-btn.active {
    background: white;
    border-bottom: 3px solid #007bff;
    color: #007bff;
}

.tab-btn:hover:not(.active) {
    background: #e9ecef;
}

.tab-content {
    padding: 1.5rem;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Bookmarks */
#bookmarks-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
    max-height: 300px;
    overflow-y: auto;
}

.bookmark-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.bookmark-content strong {
    display: block;
    margin-bottom: 0.25rem;
}

.bookmark-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-icon {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: #6c757d;
    border-radius: 2px;
}

.btn-icon:hover {
    background: #f8f9fa;
    color: #495057;
}

/* Notes */
#notes-editor {
    width: 100%;
    height: 200px;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
}

.notes-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.status-message {
    font-size: 0.9rem;
}

.status-message.success {
    color: #28a745;
}

.status-message.error {
    color: #dc3545;
}

/* Highlights */
.highlight-colors {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.highlight-btn {
    padding: 0.5rem;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    background: white;
}

.highlight-btn.active {
    border-color: #007bff;
}

.highlight-btn.yellow { color: #ffd700; }
.highlight-btn.pink { color: #ff69b4; }
.highlight-btn.blue { color: #4169e1; }
.highlight-btn.green { color: #32cd32; }

.highlight-menu {
    background: white;
    padding: 0.5rem;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    gap: 0.25rem;
    z-index: 1000;
}

.highlight-option {
    padding: 0.5rem;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    background: white;
}

#highlights-list {
    max-height: 300px;
    overflow-y: auto;
}

.highlight-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-left: 4px solid;
    background: #f8f9fa;
}

.highlight-item.yellow { border-left-color: #ffd700; }
.highlight-item.pink { border-left-color: #ff69b4; }
.highlight-item.blue { border-left-color: #4169e1; }
.highlight-item.green { border-left-color: #32cd32; }

.highlight-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex: 1;
}

.highlight-color {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.highlight-color.yellow { background: #ffd700; }
.highlight-color.pink { background: #ff69b4; }
.highlight-color.blue { background: #4169e1; }
.highlight-color.green { background: #32cd32; }

.highlight-text p {
    margin: 0 0 0.25rem 0;
    font-style: italic;
}

.highlight-text small {
    color: #6c757d;
}

/* Quiz */
.quiz-loading {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.quiz-question {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.quiz-options {
    margin: 1rem 0;
}

.quiz-option {
    display: block;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.quiz-option:hover {
    background: #e9ecef;
}

.quiz-option input {
    margin-right: 0.5rem;
}

.answer-feedback {
    margin-top: 0.5rem;
    min-height: 1.5rem;
}

.answer-feedback .success {
    color: #28a745;
}

.answer-feedback .error {
    color: #dc3545;
}

/* Enhanced Audio Player */
.enhanced-audio-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2c3e50;
    padding: 1rem;
    z-index: 999;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.audio-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    flex-wrap: wrap;
    gap: 1rem;
}

.now-playing {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.playback-speed {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.playback-speed select {
    padding: 0.25rem;
    border-radius: 4px;
    border: 1px solid #bdc3c7;
}

.audio-extra-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

#audio-element {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: block;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 10000;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left: 4px solid #28a745;
}

.notification.error {
    border-left: 4px solid #dc3545;
}

.notification i {
    font-size: 1.2rem;
}

.notification.success i {
    color: #28a745;
}

.notification.error i {
    color: #dc3545;
}

/* Utility Classes */
.no-items {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 2rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pdf-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group {
        justify-content: center;
    }
    
    .feature-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1 0 50%;
    }
    
    .audio-info {
        flex-direction: column;
        text-align: center;
    }
    
    .fullscreen-controls {
        top: 10px;
        right: 10px;
    }
    
    .fs-btn {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .tab-btn {
        flex: 1 0 100%;
        padding: 0.75rem;
    }
    
    .bookmark-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .bookmark-actions {
        align-self: flex-end;
    }
}