/**
 * SFA Widget - Simplified Progressive Approach Styles
 * Focus on therapeutic clarity and mobile-first design
 */

/* ===== CONTAINER & LAYOUT ===== */
.sfa-container {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===== HEADER ===== */
.sfa-header {
    text-align: center;
    margin-bottom: 30px;
}

.sfa-title {
    color: #1f2937;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    margin-top: 0;
}

.sfa-subtitle {
    color: #6b7280;
    font-size: 16px;
    margin: 0;
    font-weight: 400;
}

/* ===== WORD DISPLAY ===== */
.word-display {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    position: relative;
    overflow: hidden;
}

.word-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
}

.target-word {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.word-image {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    margin: 0 auto;
    background-color: rgba(255,255,255,0.2);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.8);
    font-size: 48px;
    position: relative;
    z-index: 2;
    border: 2px solid rgba(255,255,255,0.3);
}

/* ===== PROGRESS INDICATOR ===== */
.progress-indicator {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    gap: 8px;
}

.progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e5e7eb;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
}

.progress-dot.completed {
    background: #10b981;
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.progress-dot.completed::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 8px;
    font-weight: bold;
}

.progress-dot.active {
    background: #3b82f6;
    transform: scale(1.2);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.2); }
    100% { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3); }
}

/* ===== FEATURE EXPLORATION ===== */
.feature-exploration {
    background: #f9fafb;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
}

.current-feature {
    text-align: center;
    margin-bottom: 25px;
}

.feature-label {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border-radius: 20px;
    display: inline-block;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.feature-prompt {
    font-size: 16px;
    color: #4b5563;
    margin: 0;
    line-height: 1.5;
}

/* ===== THINKING SPACE (Learning Mode) ===== */
.thinking-space {
    background: white;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-style: italic;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    text-align: center;
}

.thinking-space:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
    color: #1d4ed8;
}

.thinking-space.thinking {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
    animation: gentleGlow 1.5s ease-in-out infinite alternate;
}

.thinking-space.revealed {
    background: #ecfdf5;
    border-color: #10b981;
    color: #047857;
    border-style: solid;
}

@keyframes gentleGlow {
    from { box-shadow: 0 0 5px rgba(245, 158, 11, 0.3); }
    to { box-shadow: 0 0 15px rgba(245, 158, 11, 0.5); }
}

/* ===== QUIZ OPTIONS (Quiz Mode) ===== */
.quiz-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.quiz-option {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    text-align: center;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-option:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.quiz-option:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.quiz-option.correct {
    background: #dcfce7;
    border-color: #10b981;
    color: #047857;
    animation: correctAnswer 0.5s ease;
}

.quiz-option.incorrect {
    background: #fee2e2;
    border-color: #ef4444;
    color: #dc2626;
    animation: incorrectAnswer 0.5s ease;
}

@keyframes correctAnswer {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); background: #bbf7d0; }
    100% { transform: scale(1); }
}

@keyframes incorrectAnswer {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

/* ===== FEATURE ANSWER (Learning Mode) ===== */
.feature-answer-container {
    margin: 20px 0;
}

/* Top card - Main answer (prominent green card) */
.feature-answer-main {
    background: #ecfdf5;
    border: 1px solid #10b981;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    color: #047857;
    text-align: center;
}

.feature-answer-main.revealed {
    animation: slideDown 0.4s ease;
}

/* Answer label in main card */
.feature-answer-main > strong {
    font-size: 16px;
    color: #065f46;
    display: block;
    margin-bottom: 12px;
}

/* The actual answer text - make it prominent */
.feature-answer-content {
    font-size: 24px;
    font-weight: 700;
    color: #064e3b;
    padding: 15px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    border-left: 4px solid #10b981;
}

/* Bottom card - Supporting information */
.feature-answer-support {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    color: #475569;
}

/* Thinking confirmation in support card */
.thinking-confirmation {
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #0c4a6e;
    text-align: center;
    font-weight: 500;
}

.therapeutic-benefit {
    background: #fff7ed;
    border-left: 4px solid #f59e0b;
    padding: 12px;
    border-radius: 0 6px 6px 0;
    font-size: 14px;
}

.benefit-label {
    font-weight: 600;
    color: #92400e;
    font-size: 13px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.benefit-text {
    color: #a16207;
    font-size: 13px;
    margin: 0;
    font-style: italic;
    line-height: 1.4;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== CONTROL BUTTONS ===== */
.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.reveal-button, .audio-button {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.reveal-button:hover, .audio-button:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.audio-button {
    background: #8b5cf6;
    margin-left: 10px;
}

.audio-button:hover {
    background: #7c3aed;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* ===== NAVIGATION BUTTONS ===== */
.navigation-buttons {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 300px;
    gap: 15px;
}

.nav-button {
    background: #6b7280;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    flex: 1;
}

.nav-button:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.nav-button:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.nav-button.primary {
    background: #10b981;
}

.nav-button.primary:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* ===== COMPLETION SUMMARY ===== */
.completion-summary {
    background: #f0fdf4;
    border: 1px solid #22c55e;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    margin-top: 30px;
    display: none;
}

.completion-summary.show {
    display: block;
    animation: slideDown 0.4s ease;
}

.completion-summary h3 {
    color: #166534;
    font-size: 24px;
    margin-top: 0;
    margin-bottom: 15px;
}

.completion-summary p {
    color: #15803d;
    font-size: 16px;
    margin-bottom: 15px;
    line-height: 1.5;
}

.completion-summary .nav-button.primary {
    margin-top: 10px;
    padding: 15px 30px;
    font-size: 16px;
}

/* ===== LOADING & ERROR STATES ===== */
.sfa-loading {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.sfa-error {
    text-align: center;
    padding: 40px 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #b91c1c;
}

.sfa-error h3 {
    margin-top: 0;
    color: #dc2626;
}

.retry-button {
    background: #dc2626;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 15px;
}

.retry-button:hover {
    background: #b91c1c;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .sfa-container {
        padding: 20px;
        margin: 10px;
        border-radius: 12px;
    }
    
    .target-word {
        font-size: 24px;
    }
    
    .word-image {
        width: 100px;
        height: 100px;
    }
    
    .feature-exploration {
        padding: 20px;
    }
    
    .feature-label {
        font-size: 18px;
    }
    
    .feature-prompt {
        font-size: 15px;
    }
    
    .thinking-space {
        min-height: 60px;
        padding: 15px;
        font-size: 14px;
    }
    
    .quiz-options {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .quiz-option {
        min-height: 45px;
        padding: 12px;
    }
    
    .control-buttons {
        gap: 12px;
    }
    
    .reveal-button, .audio-button {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .navigation-buttons {
        flex-direction: column;
        max-width: none;
        gap: 10px;
    }
    
    .nav-button {
        padding: 12px;
        font-size: 16px;
    }
    
    .progress-indicator {
        gap: 6px;
    }
    
    .progress-dot {
        width: 10px;
        height: 10px;
    }
    
    .completion-summary {
        padding: 20px;
    }
    
    .completion-summary h3 {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .sfa-container {
        padding: 15px;
        margin: 5px;
    }
    
    .sfa-title {
        font-size: 20px;
    }
    
    .sfa-subtitle {
        font-size: 14px;
    }
    
    .word-display {
        padding: 15px;
        margin-bottom: 25px;
    }
    
    .target-word {
        font-size: 20px;
    }
    
    .word-image {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }
    
    .feature-exploration {
        padding: 15px;
    }
    
    .control-buttons {
        gap: 10px;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
.nav-button:focus,
.quiz-option:focus,
.reveal-button:focus,
.audio-button:focus,
.thinking-space:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .word-display {
        background: #1f2937;
        color: white;
    }
    
    .feature-exploration {
        border: 2px solid #374151;
    }
    
    .thinking-space {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .progress-dot,
    .quiz-option,
    .nav-button,
    .reveal-button,
    .audio-button,
    .thinking-space {
        transition: none;
    }
    
    .progress-dot.active {
        animation: none;
    }
    
    .feature-answer.revealed,
    .completion-summary.show {
        animation: none;
    }
}