/**
 * Build a Sentence Styles
 * 
 * Le Labo-inspired design for TOEFL 2026 Build a Sentence interactive tasks.
 * Matches PrepEx design standards with cream backgrounds, green accents.
 */

/* Container */
.build-sentence-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 1.5rem;
}

.build-sentence-header h2 {
    color: var(--text-primary, #1A1816);
    margin-bottom: 0.5rem;
}

.build-sentence-header p {
    color: var(--text-secondary, #9E9689);
    line-height: 1.6;
}

/* Context Sentence Card */
.context-sentence-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(99, 102, 241, 0.08));
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
}

.context-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: #2563eb;
    margin-bottom: 0.5rem;
}

.context-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-primary, #1A1816);
    font-weight: 500;
}

/* Task Instruction Card */
.task-instruction-card {
    background: linear-gradient(135deg, rgba(92, 111, 92, 0.05), rgba(92, 111, 92, 0.08));
    border: 2px solid rgba(92, 111, 92, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
}

.task-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--primary, #5C6F5C);
    margin-bottom: 0.75rem;
}

.incomplete-sentence {
    font-size: 1.1rem;
    line-height: 2;
    color: #000000;  /* Black for fixed words - high contrast */
    font-weight: 500;
    margin-bottom: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-primary, #E8E3DA);
}

.incomplete-sentence .blank {
    display: inline-block;
    border-bottom: 2px solid var(--primary, #5C6F5C);
    min-width: 60px;
    text-align: center;
    margin: 0 2px;
    padding: 0.25rem 0.5rem;
    color: var(--primary, #5C6F5C);
    font-weight: 500;
    transition: all 0.2s ease;
}

.incomplete-sentence .blank.filled {
    background: var(--primary, #5C6F5C);
    color: white;
    border-bottom-color: var(--primary, #5C6F5C);
    border-radius: 6px;
    transform: scale(1.05);
    animation: fillIn 0.3s ease;
}

@keyframes fillIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1.05);
    }
}

.task-hint {
    color: var(--text-secondary, #9E9689);
    font-size: 0.9rem;
    font-style: italic;
}

/* Timer */
.build-sentence-timer {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary, #5C6F5C);
    margin-bottom: 1.5rem;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease;
}

/* Word Bank */
.word-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-cream, #F7F4EF);
    border-radius: 12px;
    border: 2px solid var(--border-primary, #E8E3DA);
    min-height: 80px;
}

.word-pill {
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 2px solid var(--border-primary, #E8E3DA);
    background: white;
    color: var(--text-primary, #1A1816);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    user-select: none;
}

.word-pill:hover {
    border-color: var(--primary, #5C6F5C);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(92, 111, 92, 0.15);
}

.word-pill:active {
    transform: translateY(0);
}

.word-pill.used {
    opacity: 0.3;
    pointer-events: none;
    background: var(--bg-cream, #F7F4EF);
}

/* Answer Area */
.answer-area {
    min-height: 120px;
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid var(--primary, #5C6F5C);
    background: white;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
    transition: all 0.2s ease;
}

.answer-area:empty::after {
    content: 'Click words above to build your sentence...';
    color: var(--text-muted, #C9C5C0);
    font-style: italic;
}

.answer-placeholder {
    color: var(--text-muted, #C9C5C0);
    font-style: italic;
    padding: 0.5rem;
}

.answer-word {
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: var(--primary, #5C6F5C);
    color: white;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    user-select: none;
}

.answer-word:hover {
    background: #4a5e4a;
    transform: translateY(-1px);
}

.answer-word:active {
    transform: scale(0.95);
}

.answer-word .remove-icon {
    font-size: 1.2rem;
    font-weight: 700;
    opacity: 0.8;
    margin-left: 0.25rem;
}

/* Interface */
.build-sentence-interface {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-primary, #E8E3DA);
    margin-bottom: 1.5rem;
}

/* Buttons */
.build-sentence-interface button {
    transition: all 0.2s ease;
}

.build-sentence-interface button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(92, 111, 92, 0.25);
}

.build-sentence-interface button:active:not(:disabled) {
    transform: scale(0.98);
}

.build-sentence-interface button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Results */
.build-sentence-result {
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid;
    margin-top: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.build-sentence-result.correct {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgb(34, 197, 94);
    color: rgb(21, 128, 61);
}

.build-sentence-result.incorrect {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgb(239, 68, 68);
    color: rgb(153, 27, 27);
}

.build-sentence-result h3 {
    margin-bottom: 0.5rem;
}

.build-sentence-result p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.build-sentence-result i.fas {
    flex-shrink: 0;
}

/* Pro Pill */
.pro-pill {
    background: rgba(92, 111, 92, 0.18);
    color: #2d5f4d;
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 1rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .build-sentence-container {
        padding: 1rem;
    }
    
    .build-sentence-timer {
        font-size: 1.25rem;
    }
    
    .word-bank {
        padding: 1rem;
        gap: 0.4rem;
    }
    
    .word-pill, .answer-word {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
    
    .answer-area {
        min-height: 100px;
        padding: 1rem;
    }
    
    .build-sentence-interface {
        padding: 1.5rem;
    }
    
    .build-sentence-interface .flex {
        flex-direction: column;
        align-items: stretch;
    }
    
    .build-sentence-interface button {
        width: 100%;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .build-sentence-timer {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .word-bank {
        padding: 0.75rem;
        gap: 0.3rem;
    }
    
    .word-pill, .answer-word {
        font-size: 0.8rem;
        padding: 0.35rem 0.7rem;
    }
    
    .answer-area {
        min-height: 80px;
        padding: 0.75rem;
    }
}

/* Dark Mode Support */
body.dark-mode .build-sentence-interface {
    background: #222222;
    border-color: #2D2D2D;
}

body.dark-mode .build-sentence-header h2,
body.dark-mode .build-sentence-header p {
    color: #E8E6E3;
}

body.dark-mode .word-bank {
    background: #1A1A1A;
    border-color: #2D2D2D;
}

body.dark-mode .word-pill {
    background: #222222;
    border-color: #2D2D2D;
    color: #E8E6E3;
}

body.dark-mode .word-pill:hover {
    border-color: #7FA87F;
}

body.dark-mode .word-pill.used {
    background: #1A1A1A;
}

body.dark-mode .answer-area {
    background: #222222;
    border-color: #7FA87F;
}

body.dark-mode .answer-placeholder {
    color: #666666;
}

body.dark-mode .answer-word {
    background: #7FA87F;
    color: #1A1A1A;
}

body.dark-mode .answer-word:hover {
    background: #5C6F5C;
}

body.dark-mode .build-sentence-result.correct {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgb(34, 197, 94);
    color: rgb(74, 222, 128);
}

body.dark-mode .build-sentence-result.incorrect {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgb(239, 68, 68);
    color: rgb(252, 165, 165);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .word-pill,
    .answer-word,
    .build-sentence-result,
    .fade-in {
        animation: none;
        transition: none;
    }
}

/* Focus styles for keyboard navigation */
.word-pill:focus,
.answer-word:focus,
.build-sentence-interface button:focus {
    outline: 2px solid var(--primary, #5C6F5C);
    outline-offset: 2px;
}

