/* =========================================================
   SMART QUIZ - CSS Styles
   A student coding project
========================================================= */

/* --- Variables --- */
:root {
    --bg-gradient: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    --card-bg: #ffffff;
    --primary-color: #6a5acd;
    --primary-hover: #5a4bba;
    --text-main: #333333;
    --text-muted: #666666;
    
    --science-color: #4CAF50;
    --math-color: #FF9800;
    --computer-color: #2196F3;
    --gk-color: #9C27B0;

    --correct-color: #4CAF50;
    --wrong-color: #F44336;
    --warning-color: #FFC107;
    
    --shadow-sm: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-md: 0 10px 20px rgba(0,0,0,0.15);
    --border-radius: 16px;
    --transition: all 0.3s ease;
}

/* --- Global Reset & Basics --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-main);
    overflow-x: hidden;
}

#app-container {
    width: 100%;
    max-width: 800px;
    min-height: 90vh;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    margin: 20px;
}

/* --- Screen Management --- */
.screen {
    display: none;
    padding: 40px;
    text-align: center;
    animation: fadeIn 0.5s ease;
    height: 100%;
    flex-direction: column;
    justify-content: center;
}

.screen.active {
    display: flex;
}

.hidden {
    display: none !important;
}

/* --- Typography --- */
h1, h2, h3, h4 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.main-title {
    font-size: 3rem;
    font-weight: 900;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.1);
    margin-top: 20px;
}

.subtitle {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.description {
    font-size: 1.2rem;
    margin: 20px 0;
}

.small-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* --- Buttons --- */
.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    font-family: inherit;
    margin-top: 20px;
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.primary-btn:active {
    transform: translateY(1px);
}

.primary-btn.disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- Illustrations & Icons --- */
.illustration {
    position: relative;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.floating-icon {
    font-size: 3rem;
    animation: float 3s ease-in-out infinite;
}

.icon-1 { animation-delay: 0s; }
.icon-2 { animation-delay: 0.5s; }
.icon-3 { animation-delay: 1s; }
.icon-4 { animation-delay: 1.5s; }

/* --- Inputs --- */
.input-group {
    margin: 30px 0;
}

.input-group label {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.input-group input {
    width: 80%;
    max-width: 300px;
    padding: 15px;
    font-size: 1.2rem;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    text-align: center;
    font-family: inherit;
    transition: var(--transition);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(106, 90, 205, 0.2);
}

/* --- Grid & Cards --- */
.cards-grid, .settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.subject-card, .setting-card {
    background: var(--card-bg);
    border: 2px solid #eee;
    border-radius: var(--border-radius);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    box-shadow: var(--shadow-sm);
}

.subject-card:hover, .setting-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.subject-card.selected, .setting-card.selected {
    border-color: var(--primary-color);
    background: rgba(106, 90, 205, 0.05);
    animation: selectPulse 0.3s ease;
}

.card-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
    transition: var(--transition);
}

.subject-card:hover .card-icon {
    transform: scale(1.1);
}

.indicator {
    font-size: 1.5rem;
}

/* --- Quiz Screen Layout --- */
.progress-container {
    width: 100%;
    height: 10px;
    background: #eee;
    border-radius: 5px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.5s ease;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.subject-label {
    background: var(--primary-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.question-counter {
    font-weight: bold;
    color: var(--text-muted);
}

.quiz-stats {
    display: flex;
    justify-content: space-around;
    background: #f8f9fa;
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-box span {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.stat-box strong {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.streak-box.on-fire strong {
    color: #ff5722;
    animation: firePulse 1s infinite alternate;
}

/* --- Timer --- */
.timer-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.circular-timer {
    position: relative;
    width: 80px;
    height: 80px;
}

.circular-chart {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 250px;
}

.circle-bg {
    fill: none;
    stroke: #eee;
    stroke-width: 3.8;
}

.circle {
    fill: none;
    stroke-width: 3.8;
    stroke-linecap: round;
    stroke: var(--primary-color);
    transition: stroke-dasharray 1s linear, stroke 0.3s;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
}

.timer-text span {
    font-size: 0.5rem;
    color: var(--text-muted);
}

.timer-text strong {
    font-size: 1.2rem;
    color: var(--text-main);
}

.circle.warning { stroke: var(--warning-color); }
.circle.urgent { stroke: var(--wrong-color); animation: pulseUrgent 1s infinite; }

/* --- Question Indicators --- */
.question-indicators {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 20px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ddd;
    transition: var(--transition);
}

.dot.active {
    background: var(--primary-color);
    transform: scale(1.2);
}

.dot.completed {
    background: var(--correct-color);
}

.dot.wrong-completed {
    background: var(--wrong-color);
}

/* --- Powerups --- */
.powerups {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.power-btn {
    background: white;
    border: 2px solid #eee;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: var(--transition);
}

.power-btn:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: #ccc;
}

.power-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Question Card & Options --- */
.question-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow-sm);
    animation: slideIn 0.4s ease;
    margin-bottom: 20px;
    min-height: 250px;
    display: flex;
    flex-direction: column;
}

#question-text {
    font-size: 1.4rem;
    margin-bottom: 30px;
    color: var(--text-main);
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex-grow: 1;
}

.option-btn {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #eee;
    padding: 15px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.1rem;
    text-align: left;
    transition: var(--transition);
}

.option-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    background: rgba(106, 90, 205, 0.02);
    transform: translateX(5px);
}

.option-letter {
    background: #eee;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    margin-right: 15px;
    font-weight: bold;
}

/* Answer States */
.option-btn.correct {
    border-color: var(--correct-color);
    background: rgba(76, 175, 80, 0.1);
    animation: correctPulse 0.5s ease;
}

.option-btn.correct .option-letter {
    background: var(--correct-color);
    color: white;
}

.option-btn.wrong {
    border-color: var(--wrong-color);
    background: rgba(244, 67, 54, 0.1);
    animation: shake 0.4s ease;
}

.option-btn.wrong .option-letter {
    background: var(--wrong-color);
    color: white;
}

.option-btn:disabled {
    cursor: default;
}

/* --- Feedback Area --- */
.feedback-area {
    padding: 15px;
    border-radius: var(--border-radius);
    animation: fadeIn 0.3s ease;
}

#feedback-title {
    margin: 0 0 10px 0;
}

.feedback-area.correct h2 { color: var(--correct-color); }
.feedback-area.wrong h2 { color: var(--wrong-color); }
.feedback-area.skip h2 { color: var(--text-muted); }

#fun-fact-container {
    background: #fff9c4;
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    border-left: 5px solid #fbc02d;
    text-align: left;
}

#fun-fact-container h4 {
    margin: 0 0 5px 0;
    color: #f57f17;
}

/* --- Result Screen --- */
.trophy-container {
    height: 100px;
    margin: 20px 0;
}

.trophy {
    font-size: 5rem;
    animation: slideUpTrophy 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transform: translateY(50px);
    opacity: 0;
}

.trophy.bounce {
    animation: slideUpTrophy 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, float 2s infinite ease-in-out 1s;
}

.result-message {
    font-size: 2rem;
    margin-bottom: 5px;
}

#result-submessage {
    margin-bottom: 30px;
    font-size: 1.2rem;
    color: var(--text-muted);
}

.result-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}
@media (min-width: 600px) {
    .result-grid { grid-template-columns: repeat(4, 1fr); }
}

.result-item {
    display: flex;
    flex-direction: column;
    background: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

.result-item span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.result-item strong {
    font-size: 1.4rem;
    color: var(--primary-color);
}

/* Dashboards & Progress */
.two-col-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
    text-align: left;
}
@media (min-width: 700px) {
    .two-col-layout { grid-template-columns: 1fr 1fr; }
}

.dashboard-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    text-align: left;
}

.dashboard-card h3 {
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.progress-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.progress-row > span:first-child {
    width: 100px;
}

.mini-progress-bar {
    flex-grow: 1;
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    margin: 0 10px;
    overflow: hidden;
}

.mini-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 1s ease-out;
}

/* History */
.history-title {
    margin-top: 20px;
    font-size: 1rem;
    color: var(--text-muted);
}
.history-list {
    list-style: none;
    font-size: 0.9rem;
}
.history-list li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
}

/* Achievements */
.badges-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 30px;
}
.badge {
    background: #eee;
    padding: 10px 15px;
    border-radius: 20px;
    opacity: 0.5;
    filter: grayscale(1);
    transition: var(--transition);
    font-size: 0.9rem;
}
.badge.unlocked {
    opacity: 1;
    filter: grayscale(0);
    background: #fff3e0;
    border: 1px solid #ffb74d;
    color: #e65100;
    animation: selectPulse 0.5s ease;
}

/* Daily Challenge */
.challenge-progress {
    width: 100%;
    height: 15px;
    background: #e0e0e0;
    border-radius: 10px;
    margin: 10px 0;
    overflow: hidden;
}
.challenge-fill {
    height: 100%;
    background: #4CAF50;
    transition: width 0.5s ease;
}
.challenge-text {
    font-weight: bold;
    text-align: right;
}

/* Fun Buttons */
.fun-buttons, .dev-buttons {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}
.fun-btn, .dev-btn {
    padding: 8px 15px;
    border: 2px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}
.fun-btn:hover, .dev-btn:hover {
    background: var(--primary-color);
    color: white;
}

#fun-q-feedback {
    color: var(--correct-color);
    font-weight: bold;
    animation: fadeIn 0.5s ease;
}

.great-idea {
    color: var(--correct-color);
    font-weight: bold;
    font-size: 1.2rem;
}

/* Tips & Learned */
.tips-grid, .learned-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
@media (max-width: 500px) {
    .tips-grid, .learned-grid { grid-template-columns: 1fr; }
}
.tip {
    background: #e3f2fd;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    border-left: 4px solid #2196F3;
}
.learn-item {
    background: white;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    border: 1px solid #eee;
}
.learn-item strong {
    display: block;
    color: var(--primary-color);
}
.code-card pre {
    background: #2d2d2d;
    color: #ccc;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: monospace;
    margin-bottom: 10px;
}

/* --- Floating Points Animation --- */
#animation-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.floating-point {
    position: absolute;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--correct-color);
    animation: floatUp 1s ease forwards;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

@keyframes selectPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes firePulse {
    from { text-shadow: 0 0 5px #ff5722; }
    to { text-shadow: 0 0 15px #ff9800, 0 0 25px #ffeb3b; }
}

@keyframes pulseUrgent {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes correctPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(76, 175, 80, 0); }
    50% { transform: scale(1.02); box-shadow: 0 0 15px rgba(76, 175, 80, 0.5); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(76, 175, 80, 0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

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

@keyframes floatUp {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-50px) scale(1.5); opacity: 0; }
}

/* --- Responsive Adjustments --- */
@media (max-width: 600px) {
    #app-container { margin: 10px; min-height: 95vh; border-radius: 12px; }
    .screen { padding: 20px; }
    .main-title { font-size: 2.2rem; }
    .cards-grid, .settings-grid { grid-template-columns: 1fr; }
    .question-card { padding: 20px; }
    .option-btn { font-size: 1rem; padding: 10px; }
    .powerups { flex-wrap: wrap; }
}
