/* ==========================================
   QuizLab - CSS Stylesheet
   Modern, Responsive Design with Animations
   ========================================== */

/* ==========================================
   CSS Variables & Reset
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #FF6B35;
    --secondary: #004E89;
    --accent: #FFD23F;
    --dark: #1A1A2E;
    --light: #F8F9FA;
    --success: #06D6A0;
    --danger: #EF476F;
    --card-bg: #FFFFFF;
    --shadow: rgba(0, 78, 137, 0.1);
}

/* ==========================================
   Base Styles
   ========================================== */
body {
    font-family: 'DM Sans', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 107, 53, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 210, 63, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(0, 78, 137, 0.1) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

/* ==========================================
   Container & Layout
   ========================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* ==========================================
   Header
   ========================================== */
header {
    text-align: center;
    margin-bottom: 3rem;
    animation: slideDown 0.6s ease-out;
}

h1 {
    font-family: 'Righteous', cursive;
    font-size: 4rem;
    color: var(--light);
    text-shadow: 4px 4px 0 var(--primary), 8px 8px 0 var(--secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--accent);
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

/* ==========================================
   Mode Selection Cards
   ========================================== */
.mode-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
    animation: fadeIn 0.8s ease-out 0.2s both;
}

.mode-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px var(--shadow);
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.mode-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.mode-card:hover::before {
    transform: scaleX(1);
}

.mode-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 60px rgba(0, 78, 137, 0.2);
    border-color: var(--primary);
}

.mode-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    display: block;
}

.mode-card h2 {
    font-family: 'Righteous', cursive;
    font-size: 2rem;
    color: var(--secondary);
    margin-bottom: 0.8rem;
}

.mode-card p {
    color: #666;
    line-height: 1.6;
    font-size: 1rem;
}

/* ==========================================
   Main Content Area
   ========================================== */
.main-content {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.6s ease-out;
    display: none;
}

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

.hidden {
    display: none !important;
}

/* ==========================================
   Buttons
   ========================================== */
.back-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255, 107, 53, 0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), #0066aa);
}

.btn-secondary:hover {
    box-shadow: 0 10px 30px rgba(0, 78, 137, 0.5);
}

.btn-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.copy-btn {
    background: var(--accent);
    color: var(--dark);
}

.copy-btn:hover {
    background: #ffd700;
}

.remove-question {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.remove-question:hover {
    background: #d63754;
    transform: scale(1.05);
}

/* ==========================================
   Section Titles
   ========================================== */
.section-title {
    font-family: 'Righteous', cursive;
    font-size: 2.5rem;
    color: var(--secondary);
    margin-bottom: 2rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
}

/* ==========================================
   Form Elements
   ========================================== */
.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--secondary);
    font-size: 1rem;
}

.input-group input,
.input-group textarea,
.input-group select {
    width: 100%;
    padding: 1rem;
    border: 2px solid #E0E0E0;
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.3s ease;
    background: #F8F9FA;
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* ==========================================
   Question Block
   ========================================== */
.question-block {
    background: #F8F9FA;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    border-left: 5px solid var(--primary);
    animation: slideIn 0.3s ease-out;
}

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

.question-number {
    font-family: 'Righteous', cursive;
    font-size: 1.5rem;
    color: var(--primary);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.option-input {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.option-input input[type="radio"] {
    width: auto;
    accent-color: var(--success);
}

/* ==========================================
   Quiz Cards
   ========================================== */
.quiz-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-left: 5px solid var(--secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.quiz-card:hover {
    transform: translateX(10px);
    box-shadow: 0 6px 25px rgba(0,0,0,0.12);
}

.quiz-card h3 {
    font-family: 'Righteous', cursive;
    color: var(--secondary);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* ==========================================
   Quiz Link Container
   ========================================== */
.quiz-link-container {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 15px;
    padding: 2rem;
    margin-top: 2rem;
    color: white;
    animation: pulse 2s ease-in-out infinite;
}

.quiz-link-container h3 {
    font-family: 'Righteous', cursive;
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.link-display {
    background: white;
    color: var(--dark);
    padding: 1rem;
    border-radius: 10px;
    font-family: monospace;
    word-break: break-all;
    margin-bottom: 1rem;
    font-size: 1rem;
    border: 3px solid var(--accent);
}

/* ==========================================
   Student Quiz Interface
   ========================================== */
.student-quiz-view {
    max-width: 800px;
    margin: 0 auto;
}

.question-display {
    background: white;
    border-radius: 20px;
    padding: 3rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.question-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.answer-option {
    background: #F8F9FA;
    border: 3px solid #E0E0E0;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.answer-option:hover {
    background: white;
    border-color: var(--primary);
    transform: translateX(10px);
}

.answer-option.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.02);
}

.answer-option.correct {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.answer-option.incorrect {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* ==========================================
   Progress Bar
   ========================================== */
.progress-bar {
    background: #E0E0E0;
    border-radius: 50px;
    height: 12px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary), var(--accent));
    height: 100%;
    border-radius: 50px;
    transition: width 0.5s ease;
}

/* ==========================================
   Score Display
   ========================================== */
.score-display {
    text-align: center;
    padding: 3rem;
    background: linear-gradient(135deg, var(--success), #04aa7d);
    border-radius: 20px;
    color: white;
}

.score-display h2 {
    font-family: 'Righteous', cursive;
    font-size: 3rem;
    margin-bottom: 1rem;
}

.score-number {
    font-size: 5rem;
    font-weight: 700;
    margin: 1rem 0;
    text-shadow: 3px 3px 0 rgba(0,0,0,0.2);
}

/* ==========================================
   Timer
   ========================================== */
.timer {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--card-bg);
    padding: 1.5rem 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 100;
    animation: float 3s ease-in-out infinite;
}

.timer-label {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.timer-value {
    font-family: 'Righteous', cursive;
    font-size: 2.5rem;
    color: var(--primary);
    margin-top: 0.5rem;
}

/* ==========================================
   Leaderboard
   ========================================== */
.participants-count {
    background: var(--accent);
    color: var(--dark);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    display: inline-block;
    margin-top: 1rem;
}

.leaderboard {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    margin-top: 2rem;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #E0E0E0;
    align-items: center;
}

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

.rank {
    font-family: 'Righteous', cursive;
    font-size: 1.5rem;
    color: var(--primary);
    min-width: 50px;
}

.participant-name {
    flex: 1;
    font-weight: 600;
    color: var(--secondary);
}

.participant-score {
    font-weight: 700;
    color: var(--success);
    font-size: 1.2rem;
}

/* ==========================================
   Empty State
   ========================================== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}

.empty-state-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ==========================================
   Animations
   ========================================== */
@keyframes float {
    0%, 100% { 
        transform: translate(0, 0) rotate(0deg); 
    }
    33% { 
        transform: translate(30px, -50px) rotate(5deg); 
    }
    66% { 
        transform: translate(-20px, 20px) rotate(-5deg); 
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(240, 147, 251, 0.7); 
    }
    50% { 
        box-shadow: 0 0 0 20px rgba(240, 147, 251, 0); 
    }
}

/* ==========================================
   Responsive Design
   ========================================== */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
        text-shadow: 2px 2px 0 var(--primary), 4px 4px 0 var(--secondary);
    }

    .mode-selector {
        grid-template-columns: 1fr;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .timer {
        top: 1rem;
        right: 1rem;
        padding: 1rem;
    }

    .timer-value {
        font-size: 1.8rem;
    }

    .main-content {
        padding: 1.5rem;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .section-title {
        font-size: 2rem;
    }

    .score-number {
        font-size: 3.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .mode-card {
        padding: 1.5rem;
    }

    .mode-icon {
        font-size: 2.5rem;
    }

    .mode-card h2 {
        font-size: 1.5rem;
    }

    .question-display {
        padding: 1.5rem;
    }

    .question-text {
        font-size: 1.2rem;
    }
}
