:root {
    /* PALETA (Indigo & Slate) */
    --primary: #6366f1; --primary-hover: #4f46e5; --primary-soft: #e0e7ff; --text-primary: #4338ca;
    --bg-body: #f8fafc; --bg-surface: #ffffff; --bg-hover: #f1f5f9; --bg-input: #ffffff;
    --text-main: #0f172a; --text-muted: #64748b; --border: #e2e8f0;
    --radius: 12px; --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --font-sans: 'Inter', sans-serif;
    --danger: #ef4444; --danger-soft: #fee2e2;
}

/* TMAVÝ REŽIM */
body[data-theme="dark"] {
    --bg-body: #0f172a; --bg-surface: #1e293b; --bg-hover: #334155; --bg-input: #334155;
    --text-main: #f8fafc; --text-muted: #94a3b8; --border: #334155;
    --primary-soft: #312e81; --text-primary: #818cf8;
    --danger-soft: #7f1d1d;
}

/* RESET A LAYOUT */
body { background: var(--bg-body); color: var(--text-main); font-family: var(--font-sans); height: 100vh; margin: 0; overflow: hidden; transition: background 0.3s, color 0.3s; }
#app { display: flex; width: 100%; height: 100%; }
[v-cloak] { display: none; }

/* SIDEBAR */
.app-sidebar { width: 260px; background: var(--bg-surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; z-index: 20; transition: background 0.3s; }
.app-sidebar a, .app-sidebar a:hover, .app-sidebar a:focus { text-decoration: none; }
.sidebar-header { height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.brand-icon { width: 32px; height: 32px; background: var(--primary); color: white; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.brand-text { font-weight: 700; font-size: 16px; color: var(--text-main); }

.sidebar-content { flex: 1; overflow-y: auto; padding: 16px; }
.btn-new-item { width: 100%; background: var(--text-main); color: var(--bg-surface); border: none; padding: 12px; border-radius: 8px; font-weight: 600; margin-bottom: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s; }
.btn-new-item:hover { transform: translateY(-1px); box-shadow: 0 4px 6px rgba(0,0,0,0.1); }

.nav-section-title { font-size: 11px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; margin-bottom: 8px; padding-left: 8px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--text-muted); font-weight: 500; margin-bottom: 2px; text-decoration: none; }
.nav-item:hover, .nav-item:focus { background: var(--bg-hover); color: var(--text-main); text-decoration: none; }
.nav-item.active { background: var(--primary-soft); color: var(--text-primary); }
.badge-count { background: var(--bg-hover); color: var(--text-muted); font-size: 11px; padding: 2px 6px; border-radius: 4px; margin-left: auto; }

.sub-nav { margin-left: 14px; border-left: 2px solid var(--border); margin-bottom: 8px; }
.sub-nav-item { padding: 6px 12px 6px 16px; font-size: 13px; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; border-radius: 0 6px 6px 0; }
.sub-nav-item:hover { color: var(--text-main); }
.sub-nav-item.active { color: var(--primary); font-weight: 600; background: linear-gradient(90deg, var(--bg-hover), transparent); }

/* SIDEBAR FOOTER */
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; background: var(--bg-surface); flex-shrink: 0; }
.sidebar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-sidebar-action { border: 1px solid var(--border); background: var(--bg-body); padding: 8px; border-radius: 8px; color: var(--text-muted); cursor: pointer; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; transition: all 0.2s; text-decoration: none; }
.btn-sidebar-action:hover, .btn-sidebar-action:focus { background: var(--bg-hover); color: var(--text-main); border-color: var(--text-muted); text-decoration: none; }

.user-profile { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: var(--bg-hover); border: 1px solid transparent; transition: 0.2s; }
.user-profile:hover { border-color: var(--border); background: var(--bg-input); }
.avatar { width: 36px; height: 36px; background: var(--primary); color: white; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.user-info { flex: 1; overflow: hidden; }
.user-info .name { font-size: 13px; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .role { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.btn-logout { width: 32px; height: 32px; border: none; background: transparent; color: #ef4444; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; font-size: 18px; }
.btn-logout:hover { background: #fee2e2; }

/* MAIN CONTENT */
.app-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-body); width: 0; }
.content-header { height: 64px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: var(--bg-surface); flex-shrink: 0; }

/* Search (Expandable) */
.search-container { position: relative; height: 40px; display: flex; align-items: center; }
.search-bar { display: flex; align-items: center; background: var(--bg-hover); border-radius: 99px; padding: 0; width: 40px; height: 40px; overflow: hidden; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); border: 1px solid transparent; cursor: pointer; }
.search-bar.active { width: 300px; background: var(--bg-input); border-color: var(--border); padding-left: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); cursor: text; }
.search-icon-btn { width: 32px; height: 32px; border: none; background: transparent; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 18px; flex-shrink: 0; cursor: pointer; border-radius: 50%; margin-left: 3px; }
.search-bar.active .search-icon-btn { color: var(--primary); }
.search-input { border: none; background: transparent; outline: none; height: 100%; width: 100%; color: var(--text-main); font-size: 14px; padding-right: 16px; opacity: 0; transform: translateX(10px); transition: all 0.3s ease; pointer-events: none; }
.search-bar.active .search-input { opacity: 1; transform: translateX(0); pointer-events: all; }

.header-actions { display: flex; align-items: center; gap: 12px; }
.btn-tool { border: 1px solid var(--border); background: var(--bg-surface); width: 36px; height: 36px; border-radius: 8px; color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; }
.btn-tool:hover { border-color: var(--text-muted); color: var(--text-main); }

/* TABLE */
.content-body { flex: 1; overflow-y: auto; padding: 24px; }
.modern-table-container { background: var(--bg-surface); border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow: hidden; }
.modern-table { width: 100%; border-collapse: collapse; }
.modern-table th { text-align: left; padding: 14px 20px; font-size: 11px; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--bg-surface); position: sticky; top: 0; z-index: 10; }
.modern-table td { padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; color: var(--text-main); transition: padding 0.3s; }
.modern-table tr:hover { background: var(--bg-hover); }

/* COMPACT MODE STYLES */
.table-compact th { padding: 8px 12px; }
.table-compact td { padding: 6px 12px; font-size: 13px; }
.table-compact .img-wrapper { width: 32px; height: 32px; }

/* LOW STOCK STYLE */
.stock-low .stock-display { color: var(--danger); }
.stock-low .stock-control { border: 1px solid var(--danger); background: var(--danger-soft); }

.img-wrapper { width: 40px; height: 40px; background: var(--bg-hover); border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; overflow: hidden; }
.img-wrapper img { width: 100%; height: 100%; object-fit: cover; }
.datasheet-link { font-size: 11px; text-decoration: none; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; }
.badge-category { font-weight: 600; font-size: 13px; color: var(--text-main); }
.badge-footprint { padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.badge-smd { background: #e0e7ff; color: #4338ca; }
.badge-tht { background: #ffedd5; color: #9a3412; }
.spec-tag { background: var(--bg-hover); border: 1px solid var(--border); padding: 2px 8px; border-radius: 6px; font-size: 11px; color: var(--text-main); display: inline-block; margin: 1px; }
.stock-control { display: inline-flex; align-items: center; gap: 8px; background: var(--bg-hover); padding: 4px; border-radius: 8px; }
.stock-control button { border: none; background: var(--bg-surface); width: 24px; height: 24px; border-radius: 6px; cursor: pointer; color: var(--text-main); display: flex; justify-content: center; align-items: center; }
.stock-display { font-weight: 700; font-size: 15px; }
.action-buttons { display: flex; gap: 6px; justify-content: flex-end; opacity: 0.6; }
tr:hover .action-buttons { opacity: 1; }
.btn-icon { border: none; background: transparent; width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: pointer; }
.btn-icon:hover { background: var(--bg-hover); color: var(--text-main); }

/* MODALS */
.modern-modal { border: none; border-radius: 16px; background: var(--bg-surface); color: var(--text-main); box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); }
.modal-header { border-bottom: 1px solid var(--border); padding: 20px 24px; }
.modal-body { padding: 24px; }
.modal-footer { border-top: 1px solid var(--border); padding: 16px 24px; background: var(--bg-hover); border-radius: 0 0 16px 16px; }
.modern-input, .modern-select, .form-control { width: 100%; border: 1px solid var(--border); background: var(--bg-input); padding: 10px 12px; border-radius: 8px; outline: none; color: var(--text-main); font-size: 14px; box-shadow: none; }
.modern-input:focus, .modern-select:focus, .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.modal-label { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; display: block; text-transform: uppercase; letter-spacing: 0.5px; }
.btn-close-modern { background: transparent; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }
.btn-primary { background: var(--primary); border: none; color: white; padding: 10px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; }
.btn-primary:hover { background: var(--primary-hover); }
.params-container { background: var(--bg-hover); border-radius: 8px; padding: 16px; border: 1px solid var(--border); margin-top: 8px; }
.param-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.param-label { width: 120px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.btn-remove-param { border: none; background: transparent; color: #ef4444; cursor: pointer; padding: 4px; }

/* Login */
.login-overlay { position: fixed; top:0; left:0; width:100%; height:100%; background: var(--bg-body); z-index: 9999; display: flex; justify-content: center; align-items: center; }
.login-card { background: var(--bg-surface); padding: 40px; border-radius: 24px; width: 400px; border: 1px solid var(--border); box-shadow: 0 10px 25px rgba(0,0,0,0.05); }
.login-icon { width: 64px; height: 64px; background: var(--primary-soft); color: var(--primary); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 32px; margin: 0 auto; }

.columns-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.custom-check { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--text-main); }
.custom-check:hover { background: var(--bg-hover); }
.theme-switcher { display: flex; background: var(--bg-hover); padding: 4px; border-radius: 10px; border: 1px solid var(--border); }
.theme-btn { flex: 1; border: none; background: transparent; padding: 8px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-muted); display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; transition: 0.2s; }
.theme-btn.active { background: var(--bg-surface); color: var(--text-main); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.nav-tabs .nav-link { border: none; color: var(--text-muted); font-weight: 500; padding: 10px 16px; border-radius: 8px; cursor: pointer; }
.nav-tabs .nav-link.active { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.library-manager { display: grid; grid-template-columns: minmax(260px, 330px) 1fr; gap: 16px; min-height: 520px; }
.library-panel { border: 1px solid var(--border); background: var(--bg-surface); border-radius: 12px; padding: 14px; min-height: 0; }
.library-panel-categories, .library-panel-detail { display: flex; flex-direction: column; gap: 12px; }
.library-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.library-add-row { display: grid; grid-template-columns: 1fr 40px; gap: 8px; align-items: center; }
.library-add-btn { width: 40px; height: 40px; color: var(--primary); }
.library-category-list, .library-subcategory-list { overflow: auto; min-height: 0; padding-right: 4px; }
.library-category-list { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.library-category-item { border: 1px solid var(--border); background: var(--bg-input); color: var(--text-main); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: center; text-align: left; cursor: pointer; transition: border-color 0.2s, background 0.2s, box-shadow 0.2s; }
.library-category-item:hover { border-color: var(--text-muted); background: var(--bg-hover); }
.library-category-item.active { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.library-category-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--bg-hover); color: var(--primary); font-size: 18px; }
.library-category-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.library-category-text strong { font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.library-category-text small { color: var(--text-muted); font-size: 12px; }
.library-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.library-subcategory-list { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.library-subcategory-card { border: 1px solid var(--border); background: var(--bg-input); border-radius: 12px; padding: 12px; }
.library-subcategory-head { display: flex; align-items: end; gap: 10px; }
.library-usage-badge { border: 1px solid var(--border); background: var(--bg-hover); color: var(--text-muted); border-radius: 8px; padding: 9px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.library-empty { display: flex; align-items: center; justify-content: center; min-height: 160px; color: var(--text-muted); text-align: center; }
.library-savebar { display: flex; justify-content: flex-end; padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--border); }
@media (max-width: 900px) {
    .library-manager { grid-template-columns: 1fr; }
    .library-detail-grid { grid-template-columns: 1fr; }
}
.user-add-form { background: var(--bg-hover); padding: 16px; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 20px; }
.user-list-item { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-bottom: 1px solid var(--border); }
.user-list-item:last-child { border-bottom: none; }
.transition-icon { transition: transform 0.2s; }
.rotate-180 { transform: rotate(180deg); }

/* ========================
   CHATBOT WIDGET STYLES
   ======================== */
.chatbot-toggler {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #6366f1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    transition: all 0.2s ease;
    z-index: 9999;
    color: white;
    font-size: 28px;
}
.chatbot-toggler:hover { transform: scale(1.1); }

.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 500px;
    max-height: 80vh;
    background: #ffffff; /* natvrdo bílá pro čitelnost */
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    border: 1px solid #e2e8f0;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5);
}
.chatbot-window.show { opacity: 1; pointer-events: all; transform: scale(1); }

/* Dark mode override pokud je aktivní */
body[data-theme="dark"] .chatbot-window {
    background: #1e293b;
    border-color: #334155;
}

.chat-header {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    padding: 16px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.chat-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}
body[data-theme="dark"] .chat-body { background: #0f172a; }

.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}
.chat-msg.bot {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #0f172a;
    border-bottom-left-radius: 2px;
    align-self: flex-start;
}
body[data-theme="dark"] .chat-msg.bot {
    background: #334155;
    border-color: #475569;
    color: #f1f5f9;
}

.chat-msg.user {
    background: #6366f1;
    color: white;
    border-bottom-right-radius: 2px;
    align-self: flex-end;
}

.chat-input-area {
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
    display: flex;
    gap: 8px;
}
body[data-theme="dark"] .chat-input-area {
    background: #1e293b;
    border-color: #334155;
}

.chat-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 8px 16px;
    outline: none;
    font-size: 14px;
    background: #f1f5f9;
    color: #0f172a;
}
body[data-theme="dark"] .chat-input {
    background: #334155;
    border-color: #475569;
    color: #f1f5f9;
}

.btn-send {
    background: none; border: none; color: #6366f1; font-size: 20px; cursor: pointer;
    display: flex; align-items: center;
}

/* ========================
   KANBAN BOARD STYLES
   ======================== */
.kanban-container {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 20px;
    height: calc(100vh - 140px); /* Aby se vešel do okna */
}

.kanban-col {
    min-width: 300px;
    max-width: 300px;
    background: #f1f5f9; /* Světle šedá pro pozadí sloupce */
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
body[data-theme="dark"] .kanban-col {
    background: #1e293b;
    border-color: #334155;
}

.kanban-header {
    padding: 12px 16px;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.5);
    border-radius: 12px 12px 0 0;
}
body[data-theme="dark"] .kanban-header {
    background: rgba(0,0,0,0.2);
    border-bottom-color: rgba(255,255,255,0.05);
}

.kanban-body {
    padding: 12px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* KARTA ZAKÁZKY */
.kanban-card {
    background: var(--bg-surface);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid transparent;
    cursor: grab;
    transition: all 0.2s;
    position: relative;
}
.kanban-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    border-color: var(--primary);
}
.kanban-card:active {
    cursor: grabbing;
}

.k-card-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}
.k-card-id {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-soft);
    padding: 2px 6px;
    border-radius: 4px;
}
.k-card-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 4px;
}
.k-card-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.k-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: 8px;
    font-size: 12px;
}
.k-price {
    font-weight: 700;
    color: var(--text-main);
}

/* Barvy pro hlavičky sloupců */
.col-prijato { border-top: 4px solid #64748b; }
.col-diagnostika { border-top: 4px solid #0ea5e9; }
.col-ceka { border-top: 4px solid #f59e0b; }
.col-oprava { border-top: 4px solid #6366f1; }
.col-hotovo { border-top: 4px solid #22c55e; }
.col-vydano { border-top: 4px solid #1e293b; }
