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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    padding: 2rem;
    max-width: 800px;
    width: 90%;
    margin: 2rem auto;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.title {
    font-size: 3rem;
    font-weight: bold;
    background: linear-gradient(45deg, #2196F3, #1976D2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.subtitle {
    color: #666;
    font-size: 1.2rem;
}

.upload-section {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem;
    border: 2px dashed #2196F3;
    border-radius: 15px;
    background: #f8f9ff;
}

/* Tabs */
.tabs {
    display: flex;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e0e0e0;
}

.tab-button {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-button.active {
    color: #2196F3;
    border-bottom-color: #2196F3;
}

.tab-content {
    display: none;
}

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

/* Quiz folders */
.folder {
    margin-bottom: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.folder-header {
    padding: 15px 20px;
    background: linear-gradient(45deg, #f5f5f5, #e8e8e8);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #333;
}

.folder-header:hover {
    background: linear-gradient(45deg, #e8e8e8, #d5d5d5);
}

.folder-content {
    display: none;
    padding: 10px;
    background: #fafafa;
}

.folder-content.open {
    display: block;
}

.folder-toggle {
    transform: rotate(-90deg);
    transition: transform 0.3s ease;
}

.folder-toggle.open {
    transform: rotate(0deg);
}

.quiz-item {
    display: block;
    width: 100%;
    padding: 15px 30px;
    margin: 10px 0;
    background: linear-gradient(45deg, #2196F3, #1976D2);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 1.1rem;
}

.quiz-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(33, 150, 243, 0.4);
}

/* Attempt items */
.attempt-item {
    background: linear-gradient(45deg, #ff9800, #f57c00);
    margin: 5px 0;
    position: relative;
}

.attempt-item .attempt-info {
    font-size: 0.9rem;
    opacity: 0.9;
}

.completed-item {
    background: linear-gradient(45deg, #4CAF50, #388E3C);
}

.delete-attempt {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
}

.delete-attempt:hover {
    background: rgba(255,255,255,0.3);
}

.quiz-section {
    display: none;
}

.quiz-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: linear-gradient(45deg, #e3f2fd, #bbdefb);
    border-radius: 15px;
}

.quiz-title {
    color: #1976D2;
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.progress-info {
    color: #666;
    font-size: 1.1rem;
}

.question-card {
    background: #f8f9ff;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    border-left: 5px solid #2196F3;
}

.question-text {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.options {
    display: grid;
    gap: 1rem;
}

.option {
    padding: 1rem 1.5rem;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.option:hover {
    border-color: #2196F3;
    background: #e3f2fd;
    transform: translateX(5px);
}

.option.selected {
    border-color: #2196F3;
    background: linear-gradient(45deg, #e3f2fd, #bbdefb);
    color: #1976D2;
    font-weight: 600;
}

.option.correct {
    border-color: #4CAF50;
    background: linear-gradient(45deg, #e8f5e8, #c8e6c9);
    color: #2e7d32;
}

.option.incorrect {
    border-color: #f44336;
    background: linear-gradient(45deg, #ffebee, #ffcdd2);
    color: #c62828;
}

.quiz-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(45deg, #2196F3, #1976D2);
    color: white;
}

.btn-secondary {
    background: linear-gradient(45deg, #757575, #616161);
    color: white;
}

.btn-success {
    background: linear-gradient(45deg, #4CAF50, #388E3C);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.results-section {
    display: none;
    text-align: center;
}

.score-display {
    background: linear-gradient(45deg, #e3f2fd, #bbdefb);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.score-text {
    font-size: 2rem;
    color: #1976D2;
    font-weight: bold;
    margin-bottom: 1rem;
}

.score-percentage {
    font-size: 1.5rem;
    color: #666;
}

.review-section {
    text-align: left;
    margin-top: 2rem;
}

.review-question {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 5px solid #2196F3;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.review-title {
    font-weight: bold;
    color: #333;
    margin-bottom: 1rem;
}

.answer-comparison {
    display: grid;
    gap: 0.5rem;
    margin-top: 1rem;
}

.answer-item {
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-size: 0.95rem;
}

.your-answer {
    background: #ffecb3;
    color: #f57f17;
}

.correct-answer {
    background: #c8e6c9;
    color: #2e7d32;
}

.file-info {
    margin-top: 1rem;
    padding: 1rem;
    background: #e8f5e8;
    border-radius: 10px;
    color: #2e7d32;
    text-align: center;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

.error-message {
    color: #c62828;
    background: #ffebee;
    padding: 1rem;
    border-radius: 10px;
    margin: 10px 0;
}

.no-quizzes {
    color: #666;
    padding: 2rem;
    text-align: center;
    font-style: italic;
}
/* Replace the existing media queries with these optimized versions */

/* Enhanced tablet optimization */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
        width: 95%;
        margin: 1rem auto;
    }
    
    .title {
        font-size: 2.2rem;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-button {
        padding: 0.8rem;
        font-size: 1rem;
    }
    
    .folder-header {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
    
    .quiz-item {
        padding: 12px 20px;
        font-size: 1rem;
        margin: 8px 0;
    }
}

/* Improved mobile optimization */
@media (max-width: 600px) {
    .title {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .container {
        margin: 0.5rem;
        padding: 1rem;
        width: calc(100% - 1rem);
        border-radius: 15px;
    }
    
    /* Optimize upload section */
    .upload-section {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    /* Stack quiz controls vertically */
    .quiz-controls {
        flex-direction: column;
        gap: 0.8rem;
        align-items: stretch;
    }
    
    /* Optimize question cards */
    .question-card {
        padding: 1.2rem;
        margin-bottom: 1.5rem;
    }
    
    .question-text {
        font-size: 1.1rem;
        line-height: 1.4;
        margin-bottom: 1rem;
    }
    
    /* Improve touch targets */
    .option {
        padding: 1rem;
        font-size: 0.95rem;
        line-height: 1.3;
        min-height: 44px; /* iOS recommended touch target */
    }
    
    .option:hover {
        transform: none; /* Remove transform on mobile to prevent layout issues */
    }
    
    /* Optimize buttons */
    .btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 1rem;
        min-height: 44px;
    }
    
    /* Optimize quiz header */
    .quiz-header {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .quiz-title {
        font-size: 1.4rem;
        line-height: 1.3;
    }
    
    .progress-info {
        font-size: 0.95rem;
    }
    
    /* Optimize results section */
    .score-text {
        font-size: 1.6rem;
        line-height: 1.2;
    }
    
    .score-percentage {
        font-size: 1.1rem;
    }
    
    /* Optimize review section */
    .review-question {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .review-title {
        font-size: 1rem;
        line-height: 1.3;
    }
    
    /* Optimize folder structure */
    .folder-header {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .folder-content {
        padding: 8px;
    }
    
    /* Optimize delete buttons */
    .delete-attempt {
        width: 36px;
        height: 36px;
        font-size: 16px;
        right: 8px;
    }
}

/* Ultra-small device optimization */
@media (max-width: 400px) {
    .container {
        margin: 0.25rem;
        padding: 0.75rem;
        width: calc(100% - 0.5rem);
        border-radius: 10px;
    }
    
    .title {
        font-size: 1.6rem;
        line-height: 1.2;
    }
    
    .subtitle {
        font-size: 0.9rem;
        line-height: 1.3;
    }
    
    .header {
        margin-bottom: 1.5rem;
    }
    
    /* Ultra-compact question cards */
    .question-card {
        padding: 1rem;
        margin-bottom: 1rem;
        border-left-width: 3px;
    }
    
    .question-text {
        font-size: 1rem;
        line-height: 1.4;
        margin-bottom: 0.8rem;
    }
    
    /* Smaller options with better spacing */
    .option {
        padding: 0.8rem;
        font-size: 0.9rem;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }
    
    /* Compact buttons */
    .btn {
        padding: 12px 16px;
        font-size: 0.9rem;
        border-radius: 20px;
    }
    
    /* Compact tabs */
    .tab-button {
        padding: 0.6rem 0.4rem;
        font-size: 0.9rem;
    }
    
    /* Smaller quiz items */
    .quiz-item {
        padding: 10px 16px;
        font-size: 0.9rem;
        margin: 6px 0;
        border-radius: 20px;
    }
    
    /* Compact folder headers */
    .folder-header {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    /* Compact upload section */
    .upload-section {
        padding: 0.8rem;
        border-radius: 10px;
    }
    
    /* Optimize score display */
    .score-display {
        padding: 1.5rem 1rem;
    }
    
    .score-text {
        font-size: 1.4rem;
    }
    
    .score-percentage {
        font-size: 1rem;
    }
    
    /* Compact review questions */
    .review-question {
        padding: 0.8rem;
        border-left-width: 3px;
    }
    
    .answer-item {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* Landscape orientation optimization for small devices */
@media (max-width: 600px) and (orientation: landscape) {
    .container {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .title {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .header {
        margin-bottom: 1rem;
    }
    
    .question-card {
        padding: 0.8rem;
        margin-bottom: 1rem;
    }
    
    .quiz-header {
        padding: 0.8rem;
        margin-bottom: 1rem;
    }
}