/* ==========================================================================
    EXERCISES.CSS - Mřížky, karty a navigace cvičení
   ========================================================================== */

/* --- 1. UNIVERZÁLNÍ MŘÍŽKA (Homepage i Kategorie) --- */
main.container #exercise-grid,
main.container .exercise-grid,
main.container .cat-exercise-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 2rem 0 3rem 0;
    width: 100%;
    align-items: start;
}

.home-exercise-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

:root {
    --section-accent: #14b8a6;
    --section-accent-strong: #0f9f8f;
    --section-accent-soft: rgba(20, 184, 166, 0.22);
}

.level-title {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
}

h1.level-title {
    margin-top: var(--h1-margin-y);
    margin-bottom: var(--h1-margin-y);
}

.level-icon {
    width: 40px;
    height: 40px;
    object-fit: cover;
    flex-shrink: 0;
}

.category-title-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.cat-type-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #212529;
    margin: 10px 0 15px 0;
    border-bottom: 3px solid var(--section-accent);
    padding-bottom: 8px;
    display: block;
    width: 100%;
}

.category-journey {
    display: grid;
    grid-template-columns: max-content 1fr;
    align-items: center;
    column-gap: 12px;
    margin: 0 0 22px 0;
}

.category-journey-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1f2933;
    white-space: nowrap;
    line-height: 1;
}

.progress-bar-container.category-progress-bar {
    position: relative;
    flex: 1;
    height: 14px;
    margin-bottom: 0;
    background: #eef2f7;
    border: 1px solid var(--section-accent-soft);
    border-radius: 999px;
    overflow: visible;
}

.progress-bar-fill.category-progress-bar-fill {
    background: linear-gradient(90deg, var(--section-accent) 0%, var(--section-accent-strong) 100%);
    transition: width 0.35s ease;
}

.category-progress-cat {
    position: absolute;
    top: calc(50% - 2px);
    left: clamp(20px, var(--journey-percent), calc(100% - 28px));
    width: 56px;
    height: 42px;
    max-width: none;
    display: block;
    object-fit: contain;
    transform: translate(-50%, -50%) scaleX(-1);
    transform-origin: center;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
    pointer-events: none;
    z-index: 2;
}

/* --- 2. KARTA CVIČENÍ (Sjednocená) --- */
.cat-exercise-card, 
.exercise-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    padding: 13px 20px;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    text-decoration: none;
    color: #212529;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.cat-exercise-card:hover, 
.exercise-row:hover {
    border-color: var(--section-accent);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.ex-name, .cat-ex-name {
    font-weight: 600;
}

.ex-progress, .cat-ex-progress {
    display: flex;
    gap: 3px;
}

.dot {
    width: 24px;
    height: 24px;
    object-fit: contain;
    opacity: 0.35;
    filter: grayscale(1);
}

.cat-dot {
    width: 24px;
    height: 24px;
    object-fit: contain;
    opacity: 0.35;
    filter: grayscale(1);
}

.dot.active {
    opacity: 1;
    filter: none;
}

.cat-dot.active {
    opacity: 1;
    filter: none;
}

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

.loading-message-small {
    padding: 20px;
}

/* --- 3. VNITŘNÍ LOGIKA CVIČENÍ (Hra a Statistiky) --- */
body[data-level="beginner"] {
    --level-bg: #ffffff;
    --level-border: #48c78e;
    --level-text: #2e7d32;
    --section-accent: #14b8a6;
    --section-accent-strong: #0f9f8f;
    --section-accent-soft: rgba(20, 184, 166, 0.22);
}

body[data-level="elementary"] {
    --level-bg: #f0f7ff;
    --level-border: #3273dc;
    --level-text: #205081;
    --section-accent: #facc15;
    --section-accent-strong: #eab308;
    --section-accent-soft: rgba(250, 204, 21, 0.3);
}

body[data-level="pre-intermediate"] {
    --level-bg: #fffbf0;
    --level-border: #ffdd57;
    --level-text: #856404;
    --section-accent: #4447d7;
    --section-accent-strong: #373ac1;
    --section-accent-soft: rgba(68, 71, 215, 0.25);
}

.ai-context-hidden {
    display: none;
}

.loader-placeholder {
    text-align: center;
    padding: 100px;
    font-style: italic;
    color: #666;
}

/* --- 3.1 RÁMEČEK SE STATISTIKAMI --- */
.stats-frame {
    background-color: #ffffff;
    border: 1px solid #48c78e;
    border-radius: 12px;
    padding: 15px 25px;
    margin: 25px 0;
    box-shadow: 0 4px 15px rgba(72, 199, 142, 0.11);
}

.progress-bar-container {
    height: 16px;
    background: #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-bar-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--section-accent) 0%, var(--section-accent-strong) 100%);
    transition: width 0.3s ease;
}

.score-line-horizontal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #666;
}

.score-item-question .score-label {
    font-size: 1rem;
    font-weight: 700;
    color: inherit;
}

.score-item-cats .score-label {
    font-size: 1rem;
    font-weight: 700;
    color: inherit;
}

.score-item-results {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    font-size: 1rem;
    font-weight: 700;
}

.score-item-cats {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.result-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}

.result-pill-correct {
    color: #2f9e69;
}

.result-pill-wrong {
    color: #FFA500;
}

.result-icon {
    font-size: 1rem;
}

#owl-container {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.score-cat-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* --- 4. SPODNÍ NAVIGACE (ZAROVNÁNÍ TLAČÍTEK POD RÁMEČKEM) --- */
.exercise-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 20px;
    padding: 0 5px;
}

.exercise-navigation a {
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.button.is-light,
.button.is-success {
    padding: 10px 25px;
    border-radius: 20px;
    border: none;
}

.button.is-light {
    background-color: #f1f3f5;
    color: #212529;
}

.button.is-light:hover {
    background-color: #e2e6ea;
}

/* --- 4.1 TLAČÍTKO "NEXT LESSON" --- */
.button.is-success {
    background-color: #00D1B2;
    color: #001F1A;
}

.button.is-success:hover {
    background-color: #00b894;
}

/* --- 5. RESPONZIVITA --- */
@media (max-width: 1024px) {
    main.container #exercise-grid, 
    main.container .cat-exercise-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    main.container #exercise-grid, 
    main.container .cat-exercise-grid { grid-template-columns: 1fr; }
    .score-line-horizontal {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    }
    .score-item-question .score-label,
    .score-item-cats .score-label { font-size: 0.95rem; }
    .score-item-results { gap: 8px; font-size: 0.92rem; }
    .result-icon { font-size: 0.92rem; }
    .score-cat-icon { width: 24px; height: 24px; }
    .exercise-navigation {
        flex-direction: row;
        align-items: stretch;
        gap: 10px;
        text-align: center;
    }
    .exercise-navigation a {
        flex: 1 1 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
    }
    .exercise-navigation .button.is-light,
    .exercise-navigation .button.is-success {
        width: 100%;
        padding: 10px 14px;
    }
}