/* style.css */
:root {
    --primary: #2e7d32;      /* Tmavě zelená */
    --primary-light: #4caf50;
    --accent: #81c784;
    --bg-color: #f1f8e9;
    --card-bg: #ffffff;
    --text-main: #333;
    --text-muted: #666;
    --border-color: #ddd;
    --correct-bg: #e8f5e9;
    --correct-border: #2e7d32;
    --wrong-bg: #ffebee;
    --wrong-border: #c62828;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding-bottom: 80px;
    line-height: 1.6;
}

/* --- OVLÁDACÍ LIŠTA (Sticky Header) --- */
.controls-wrapper {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 10px 20px;
    z-index: 1000;
    border-bottom: 3px solid var(--primary);
    transition: all 0.3s ease;
}

.top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
    max-height: 100px; 
    opacity: 1;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.controls-wrapper.compact .top-row {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    pointer-events: none;
}

.controls-wrapper.compact {
    padding-top: 10px;
    padding-bottom: 10px;
}

h1 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-link {
    text-decoration: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: transform 0.2s ease;
}

.logo-link:hover {
    transform: scale(1.1); 
}

/* Přepínače režimů */
.mode-switch {
    display: flex;
    gap: 10px;
}

.mode-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 20px;
    background: #e0e0e0;
    color: #555;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.mode-btn.active {
    background: var(--primary);
    color: white;
}

/* --- TOOLBAR --- */
.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    gap: 5px;
}

.btn-icon {
    background: var(--primary-light);
    color: white;
    border: none;
    padding: 0; /* Pro zarovnání s ikonou */
    width: 40px;
    height: 40px;
    border-radius: 50%; /* Kulatá tlačítka jako v ostatních app */
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover { background: var(--primary); }

/* Styl pro tlačítko tisku - hnědá pro zemědělství */
.btn-print {
    background: #5d4037;
}
.btn-print:hover { background: #3e2723; }


.search-input {
    flex-grow: 1;
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    outline: none;
    min-width: 0;
}
.search-input:focus { border-color: var(--primary); }

.btn-reset {
    background: #ff7043;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    margin-left: auto; 
}

/* --- MOBIL --- */
@media (max-width: 600px) {
    .top-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .mode-switch { width: 100%; }
    .mode-btn { flex: 1; text-align: center; }

    .toolbar {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }

    .control-group { order: 1; }
    .btn-print { order: 2; } /* Tisk hned za přehrávačem */
    .btn-reset { order: 3; margin-left: 0; }
    .search-input { order: 4; width: 100%; flex-basis: 100%; }
}

/* --- KARTY OTÁZEK --- */
.container {
    max-width: 800px;
    margin: 20px auto;
    padding: 0 15px;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-left: 5px solid var(--accent);
    transition: transform 0.2s;
}

.card.reading-active {
    border-left-color: #ffa726;
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.question-text {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #2c3e50;
}

/* --- REŽIM ČTENÍ --- */
.study-options-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.study-option {
    padding: 10px 15px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
    color: #999;
    font-size: 0.95rem;
}

.study-option.correct {
    background: var(--correct-bg);
    border: 2px solid var(--correct-border);
    color: #1b5e20;
    font-weight: 700;
    position: relative;
}

.study-option.correct::after {
    content: "\f00c"; /* FontAwesome check */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--correct-border);
}

.study-answer-text {
    background: var(--correct-bg);
    border-left: 4px solid var(--correct-border);
    padding: 15px;
    color: #1b5e20;
    border-radius: 4px;
}

/* --- REŽIM TEST --- */
.options-grid {
    display: grid;
    gap: 8px;
}

.btn-option {
    text-align: left;
    background: #fff;
    border: 2px solid #eee;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-option:hover:not(:disabled) { background: #f1f1f1; }

.btn-option.correct {
    background: var(--correct-bg);
    border-color: var(--correct-border);
    color: #1b5e20;
}

.btn-option.wrong {
    background: var(--wrong-bg);
    border-color: var(--wrong-border);
    color: #b71c1c;
    opacity: 0.7;
}

textarea {
    width: 100%;
    height: 80px;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    margin-bottom: 10px;
    font-family: inherit;
}

.btn-check {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
}

.open-evaluation {
    margin-top: 10px;
    padding: 10px;
    border-radius: 5px;
    display: none;
}
.match-high { background: #c8e6c9; border: 1px solid #2e7d32; }
.match-med { background: #fff9c4; border: 1px solid #fbc02d; }
.match-low { background: #ffcdd2; border: 1px solid #c62828; }

body.mode-study .test-element { display: none !important; }
body.mode-test .study-element { display: none !important; }
body.mode-test #audio-controls { opacity: 0.3; pointer-events: none; }

/* =========================================
   STYLY PRO TISK (TAHÁK)
   ========================================= */
@media print {
    /* Skrytí UI */
    .controls-wrapper, 
    .container, 
    .mode-switch,
    #status-bar,
    .btn-reset,
    .btn-icon {
        display: none !important;
    }

    /* Zobrazení a formátování tiskové oblasti */
    #printable-area {
        display: block !important;
        width: 100%;
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        font-size: 10px; /* Malé písmo */
        line-height: 1.3;
        color: #000;
        
        /* 3 sloupce */
        column-count: 3;
        column-gap: 15px;
        column-rule: 1px solid #ddd;
    }

    .print-item {
        break-inside: avoid;
        page-break-inside: avoid;
        margin-bottom: 10px;
        padding-bottom: 5px;
        border-bottom: 1px dotted #ccc;
    }

    .print-question {
        font-weight: bold;
        color: #2e7d32; /* Zelená */
        display: block;
        margin-bottom: 2px;
        font-size: 11px;
    }

    .print-answer {
        color: #000;
        display: block;
    }
    
    .print-highlight {
        display: block;
        padding-left: 5px;
        border-left: 2px solid #a5d6a7;
        font-weight: 600;
    }

    @page {
        margin: 1cm;
        size: A4 portrait;
    }
}