/* Flashcard Quiz Mode Styles */

/* Wordbank section header with quiz button */
.wordbank-section {
    margin: 30px 0;
}

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

.wordbank-header h2 {
    margin: 0;
    flex: 1;
}

.wordbank-header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quiz-button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.quiz-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.quiz-button:active {
    transform: translateY(0);
}

.quiz-settings-external-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-settings-external-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.quiz-settings-external-btn:active {
    transform: translateY(0);
}

/* Quiz overlay - full screen */
.quiz-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

/* Mobile: Adjust for keyboard */
.quiz-overlay.mobile-keyboard-active {
    align-items: flex-start;
    padding: 10px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.quiz-container {
    width: 100%;
    max-width: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideUp 0.3s ease;
    position: relative;
    transition: max-height 0.3s ease;
}

/* Mobile: Fixed height when keyboard is active */
.quiz-overlay.mobile-keyboard-active .quiz-container {
    max-height: var(--available-height, 50vh);
    overflow-y: auto;
}

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

/* Quiz header */
.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    gap: 15px;
}

.quiz-progress {
    flex: 1;
}

.quiz-progress-text {
    font-size: 16px;
    font-weight: 600;
}

.quiz-settings-btn,
.quiz-close-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.quiz-settings-btn:hover,
.quiz-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.quiz-close-btn {
    font-size: 28px;
    line-height: 1;
}

/* Quiz content area */
.quiz-content {
    padding: 40px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile: Reduce min-height when keyboard is active */
.quiz-overlay.mobile-keyboard-active .quiz-content {
    min-height: 250px;
    padding: 20px;
}

/* Quiz card */
.quiz-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.quiz-card-image-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    flex-shrink: 0;
}

.quiz-card-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: block;
}

/* Mobile: Smaller image when keyboard is active */
.quiz-overlay.mobile-keyboard-active .quiz-card-image {
    height: 180px;
}

.quiz-card-translation {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    color: white;
    padding: 12px 20px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    border-radius: 12px 12px 0 0;
}

/* Input container */
.quiz-card-input-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.quiz-card-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 20px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
}

.quiz-card-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.quiz-card-input:disabled {
    background: #f7fafc;
    cursor: not-allowed;
}

/* Mobile: Keep input looking active when showing feedback */
.quiz-overlay.mobile-keyboard-active .quiz-card-input:disabled {
    background: white;
    cursor: text;
}

/* Feedback display - overlay on image */
.quiz-feedback {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-radius: 12px;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.quiz-feedback.show {
    opacity: 1;
    pointer-events: auto;
}

.quiz-feedback.correct {
    background: rgba(56, 161, 105, 0.95);
    backdrop-filter: blur(8px);
    animation: bounceIn 0.5s ease;
}

.quiz-feedback.incorrect {
    background: rgba(229, 62, 62, 0.95);
    backdrop-filter: blur(8px);
    animation: shakeIn 0.5s ease;
}

.quiz-feedback-icon {
    font-size: 64px;
    color: white;
}

.quiz-feedback-text {
    font-size: 24px;
    font-weight: 700;
    color: white;
}

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

@keyframes shakeIn {
    0% {
        opacity: 0;
        transform: translateX(0);
    }
    15% {
        opacity: 1;
        transform: translateX(-15px);
    }
    30% {
        transform: translateX(15px);
    }
    45% {
        transform: translateX(-10px);
    }
    60% {
        transform: translateX(10px);
    }
    75% {
        transform: translateX(-5px);
    }
    100% {
        transform: translateX(0);
    }
}

.quiz-correct-answer {
    font-size: 18px;
    font-weight: 600;
    color: white;
    text-align: center;
    max-width: 90%;
}

/* Settings panel - inside quiz overlay */
.quiz-settings-panel {
    position: absolute;
    top: 70px;
    left: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
    z-index: 10;
    animation: slideDown 0.3s ease;
}

/* Standalone settings modal */
.quiz-settings-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.quiz-settings-modal-container {
    width: 100%;
    max-width: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
    animation: slideUp 0.3s ease;
    position: relative;
}

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

.quiz-settings-modal-header h3 {
    margin: 0;
    color: #2d3748;
}

.quiz-settings-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #e2e8f0;
    color: #2d3748;
    border-radius: 8px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.quiz-settings-modal-close:hover {
    background: #cbd5e0;
    transform: scale(1.05);
}

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

.quiz-settings-panel h3 {
    margin: 0 0 20px 0;
    color: #2d3748;
}

.quiz-settings-option {
    margin-bottom: 20px;
}

.quiz-settings-option label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.quiz-settings-option input[type="number"] {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

.quiz-settings-option input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
}

.quiz-settings-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.quiz-reset-btn,
.quiz-settings-close-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-reset-btn {
    background: #fc8181;
    color: white;
}

.quiz-reset-btn:hover {
    background: #f56565;
    transform: translateY(-1px);
}

.quiz-settings-close-btn {
    background: #e2e8f0;
    color: #2d3748;
}

.quiz-settings-close-btn:hover {
    background: #cbd5e0;
    transform: translateY(-1px);
}

/* Completion screen */
.quiz-completion {
    text-align: center;
    padding: 40px 20px;
}

.quiz-completion-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: celebrate 0.6s ease;
}

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

.quiz-completion h2 {
    color: #2d3748;
    margin-bottom: 15px;
}

.quiz-completion p {
    color: #4a5568;
    font-size: 18px;
    margin-bottom: 30px;
}

.quiz-completion-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.quiz-restart-btn,
.quiz-next-batch-btn,
.quiz-finish-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.quiz-restart-btn:hover,
.quiz-next-batch-btn:hover,
.quiz-finish-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.quiz-finish-btn {
    background: linear-gradient(135deg, #a0aec0 0%, #718096 100%);
}

.quiz-finish-btn:hover {
    box-shadow: 0 6px 16px rgba(113, 128, 150, 0.4);
}

/* Responsive design */
@media (max-width: 768px) {
    .quiz-overlay {
        padding: 10px;
    }

    .quiz-container {
        max-width: 100%;
    }

    .quiz-content {
        padding: 20px;
        min-height: 300px;
    }

    .quiz-card-image {
        height: 200px;
    }

    .quiz-card-input {
        font-size: 18px;
        padding: 14px 16px;
    }

    .quiz-settings-panel {
        left: 10px;
        right: 10px;
        padding: 20px;
    }
}
