/* style.css v1.19 */
:root {
    /* Moderní barevná paleta - Světlý režim */
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --border-color: #e2e8f0;
    --surface-color: #ffffff;
    --lane-bg: #f1f5f9;
    
    /* Pastelové barvy lístečků podle důležitosti */
    --note-high: #fee2e2;
    --note-high-border: #ef4444;
    --note-med: #fef3c7;
    --note-med-border: #f59e0b;
    --note-low: #dcfce7;
    --note-low-border: #22c55e;
    
    /* Hotové lístečky */
    --note-completed-bg: #f1f5f9;
    --note-completed-border: #94a3b8;
    --note-completed-text: #94a3b8;

    /* Stíny a zaoblení */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
    --transition: all 0.2s ease-in-out;
}

/* --- MAPOVÁNÍ PRO TMAVÝ REŽIM (DARK MODE) --- */
body.dark-mode {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --surface-color: #1e293b;
    --lane-bg: #1e293b;
    
    --note-high: #451a1a;
    --note-high-border: #f87171;
    --note-med: #453015;
    --note-med-border: #fbbf24;
    --note-low: #143520;
    --note-low-border: #34d399;
    
    --note-completed-bg: #1e293b;
    --note-completed-border: #475569;
    --note-completed-text: #64748b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- Univerzální třídy --- */
.hidden { display: none !important; }

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* --- Tlačítka --- */
.btn-primary { background-color: var(--primary-color); color: white; border: none; padding: 10px 20px; border-radius: var(--radius-md); cursor: pointer; font-weight: 600; transition: var(--transition); display: inline-flex; align-items: center; justify-content: center; }
.btn-primary:hover { background-color: var(--primary-hover); }

.btn-outline { background-color: transparent; color: var(--text-muted); border: 1px solid var(--border-color); padding: 8px 16px; border-radius: var(--radius-md); cursor: pointer; font-weight: 500; transition: var(--transition); }
.btn-outline:hover { background-color: var(--lane-bg); color: var(--text-color); }

.btn-danger-outline { background-color: transparent; color: #ef4444; border: 1px solid #ef4444; padding: 8px 16px; border-radius: var(--radius-md); cursor: pointer; font-weight: 500; transition: var(--transition); }
.btn-danger-outline:hover { background-color: #ef4444; color: white; }

.btn-success-outline { background-color: transparent; color: #22c55e; border: 1px solid #22c55e; padding: 8px 16px; border-radius: var(--radius-md); cursor: pointer; font-weight: 500; transition: var(--transition); }
.btn-success-outline:hover { background-color: #22c55e; color: white; }

.btn-icon { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1em; padding: 4px; border-radius: 4px; transition: var(--transition); }
.btn-icon:hover { color: var(--text-color); background: rgba(0,0,0,0.05); }
.btn-icon.delete:hover { color: var(--note-high-border); background: var(--note-high); }
.btn-icon.edit:hover { color: var(--primary-color); background: rgba(59, 130, 246, 0.1); }
.btn-icon.postpone:hover { color: var(--note-med-border); background: rgba(245, 158, 11, 0.1); }

.header-icon-btn { font-size: 1.3em; padding: 6px; }
.header-icon-btn.active-bell { color: #f59e0b; }
.header-icon-btn.active-bell:hover { background: rgba(245, 158, 11, 0.1); }

/* Skrytí FAB tlačítka na desktopech */
.mobile-fab-btn { display: none; }

/* --- Autentizační obrazovka --- */
.auth-screen { position: fixed; inset: 0; background-color: rgba(15, 23, 42, 0.8); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 20px; }
.auth-box { background: var(--surface-color); padding: 40px 30px; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 400px; text-align: center; border: 1px solid var(--border-color); }
.auth-box h2 { color: var(--text-color); margin-bottom: 8px; }
.auth-box p { color: var(--text-muted); font-size: 0.9em; margin-bottom: 24px; }
.auth-box .btn-primary { width: 100%; margin-top: 10px; }
.error-message { color: var(--note-high-border); margin-top: 12px; font-size: 0.9em; min-height: 20px; }

/* --- Modální okna --- */
.modal { position: fixed; inset: 0; background-color: rgba(15, 23, 42, 0.6); backdrop-filter: blur(2px); display: flex; justify-content: center; align-items: center; z-index: 2000; padding: 20px; }
.modal-content { background: var(--surface-color); padding: 25px 30px; border-radius: var(--radius-lg); width: 100%; max-width: 550px; box-shadow: var(--shadow-lg); max-height: 95vh; display: flex; flex-direction: column; border: 1px solid var(--border-color); }
.trash-content { max-width: 600px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.modal-header h3 { color: var(--text-color); margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; flex-shrink: 0; }
.trash-actions { justify-content: space-between; } 

/* --- Vzhled Custom Dialogových oken (Nahrazují alert/confirm) --- */
.dialog-content {
    max-width: 420px;
    text-align: center;
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    background-color: var(--surface-color);
}
.dialog-title { font-size: 1.3em; font-weight: 700; margin-bottom: 12px; color: var(--text-color); }
.dialog-message { font-size: 0.98em; color: var(--text-muted); line-height: 1.5; margin-bottom: 24px; word-break: break-word; }
.dialog-actions { justify-content: center; gap: 16px; margin-top: 0; }

/* --- Formuláře --- */
.modern-form .form-group { margin-bottom: 16px; text-align: left; }
.modern-form label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 0.9em; color: var(--text-color); }
.modern-form input:not([type="checkbox"]), .modern-form select { width: 100%; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background-color: var(--bg-color); color: var(--text-color); transition: var(--transition); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .full-width { grid-column: 1 / -1; }

/* --- Rozhraní podúkolů v Modálu --- */
.subtasks-section { background-color: var(--lane-bg); padding: 15px; border-radius: var(--radius-md); border: 1px solid var(--border-color); }
.edit-subtasks-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; max-height: 160px; overflow-y: auto; padding-right: 4px; }
.edit-subtasks-list::-webkit-scrollbar { width: 4px; }
.edit-subtasks-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: var(--radius-full); }
.edit-subtask-item { display: flex; align-items: center; justify-content: space-between; background-color: var(--surface-color); padding: 8px 12px; border-radius: var(--radius-md); border: 1px solid var(--border-color); gap: 10px; }
.edit-subtask-item-left { display: flex; align-items: flex-start; gap: 10px; flex: 1; }
.edit-subtask-item-left span { word-break: break-word; font-size: 0.95em; color: var(--text-color); }
.edit-subtask-item-left span.completed { text-decoration: line-through; color: var(--text-muted); }
.subtask-add-row { display: flex; gap: 10px; }
.subtask-add-row input { flex: 1; background-color: var(--surface-color) !important; color: var(--text-color); }
.subtask-add-row .btn-outline { padding: 0 15px; background-color: var(--surface-color); }

/* --- Styly pro Koš --- */
.trash-info { font-size: 0.9em; color: var(--text-muted); margin-bottom: 15px; flex-shrink: 0; }
.trash-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 5px; }
.trash-list::-webkit-scrollbar { width: 6px; }
.trash-list::-webkit-scrollbar-track { background: transparent; }
.trash-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: var(--radius-full); }
.trash-item { background-color: var(--bg-color); border: 1px solid var(--border-color); padding: 12px 15px; border-radius: var(--radius-md); display: flex; justify-content: space-between; align-items: center; gap: 15px; transition: var(--transition); }
.trash-item:hover { border-color: #cbd5e1; background-color: var(--surface-color); }
.trash-item-content { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.trash-item-text { font-weight: 500; color: var(--text-color); word-break: break-word; }
.trash-item-meta { font-size: 0.85em; color: var(--text-muted); }
.trash-item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.empty-trash-message { text-align: center; color: var(--text-muted); padding: 30px 0; font-style: italic; }

/* --- Hlavní aplikace --- */
.app-screen { display: flex; flex-direction: column; min-height: 100vh; width: 100%; }

/* FIXNÍ NAVIGAČNÍ LIŠTA NA VRCHU STRÁNKY */
.app-header {
    background-color: var(--surface-color);
    padding: 15px 25px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.header-top { display: flex; justify-content: space-between; align-items: center; gap: 15px; width: 100%; }
.header-brand { display: flex; align-items: center; gap: 15px; }
.header-brand h1 { font-size: 1.4em; color: var(--text-color); margin: 0; }
.user-badge { background: var(--lane-bg); padding: 4px 12px; border-radius: var(--radius-full); font-size: 0.85em; font-weight: 600; color: var(--text-muted); border: 1px solid var(--border-color); }
.header-controls { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

/* Tlačítka štítků */
.tags-container { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-top: 10px; border-top: 1px solid var(--border-color); }
.tags-container::-webkit-scrollbar { height: 0; } 
.tag-btn { background-color: var(--lane-bg); color: var(--text-muted); border: 1px solid var(--border-color); border-radius: 16px; padding: 4px 12px; font-size: 0.85em; font-weight: 500; cursor: pointer; transition: var(--transition); white-space: nowrap; }
.tag-btn:hover { background-color: rgba(0,0,0,0.05); color: var(--text-color); }
.tag-btn.active { background-color: var(--primary-color); color: white; box-shadow: var(--shadow-sm); border-color: var(--primary-color); }

/* Vyhledávání a Filtry */
.search-wrapper { position: relative; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 0.9em; opacity: 0.5; color: var(--text-muted); }
.search-input { padding: 8px 12px 8px 32px; border: 1px solid var(--border-color); border-radius: var(--radius-full); background-color: var(--lane-bg); color: var(--text-color); width: 220px; transition: var(--transition); }
.search-input:focus { width: 260px; background-color: var(--surface-color); }
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-group label { font-size: 0.9em; font-weight: 500; color: var(--text-muted); }
.modern-select { padding: 8px 12px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background-color: var(--surface-color); color: var(--text-color); cursor: pointer; }

.toggle-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle-switch input { display: none; }
.toggle-slider { position: relative; width: 40px; height: 22px; background-color: var(--border-color); border-radius: 22px; transition: var(--transition); }
.toggle-slider::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background-color: white; border-radius: 50%; transition: var(--transition); box-shadow: var(--shadow-sm); }
.toggle-switch input:checked + .toggle-slider { background-color: var(--primary-color); }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(18px); }
.toggle-label { font-size: 0.9em; font-weight: 500; color: var(--text-muted); user-select: none; }

/* SEKCE PRO RYCHLÉ PŘIDÁNÍ */
.quick-add-section { background-color: var(--surface-color); padding: 20px 25px; border-bottom: 1px solid var(--border-color); z-index: 5; position: relative; }
.quick-add-container { display: block; }

.quick-add-form { display: flex; flex-direction: column; gap: 15px; max-width: 1200px; margin: 0 auto; }
.quick-add-main input { width: 100%; padding: 15px 20px; font-size: 1.1em; border: 2px solid transparent; border-radius: var(--radius-md); background-color: var(--lane-bg); color: var(--text-color); transition: var(--transition); }
.quick-add-main input:focus { border-color: var(--primary-color); background-color: var(--surface-color); box-shadow: var(--shadow-md); }
.quick-add-details { display: flex; gap: 15px; align-items: center; flex-wrap: wrap; }
.input-wrapper { position: relative; flex: 1; min-width: 170px; }
.input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 1.1em; z-index: 1; }
.input-wrapper input, .input-wrapper select { width: 100%; padding: 10px 12px 10px 38px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background-color: var(--surface-color); color: var(--text-color); transition: var(--transition); }

/* FLUIDNÍ MŘÍŽKA */
.board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    align-items: start;
    padding: 25px;
    gap: 25px;
    width: 100%;
}

.lane {
    background-color: var(--lane-bg);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    height: auto;
}

.lane-header { padding: 16px 20px; font-weight: 600; color: var(--text-color); border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.lane-count { background: var(--border-color); color: var(--text-muted); border-radius: var(--radius-full); padding: 2px 10px; font-size: 0.85em; }

.lane-body { 
    padding: 15px;
    display: flex;
    flex-direction: column;
    transition: background-color 0.2s; 
}
.lane-body.drag-over-container { background-color: rgba(59, 130, 246, 0.1); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* --- DEFINICE ANIMACÍ (MICRO-INTERACTIONS) --- */
@keyframes noteDelete {
    0% { transform: scale(1); opacity: 1; max-height: 400px; margin-bottom: 15px; padding: 16px; }
    50% { transform: scale(0.85); opacity: 0.4; }
    100% { transform: scale(0.5); opacity: 0; max-height: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; border: none; }
}

@keyframes noteComplete {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); background-color: #69db7c; border-color: #2b8a3e; }
    100% { transform: scale(1); }
}

@keyframes notePostpone {
    0% { transform: translateX(0); opacity: 1; max-height: 400px; margin-bottom: 15px; }
    100% { transform: translateX(120%); opacity: 0; max-height: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; border: none; }
}

.note-card.anim-delete { animation: noteDelete 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.note-card.anim-complete { animation: noteComplete 0.3s ease-in-out forwards; }
.note-card.anim-postpone { animation: notePostpone 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

/* Lístečky */
.note-card { background-color: var(--surface-color); padding: 16px; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); margin-bottom: 15px; cursor: grab; position: relative; border-left: 6px solid transparent; border-top: 1px solid var(--border-color); border-right: 1px solid var(--border-color); border-left-style: solid; border-bottom: 1px solid var(--border-color); transition: box-shadow 0.2s, transform 0.2s, opacity 0.2s, background-color 0.2s; overflow: hidden; }
.note-card:last-child { margin-bottom: 0; }

.note-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.note-card:active { cursor: grabbing; }
.note-card.dragging { opacity: 0.5; transform: scale(1.02); box-shadow: var(--shadow-lg); }

.note-card.drag-over-top { box-shadow: 0 -3px 0 var(--primary-color), var(--shadow-sm); }
.note-card.drag-over-bottom { box-shadow: 0 3px 0 var(--primary-color), var(--shadow-sm); }

.note-card[data-importance="3"] { background-color: var(--note-high); border-left-color: var(--note-high-border); }
.note-card[data-importance="2"] { background-color: var(--note-med); border-left-color: var(--note-med-border); }
.note-card[data-importance="1"] { background-color: var(--note-low); border-left-color: var(--note-low-border); }

.note-card.completed { background-color: var(--note-completed-bg) !important; border-left-color: var(--note-completed-border) !important; opacity: 0.6; transform: none !important; box-shadow: none !important; }
.note-card.completed .note-text { text-decoration: line-through; color: var(--note-completed-text); }

.note-text a { color: var(--primary-color); text-decoration: none; font-weight: 500; }
.note-text a:hover { text-decoration: underline; }

.note-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.note-main { display: flex; gap: 12px; align-items: flex-start; flex: 1; }

.note-checkbox { appearance: none; width: 20px; height: 20px; border: 2px solid var(--border-color); border-radius: 4px; background-color: var(--surface-color); cursor: pointer; position: relative; margin-top: 2px; transition: var(--transition); flex-shrink: 0; }
.note-checkbox:checked { background-color: var(--primary-color); border-color: var(--primary-color); }
.note-checkbox:checked::after { content: '✔'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-size: 12px; }

.note-text { font-size: 1em; word-break: break-word; flex: 1; line-height: 1.4; color: var(--text-color); }
.note-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.2s; }
.note-card:hover .note-actions { opacity: 1; }

/* Progress Bar a Checklist */
.note-progress-container { margin-top: 12px; background-color: rgba(0, 0, 0, 0.08); border-radius: var(--radius-full); height: 6px; overflow: hidden; width: 100%; }
.note-progress-bar { background-color: var(--primary-color); height: 100%; width: 0%; transition: width 0.3s ease-in-out; border-radius: var(--radius-full); }
.note-card.completed .note-progress-bar, .note-progress-container[data-progress="100"] .note-progress-bar { background-color: var(--note-low-border); }

.note-subtasks-preview { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border-color); padding-top: 10px; }
.subtask-preview-item { display: flex; align-items: flex-start; gap: 8px; font-size: 0.88em; color: var(--text-color); line-height: 1.3; }
.subtask-preview-checkbox { appearance: none; width: 16px; height: 16px; border: 1.5px solid var(--text-muted); border-radius: 3px; background-color: var(--surface-color); cursor: pointer; position: relative; margin-top: 2px; flex-shrink: 0; transition: var(--transition); }
.subtask-preview-checkbox:checked { background-color: var(--text-muted); border-color: var(--text-muted); }
.subtask-preview-checkbox:checked::after { content: '✓'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-size: 10px; font-weight: bold; }
.subtask-preview-item span { word-break: break-word; }
.subtask-preview-item.completed span { text-decoration: line-through; color: var(--text-muted); }

.note-meta { font-size: 0.85em; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-color); }
.note-time-badge { background: rgba(0, 0, 0, 0.04); color: var(--text-color); padding: 4px 8px; border-radius: var(--radius-md); font-weight: 500; border: 1px solid var(--border-color); white-space: nowrap; }
body.dark-mode .note-time-badge { background: rgba(255, 255, 255, 0.05); }
.recurring-indicator { color: var(--primary-color); margin-left: 5px; font-size: 1.1em; }

/* === MOBILNÍ RESPONZIVITA === */
@media (max-width: 992px) {
    .header-top { flex-direction: column; align-items: stretch; }
    .header-controls { flex-wrap: wrap; justify-content: space-between; gap: 10px; }
    .search-wrapper { width: 100%; order: -1; margin-bottom: 5px; }
    .search-input { width: 100%; }
    .search-input:focus { width: 100%; }
}

@media (max-width: 768px) {
    .filter-group, .toggle-switch { flex: 1 1 auto; justify-content: flex-start; white-space: nowrap; }
    .btn-outline { flex: 0 0 auto; }
    
    body { height: auto; min-height: 100dvh; overflow-y: auto; }
    .app-screen { height: auto; overflow: visible; }
    .app-header { position: sticky; top: 0; }

    /* Zobrazení plovoucího FAB tlačítka */
    .mobile-fab-btn {
        display: flex; position: fixed; bottom: 25px; right: 25px; width: 60px; height: 60px;
        border-radius: 50%; background-color: var(--primary-color); color: white; box-shadow: var(--shadow-lg);
        z-index: 999; font-size: 1.6em; justify-content: center; align-items: center; border: none; cursor: pointer; transition: transform 0.2s ease, background-color 0.2s ease;
    }
    .mobile-fab-btn:active { transform: scale(0.9); background-color: var(--primary-hover); }

    .quick-add-container { display: none; margin-top: 15px; }
    .quick-add-container.active { display: block; }
    .quick-add-section { padding: 0; border-bottom: none; }
    .quick-add-container.active .quick-add-form { padding: 15px; background: var(--surface-color); border-bottom: 1px solid var(--border-color); }

    .quick-add-details { flex-direction: column; align-items: stretch; }
    .input-wrapper { width: 100%; }
    .quick-add-details .btn-primary { width: 100%; padding: 12px; }
    .form-grid { grid-template-columns: 1fr; }
    
    .board { grid-template-columns: 1fr; padding: 15px; gap: 20px; }
    .note-actions { opacity: 1; }
    
    .trash-item { flex-direction: column; align-items: flex-start; }
    .trash-item-actions { width: 100%; justify-content: space-between; margin-top: 10px; }
    .trash-item-actions button { flex: 1; text-align: center; justify-content: center; }
}
