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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #0055A4 0%, #ffffff 50%, #EF4135 100%);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0.5rem 1rem 1rem;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(90deg, 
            rgba(0, 85, 164, 0.1) 0%, 
            rgba(0, 85, 164, 0.1) 33.33%,
            rgba(255, 255, 255, 0.1) 33.33%, 
            rgba(255, 255, 255, 0.1) 66.66%,
            rgba(239, 65, 53, 0.1) 66.66%, 
            rgba(239, 65, 53, 0.1) 100%);
    pointer-events: none;
}

#app {
    width: 100%;
    max-width: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    border: 3px solid transparent;
    background-clip: padding-box;
}

#app::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, #0055A4, #ffffff, #EF4135, #0055A4);
    border-radius: 20px;
    z-index: -1;
    animation: borderGlow 3s ease-in-out infinite alternate;
}

@keyframes borderGlow {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Screen Management */
.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 80vh;
}

.screen.active {
    display: flex;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, #0055A4 0%, #ffffff 50%, #EF4135 100%);
    color: white;
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(90deg, 
            rgba(0, 85, 164, 0.95) 0%, 
            rgba(0, 85, 164, 0.95) 33.33%,
            rgba(0, 0, 0, 0.7) 33.33%, 
            rgba(0, 0, 0, 0.7) 66.66%,
            rgba(239, 65, 53, 0.95) 66.66%, 
            rgba(239, 65, 53, 0.95) 100%);
    z-index: 0;
}

header > * {
    position: relative;
    z-index: 1;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 4px 12px rgba(0, 0, 0, 0.6);
    position: relative;
    color: white;
}

/* French flag emojis for all headers (consistent structure) */
.header-content h1::before {
    content: '🇫🇷';
    position: absolute;
    left: -1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

.header-content h1::after {
    content: '🇫🇷';
    position: absolute;
    right: -1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

header p {
    font-size: 1rem;
    opacity: 1;
    margin-bottom: 0;
    color: white;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    font-weight: 500;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.header-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

/* Reset header padding now that actions moved out */
header { 
    padding-right: 2rem;
}

/* Progress Container */
.progress-container {
    width: 100%;
    max-width: 400px;
}

.progress-stats {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: white;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0055A4, #EF4135);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Main Content */
main {
    flex: 1;
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Upload Screen */
.upload-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
}

.upload-area {
    width: 100%;
    max-width: 400px;
    border: 3px dashed #0055A4;
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(0, 85, 164, 0.05), rgba(239, 65, 53, 0.05));
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(0, 85, 164, 0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.upload-area:hover::before,
.upload-area.dragover::before {
    transform: translateX(100%);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #EF4135;
    background: linear-gradient(135deg, rgba(0, 85, 164, 0.1), rgba(239, 65, 53, 0.1));
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 25px rgba(0, 85, 164, 0.2);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
    display: inline-block;
}

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

.upload-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #1e293b;
}

.upload-content p {
    color: #64748b;
    margin-bottom: 1rem;
}

.format-info {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0055A4 !important;
    text-shadow: 0 1px 2px rgba(0, 85, 164, 0.1);
}

.example-section {
    width: 100%;
    max-width: 400px;
}

.example-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #1e293b;
}

.example-section pre {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    margin-bottom: 2rem;
}

.sample-section {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(0, 85, 164, 0.05), rgba(239, 65, 53, 0.05));
    border: 2px dashed #0055A4;
    border-radius: 12px;
    margin-top: 1rem;
}

.sample-section h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #0055A4;
}

.sample-section p {
    color: #64748b;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

#use-sample-btn {
    background: linear-gradient(135deg, #0055A4, #EF4135);
    color: white;
    border: none;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
}

#use-sample-btn:hover {
    background: linear-gradient(135deg, #004080, #d63029);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 85, 164, 0.3);
}

/* Quiz Screen */
.quiz-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    padding-top: 0.5rem;
}

.question-section {
    text-align: center;
    width: 100%;
}

.question-section h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.75rem;
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
}

.instruction {
    font-size: 1.1rem;
    color: #64748b;
}

.answers-section {
    width: 100%;
    max-width: 500px;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.answer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.answer-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    min-height: 60px;
    position: relative;
    overflow: hidden;
}

.answer-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 85, 164, 0.1), transparent);
    transition: left 0.5s ease;
}

.answer-btn:hover::before {
    left: 100%;
}

.answer-btn:hover {
    border-color: #0055A4;
    background: linear-gradient(135deg, rgba(0, 85, 164, 0.05), rgba(239, 65, 53, 0.05));
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 85, 164, 0.15);
}

.answer-btn:focus {
    outline: none;
    border-color: #0055A4;
    box-shadow: 0 0 0 3px rgba(0, 85, 164, 0.1);
}

.answer-btn.correct {
    border-color: #22c55e;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05));
    color: #166534;
    animation: correctGlow 0.6s ease-out;
}

.answer-btn.incorrect {
    border-color: #EF4135;
    background: linear-gradient(135deg, rgba(239, 65, 53, 0.1), rgba(239, 65, 53, 0.05));
    color: #EF4135;
    animation: incorrectShake 0.6s ease-out;
}

@keyframes correctGlow {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.answer-btn.disabled {
    pointer-events: none;
    opacity: 0.7;
}

.answer-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, #0055A4, #EF4135);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.answer-number::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.answer-btn:hover .answer-number::before {
    left: 100%;
}

.answer-btn.correct .answer-number {
    background: #22c55e;
    animation: numberPulse 0.6s ease-out;
}

.answer-btn.incorrect .answer-number {
    background: #EF4135;
    animation: numberShake 0.6s ease-out;
}

@keyframes numberPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes numberShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

/* Feedback Section */
.feedback-section {
    width: 100%;
    max-width: 400px;
    text-align: center;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.feedback-icon {
    display: none;
}

.feedback-text {
    display: none;
}

/* Completion Screen */
.completion-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.completion-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: celebration 2s ease-in-out infinite;
    display: inline-block;
}

@keyframes celebration {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    50% { transform: scale(1.2) rotate(0deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

.completion-container h2 {
    font-size: 1.8rem;
    color: #1e293b;
    margin-bottom: 1rem;
}

.completion-container p {
    font-size: 1.1rem;
    color: #64748b;
    margin-bottom: 2rem;
}

.completion-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 300px;
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 120px;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #0055A4, #EF4135);
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #004080, #d63029);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 85, 164, 0.3);
}

.btn-secondary {
    background: white;
    color: #0055A4;
    border: 2px solid #0055A4;
    position: relative;
    overflow: hidden;
}

.btn-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 85, 164, 0.1), transparent);
    transition: left 0.5s ease;
}

.btn-secondary:hover::before {
    left: 100%;
}

.btn-secondary:hover {
    background: #0055A4;
    color: white;
    border-color: #0055A4;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 85, 164, 0.2);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal[hidden] {
    display: none !important;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #1e293b;
}

.modal-content p {
    margin-bottom: 2rem;
    color: #64748b;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Header Action Buttons */
#flip-mode-btn,
#reset-btn {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    min-width: auto;
    background: rgba(255, 255, 255, 0.9);
    color: #0055A4;
    border: 2px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10;
    border-radius: 12px;
}

#flip-mode-btn:hover,
#reset-btn:hover {
    background: white;
    color: #0055A4;
    border-color: white;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

#flip-mode-btn {
    font-weight: 600;
    transition: all 0.3s ease;
}

#flip-mode-btn.active {
    background: linear-gradient(135deg, #0055A4, #EF4135);
    color: white;
    border-color: rgba(255, 255, 255, 0.9);
}

/* Responsive Design */
@media (min-width: 768px) {
    body {
        padding: 2rem;
    }
    
    #app {
        min-height: 70vh;
    }
    
    .screen {
        min-height: 70vh;
    }
    
    header {
        padding: 2.5rem 2rem 2rem;
    }
    
    header h1 {
        font-size: 2.2rem;
    }
    
    main {
        padding: 3rem 2rem;
    }
    
    .answer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .question-section h2 {
        font-size: 3rem;
    }
    
    .completion-actions {
        flex-direction: row;
        max-width: none;
    }
}

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

@media (min-width: 1024px) {
    #app {
        max-width: 800px;
    }
    
    .answer-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 600px;
    }
}

/* 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 */
.btn:focus-visible,
.answer-btn:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .answer-btn {
        border-width: 3px;
    }
} 

/* Footer Controls */
#footer-controls {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: center;
    pointer-events: none; /* allow inner to manage clicks */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Show footer controls when quiz or completion screen is active */
body:has(#quiz-screen.active) #footer-controls,
body:has(#completion-screen.active) #footer-controls {
    opacity: 1;
    visibility: visible;
}

#footer-controls .footer-inner {
    pointer-events: all;
    display: flex;
    gap: 0.75rem;
    background: rgba(255,255,255,0.85);
    border: 2px solid rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    padding: 0.5rem 0.75rem;
    border-radius: 14px;
}

#footer-controls .btn {
    min-width: 110px;
} 