/**
 * style.css - Style aplikacji do nauki czytania
 */

/* Reset i podstawy */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-color: #fff8e7;
    --bg-secondary: #fff;
    --text-color: #333;
    --text-light: #666;
    --correct: #4caf50;
    --incorrect: #f44336;
    --accent: #ff9800;
    --accent-light: #ffb74d;
    --accent-dark: #f57c00;
    --word-color: #1976d2;
    --word-hover: #1565c0;
    --shadow: rgba(0, 0, 0, 0.1);
    --border-radius: 16px;
    --listening-color: #e91e63;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
}

/* Nagłówek */
.header {
    background: var(--bg-secondary);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px var(--shadow);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    text-decoration: none;
}

.logo-icon {
    font-size: 2rem;
}

.nav-links {
    display: flex;
    gap: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.2s;
}

.nav-link:hover {
    background: var(--accent-dark);
}

/* Kontener główny */
.main-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Sekcja startowa */
.start-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 4px 20px var(--shadow);
}

.start-icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.start-section h2 {
    font-size: 2rem;
    color: var(--text-color);
    margin-bottom: 15px;
}

.start-section p {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 30px;
}

/* Sekcja słowa */
.word-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 60px 40px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px var(--shadow);
    text-align: center;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.word-display {
    display: flex;
    justify-content: center;
    align-items: center;
}

.word-text {
    font-size: 5rem;
    font-weight: bold;
    color: var(--word-color);
    cursor: pointer;
    padding: 20px 40px;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    user-select: none;
}

.word-text:hover {
    color: var(--word-hover);
    background: rgba(25, 118, 210, 0.05);
    transform: scale(1.02);
}

.word-text:active {
    transform: scale(0.98);
}

.word-text.speaking {
    animation: speaking-pulse 0.5s ease-in-out infinite;
}

.word-text.correct {
    color: var(--correct);
    animation: correct-bounce 0.6s ease;
}

.word-text.dont-know {
    color: var(--accent);
    animation: shake 0.4s ease;
}

@keyframes speaking-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

@keyframes correct-bounce {
    0% { transform: scale(1); }
    30% { transform: scale(1.15); }
    50% { transform: scale(0.95); }
    70% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(10px); }
}

/* Wskaźnik nasłuchiwania */
.listening-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 10px 20px;
    background: rgba(233, 30, 99, 0.1);
    border-radius: 30px;
    color: var(--listening-color);
    font-weight: 500;
}

.mic-icon {
    font-size: 1.5rem;
    animation: mic-pulse 1.5s ease-in-out infinite;
}

@keyframes mic-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

/* Przycisk mikrofonu */
.mic-button {
    margin-top: 20px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, #e91e63, #c2185b);
    color: white;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.4);
    transition: all 0.2s;
}

.mic-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.5);
}

.mic-button:active {
    transform: scale(0.95);
}

.mic-button.listening {
    background: linear-gradient(145deg, #4caf50, #388e3c);
    animation: mic-pulse 1s ease-in-out infinite;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

/* Sekcja przycisków */
.buttons-section {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

/* Przyciski */
.btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.btn-secondary {
    background: #e0e0e0;
    color: var(--text-color);
}

.btn-secondary:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
}

.btn-large {
    padding: 20px 40px;
    font-size: 1.4rem;
    border-radius: 12px;
    min-width: 180px;
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

/* Animacja ładowania przycisku */
.btn-large.loading {
    color: rgba(255, 255, 255, 0.7);
    pointer-events: none;
}

.btn-large.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    width: 0%;
    background: rgba(255, 255, 255, 0.3);
    animation: btn-load var(--load-duration, 5000ms) linear forwards;
    z-index: -1;
}

@keyframes btn-load {
    0% { width: 0%; }
    100% { width: 100%; }
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Konfetti */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: confetti-fall 1.2s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) rotate(720deg) scale(0);
        opacity: 0;
    }
}

/* Komunikat sukcesu */
.success-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--correct);
    color: white;
    padding: 20px 50px;
    border-radius: 20px;
    font-size: 2.5rem;
    font-weight: bold;
    z-index: 1001;
    animation: success-appear 0.3s ease-out;
    box-shadow: 0 8px 30px rgba(76, 175, 80, 0.4);
}

.success-message.fade-out {
    animation: success-fade 0.5s ease-out forwards;
}

@keyframes success-appear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes success-fade {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* Ukryte elementy */
.hidden {
    display: none !important;
}

/* ==================== */
/* Strona ustawień      */
/* ==================== */

.config-container {
    max-width: 600px;
    margin: 40px auto;
    padding: 20px;
}

.config-panel {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 30px 40px;
    box-shadow: 0 4px 20px var(--shadow);
}

.config-panel h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--accent);
}

.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 1.1rem;
}

.form-section p {
    margin-bottom: 10px;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Radio options */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f5f5f5;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.radio-option:hover {
    background: #e8e8e8;
}

.radio-option input[type="radio"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.radio-option .option-label {
    font-weight: 500;
}

.radio-option .option-desc {
    margin-left: auto;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Checkbox options */
.checkbox-option {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f5f5f5;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 10px;
}

.checkbox-option:hover {
    background: #e8e8e8;
}

.checkbox-option input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

/* Voice select */
.voice-select {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f5f5f5;
    margin-bottom: 10px;
    cursor: pointer;
}

.voice-select:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Form actions */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.form-actions .btn {
    min-width: 150px;
}

/* Warning box */
.warning-box {
    background: #fff3e0;
    border: 1px solid #ffb74d;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
    color: #e65100;
    font-size: 0.9rem;
}

/* ==================== */
/* Responsywność        */
/* ==================== */

@media (max-width: 768px) {
    .word-text {
        font-size: 3.5rem;
        padding: 15px 30px;
    }

    .btn-large {
        padding: 15px 30px;
        font-size: 1.2rem;
        min-width: 140px;
    }

    .buttons-section {
        flex-direction: column;
        align-items: center;
    }

    .start-section {
        padding: 40px 20px;
    }

    .start-icon {
        font-size: 4rem;
    }

    .success-message {
        font-size: 2rem;
        padding: 15px 40px;
    }
}

@media (max-width: 480px) {
    .header {
        flex-direction: column;
        gap: 10px;
    }

    .logo {
        font-size: 1.2rem;
    }

    .logo-icon {
        font-size: 1.5rem;
    }

    .nav-link {
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    .word-text {
        font-size: 2.5rem;
        padding: 10px 20px;
    }

    .word-section {
        padding: 40px 20px;
        min-height: 200px;
    }

    .btn-large {
        padding: 12px 25px;
        font-size: 1.1rem;
        min-width: 120px;
    }

    .config-panel {
        padding: 20px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}
