/**
 * ═══════════════════════════════════════════════════════════════
 * TRÉNINKOVÝ ČASOVAČ - Styles
 * ═══════════════════════════════════════════════════════════════
 * @version     13.2.0
 * @updated     2026-02-02
 * @author      Martin Smolný (CCD TEAM CZ)
 * @description Kompletní styly pro tréninkový časovač
 * ═══════════════════════════════════════════════════════════════
 */

/* style.css */
:root {
    --background-color: #121829;
    --text-color: #e0e0e0;
    --primary-color: #3b82f6;
    --secondary-color: #1f2940;
    --border-color: #303d5e;
    --disabled-color: #4b5563;
    --past-block-color: #6b7280;
    --current-block-color: #ffffff;
    --future-block-color: #a0a0c0;
    --font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    --circle-size: 300px;
    --stroke-width: 8px;
    --stroke-color: #ffffff;
    --track-color: rgba(255, 255, 255, 0.2);
    --delta-ahead-color: #22c55e;
    --delta-behind-color: #ef4444;
    
    --green-btn-bg: #22c55e;
    --green-btn-text: #111111;
    --red-btn-bg: #ef4444;
    --orange-btn-bg: #f97316;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.5s ease-in-out, background-color 0.3s;
    min-height: 100vh;
}

.container { max-width: 1200px; margin: 2rem auto; padding: 2rem; position: relative; }
.setup-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; }
.card { background-color: var(--secondary-color); border-radius: 12px; padding: 1.5rem 2rem; border: 1px solid var(--border-color); }
.card h2 { font-size: 1.5rem; margin-bottom: 1.5rem; text-align: left; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; }
.settings-sidebar .card h2 { text-align: center; }

@media (max-width: 1024px) { .setup-grid { grid-template-columns: 1fr; } }

.settings-sidebar details { border: none; border-bottom: 1px solid var(--border-color); margin-bottom: 1rem; }
.settings-sidebar details:last-child { border-bottom: none; margin-bottom: 0; }
.settings-sidebar summary { padding: 1rem 0; font-weight: bold; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.settings-sidebar summary::-webkit-details-marker { display: none; }

.settings-sidebar summary::after { 
    content: '+'; 
    font-family: var(--font-family); 
    font-weight: bold; 
    transition: transform 0.2s;
    font-size: 1.25rem;
    color: var(--future-block-color);
}
.settings-sidebar details[open] summary::after { 
    content: '–'; 
}

.customization-content { padding: 1rem 0; display: flex; flex-direction: column; gap: 1.5rem; }

.save-changes-btn { 
    margin-top: 1.5rem; 
    background-color: var(--green-btn-bg);
    color: var(--green-btn-text);
    transition: background-color 0.2s, color 0.2s;
}

.secondary-btn { 
    background-color: transparent; 
    border: 1px solid var(--border-color) !important; 
    color: var(--future-block-color); 
    font-weight: normal;
    text-align: center;
    display: block;
    cursor: pointer;
}
.secondary-btn:hover { background-color: var(--border-color); color: var(--text-color); }

h1 { text-align: center; margin-bottom: 2rem; }
input, button, select { font-family: var(--font-family); border: 1px solid var(--border-color); background-color: #2a344e; color: var(--text-color); padding: 0.75rem; border-radius: 8px; font-size: 1rem; width: 100%; margin-top: 0.5rem; }
button { background-color: var(--primary-color); cursor: pointer; transition: background-color 0.2s; font-weight: bold; border: none; }
button:hover { opacity: 0.9; }
button:disabled { background-color: var(--disabled-color); cursor: not-allowed; }

#start-training-btn {
    background-color: var(--green-btn-bg) !important;
    color: var(--green-btn-text);
    font-weight: bold;
}

#start-pause-btn.is-paused {
    color: var(--green-btn-text) !important;
    font-weight: bold !important;
}


.io-btn {
    display: block;
    text-align: center;
    cursor: pointer;
    background-color: var(--green-btn-bg);
    color: var(--green-btn-text);
    font-weight: bold;
    padding: 1rem;
    border-radius: 8px;
    border: none;
    width: 100%;
    margin-top: 0.5rem;
    font-size: 1rem;
    transition: background-color 0.2s;
}
.io-btn:hover {
    opacity: 0.9;
}


.setup-view, .timer-view { display: none; }
.view-active { display: block; }
.input-group { margin-bottom: 1rem; }
.input-group label { display: block; margin-bottom: 0.25rem; font-weight: 500; color: var(--future-block-color); }

.input-group label.io-btn {
    color: var(--green-btn-text) !important; 
    font-weight: bold !important;
}

.time-inputs-container { display: flex; gap: 0.5rem; }
.time-inputs-container input { text-align: center; }
.file-status-container { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; font-size: 0.9rem; color: var(--future-block-color); }
.delete-file-btn { width: auto; font-size: 0.8rem; padding: 0.3rem 0.6rem; margin: 0; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }


/* OPRAVA (Symetrie): Sjednocení vertikálních mezer */
.main-content > .card:nth-child(2),
.settings-sidebar > .card:nth-child(2),
#start-training-btn {
    margin-top: 2rem !important;
}

/* OPRAVA (Symetrie): Finální doladění dle Martina na 2.7rem */
.main-content > .card:first-child {
    padding-bottom: 2.7rem;
}

/* OPRAVA (Centrování): Tímto zajistíme správné centrování labelu */
.settings-sidebar .card:nth-of-type(2) .input-group {
    margin-bottom: 0;
    text-align: center; /* Vycenruje label */
}

/* ZMĚNA: Nové styly pro HH:MM inputy času zahájení */
#start-time-inputs {
    max-width: 200px; /* Omezíme šířku kontejneru */
    margin: 0.5rem auto 0 auto; /* Vytvoří mezeru nahoře a vycentruje */
}
/* Zvětšíme písmo a padding v políčkách, aby vypadaly robustněji */
#start-time-inputs input {
    font-size: 1.25rem;
    padding: 1rem 0.75rem;
}
/* --- Konec opravy --- */


input[type="file"] {
    display: none;
}


#blocks-list { margin-top: 1rem; }
.block-item { display: flex; align-items: center; justify-content: space-between; background-color: #121829; padding: 1rem; border-radius: 8px; margin-bottom: 0.75rem; }
.block-item span { font-weight: bold; }
.block-item-buttons { display: flex; gap: 0.5rem; }
.block-item .edit-btn, .block-item .remove-btn { color: white; padding: 0.5rem 0.75rem; border-radius: 6px; width: auto; font-size: 0.9rem; }
.block-item .edit-btn { background-color: var(--primary-color); }
.block-item .remove-btn { background-color: var(--red-btn-bg); }

.timer-view-wrapper { display: flex; flex-direction: row; align-items: flex-start; justify-content: center; min-height: calc(100vh - 4rem); gap: 2rem; }
@media (max-width: 768px) { .timer-view-wrapper { flex-direction: column; align-items: center; } }
.timer-main-display { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; padding: 1rem; min-width: 350px; }
.timer-schedule-sidebar { flex: 1; padding: 1rem; min-width: 300px; max-width: 400px; }
.timer-schedule-sidebar h2 { text-align: center; margin-bottom: 1.5rem; margin-top: 2.5rem; }
@media (max-width: 768px) { .timer-schedule-sidebar { width: 90%; max-width: 600px; } .timer-main-display { width: 100%; } .timer-schedule-sidebar h2 { margin-top: 0; } }
#current-block-name { font-size: 2.5rem; text-align: center; margin-bottom: 1rem; }
#current-block-message { font-size: 1.1rem; color: var(--future-block-color); text-align: center; min-height: 30px; margin-bottom: 2rem; }

.countdown-circle-container { position: relative; width: var(--circle-size); height: var(--circle-size); display: flex; align-items: center; justify-content: center; margin-bottom: 2rem; }
.countdown-circle-svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.countdown-circle-track { fill: none; stroke: var(--track-color); stroke-width: var(--stroke-width); }
.countdown-circle-progress { fill: none; stroke: var(--stroke-color); stroke-width: var(--stroke-width); stroke-linecap: round; transition: stroke-dashoffset 0.9s linear; }
#countdown-display { font-size: 4rem; font-weight: bold; z-index: 10; position: relative; }
.controls { display: flex; justify-content: center; gap: 1rem; margin-top: 2rem; margin-bottom: 3rem; width: 100%; max-width: 450px; }
.controls button { flex: 1; padding: 1rem; font-size: 1.1rem; white-space: nowrap; }


/* OPRAVA (Scrollbar bug fix) */
#schedule-display { 
    display: flex; 
    flex-direction: column; 
    gap: 0.5rem; 
    max-height: 60vh; 
    overflow-y: auto; 
    width: 100%; 
    padding: 0 5px;
    
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}
#schedule-display::-webkit-scrollbar { 
    width: 8px; 
}
#schedule-display::-webkit-scrollbar-track { 
    background: transparent;
    border-radius: 10px;
}
#schedule-display::-webkit-scrollbar-thumb { 
    background: transparent; 
    border-radius: 10px; 
}
#schedule-display:hover {
    scrollbar-color: var(--primary-color) var(--secondary-color);
}
#schedule-display:hover::-webkit-scrollbar-track { 
    background: var(--secondary-color);
}
#schedule-display:hover::-webkit-scrollbar-thumb { 
    background: var(--primary-color); 
}
#schedule-display::-webkit-scrollbar-thumb:hover { 
    background: #555; 
}
/* --- Konec opravy scrollbaru --- */

.schedule-item { 
    padding: 1rem;
    border-radius: 8px; 
    transition: all 0.3s; 
    position: relative; 
} 
.schedule-item.past { color: var(--past-block-color); opacity: 0.6; }
.schedule-item.current { background-color: var(--primary-color); color: var(--current-block-color); font-weight: bold; transform: scale(1.02); }

.schedule-item.current small {
    color: var(--green-btn-text) !important;
    font-weight: normal;
}

.schedule-item.future { color: var(--future-block-color); }
.schedule-item span { position: relative; z-index: 2; }

.top-right-controls { position: absolute; top: 1rem; right: 1rem; display: flex; align-items: center; gap: 1rem; z-index: 100; }
#current-real-time { font-size: 1.2rem; color: var(--text-color); font-weight: bold; display: none; background-color: rgba(18, 24, 41, 0.7); padding: 0.5rem 0.75rem; border-radius: 8px; }
body.in-timer-mode #current-real-time { display: block; }
.icon-btn { background: none; border: none; color: var(--text-color); font-size: 1.5rem; cursor: pointer; width: auto; padding: 0; margin: 0; line-height: 1; }
.icon-btn:hover { color: var(--primary-color); }

body.in-timer-mode #lang-switcher,
body.in-timer-mode #reset-app-btn,
body.in-timer-mode #hard-refresh-btn,
body.in-timer-mode #app-settings-btn {
    display: none;
}

#app-settings-btn {
    display: none;
}
body:not(.in-timer-mode) #app-settings-btn {
    display: block;
}


.color-picker-group { display: flex; align-items: center; gap: 10px; }
.color-picker-group input[type="color"] { padding: 0; width: 40px; height: 40px; border: none; border-radius: 8px; background: none; cursor: pointer; }

#lang-switcher { display: flex; gap: 0.5rem; background-color: rgba(18, 24, 41, 0.7); padding: 0.25rem; border-radius: 8px; }
.lang-btn { background: none; border: 1px solid transparent; color: var(--text-color); cursor: pointer; opacity: 0.6; padding: 0.25rem 0.5rem; font-size: 1rem; margin: 0; font-weight: bold; }
.lang-btn.active { opacity: 1; background-color: var(--primary-color); }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.7); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background-color: var(--secondary-color); padding: 2rem; border-radius: 12px; border: 1px solid var(--border-color); width: 90%; max-width: 500px; display: flex; flex-direction: column; gap: 1.5rem; }

#app-settings-modal .modal-content {
    max-width: 360px;
}
#app-settings-modal .customization-content {
    gap: 0.5rem;
}
#app-settings-modal .input-group[style*="border-top"] {
    padding-top: 0.5rem !important;
    margin-top: 0.5rem !important;
}
#app-settings-modal .io-btn {
    font-weight: bold !important;
}

.modal-content h2 { text-align: center; margin-bottom: 0; }
.voice-select-group { display: flex; flex-direction: column; gap: 0.5rem; }
.voice-select-group .controls { display: flex; gap: 1rem; margin: 0; padding: 0; }
.voice-select-group .controls select { flex-grow: 1; }
.voice-select-group .controls button { flex-grow: 0; width: auto; padding: 0.75rem 1rem; }

/* Styly pro Rychlou stopku */
#quick-timer-btn { display: none; }
body.in-timer-mode #quick-timer-btn { display: block; }
#quick-timer-display.active { color: var(--primary-color); transition: color 0.3s; }

#stop-quick-timer-btn {
    background-color: var(--red-btn-bg) !important;
    color: var(--text-color) !important;
    font-weight: bold !important;
    border: none !important;
}
#stop-quick-timer-btn:hover {
    opacity: 0.9;
}


/* Styly pro Delta Time (Skluz/Náskok) */
#delta-time-display {
    font-size: 1.2rem;
    font-weight: bold;
    display: none;
    background-color: rgba(18, 24, 41, 0.7);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    min-width: 130px;
    text-align: center;
}
body.in-timer-mode #delta-time-display { display: block; }
#delta-time-display.delta-on-time { color: var(--text-color); }
#delta-time-display.delta-ahead { color: var(--delta-ahead-color); }
#delta-time-display.delta-behind { color: var(--delta-behind-color); }


/* Zvýraznění formuláře pro úpravu bloku */
.card.editing-active {
    border-color: var(--primary-color);
    box-shadow: 0 0 12px 2px var(--primary-color);
    transition: box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out;
}

/* ZMĚNA: Přidání stylu pro footer */
.app-footer {
    text-align: center;
    padding: 3rem 1rem 1.5rem 1rem; /* Více místa shora */
    font-size: 0.85rem;
    color: var(--border-color); /* Decentní barva */
    opacity: 0.8;
    width: 100%;
    margin: 0 auto;
}

.app-footer p {
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   v13 UX IMPROVEMENTS - Settings Menu, Animations, Effects
   ═══════════════════════════════════════════════════════════════ */

/* --- Settings Dropdown Menu --- */
.settings-menu-container {
    position: relative;
}

.settings-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background-color: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    min-width: 220px;
    padding: 0.5rem 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease-out;
    z-index: 1000;
}

.settings-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 0.95rem;
    font-weight: normal;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s;
    margin: 0;
    border-radius: 0;
}

.dropdown-item:hover {
    background-color: rgba(59, 130, 246, 0.15);
}

/* Label jako dropdown item (pro file input) */
label.dropdown-item {
    margin: 0;
}

.dropdown-item-danger:hover {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--red-btn-bg);
}

.dropdown-icon {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.5rem 0;
}

/* Skryjeme menu v timer módu */
body.in-timer-mode .settings-menu-container {
    display: none;
}

/* --- Block Add Animation --- */
@keyframes blockSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.block-item {
    animation: blockSlideIn 0.3s ease-out;
}

.block-item.just-added {
    animation: blockSlideIn 0.3s ease-out, blockHighlight 2s ease-out;
}

@keyframes blockHighlight {
    0% {
        box-shadow: 0 0 0 2px var(--primary-color);
        background-color: rgba(59, 130, 246, 0.2);
    }
    100% {
        box-shadow: 0 0 0 0px transparent;
        background-color: #121829;
    }
}

/* --- Toast Notification (pravý horní roh, nad ikonami) --- */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 2rem;
    z-index: 2000;
    pointer-events: none;
}

.toast {
    background-color: var(--green-btn-bg);
    color: var(--green-btn-text);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease-out;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* --- Pulsing CTA Button --- */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

#start-training-btn:not(:disabled) {
    animation: pulse 2s infinite;
}

#start-training-btn:not(:disabled):hover {
    animation: none;
    transform: scale(1.02);
    transition: transform 0.2s;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--future-block-color);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.empty-state-description {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.empty-state-cta {
    display: inline-block;
    color: var(--primary-color);
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
}

.empty-state-cta:hover {
    opacity: 0.8;
}

/* --- Timer Countdown Effects --- */
@keyframes countdownPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes countdownUrgent {
    0%, 100% {
        color: var(--text-color);
    }
    50% {
        color: var(--red-btn-bg);
    }
}

.countdown-warning #countdown-display {
    animation: countdownPulse 1s ease-in-out infinite;
    color: #f59e0b; /* Amber/Yellow */
}

.countdown-critical #countdown-display {
    animation: countdownPulse 0.5s ease-in-out infinite, countdownUrgent 0.5s ease-in-out infinite;
}

.countdown-warning .countdown-circle-progress {
    stroke: #f59e0b !important;
    transition: stroke 0.3s;
}

.countdown-critical .countdown-circle-progress {
    stroke: var(--red-btn-bg) !important;
    transition: stroke 0.3s;
}

/* --- Improved Timer Controls --- */
.controls {
    flex-direction: column;
    gap: 0.75rem;
}

.controls-primary {
    width: 100%;
}

.controls-primary button {
    width: 100%;
    padding: 1.25rem;
    font-size: 1.3rem;
    text-align: center !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.controls-secondary {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.controls-secondary button {
    flex: 1;
    padding: 0.75rem;
    font-size: 0.95rem;
    background-color: var(--secondary-color);
    border: 1px solid var(--border-color);
}

.controls-secondary button:hover {
    background-color: var(--border-color);
}

/* --- Celebration Animation --- */
@keyframes celebration {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.1);
    }
    50% {
        transform: scale(1);
    }
    75% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.block-complete-celebration {
    animation: celebration 0.6s ease-out;
}