/* ============================================================
   Kniha jízd - Grant Corporation
   Design: čistý, moderní, profesionální
   Barvy: #1a2f6e (navy), #8b9bb4 (steel), #f5f7fc (light bg)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ---- Variables ---- */
:root {
  --navy:        #1a2f6e;
  --navy-dark:   #0f1e4a;
  --navy-light:  #2a4494;
  --steel:       #8b9bb4;
  --steel-light: #c5cfe0;
  --bg:          #f5f7fc;
  --bg-card:     #ffffff;
  --bg-hover:    #eef1f9;
  --text:        #1a1a2e;
  --text-muted:  #6b7a99;
  --text-light:  #9aa5bc;
  --border:      #e2e8f4;
  --border-dark: #c5cfe0;
  --success:     #2e7d32;
  --success-bg:  #e8f5e9;
  --warning:     #e65100;
  --warning-bg:  #fff3e0;
  --danger:      #c62828;
  --danger-bg:   #ffebee;
  --info:        #0277bd;
  --info-bg:     #e1f5fe;
  --green-trip:  #2e7d32;
  --red-trip:    #c62828;
  --shadow-sm:   0 1px 3px rgba(26, 47, 110, 0.08);
  --shadow-md:   0 4px 12px rgba(26, 47, 110, 0.10);
  --shadow-lg:   0 8px 24px rgba(26, 47, 110, 0.12);
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --font:        'DM Sans', system-ui, sans-serif;
  --font-mono:   'DM Mono', monospace;
  --sidebar-w:   240px;
  --topbar-h:    60px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--navy-light); }
img { max-width: 100%; }

/* ============================================================
   Layout - Sidebar + Content
   ============================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo img {
  height: 32px;
  filter: brightness(0) invert(1);
}

.sidebar-logo-text {
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  line-height: 1.2;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
  padding: 10px 20px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(255,255,255,0.75);
  font-size: 0.875rem;
  font-weight: 400;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
  border-left-color: rgba(255,255,255,0.3);
}

.nav-item.active {
  background: rgba(255,255,255,0.12);
  color: white;
  border-left-color: white;
  font-weight: 500;
}

.nav-item .icon {
  width: 18px;
  text-align: center;
  opacity: 0.8;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
}

.sidebar-footer .username {
  color: rgba(255,255,255,0.85);
  font-weight: 500;
}

/* ---- Main content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-content {
  padding: 28px;
  flex: 1;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .accent {
  width: 4px;
  height: 16px;
  background: var(--navy);
  border-radius: 2px;
  flex-shrink: 0;
}

/* ---- Vehicle cards ---- */
.vehicle-card {
  border-top: 4px solid var(--navy);
  transition: box-shadow 0.2s;
}
.vehicle-card:hover { box-shadow: var(--shadow-md); }
.vehicle-card.color-0 { border-top-color: #1a2f6e; }
.vehicle-card.color-1 { border-top-color: #5b4fcf; }
.vehicle-card.color-2 { border-top-color: #0277bd; }
.vehicle-card.color-3 { border-top-color: #2e7d32; }

/* ---- Stat cards ---- */
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-value {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat-unit {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 3px;
}

/* ============================================================
   Tables
   ============================================================ */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: var(--navy);
  color: white;
  padding: 9px 12px;
  text-align: left;
  font-weight: 500;
  font-size: 0.8rem;
  white-space: nowrap;
}

thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-hover); }
tbody tr:nth-child(even) td { background: #fafbfe; }
tbody tr:nth-child(even):hover td { background: var(--bg-hover); }

/* Jízda TAM - zelená linka vlevo */
tbody tr.trip-there td:first-child {
  border-left: 3px solid var(--green-trip);
}
/* Jízda ZPĚT - červená linka vlevo */
tbody tr.trip-back td:first-child {
  border-left: 3px solid var(--red-trip);
}
/* Tankování řádek */
tbody tr.fuel-row td {
  background: #fffde7 !important;
  font-style: italic;
  border-left: 3px solid #f9a825;
}

/* Odo/stav nádrže - mono font */
.odo-value, .tank-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}
.btn-primary:hover {
  background: var(--navy-light);
  border-color: var(--navy-light);
  color: white;
}

.btn-secondary {
  background: white;
  color: var(--navy);
  border-color: var(--border-dark);
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}
.btn-success:hover { background: #1b5e20; color: white; }

.btn-danger {
  background: white;
  color: var(--danger);
  border-color: #ef9a9a;
}
.btn-danger:hover { background: var(--danger-bg); }

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 10px 24px;
  font-size: 1rem;
}

/* ============================================================
   Forms
   ============================================================ */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26, 47, 110, 0.1);
}

.form-control::placeholder { color: var(--text-light); }

select.form-control { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 3px;
}

/* ============================================================
   Badges & Status
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge-draft {
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffcc80;
}

.badge-final {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.badge-navy {
  background: #e8edf8;
  color: var(--navy);
  border: 1px solid #c5cfe0;
}

/* ============================================================
   Alerts / Flash messages
   ============================================================ */

.alert {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid transparent;
}

.alert-success  { background: var(--success-bg);  color: var(--success);  border-color: #a5d6a7; }
.alert-warning  { background: var(--warning-bg);  color: var(--warning);  border-color: #ffcc80; }
.alert-danger   { background: var(--danger-bg);   color: var(--danger);   border-color: #ef9a9a; }
.alert-info     { background: var(--info-bg);     color: var(--info);     border-color: #81d4fa; }

/* ============================================================
   Wizard steps
   ============================================================ */

.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
}

.wizard-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.wizard-step.active .wizard-step-num {
  background: var(--navy);
  color: white;
}

.wizard-step.done .wizard-step-num {
  background: var(--success);
  color: white;
}

.wizard-step.active { color: var(--navy); }
.wizard-step.done   { color: var(--success); }

.wizard-step-arrow {
  color: var(--border-dark);
  font-size: 1rem;
  margin: 0 2px;
}

/* ============================================================
   Month calendar view
   ============================================================ */

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 16px;
}

.day-header {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px;
}

.day-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.8rem;
  background: white;
  cursor: default;
  position: relative;
  overflow: hidden;
}

.day-cell.weekend, .day-cell.holiday {
  background: var(--bg);
  color: var(--text-light);
}

.day-cell.has-trips {
  background: #e8edf8;
  border-color: var(--navy);
}

.day-cell.has-trips.trip-there-only { border-left: 3px solid var(--green-trip); }
.day-cell.has-trips.trip-both { border-left: 3px solid var(--navy); }

.day-cell.has-fuel::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f9a825;
  position: absolute;
  top: 3px;
  right: 3px;
}

.day-num {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.day-km {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ============================================================
   Upload zone
   ============================================================ */

.upload-zone {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--navy);
  background: var(--bg-hover);
}

.upload-zone .icon-upload {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.4;
}

.upload-zone p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 4px 0;
}

/* ============================================================
   Progress & Loading
   ============================================================ */

.progress-bar-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--navy);
  border-radius: 2px;
  transition: width 0.3s;
}

/* ============================================================
   Charts (Chart.js canvases)
   ============================================================ */

.chart-wrap {
  position: relative;
  height: 220px;
  margin-top: 16px;
}

/* ============================================================
   Login page
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo img { height: 48px; }

.login-title {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

.login-subtitle {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); transition: transform 0.25s; }
  .sidebar.open { transform: translateX(0); --sidebar-w: 240px; }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .stat-value { font-size: 1.3rem; }
  table { font-size: 0.8rem; }
  thead th, tbody td { padding: 6px 8px; }
  .card { padding: 14px 16px; }
}

/* ============================================================
   Utility
   ============================================================ */

.text-muted   { color: var(--text-muted); }
.text-navy    { color: var(--navy); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-sm      { font-size: 0.8rem; }
.text-xs      { font-size: 0.75rem; }
.font-mono    { font-family: var(--font-mono); }
.font-600     { font-weight: 600; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 700px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Dot indicator */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-green  { background: var(--success); }
.dot-orange { background: #f9a825; }
.dot-red    { background: var(--danger); }
.dot-navy   { background: var(--navy); }
