/* styles/base.css — Reset, typografie, utility třídy, layout */

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

:root {
  --c-bg-page:    #f0f0f0;
  --c-bg:         #f8f9fa;
  --c-surface:    #ffffff;
  --c-border:     #e5e7eb;
  --c-border-light: #f3f4f6;
  --c-text:       #1a1a1a;
  --c-text-muted: #6b7280;
  --c-text-light: #9ca3af;
  --c-primary:    #4f46e5;
  --c-primary-bg: #eef2ff;
  --c-green:      #16a34a;
  --c-green-bg:   #f0fdf4;
  --c-orange:     #ea580c;
  --c-orange-bg:  #fff7ed;
  --c-blue:       #2563eb;
  --c-blue-bg:    #eff6ff;
  --c-nzu:        #059669;
  --c-nzu-bg:     #ecfdf5;
  --c-radius:     8px;
  --c-shadow:     0 1px 4px rgba(0,0,0,0.08);
  --c-shadow-md:  0 4px 16px rgba(0,0,0,0.10);
}

/* ─── TÉMA: TLUMENÝ ─────────────────────────────────────────────────────────── */
[data-theme="darker"] {
  --c-bg-page:    #d8d8d2;
  --c-bg:         #e2e2dc;
  --c-surface:    #eaeae4;
  --c-border:     #c4c4bc;
  --c-border-light: #d4d4cc;
  --c-text-light: #7a7a72;
}
/* Chipy – stejné jako světlá varianta */
[data-theme="darker"] .chip-done    { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; opacity: 1; }
[data-theme="darker"] .chip-active  { background: #fff7ed; color: #c2410c; border-color: #fed7aa; opacity: 1; }
[data-theme="darker"] .chip-waiting { background: #f3f4f6; color: #6b7280; border-color: #d1d5db; opacity: 0.75; }

/* ─── TÉMA: TMAVÝ ───────────────────────────────────────────────────────────── */
/* Chipy – stejné jako světlá varianta */
[data-theme="dark"] .chip-done    { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; opacity: 1; }
[data-theme="dark"] .chip-active  { background: #fff7ed; color: #c2410c; border-color: #fed7aa; opacity: 1; }
[data-theme="dark"] .chip-waiting { background: #f3f4f6; color: #6b7280; border-color: #d1d5db; opacity: 0.75; }

[data-theme="dark"] {
  --c-bg-page:    #0f1117;
  --c-bg:         #1a1d27;
  --c-surface:    #242838;
  --c-border:     #343848;
  --c-border-light: #2a2e3e;
  --c-text:       #e8eaf0;
  --c-text-muted: #8892a4;
  --c-text-light: #5a6478;
  --c-primary:    #818cf8;
  --c-primary-bg: #1e1b4b;
  --c-green:      #4ade80;
  --c-green-bg:   #14532d;
  --c-orange:     #fb923c;
  --c-orange-bg:  #431407;
  --c-blue:       #60a5fa;
  --c-blue-bg:    #1e3a5f;
  --c-nzu:        #34d399;
  --c-nzu-bg:     #064e3b;
  --c-shadow:     0 1px 4px rgba(0,0,0,0.4);
  --c-shadow-md:  0 4px 20px rgba(0,0,0,0.5);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg-page);
  transition: background 0.2s, color 0.2s;
}

#app { min-height: 100vh; }

/* ─── TYPOGRAPHY ────────────────────────────────────────────────────────────── */
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p  { color: var(--c-text-muted); }

/* ─── BUTTONS ───────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--c-primary); color: white;
  border: none; border-radius: var(--c-radius);
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.88; }
.btn-primary.btn-large { padding: 12px 28px; font-size: 15px; }

.btn-secondary {
  background: var(--c-surface); color: var(--c-text);
  border: 1px solid var(--c-border); border-radius: var(--c-radius);
  padding: 7px 14px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background 0.15s;
}
.btn-secondary:hover { background: var(--c-bg); }

/* Outline-primary — bílé pozadí, modré ohraničení + text. Zvýraznění
   sekundárních akcí které jsou ale "primárně užitečné" (např. import,
   pick customer). Vizuálně mezi btn-secondary a btn-primary. */
.btn-outline-primary {
  background: var(--c-surface); color: var(--c-primary);
  border: 1.5px solid var(--c-primary); border-radius: var(--c-radius);
  padding: 7px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.btn-outline-primary:hover { background: var(--c-primary-bg); }

.btn-danger {
  background: #fef2f2; color: #dc2626;
  border: 1px solid #fecaca; border-radius: var(--c-radius);
  padding: 7px 14px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background 0.15s;
}
.btn-danger:hover { background: #fee2e2; }

.btn-back {
  background: none; border: none;
  color: var(--c-primary); font-size: 14px; font-weight: 600;
  cursor: pointer; padding: 6px 0;
}
.btn-back:hover { opacity: 0.75; }

/* ─── INPUTS ────────────────────────────────────────────────────────────────── */
.input {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--c-border); border-radius: 6px;
  font-size: 13px; background: var(--c-surface); color: var(--c-text);
  transition: border-color 0.15s;
}
.input:focus { outline: none; border-color: var(--c-primary); }
textarea.input { resize: vertical; min-height: 60px; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

/* ─── PROGRESS BAR ──────────────────────────────────────────────────────────── */
.progress-bar-bg  { background: var(--c-border); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar-fill { background: var(--c-primary); height: 100%; border-radius: 4px; transition: width 0.3s ease; }
.nzu-bar .progress-bar-fill { background: var(--c-nzu); }

/* ─── BADGES ────────────────────────────────────────────────────────────────── */
.badge-nzu { background: var(--c-nzu-bg); color: var(--c-nzu); border: 1px solid #6ee7b7; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }

/* ─── STATUS BADGE ──────────────────────────────────────────────────────────── */
.status-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 10px; border: 1px solid; white-space: nowrap; }
.status-icon  { font-size: 10px; }

/* ─── LOADING / ERROR ───────────────────────────────────────────────────────── */
.loading { color: var(--c-text-muted); padding: 24px; text-align: center; font-size: 13px; }
.error   { color: #dc2626; padding: 16px; background: #fef2f2; border-radius: var(--c-radius); }
.empty-state { color: var(--c-text-muted); padding: 32px; text-align: center; }

/* ─── MODAL ─────────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.modal-box { position: relative; background: var(--c-surface); border-radius: 12px; padding: 24px; min-width: 340px; max-width: 520px; box-shadow: var(--c-shadow-md); display: flex; flex-direction: column; gap: 12px; }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.modal-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ─── SPLASH / ACCESS PROMPT ────────────────────────────────────────────────── */
.splash, .access-prompt {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; gap: 12px; padding: 32px;
}
.splash-logo  { font-size: 48px; }
.splash-title { font-size: 24px; font-weight: 700; }
.splash-subtitle { color: var(--c-text-muted); }
.access-icon  { font-size: 40px; }
.access-prompt h2 { text-align: center; }
.access-prompt p  { text-align: center; max-width: 400px; }
.access-hint  { font-size: 13px; color: var(--c-text-light); }
.access-hint code { background: var(--c-bg); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
.error-msg { color: #dc2626; font-size: 13px; margin-top: 8px; }

.browser-hint { background: var(--c-bg); border: 1px solid var(--c-border); border-radius: var(--c-radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; margin: 8px 0; max-width: 420px; }
.browser-step { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; }
.browser-step-num { background: var(--c-primary); color: white; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.browser-step code { background: var(--c-surface); border: 1px solid var(--c-border); padding: 1px 5px; border-radius: 3px; font-size: 11px; word-break: break-all; }

/* ─── NASTAVENÍ MODAL ───────────────────────────────────────────────────────── */
.settings-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.settings-box {
  background: var(--c-surface); border-radius: 12px; padding: 24px 28px;
  width: 400px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  animation: slideUp 0.15s ease;
}
@keyframes slideUp { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.settings-title        { font-size: 16px; font-weight: 700; margin-bottom: 18px; }
.settings-section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--c-text-muted); margin-bottom: 10px; }
.settings-folder-row   { background: var(--c-bg); border: 1px solid var(--c-border); border-radius: 8px; padding: 12px 14px; margin-bottom: 20px; }
.settings-folder-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--c-text-muted); margin-bottom: 4px; }
.settings-folder-name  { font-size: 14px; font-weight: 600; color: var(--c-text); }
.settings-hint         { font-size: 13px; color: var(--c-text-muted); line-height: 1.5; margin-bottom: 16px; }
.settings-hint strong  { color: var(--c-text); }
.settings-actions      { display: flex; gap: 8px; margin-top: 20px; }

/* Theme picker */
.theme-picker { display: flex; gap: 10px; margin-bottom: 4px; }
.theme-option {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 2px solid var(--c-border); border-radius: 8px; padding: 8px 6px;
  cursor: pointer; background: none; transition: border-color 0.15s;
}
.theme-option:hover    { border-color: var(--c-primary); }
.theme-option.selected { border-color: var(--c-primary); background: var(--c-primary-bg); }
.theme-option span     { font-size: 11px; font-weight: 600; color: var(--c-text-muted); }
.theme-option.selected span { color: var(--c-primary); }

.theme-preview {
  width: 100%; height: 44px; border-radius: 5px; overflow: hidden;
  display: flex; flex-direction: column; gap: 3px; padding: 5px;
  border: 1px solid rgba(0,0,0,0.08);
}
.theme-preview-bar  { height: 7px; border-radius: 3px; }
.theme-preview-card { height: 14px; border-radius: 3px; }

/* Světlý */
.tp-light { background: #f0f0f0; }
.tp-light .theme-preview-bar  { background: #ffffff; }
.tp-light .theme-preview-card { background: #ffffff; }

/* Tlumený */
.tp-darker { background: #d8d8d2; }
.tp-darker .theme-preview-bar  { background: #eaeae4; }
.tp-darker .theme-preview-card { background: #eaeae4; }

/* Tmavý */
.tp-dark { background: #0f1117; }
.tp-dark .theme-preview-bar  { background: #242838; }

/* ─── TASKS VIEW ─────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
}

.tasks-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.tasks-title { display: flex; align-items: baseline; gap: 10px; }
.tasks-subtitle { color: var(--c-text-muted); font-size: 13px; }

.tasks-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.user-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--c-text-muted);
}
.user-btn {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.user-btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.user-btn.active {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
  font-weight: 600;
}

.tasks-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}

.tasks-section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-muted);
  margin: 20px 0 8px;
}
.tasks-section-label:first-child { margin-top: 0; }
.tasks-section-overdue { color: var(--c-orange); }
.tasks-section-done    { color: var(--c-text-light); }

.task-card {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--c-radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--c-shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.task-card:hover { border-color: var(--c-primary); box-shadow: var(--c-shadow-md); }

.task-card-overdue {
  border-left: 4px solid var(--c-orange);
  background: var(--c-orange-bg);
}
.task-card-done {
  opacity: 0.65;
  border-color: var(--c-border-light);
}
.task-card-done:hover { opacity: 0.85; }

.task-card-main { flex: 1; min-width: 0; }

.task-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.task-assignee {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.assignee-petr  { background: var(--c-blue-bg);   color: var(--c-blue);    }
.assignee-artem { background: var(--c-primary-bg); color: var(--c-primary); }

.task-deadline { font-size: 12px; color: var(--c-text-muted); }
.task-deadline-overdue { color: var(--c-orange); font-weight: 600; }
.task-deadline-none    { color: var(--c-text-light); font-style: italic; }

.task-created-by {
  font-size: 11px;
  color: var(--c-text-light);
  margin-left: auto;
}

.task-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text);
  line-height: 1.4;
  word-break: break-word;
}
.task-title-done { text-decoration: line-through; color: var(--c-text-muted); }

.task-desc {
  font-size: 13px;
  color: var(--c-text-muted);
  margin-top: 4px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.task-done-info {
  font-size: 12px;
  color: var(--c-text-light);
  margin-top: 6px;
}

.task-card-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.task-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--c-border);
  background: var(--c-bg);
  color: var(--c-text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
}
.task-btn:hover  { background: var(--c-surface); color: var(--c-text); }
.task-btn-done   { border-color: var(--c-green); color: var(--c-green); }
.task-btn-done:hover   { background: var(--c-green-bg); }
.task-btn-reopen { border-color: var(--c-blue); color: var(--c-blue); }
.task-btn-reopen:hover { background: var(--c-blue-bg); }
.task-btn-delete { border-color: #fca5a5; color: #ef4444; }
.task-btn-delete:hover { background: #fef2f2; }

.tasks-empty {
  text-align: center;
  color: var(--c-text-muted);
  padding: 48px 16px;
  font-size: 15px;
}

/* Modal */
.tasks-modal-box {
  background: var(--c-surface);
  border-radius: 12px;
  padding: 0;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--c-shadow-md);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--c-border);
}
.modal-header h2 { font-size: 16px; }
.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--c-text-muted);
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--c-bg); color: var(--c-text); }
.modal-body   { padding: 16px 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 18px;
  border-top: 1px solid var(--c-border);
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-muted);
  margin: 12px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-label:first-child { margin-top: 0; }
.form-input {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--c-radius);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--c-primary); }
.form-textarea { resize: vertical; min-height: 70px; }
.form-row { display: flex; gap: 12px; }
.form-col { flex: 1; }
.form-error {
  margin-top: 10px;
  font-size: 13px;
  color: #ef4444;
  background: #fef2f2;
  border-radius: 6px;
  padding: 6px 10px;
}

@media (max-width: 500px) {
  .task-card { flex-direction: column; }
  .task-card-actions { flex-direction: row; flex-wrap: wrap; }
  .task-created-by { margin-left: 0; }
  .form-row { flex-direction: column; }
}

/* ─── SCAN SLOŽEK – kandidáti ────────────────────────────────────────────── */
.scan-found-info { font-size: 13px; color: var(--c-text-muted); margin-bottom: 8px; }
.modal-box { max-width: 560px; }
.scan-candidate-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 320px; overflow-y: auto;
  border: 1px solid var(--c-border); border-radius: 8px;
  padding: 4px 0; margin-bottom: 4px;
}
.scan-candidate {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; cursor: pointer; font-size: 13px;
  border-radius: 6px; transition: background 0.1s;
}
.scan-candidate:hover { background: var(--c-hover); }
.scan-candidate input[type="checkbox"] { width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; accent-color: var(--c-primary); }
.scan-cand-id   { font-family: monospace; font-size: 11px; color: var(--c-text-muted); min-width: 80px; }
.scan-cand-name { flex: 1; font-weight: 500; color: var(--c-text); }
.scan-cand-year { font-size: 11px; color: var(--c-text-muted); }

.import-result { font-size: 13px; padding: 10px 12px; border-radius: 8px; }
.import-result.success { background: #f0fdf4; color: #15803d; }
.import-result.error   { background: #fef2f2; color: #dc2626; }
