* {
    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;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.main-content {
    padding: 30px;
}

.tabs {
    display: flex;
    background: #f8fafc;
    border-radius: 10px;
    padding: 5px;
    margin-bottom: 30px;
}

.tab {
    flex: 1;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 600;
}

.tab.active {
    background: #4f46e5;
    color: white;
}

.tab:hover:not(.active) {
    background: #e2e8f0;
}

.tab-content {
    display: none;
}

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

.upload-section {
    border: 3px dashed #cbd5e1;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    margin-bottom: 30px;
}

.upload-section:hover {
    border-color: #4f46e5;
    background: #f8fafc;
}

.upload-section.dragover {
    border-color: #4f46e5;
    background: #ede9fe;
}

.upload-icon {
    font-size: 3em;
    color: #94a3b8;
    margin-bottom: 20px;
}

.upload-text {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: #64748b;
}

.file-input {
    display: none;
}

.upload-btn {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    margin-right: 10px;
    transition: background 0.3s ease;
}

.upload-btn:hover {
    background: #4338ca;
}

.text-input {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1em;
    resize: vertical;
    margin-bottom: 20px;
}

.text-input:focus {
    outline: none;
    border-color: #4f46e5;
}

.generate-btn {
    background: #059669;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: background 0.3s ease;
}

.generate-btn:hover {
    background: #047857;
}

.generate-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.flashcard-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.flashcard {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    position: relative;
    min-height: 250px;
}

.flashcard:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.flashcard.flipped .flashcard-front {
    transform: rotateY(-180deg);
}

.flashcard.flipped .flashcard-back {
    transform: rotateY(0deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    transition: transform 0.6s ease;
    padding: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.flashcard-back {
    transform: rotateY(180deg);
    background: #f8fafc;
}

.flashcard h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #1e293b;
}

.flashcard p {
    font-size: 1em;
    line-height: 1.6;
    color: #475569;
}

.activity-container {
    margin-top: 30px;
}

.activity-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.activity-title {
    font-size: 1.4em;
    margin-bottom: 20px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.quiz-question {
    font-size: 1.1em;
    margin-bottom: 20px;
    color: #374151;
}

.quiz-options {
    list-style: none;
    margin-bottom: 20px;
}

.quiz-option {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quiz-option:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.quiz-option.selected {
    background: #ddd6fe;
    border-color: #7c3aed;
}

.quiz-option.correct {
    background: #dcfce7;
    border-color: #16a34a;
}

.quiz-option.incorrect {
    background: #fee2e2;
    border-color: #dc2626;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    margin: 20px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #059669, #10b981);
    transition: width 0.3s ease;
    border-radius: 5px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    color: #4f46e5;
    margin-bottom: 5px;
}

.stat-label {
    color: #64748b;
    font-size: 0.9em;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #4f46e5;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.empty-state {
    text-align: center;
    padding: 60px;
    color: #64748b;
}

.empty-state i {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.btn-secondary {
    background: #6b7280;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    margin: 5px;
    transition: background 0.3s ease;
}

.btn-secondary:hover {
    background: #4b5563;
}

.activity-header {
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:12px;
}
.activity-header h2 { margin:0; font-size:1.25rem; color:#1f2937; }
.activity-count { color:#6b7280; font-size:0.9rem; }

.activity-card {
    background: #fff;
    border-radius:10px;
    padding:14px;
    box-shadow: 0 2px 6px rgba(15,23,42,0.06);
    margin-bottom:12px;
    border: 1px solid #e6eef8;
}

.activity-q { display:flex; gap:12px; align-items:flex-start; margin-bottom:12px; }
.q-number {
    background: linear-gradient(90deg,#667eea,#764ba2);
    color:#fff; width:36px; height:36px; border-radius:8px;
    display:flex; align-items:center; justify-content:center; font-weight:700;
}
.q-text { color:#0f172a; font-weight:600; }

.opts-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; }
.opt {
    display:flex; align-items:center; gap:10px;
    padding:10px; border-radius:8px; border:1px solid #e6eef8; background:#f8fafc;
    cursor:pointer; transition:all .15s ease; text-align:left;
}
.opt:hover { transform:translateY(-2px); box-shadow:0 6px 18px rgba(102,126,234,0.06); }
.opt:disabled { opacity:0.7; cursor:default; transform:none; }
.opt-letter {
    width:34px; height:34px; border-radius:6px; background:#eef2ff; color:#3730a3;
    display:flex; align-items:center; justify-content:center; font-weight:700;
}
.opt-text { flex:1; color:#0f172a; }

.opt.selected { box-shadow:0 6px 18px rgba(99,102,241,0.08); border-color:#6366f1; }
.opt-correct { border-color:#48bb78; background:#f0fff4; }
.opt-incorrect { border-color:#f56565; background:#fff5f5; }

.act-feedback { margin-top:10px; font-size:0.95rem; color:#0f172a; }
.act-feedback .fb.correct { color:#065f46; }
.act-feedback .fb.incorrect { color:#7f1d1d; }
.act-feedback .exp { margin-top:8px; color:#374151; font-size:0.9rem; }


@media (max-width: 768px) {
    .main-content {
        padding: 20px;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .flashcard-container {
        grid-template-columns: 1fr;
    }
}