/* ================================================================
   BQ-DASHBOARD  –  styl inspirovaný email.seznam.cz
   ================================================================ */

:root {
  --accent:       #2d2d2d;
  --accent-hover: #1a1a1a;
  --accent-light: #ffe8e8;
  --sidebar-bg:   #f5f5f5;
  --logo-bg:      #ffffff;
  --border:       #e0e0e0;
  --border-dark:  #d0d0d0;
  --card-bg:      #ffffff;
  --text:         #1a1a1a;
  --text-muted:   #888888;
  --text-light:   #666666;
  --sidebar-w:    220px;
  --green:        #2e7d32;
  --yellow:       #e65100;
  --purple:       #6a1b9a;
  --teal:         #00695c;
  --red:          #2d2d2d;
}

/* ── Reset & base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: #ffffff;
  font-family: system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Odstraň veškeré zakulacení a stíny z Bootstrap */
*, .card, .btn, .badge, .form-control, .form-select,
.input-group-text, .dropdown-menu, .modal-content,
.nav-link, .pagination .page-link {
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* ── Wrapper / Layout ────────────────────────────────────────── */
#wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  transition: width .2s ease;
  z-index: 200;
}

#page-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

/* ── Sidebar logo oblast (bílé pozadí) ───────────────────────── */
.sidebar-brand {
  background: var(--logo-bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  min-height: 56px;
  overflow: hidden;
}

.sidebar-logo {
  width: 110px;
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Sidebar navigace ────────────────────────────────────────── */
.sidebar-nav { padding: 8px 0; flex: 1; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  color: #333333;
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  border-left: 3px solid transparent;
  transition: background .1s;
}

.sidebar-nav a:hover {
  background: #ebebeb;
  color: var(--text);
}

.sidebar-nav a.active {
  font-weight: 600;
  color: var(--accent);
  background: #efefef;
  border-left-color: #2d2d2d;
}

.sidebar-nav a i { font-size: 14px; flex-shrink: 0; }

.sidebar-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.topbar .page-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.topbar .ms-auto {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── Flatpickr ───────────────────────────────────────────────── */
.flatpickr-input {
  background: #ffffff !important;
  border: 1px solid var(--border-dark) !important;
  color: var(--text) !important;
  border-radius: 0 !important;
  padding: 5px 10px;
  font-size: 13px;
  width: 205px;
  font-family: inherit;
}

/* ── Hlavní obsah ────────────────────────────────────────────── */
.main-content { padding: 24px; flex: 1; }

/* ── Nadpis stránky v obsahu ─────────────────────────────────── */
.page-section-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

/* ── Karty ───────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border) !important;
  overflow: hidden;
}

.card-header {
  background: #f5f5f5;
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-body { padding: 14px; }

/* ── KPI karty ───────────────────────────────────────────────── */
.kpi-card {
  border: 1px solid var(--border) !important;
  border-left: 3px solid var(--accent) !important;
  padding: 16px;
  background: #ffffff;
}
.kpi-card.green  { border-left-color: var(--green)  !important; }
.kpi-card.yellow { border-left-color: var(--yellow) !important; }
.kpi-card.purple { border-left-color: var(--purple) !important; }
.kpi-card.red    { border-left-color: var(--red)    !important; }
.kpi-card.teal   { border-left-color: var(--teal)   !important; }

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  min-height: 1.85rem;
}
.kpi-change {
  font-size: 12px;
  margin-top: 4px;
  min-height: 1rem;
  color: var(--text-muted);
}
.kpi-change .up      { color: var(--green); }
.kpi-change .down    { color: var(--red); }
.kpi-change .neutral { color: var(--text-muted); }

/* ── Skeleton loader ─────────────────────────────────────────── */
.skel {
  background: linear-gradient(90deg, #f0f0f0 25%, #e4e4e4 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skel-shine 1.4s infinite;
  display: inline-block;
  min-height: 1em;
  min-width: 60px;
}
@keyframes skel-shine {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Grafy ───────────────────────────────────────────────────── */
.chart-wrap         { position: relative; height: 280px; }
.chart-wrap.tall    { height: 360px; }
.chart-wrap.short   { height: 200px; }

/* ── Tabulky (Excel styl) ────────────────────────────────────── */
.table {
  border-collapse: collapse;
  color: var(--text);
  font-size: 13px;
  width: 100%;
  margin-bottom: 0;
}
.table thead th {
  background: #f5f5f5;
  border-bottom: 2px solid var(--border);
  border-top: none;
  color: var(--text-light);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 10px 12px;
  white-space: nowrap;
}
.table td {
  border-bottom: 1px solid #f0f0f0;
  padding: 10px 12px;
  vertical-align: middle;
}
.table th { border-color: var(--border) !important; }
.table td { border-color: #f0f0f0 !important; }
.table tbody tr:hover td { background: #f9f9f9; }

/* DataTables */
div.dataTables_wrapper .dataTables_length select,
div.dataTables_wrapper .dataTables_filter input {
  background: #ffffff;
  border: 1px solid var(--border-dark);
  color: var(--text);
  border-radius: 0 !important;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 13px;
}
div.dataTables_wrapper .dataTables_info,
div.dataTables_wrapper .dataTables_length label,
div.dataTables_wrapper .dataTables_filter label {
  color: var(--text-muted);
  font-size: 12.5px;
}
div.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--text) !important;
  background: transparent !important;
  border: none !important;
  font-size: 13px;
}
div.dataTables_wrapper .dataTables_paginate .paginate_button.current,
div.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  color: var(--accent) !important;
  background: var(--accent-light) !important;
  border: none !important;
}

/* ── Tlačítka ────────────────────────────────────────────────── */
.btn { font-family: inherit; font-size: 13px; cursor: pointer; }

.btn-primary {
  background: var(--accent) !important;
  border: none !important;
  color: #ffffff !important;
  font-weight: 600;
  padding: 8px 20px;
}
.btn-primary:hover { background: var(--accent-hover) !important; }

.btn-outline-secondary {
  background: #ffffff !important;
  border: 1px solid var(--border-dark) !important;
  color: #333333 !important;
  padding: 6px 14px;
}
.btn-outline-secondary:hover { background: #ebebeb !important; }

.btn-secondary {
  background: var(--accent) !important;
  border: none !important;
  color: #ffffff !important;
  font-weight: 600;
}

.btn-link { color: var(--text-muted) !important; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  font-weight: 600;
  font-size: 11.5px;
  padding: 2px 6px;
}
.badge.bg-primary   { background: var(--accent) !important; }
.badge.bg-secondary { background: #888 !important; }
.badge.bg-success   { background: var(--green) !important; }

/* ── Form controls ───────────────────────────────────────────── */
.form-control, .form-select {
  border-color: var(--border-dark);
  color: var(--text);
  background: #ffffff;
  font-family: inherit;
  font-size: 13px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent) !important;
  outline: 2px solid rgba(204,0,0,.15) !important;
}
.form-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.input-group-text {
  border-color: var(--border-dark);
  background: #f5f5f5;
  color: var(--text-muted);
}

/* ── Lookup mapovací box ─────────────────────────────────────── */
.mapping-card {
  background: #fff8f8 !important;
  border: 1px solid #f0b8b8 !important;
}

/* ── Alerty ──────────────────────────────────────────────────── */
.alert-bq {
  background: #fff8f8;
  border: 1px solid #f0b8b8;
  color: #990000;
  padding: 10px 14px;
  font-size: 13px;
}

/* ── Sidebar collapse ────────────────────────────────────────── */
#wrapper.collapsed .sidebar { width: 0; border: none; overflow: hidden; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d0d0d0; }
::-webkit-scrollbar-thumb:hover { background: #b0b0b0; }

/* ── Responsivní ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: calc(-1 * var(--sidebar-w)); }
  #wrapper.mobile-open .sidebar { left: 0; }
  .main-content { padding: 16px; }
}
