/* 
 * Premium UI System for Language Learning Games 
 * Extracted from Flashcards Quiz to provide a unified 'App' experience
 */

/* CSS Variables for Premium Consistency */
:root {
    --fc-bg: #f8fafc;
    --fc-card-bg: rgba(255, 255, 255, 0.95);
    --fc-primary: #1564C7;
    --fc-primary-hover: #1e40af;
    --fc-success: #10b981;
    --fc-success-bg: #dcfce7;
    --fc-danger: #ef4444;
    --fc-danger-bg: #fee2e2;
    --fc-warning: #f59e0b;
    --fc-warning-bg: #fef3c7;
    --fc-text-main: #0f172a;
    --fc-text-muted: #64748b;
    --fc-border: #e2e8f0;
    --fc-shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --fc-shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --fc-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --fc-radius: 16px;
    --fc-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Layout */
.game-container {
    max-width: 800px;
    margin: 2rem auto 4rem;
    padding: 0 1rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.game-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.game-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--fc-text-main);
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.text-highlight {
    color: var(--fc-primary);
    position: relative;
    display: inline-block;
}

.text-highlight::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 100%;
    height: 6px;
    background-color: var(--fc-primary);
    opacity: 0.2;
    border-radius: 4px;
}

.game-subtitle {
    font-size: 1.1rem;
    color: var(--fc-text-muted);
    font-weight: 500;
}

/* Glassmorphism Cards */
.card-glass {
    background: var(--fc-card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--fc-radius);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--fc-shadow-md);
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
}

.card-glass-hover {
    transition: var(--fc-transition);
}

.card-glass-hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--fc-shadow-hover);
    border-color: #cbd5e1;
}

/* Progress Bar */
.progress-container {
    margin-bottom: 2.5rem;
}

.progress-bar-wrapper {
    width: 100%;
    height: 8px;
    background-color: var(--fc-border);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, var(--fc-primary));
    border-radius: 999px;
    transition: width 0.5s ease-out;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
}

.progress-text {
    color: var(--fc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
}

.score-badge {
    background-color: #f1f5f9;
    color: var(--fc-text-main);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-weight: 700;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}

/* Question Area */
.question-zone {
    text-align: center;
    margin-bottom: 2.5rem;
}

.question-prompt {
    font-size: 1.1rem;
    color: var(--fc-text-muted);
    margin-bottom: 1rem;
}

.word-card {
    display: inline-block;
    padding: 1.5rem 3rem;
    background: linear-gradient(to bottom right, #ffffff, #f8fafc);
    border: 2px solid var(--fc-border);
    border-radius: 16px;
    box-shadow: var(--fc-shadow-sm);
    transform: translateY(0);
    transition: var(--fc-transition);
}

.word-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--fc-shadow-md);
    border-color: #cbd5e1;
}

.game-word {
    font-size: 3rem;
    font-weight: 900;
    color: var(--fc-text-main);
    margin: 0;
    letter-spacing: -0.025em;
    line-height: 1.2;
    word-break: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 640px) {
    .game-word {
        font-size: 2rem;
    }
    .word-card {
        padding: 1rem 1.5rem;
    }
    .game-title {
        font-size: 2rem;
    }
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .options-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.option-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--fc-text-main);
    background-color: white;
    border: 2px solid var(--fc-border);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: var(--fc-transition);
    box-shadow: var(--fc-shadow-sm);
    position: relative;
    overflow: hidden;
}

.option-btn:not(:disabled):hover {
    transform: translateY(-3px);
    box-shadow: var(--fc-shadow-md);
    border-color: var(--fc-primary);
    color: var(--fc-primary);
}

.option-btn:not(:disabled):active {
    transform: translateY(1px);
}

.option-text {
    z-index: 2;
}

.option-icon {
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Status Colors */
.option-correct {
    background-color: var(--fc-success-bg);
    border-color: var(--fc-success);
    color: #065f46;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
    z-index: 10;
}

.option-incorrect {
    background-color: var(--fc-danger-bg);
    border-color: var(--fc-danger);
    color: #991b1b;
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

.option-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f1f5f9;
}

/* Next Button */
.next-action {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px dashed var(--fc-border);
}

.btn-next {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--fc-text-main);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--fc-transition);
    box-shadow: var(--fc-shadow-md);
}

.btn-next:hover {
    background-color: #000;
    transform: translateY(-2px);
    box-shadow: var(--fc-shadow-hover);
}

.btn-next:active {
    transform: translateY(0);
}

/* Results Screen */
.game-result {
    text-align: center;
    padding: 4rem 2rem;
}

.result-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: bounce-in 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.result-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--fc-text-main);
    margin-bottom: 2rem;
}

.result-score-wrapper {
    margin-bottom: 2rem;
}

.result-score {
    display: inline-block;
    font-size: 5rem;
    font-weight: 900;
    line-height: 1;
    padding: 1rem 3rem;
    border-radius: 24px;
    background: #f8fafc;
    border: 4px solid;
    box-shadow: var(--fc-shadow-md);
}

.score-total {
    font-size: 2.5rem;
    color: var(--fc-text-muted);
    font-weight: 700;
}

.score-high { border-color: var(--fc-success); color: var(--fc-success); }
.score-med { border-color: #f59e0b; color: #f59e0b; }
.score-low { border-color: var(--fc-danger); color: var(--fc-danger); }

.result-message {
    font-size: 1.25rem;
    color: var(--fc-text-muted);
    font-weight: 500;
    margin-bottom: 3rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #2563eb, var(--fc-primary));
    color: white;
    border: none;
    padding: 1.1rem 3rem;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--fc-transition);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 25px -5px rgba(37, 99, 235, 0.4);
}

/* Inputs and Forms */
.game-input {
    width: 100%;
    padding: 1.25rem;
    font-size: 1.5rem;
    border: 2px solid var(--fc-border);
    border-radius: 12px;
    text-align: center;
    font-weight: 700;
    color: var(--fc-text-main);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
    transition: var(--fc-transition);
}

.game-input:focus {
    outline: none;
    border-color: var(--fc-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.game-input.is-invalid {
    border-color: var(--fc-danger);
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

/* Loading Spinner */
.game-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem;
    color: var(--fc-text-muted);
    font-weight: 600;
    font-size: 1.2rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e2e8f0;
    border-top-color: var(--fc-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

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

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pop-in {
    0% { transform: scale(0.5); opacity: 0; }
    80% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes bounce-in {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); opacity: 1; }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.animation-fade-in { animation: fade-in 0.4s ease-out forwards; }
.animation-fade-in-up { animation: fade-in-up 0.5s ease-out forwards; }

/* Responsive Adjustments */
@media (max-width: 640px) {
    .game-title { font-size: 2rem; }
    .card-glass { padding: 1.5rem; }
    .game-word { font-size: 2.2rem; }
    .word-card { padding: 1.25rem 2rem; }
    .option-btn { font-size: 1.05rem; padding: 1rem; }
    .result-score { font-size: 3.5rem; padding: 1rem 2rem; }
    .score-total { font-size: 1.8rem; }
    .game-input { font-size: 1.2rem; }
}
