/* ========================================
   CCNP ENCOR Study Game - Premium Styles
   ======================================== */

/* Color Palette */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-dark: #5a67d8;
    --primary-light: #7c3aed;
    --success: #10b981;
    --success-light: #34d399;
    --error: #ef4444;
    --error-light: #f87171;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: rgba(0, 0, 0, 0.3);

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    background-image:
        radial-gradient(at 27% 37%, hsla(215, 98%, 61%, 0.2) 0px, transparent 50%),
        radial-gradient(at 97% 21%, hsla(125, 98%, 72%, 0.1) 0px, transparent 50%),
        radial-gradient(at 52% 99%, hsla(354, 98%, 61%, 0.1) 0px, transparent 50%),
        radial-gradient(at 10% 29%, hsla(256, 96%, 67%, 0.2) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    animation: fadeIn var(--transition-normal);
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Screen */
#loading-screen .loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 2rem;
}

.loader {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 3rem;
}

.app-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.app-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Score Card */
.score-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 20px 40px var(--shadow);
    transition: transform var(--transition-fast);
}

.score-card:hover {
    transform: translateY(-2px);
}

.score-content {
    flex: 1;
}

.score-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.score-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.score-percentage {
    font-size: 1.25rem;
    color: var(--success);
    font-weight: 600;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-reset {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.6);
}

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

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.btn-reset {
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
}

.btn-reset:hover {
    background: var(--error);
    color: white;
    transform: scale(1.05);
}

/* Section Selector Card */
.section-selector-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 60px var(--shadow);
}

.section-selector-card h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.helper-text {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Section List */
.section-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.section-list::-webkit-scrollbar {
    width: 6px;
}

.section-list::-webkit-scrollbar-track {
    background: var(--bg-glass);
    border-radius: 10px;
}

.section-list::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
}

/* Section Item */
.section-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.section-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.section-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--primary-light);
}

.section-item label {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.section-name {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--text-primary);
}

.question-count {
    font-size: 0.875rem;
    color: var(--text-muted);
    background: var(--bg-glass);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

/* Gameplay Screen */
.gameplay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.score-display-small {
    font-size: 1.125rem;
    font-weight: 600;
    background: var(--bg-card);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

/* Progress Bar */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-glass);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 10px;
    transition: width var(--transition-normal);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6);
}

/* Question Info */
.question-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.question-counter {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.section-badge {
    background: var(--primary-gradient);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Question Card */
.question-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px var(--shadow);
}

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

/* Options List */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.option-btn {
    width: 100%;
    padding: 1.25rem 1.5rem;
    background: var(--bg-glass);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    min-height: 56px;
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-light);
    transform: translateX(8px);
}

/* Feedback Screen */
.feedback-overlay {
    max-width: 800px;
    margin: 10rem auto;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 20px 60px var(--shadow);
    text-align: center;
}

.feedback-content {
    margin-bottom: 2rem;
}

.feedback-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 1.5rem;
    font-weight: bold;
}

.feedback-correct .feedback-icon {
    background: var(--success);
    color: white;
    animation: scaleIn 0.5s ease;
}

.feedback-incorrect .feedback-icon {
    background: var(--error);
    color: white;
    animation: shake 0.5s ease;
}

.feedback-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.feedback-correct h2 {
    color: var(--success-light);
}

.feedback-incorrect h2 {
    color: var(--error-light);
}

.feedback-content p {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.correct-answer {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-glass);
    border-left: 4px solid var(--success);
    border-radius: 8px;
    text-align: left;
}

.correct-answer .label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.correct-answer .answer {
    display: block;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--success-light);
}

/* Celebration Animation */
.celebration-animation {
    position: relative;
    height: 60px;
    margin-bottom: 1rem;
}

.confetti {
    position: absolute;
    font-size: 2rem;
    animation: confettiFall 1.5s ease-out infinite;
}

.confetti:nth-child(1) {
    left: 20%;
    animation-delay: 0s;
}

.confetti:nth-child(2) {
    left: 40%;
    animation-delay: 0.2s;
}

.confetti:nth-child(3) {
    left: 60%;
    animation-delay: 0.4s;
}

.confetti:nth-child(4) {
    left: 80%;
    animation-delay: 0.6s;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(60px) rotate(360deg);
        opacity: 0;
    }
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

/* Round Complete Screen */
.completion-card {
    max-width: 700px;
    margin: 5rem auto;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 20px 60px var(--shadow);
    text-align: center;
}

.celebration-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

.completion-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
}

.stat-card.wide {
    grid-column: 1 / -1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
    }

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

    .score-card {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

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

    .question-card {
        padding: 1.5rem;
    }

    .feedback-overlay,
    .completion-card {
        margin: 3rem auto;
        padding: 2rem;
    }

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

    .stat-card.wide {
        grid-column: 1;
    }

    #exit-round-btn {
        font-size: 0.875rem;
        padding: 0.625rem 1rem;
    }
}

@media (max-width: 480px) {
    .app-title {
        font-size: 1.75rem;
    }

    .app-subtitle {
        font-size: 1rem;
    }

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

    .option-btn {
        font-size: 1rem;
        padding: 1rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles for Keyboard Navigation */
button:focus-visible,
input:focus-visible {
    outline: 3px solid var(--primary-light);
    outline-offset: 2px;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    opacity: 0.7;
    margin-top: 2rem;
}

.start-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.start-buttons button {
    flex: 1;
}

:root {
    --secondary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Feedback Options Styles - Added for Question Display */
.feedback-options-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    text-align: left;
}

.option-btn.correct {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
    color: var(--success-light);
    cursor: default;
    transform: none !important;
}

.option-btn.incorrect {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--error);
    color: var(--error-light);
    cursor: default;
    transform: none !important;
}

.option-btn.neutral {
    background: var(--bg-glass);
    border-color: transparent;
    opacity: 0.5;
    cursor: default;
    transform: none !important;
}

.option-btn.neutral:hover,
.option-btn.correct:hover,
.option-btn.incorrect:hover {
    background: inherit;
    border-color: inherit;
    /* Keep original border color */
    transform: none;
}