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

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

:root {
    --bg-color: #f5f0e6;
    --bg-secondary: #fff;
    --text-color: #333;
    --text-light: #666;
    --correct: #4caf50;
    --incorrect: #f44336;
    --accent: #2196f3;
    --accent-light: #64b5f6;
    --shadow: rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --bubble-primary: #42a5f5;
    --bubble-secondary: #1e88e5;
    --blank-color: #999;
}

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-light);
}

/* Kontener główny */
.main-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Sekcja zdania */
.sentence-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 30px 40px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px var(--shadow);
    min-height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sentence-display {
    font-size: 2rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.8;
    letter-spacing: 0.5px;
    word-spacing: 0.2em;
}

.word {
    display: inline-block;
    white-space: nowrap;
}

/* Luki w zdaniach */
.challenge-blank {
    display: inline-block;
    min-width: 1.5em;
    padding: 0 4px;
    border-bottom: 2px solid var(--blank-color);
    margin: 0 2px;
    text-align: center;
    color: var(--accent);
    font-weight: bold;
    transition: all 0.3s ease;
}

.challenge-blank.active {
    border-bottom-color: var(--accent);
    background: rgba(33, 150, 243, 0.1);
    border-radius: 4px 4px 0 0;
}

.challenge-blank.filled {
    border-bottom-color: var(--correct);
    color: var(--correct);
    animation: blank-fill 0.4s ease-out;
    min-width: auto;
    padding: 0 1px;
    margin: 0;
}

@keyframes blank-fill {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Sekcja bąbelków */
.bubbles-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px var(--shadow);
    min-height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.bubbles-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    flex-wrap: wrap;
}

/* Bąbelki z opcjami */
.choice-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    height: 80px;
    padding: 15px 25px;
    font-size: 1.8rem;
    font-weight: bold;
    color: white;
    background: linear-gradient(145deg, var(--bubble-primary), var(--bubble-secondary));
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
    animation:
        bubble-float 3s ease-in-out infinite,
        bubble-pulse 2s ease-in-out infinite,
        bubble-appear 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
    transition: transform 0.2s, box-shadow 0.2s;
}

.choice-bubble:nth-child(1) { animation-delay: 0s, 0s, 0s; }
.choice-bubble:nth-child(2) { animation-delay: 0.5s, 0.3s, 0.1s; }
.choice-bubble:nth-child(3) { animation-delay: 1s, 0.6s, 0.2s; }
.choice-bubble:nth-child(4) { animation-delay: 1.5s, 0.9s, 0.3s; }

.choice-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.5);
}

.choice-bubble:active {
    transform: scale(0.95);
}

/* Animacje bąbelków */
@keyframes bubble-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.02); }
}

@keyframes bubble-pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3); }
    50% { box-shadow: 0 6px 25px rgba(33, 150, 243, 0.5); }
}

@keyframes bubble-appear {
    0% {
        transform: translateY(50px) scale(0);
        opacity: 0;
    }
    60% {
        transform: translateY(-10px) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Poprawna odpowiedź */
.choice-bubble.correct {
    animation: bubble-success 0.4s ease-in forwards;
    background: linear-gradient(145deg, #66bb6a, #43a047);
}

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

/* Błędna odpowiedź */
.choice-bubble.popping {
    background: linear-gradient(145deg, #ef5350, #e53935);
    animation:
        bubble-shake 0.2s ease-in-out,
        bubble-pop 0.4s ease-in 0.2s forwards;
}

@keyframes bubble-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px) rotate(-3deg); }
    40% { transform: translateX(5px) rotate(3deg); }
    60% { transform: translateX(-3px) rotate(-2deg); }
    80% { transform: translateX(3px) rotate(2deg); }
}

@keyframes bubble-pop {
    0% { transform: scale(1); opacity: 1; }
    20% { transform: scale(1.15); }
    100% { transform: scale(0); opacity: 0; }
}

/* Latająca litera */
.flying-letter {
    position: fixed;
    font-size: 2rem;
    font-weight: bold;
    color: var(--correct);
    z-index: 200;
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: left 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                top 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.flying-letter.jumping {
    animation: letter-jump 0.5s ease-out forwards;
}

@keyframes letter-jump {
    0% { transform: translate(-50%, -50%) scale(1); }
    25% { transform: translate(-50%, -50%) scale(1.3) translateY(-20px); }
    100% { transform: translate(-50%, -50%) scale(1) translateY(0); }
}

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

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: confetti-fall 1s ease-out forwards;
}

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

/* Panel statusu */
.status-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 60px;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: 0 2px 10px var(--shadow);
}

.status-item {
    text-align: center;
}

.status-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--accent);
}

.status-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Pasek postępu */
.progress-container {
    width: 100%;
    height: 8px;
    background: #ddd;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
}

#progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Przyciski */
.btn {
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
}

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

.btn-secondary:hover {
    background: #ccc;
}

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

.start-section h2 {
    margin-bottom: 10px;
    font-size: 2rem;
}

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

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

/* Panel wyników */
.result-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.result-content {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: slideIn 0.3s ease;
}

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

.result-emoji {
    font-size: 4rem;
    margin-bottom: 10px;
}

.result-content h2 {
    margin-bottom: 20px;
    color: var(--accent);
}

.result-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Strona konfiguracji */
.config-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

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

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

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-color);
}

.form-hint {
    display: block;
    font-size: 0.85em;
    color: var(--text-light);
    margin-top: 8px;
}

.form-group-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

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

.radio-option:hover,
.checkbox-option:hover {
    background: #eee;
}

.radio-option input,
.checkbox-option input {
    accent-color: var(--accent);
    width: 18px;
    height: 18px;
}

/* Select */
select {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Przyciski formularza */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.form-actions .btn {
    flex: 1;
}

/* Responsywność */
@media (max-width: 600px) {
    .header {
        flex-direction: column;
        gap: 10px;
    }

    .sentence-display {
        font-size: 1.5rem;
    }

    .choice-bubble {
        min-width: 65px;
        height: 65px;
        font-size: 1.4rem;
    }

    .status-panel {
        flex-direction: column;
        gap: 15px;
    }

    .result-stats {
        flex-direction: column;
        gap: 15px;
    }

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

    .bubbles-container {
        gap: 15px;
    }
}

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

.text-center {
    text-align: center;
}
