/* style.css */
:root {
    --primary: #2c3e50;
    --accent: #3498db;
    --success: #27ae60;
    --error: #e74c3c;
    --bg: #f4f7f6;
    --card-bg: #ffffff;
    --solution-glow: 0 0 0 2px #27ae60; /* Zvýraznění správných odpovědí */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    color: var(--primary);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* --- OVLÁDACÍ PANEL --- */
.controls {
    position: sticky;
    top: 0;
    background: var(--bg);
    padding: 20px 0;
    z-index: 100;
    border-bottom: 2px solid #e0e0e0;
}

.search-box {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.3s;
    margin-bottom: 15px;
}

.search-box:focus {
    border-color: var(--accent);
    outline: none;
}

/* Toolbar (Reset + Přepínač) */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-reset {
    background: #fff;
    border: 1px solid #ddd;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    color: #666;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-reset:hover {
    background: #f0f0f0;
    color: #333;
    border-color: #bbb;
}

/* Toggle Switch (Přepínač) */
.toggle-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 10px;
    font-size: 0.9em;
    color: #555;
    user-select: none;
}

.toggle-container input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 20px;
    transition: 0.3s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-container input:checked + .toggle-slider {
    background-color: var(--success);
}

.toggle-container input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* --- KARTA OTÁZKY --- */
.card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border-left: 5px solid var(--accent);
    transition: transform 0.2s;
}

.q-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
    color: #7f8c8d;
    margin-bottom: 15px;
}

.q-text {
    font-size: 1.25em;
    font-weight: 600;
    margin-bottom: 20px;
}

/* --- SINGLE CHOICE TLAČÍTKA --- */
.btn-option {
    display: block;
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 10px;
    text-align: left;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    position: relative;
}

.btn-option:hover {
    background: #e2e6ea;
    border-color: #adb5bd;
}

/* Stavy po kliknutí */
.btn-option.correct {
    background-color: #d4edda;
    border-color: var(--success);
    color: #155724;
}

.btn-option.wrong {
    background-color: #f8d7da;
    border-color: var(--error);
    color: #721c24;
}

.btn-option.disabled {
    pointer-events: none;
    opacity: 0.7;
}

/* Režim "Zobrazit řešení" pro Single Choice */
body.reveal-mode .btn-option[data-is-correct="true"] {
    box-shadow: var(--solution-glow);
    background-color: #e8f5e9;
}

/* --- MATCHING GAME (SPOJOVAČKA) --- */
.match-container {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.match-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.match-item {
    padding: 15px;
    background: white;
    border: 2px solid var(--accent);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    user-select: none;
    font-size: 0.95em;
    transition: 0.2s;
    position: relative; /* Pro absolutní pozici čísla */
}

.match-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.match-item.selected {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.3);
}

.match-item.error {
    animation: shake 0.4s;
    border-color: var(--error);
    background: #fce4ec;
}

/* Společný styl pro spárované položky (uživatelem nebo řešením) */
.match-item.matched,
.match-item.solution-show {
    cursor: default;
    color: #333;
    font-weight: 500;
    border-width: 2px;
}

/* Specifické pro odhalené řešení (mírně průhledné) */
.match-item.solution-show {
    opacity: 0.85;
}

/* ČÍSLO PÁRU (BADGE) - Zobrazí se u matched i solution-show */
.match-item.matched::before,
.match-item.solution-show::before {
    content: attr(data-pair-id);
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
}

/* Číslo na pravé straně pro pravý sloupec */
.match-col:last-child .match-item::before {
    left: auto;
    right: -12px;
}

/* V režimu řešení vypneme interakci myší na kartičkách */
body.reveal-mode .match-item {
    pointer-events: none;
}

/* --- OSTATNÍ --- */
.explanation {
    margin-top: 20px;
    padding: 15px;
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    border-radius: 4px;
    display: none;
}

.loading, .error-msg {
    text-align: center;
    padding: 20px;
    font-size: 1.1em;
}
.error-msg { color: var(--error); }

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}