/*
Theme Name: Garáž
Theme URI: https://garaz.bezkravaty.sk
Author: Bez kravaty s. r. o.
Description: Celoobrazovková appka Garáž – evidencia vozidiel, poistenia, STK, servisu a nákladov. Vyžaduje plugin Garáž.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 8.0
Text Domain: garaz-theme
*/

:root {
  --bg: #14181c;
  --surface: #1e252b;
  --surface-2: #262e35;
  --surface-3: #2f3944;
  --border: #37414a;
  --text: #e8e6e1;
  --text-dim: #8b95a1;
  --text-faint: #5d6670;
  --accent: #e8a33d;
  --accent-dark: #a5701f;
  --teal: #4a9b8e;
  --danger: #d0564a;
  --blue: #3d7dbf;
  --violet: #8b7bc7;
  --mono: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --head: 'Oswald', 'Arial Narrow', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body.admin-bar .garaz-wrap { min-height: calc(100vh - 32px); }
a { color: var(--accent); }
button { font-family: inherit; }
.loading { padding: 3rem; color: var(--text-dim); font-size: 14px; }

/* ---------- vstupná brána (neprihlásený) ---------- */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.gate-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 2.5rem 2rem; max-width: 420px; width: 100%; text-align: center; }
.gate-logo { font-family: var(--head); font-size: 32px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.5rem; }
.gate-sub { color: var(--text-dim); margin: 0 0 1.5rem; }
.gate .btn-primary, .gate .btn-ghost { display: inline-block; text-decoration: none; }

/* ---------- rozloženie appky ---------- */
.garaz-wrap { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 1rem 0.75rem;
  position: sticky; top: 0; height: 100vh;
}
body.admin-bar .sidebar { top: 32px; height: calc(100vh - 32px); }
.sidebar-head { padding: 0.25rem 0.5rem 0.75rem; }
.sidebar-title { font-family: var(--head); font-size: 22px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; color: var(--accent); }
.sidebar-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.sidebar-user { font-size: 12px; color: var(--text-faint); margin-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.role-badge { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-dim); }

.vehicle-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.vehicle-item {
  text-align: left; background: transparent; border: 1px solid transparent; border-radius: 8px;
  padding: 8px 10px; cursor: pointer; color: var(--text-dim); width: 100%;
}
.vehicle-item:hover { background: var(--surface-2); }
.vehicle-item.active { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.vehicle-item-dash { font-size: 13px; font-weight: 500; padding: 9px 10px; }
.vehicle-item-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.vehicle-item-ecv { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.04em; color: var(--text); font-weight: 600; }
.vehicle-item-name { font-size: 12px; margin-top: 2px; }

.sidebar-foot { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 6px; }
.btn-add-vehicle {
  background: transparent; border: 1px dashed var(--border); color: var(--text-dim);
  border-radius: 8px; padding: 9px; cursor: pointer; font-size: 13px; width: 100%;
}
.btn-add-vehicle:hover { border-color: var(--accent); color: var(--accent); }
.sidebar-links { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 4px 6px 0; font-size: 12px; }
.sidebar-links a, .sidebar-links button { color: var(--text-dim); text-decoration: none; background: none; border: none; padding: 0; cursor: pointer; font-size: 12px; }
.sidebar-links a:hover, .sidebar-links button:hover { color: var(--accent); }

.main { flex: 1; padding: 1.5rem 1.75rem 3rem; overflow-y: auto; max-width: 1100px; }
.banner-error { background: #3a2321; border: 1px solid var(--danger); color: #f0a89e; padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 1rem; }

.section-title { font-family: var(--head); font-size: 24px; text-transform: uppercase; letter-spacing: 0.02em; font-weight: 600; margin: 0 0 1rem; }
.subsection-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin: 1.5rem 0 0.6rem; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }

/* ---------- dashboard ---------- */
.metric-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.metric-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.metric-label { font-size: 12px; color: var(--text-dim); }
.metric-value { font-size: 28px; font-weight: 600; margin-top: 4px; font-family: var(--mono); }
.metric-card.warn .metric-value { color: var(--accent); }
.metric-card.danger .metric-value { color: var(--danger); }
.metric-card.ok .metric-value { color: var(--teal); }

.deadline-list { display: flex; flex-direction: column; gap: 6px; }
.deadline-row {
  display: grid; grid-template-columns: 10px 90px 90px 1fr auto; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px;
  cursor: pointer; color: var(--text); text-align: left; font-size: 13px; width: 100%;
}
.deadline-row:hover { border-color: var(--text-faint); }
.deadline-ecv { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
.deadline-label { color: var(--text-dim); }
.deadline-date { color: var(--text-dim); font-family: var(--mono); font-size: 12px; }
.deadline-status { text-align: right; font-weight: 500; white-space: nowrap; }
.deadline-row.done { opacity: 0.75; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-ok, .status-ok { color: var(--teal); }  .dot-ok { background: var(--teal); }
.dot-warn, .status-warn { color: var(--accent); } .dot-warn { background: var(--accent); }
.dot-danger, .status-danger { color: var(--danger); } .dot-danger { background: var(--danger); }
.dot-none, .status-none { color: var(--text-faint); } .dot-none { background: var(--text-faint); }
.vehicle-item .dot { width: 7px; height: 7px; }

.muted { color: var(--text-dim); font-size: 13px; }
.empty-state { background: var(--surface); border: 1px dashed var(--border); border-radius: 12px; padding: 2.5rem 1.5rem; text-align: center; }
.empty-state.small { padding: 1.75rem 1rem; }
.empty-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.empty-body { font-size: 13px; color: var(--text-dim); margin-bottom: 1rem; }

/* ---------- detail vozidla ---------- */
.vehicle-header { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.plate { display: inline-flex; align-items: stretch; border-radius: 4px; overflow: hidden; border: 2px solid #1a1a1a; height: 46px; flex-shrink: 0; }
.plate.small { height: 24px; border-width: 1px; }
.plate-eu { background: #1e5fa8; color: #fff; width: 26px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 8px; line-height: 1.1; padding: 2px 0; }
.plate.small .plate-eu { width: 14px; font-size: 5px; }
.plate-stars { color: #f2c744; font-size: 9px; }
.plate.small .plate-stars { font-size: 5px; }
.plate-sk { font-weight: 700; font-size: 9px; }
.plate.small .plate-sk { font-size: 5px; }
.plate-num { background: #f4f1e8; color: #1a1a1a; font-family: var(--mono); font-weight: 700; font-size: 19px; letter-spacing: 0.06em; display: flex; align-items: center; padding: 0 12px; white-space: nowrap; }
.plate.small .plate-num { font-size: 11px; padding: 0 6px; }

.vehicle-header-info { flex: 1; min-width: 180px; }
.vehicle-header-name { font-family: var(--head); font-size: 22px; font-weight: 600; }
.vehicle-header-meta { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.meta-sep { margin: 0 6px; color: var(--text-faint); }
.vehicle-header-vin { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); margin-top: 4px; letter-spacing: 0.03em; }
.vehicle-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.chip-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 1.25rem; }
.chip { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; text-align: left; color: var(--text); cursor: default; }
.chip-icon { font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--text-faint); background: var(--surface-3); border-radius: 5px; padding: 4px 6px; flex-shrink: 0; }
.chip-label { font-size: 11px; color: var(--text-dim); }
.chip-value { font-size: 13.5px; font-weight: 600; margin-top: 1px; }
.chip-sub { font-size: 11px; color: var(--text-faint); font-family: var(--mono); }
.chip-ok .chip-value { color: var(--teal); }
.chip-warn .chip-value { color: var(--accent); }
.chip-danger .chip-value { color: var(--danger); }
.chip-none .chip-value { color: var(--text-dim); font-weight: 500; }

details.tp { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0; margin-bottom: 1.25rem; }
details.tp summary { cursor: pointer; padding: 10px 14px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
details.tp summary::-webkit-details-marker { display: none; }
details.tp summary::after { content: '+'; font-family: var(--mono); }
details.tp[open] summary::after { content: '–'; }
.tp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; padding: 0 14px 14px; }
.tp-item { font-size: 13px; }
.tp-item .k { font-size: 11px; color: var(--text-faint); }
.tp-item.gdpr .k::after { content: ' · osobný údaj'; color: var(--accent-dark); }

.tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 1rem; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { background: transparent; border: 1px solid var(--border); color: var(--text-dim); border-radius: 999px; padding: 6px 13px; font-size: 12.5px; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface-3); color: var(--text); border-color: var(--text-faint); }
.tab .n { font-family: var(--mono); font-size: 11px; opacity: 0.7; margin-left: 4px; }

.btn-primary { background: var(--accent); color: #241705; border: none; border-radius: 8px; padding: 9px 16px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-primary:hover { background: #f0ae4c; }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-dim); border-radius: 8px; padding: 9px 16px; font-size: 13px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-ghost:hover { color: var(--text); border-color: var(--text-faint); }
.btn-ghost-danger { background: transparent; border: 1px solid var(--border); color: var(--danger); border-radius: 8px; padding: 9px 14px; font-size: 13px; cursor: pointer; }
.btn-ghost-danger:hover { border-color: var(--danger); background: #3a2321; }
.btn-danger { background: var(--danger); color: #fff; border: none; border-radius: 8px; padding: 9px 16px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-sm { padding: 6px 10px; font-size: 12px; }

.event-list { display: flex; flex-direction: column; gap: 8px; }
.event-card { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid; border-radius: 8px; padding: 10px 14px; }
.event-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.event-type-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.event-date { font-size: 12px; color: var(--text-dim); font-family: var(--mono); }
.event-actions { margin-left: auto; display: flex; gap: 2px; }
.event-actions button { background: transparent; border: none; color: var(--text-faint); font-size: 12px; cursor: pointer; padding: 2px 6px; border-radius: 5px; }
.event-actions button:hover { color: var(--text); background: var(--surface-3); }
.event-actions button.del:hover { color: var(--danger); }
.event-line-main { font-size: 13.5px; font-weight: 500; white-space: pre-wrap; }
.event-line { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.event-line .status-ok, .event-line .status-warn, .event-line .status-danger { font-weight: 600; }

/* ---------- modálne okná a formuláre ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 100000; padding: 1rem; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal.wide { max-width: 680px; }
.modal-title { font-family: var(--head); font-size: 18px; font-weight: 600; margin: 0 0 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-dim); margin-bottom: 10px; }
.field.full { grid-column: 1 / -1; }
.field > span { font-weight: 500; }
.field .req { color: var(--accent); }
.field input, .field select, .field textarea {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px;
  color: var(--text); font-size: 13.5px; font-family: inherit; width: 100%; color-scheme: dark;
}
.field textarea { min-height: 64px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 11.5px; }
.form-section { grid-column: 1 / -1; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin: 6px 0 6px; padding-top: 8px; border-top: 1px solid var(--border); }
details.form-more { grid-column: 1 / -1; margin-bottom: 10px; }
details.form-more summary { cursor: pointer; font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
details.form-more .form-grid { margin-top: 4px; }
.form-error { color: var(--danger); font-size: 12.5px; margin: 4px 0 8px; background: #3a2321; border-radius: 6px; padding: 6px 10px; }
.form-info { color: var(--text-dim); font-size: 12.5px; margin: 4px 0 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 0.5rem; flex-wrap: wrap; }
.modal-actions .left { margin-right: auto; }
.check-list { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow-y: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 6px 10px; }
.check-list label { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text); cursor: pointer; }
.check-list input { width: auto; }
.check-list .em { color: var(--text-faint); font-size: 11.5px; }
.import-result { font-size: 13px; }
.import-result ul { margin: 6px 0 0 1.2em; padding: 0; color: var(--text-dim); font-size: 12.5px; max-height: 200px; overflow-y: auto; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text);
  padding: 9px 18px; border-radius: 999px; font-size: 13px; z-index: 100001; box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}
.toast.error { border-color: var(--danger); color: #f0a89e; }

/* ---------- mobil ---------- */
@media (max-width: 760px) {
  .garaz-wrap { flex-direction: column; }
  .sidebar, body.admin-bar .sidebar { width: 100%; height: auto; top: auto; position: static; border-right: none; border-bottom: 1px solid var(--border); padding: 0.75rem; }
  .sidebar-head { padding-bottom: 0.5rem; }
  .vehicle-item-dash { white-space: nowrap; }
  .vehicle-list { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
  .vehicle-item { width: auto; flex-shrink: 0; min-width: 120px; align-self: flex-start; }
  .sidebar-foot { flex-direction: row; align-items: center; justify-content: space-between; }
  .btn-add-vehicle { width: auto; }
  .main { padding: 1rem; }
  .form-grid { grid-template-columns: 1fr; }
  .deadline-row { grid-template-columns: 10px 1fr auto; }
  .deadline-row .deadline-date { display: none; }
  .deadline-row .deadline-label { grid-column: 2; }
}
