/* --- Core Variables & Reset --- */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    /* Modern soft gradient system */
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
    --gradient-glow: 0 10px 30px -10px rgba(139, 92, 246, 0.5);
    
    --radius-lg: 24px;
    --radius-md: 12px;
    --transition-smooth: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-secondary);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* --- Layout Architecture --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo span {
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 2rem;
    transition: var(--transition-smooth);
}

.nav-links a.active, .nav-links a:hover {
    color: var(--text-main);
}

.container {
    max-width: 1100px;
    width: 90%;
    margin: 3rem auto;
    flex: 1;
}

/* --- Views Management --- */
.view-section {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition-smooth);
}

.view-section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* --- Home / Upload View Design --- */
.hero-text {
    text-align: center;
    margin-bottom: 3rem;
}

.hero-text h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.gradient-text {
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-text p {
    color: var(--text-muted);
    font-size: 1.15rem;
    max-width: 600px;
    margin: 0 auto;
}

.input-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.05);
    border: 1px solid var(--border-color);
}

.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.tab-btn {
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem 1rem;
    position: relative;
    transition: var(--transition-smooth);
}

.tab-btn i {
    margin-right: 0.5rem;
}

.tab-btn.active {
    color: var(--text-main);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -14px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

/* Drag & Drop Zone */
.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    background: #fdfdfd;
    transition: var(--transition-smooth);
}

.dropzone:hover, .dropzone.dragover {
    border-color: #8b5cf6;
    background: #f5f3ff;
}

.drop-icon {
    font-size: 3rem;
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;
}

.dropzone h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.dropzone p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.file-display {
    margin-top: 1rem;
    padding: 1rem;
    background: #f1f5f9;
    border-radius: var(--radius-md);
    font-weight: 500;
    color: #334155;
    animation: fadeIn 0.3s ease;
}

textarea {
    width: 100%;
    height: 250px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    resize: none;
    font-size: 1rem;
    outline: none;
    transition: var(--transition-smooth);
}

textarea:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.generation-settings {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    gap: 1.5rem;
    flex-wrap: wrap;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

select {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    outline: none;
    cursor: pointer;
    background: white;
}

/* --- UI Controls & Buttons --- */
.btn {
    padding: 0.85rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
}

.btn-glow {
    box-shadow: var(--gradient-glow);
}

.btn-glow:hover {
    box-shadow: 0 15px 35px -5px rgba(139, 92, 246, 0.7);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Quiz Play Arena --- */
.quiz-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 3rem;
    box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.05);
    border: 1px solid var(--border-color);
}

.progress-container {
    margin-bottom: 2.5rem;
}

.progress-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.progress-bar-bg {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-primary);
    border-radius: 4px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.question-text {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    line-height: 1.4;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 3rem;
}

.option-node {
    padding: 1.25rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.option-node:hover:not(.disabled) {
    border-color: #8b5cf6;
    background: #fdfcff;
}

.option-node.selected {
    border-color: #3b82f6;
    background: #eff6ff;
}

.option-node.correct {
    border-color: #10b981;
    background: #ecfdf5;
    color: #065f46;
}

.option-node.incorrect {
    border-color: #ef4444;
    background: #fef2f2;
    color: #991b1b;
}

.quiz-footer {
    display: flex;
    justify-content: flex-end;
}

/* --- Analytics & Dashboard Results --- */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
}

.result-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 3rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.05);
}

.score-summary {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.feedback-badge {
    margin-bottom: 1rem;
}

.animated-badge {
    font-size: 3.5rem;
    color: #eab308;
    animation: float 3s ease-in-out infinite;
}

.score-summary h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.score-summary p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.score-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    box-shadow: var(--gradient-glow);
}

#score-percentage {
    color: white;
    font-size: 2.5rem;
    font-weight: 800;
}

.score-fraction {
    font-weight: 600;
    color: var(--text-main);
}

.metrics-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.metric-item {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.color-gradient {
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.action-zone {
    display: flex;
    gap: 1rem;
}

.action-zone .btn {
    flex: 1;
    justify-content: center;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: white;
    padding: 1rem 2rem;
    border-radius: 30px;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    transition: var(--transition-smooth);
    opacity: 0;
    z-index: 1000;
}

.toast.show {
    bottom: 30px;
    opacity: 1;
}

/* --- Micro-Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.icon-bounce:hover {
    animation: bounce 0.5s ease infinite alternate;
}

.icon-pulse:hover {
    animation: pulse 1s infinite;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-4px); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* --- Responsive Adaptations --- */
@media (max-width: 900px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .hero-text h1 {
        font-size: 2.2rem;
    }
    
    .input-card, .quiz-card, .result-card {
        padding: 1.5rem;
    }
    
    .generation-settings {
        flex-direction: column;
        align-items: stretch;
    }
    
    .generation-settings .btn {
        width: 100%;
        justify-content: center;
    }
    
    .action-zone {
        flex-direction: column;
    }



}