/* ═══════════════════════════════════════════════════════════
   OKO v2 — Rezervační systém (detskeoci.cz / NeoVize)
   Čisté CSS — port z designového prototypu
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: #f0f6fc;
  color: #1a1f36;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

:root {
  --blue: #a66291;
  --blue-dark: #8f5079;
  --blue-light: #f5ecf2;
  --blue-mid: #b87ea6;
  --coral: #076ebf;
  --coral-light: #e6f1fa;
  --green: #10b981;
  --green-light: #d1fae5;
  --orange: #f59e0b;
  --orange-light: #fef3c7;
  --red: #ef4444;
  --red-light: #fee2e2;
  --gray: #6b7280;
  --gray-light: #f3f4f6;
  --border: #e5e7eb;
  --white: #ffffff;
  --shadow-sm: 0 1px 3px rgba(7,110,191,0.08), 0 1px 2px rgba(7,110,191,0.04);
  --shadow: 0 4px 16px rgba(7,110,191,0.10), 0 1px 4px rgba(7,110,191,0.06);
  --shadow-lg: 0 12px 40px rgba(7,110,191,0.16), 0 4px 12px rgba(7,110,191,0.08);
}

/* Scrollbars */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c3dcf0; border-radius: 99px; }

.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── TOP NAV ── */
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 0 16px;
  height: 52px;
  background: var(--coral);
  position: relative;
  border-bottom: 2px solid #055a9c;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(7,110,191,0.18);
}
.topbar-brand {
  display: flex; align-items: center;
  cursor: pointer;
  padding: 0 4px;
}
.topbar-brand img {
  height: 30px; display: block;
  /* přebarvení transparentního loga na bílou (modrý top bar) */
  filter: brightness(0) invert(1);
}

.topbar-sep { width: 1px; height: 24px; background: rgba(255,255,255,0.25); margin: 0 4px; }

.date-nav {
  display: flex; align-items: center; gap: 4px;
  position: absolute; left: 50%; transform: translateX(-50%);
}
.btn-icon {
  width: 30px; height: 30px; border: none; cursor: pointer;
  border-radius: 7px; background: transparent; color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: background 0.12s;
  font-family: inherit;
}
.btn-icon:hover { background: rgba(255,255,255,0.18); }

.date-chip {
  padding: 5px 10px; border-radius: 7px; cursor: pointer;
  font-size: 12px; font-weight: 500; color: rgba(255,255,255,0.8);
  transition: all 0.12s; white-space: nowrap;
}
.date-chip:hover { background: rgba(255,255,255,0.18); color: white; }
.date-chip.today { background: white; color: var(--coral); font-weight: 700; }
.date-chip.active { background: rgba(255,255,255,0.22); color: white; font-weight: 700; }
.date-chip--month { font-size: 13px; padding: 5px 14px; }

.btn-today {
  padding: 6px 14px; border-radius: 8px; border: 1.5px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.15); color: white; font-weight: 600; font-size: 12px;
  cursor: pointer; transition: all 0.12s;
  font-family: inherit;
}
.btn-today:hover { background: rgba(255,255,255,0.25); border-color: rgba(255,255,255,0.5); }

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

.btn-nav {
  padding: 6px 12px; border-radius: 8px; border: 1.5px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.12); color: white; font-weight: 500; font-size: 12px;
  cursor: pointer; transition: all 0.12s; white-space: nowrap;
  font-family: inherit;
}
.btn-nav:hover { background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.5); }
.btn-nav.active { background: white; color: var(--coral); border-color: white; font-weight: 700; }

.btn-coral {
  padding: 6px 14px; border-radius: 8px; border: none;
  background: var(--blue); color: white; font-weight: 600; font-size: 12px;
  cursor: pointer; transition: all 0.12s;
  font-family: inherit;
}
.btn-coral:hover { background: var(--blue-dark); }
.btn-coral:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-coral:disabled:hover { background: var(--coral); }

.user-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 5px;
  border-radius: 99px; border: 1.5px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.15); cursor: pointer; transition: all 0.12s;
}
.user-btn:hover { background: rgba(255,255,255,0.25); border-color: rgba(255,255,255,0.5); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: white; color: var(--coral);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
}
.user-name { font-size: 12px; font-weight: 600; color: white; }
.user-caret { color: rgba(255,255,255,0.7); font-size: 10px; margin-left: 2px; }

/* ── USER DROPDOWN ── */
.user-dropdown-wrap { position: relative; }
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(7,110,191,0.16), 0 2px 8px rgba(7,110,191,0.08);
  min-width: 210px;
  overflow: hidden;
  z-index: 200;
  border: 1.5px solid var(--border);
  animation: popIn 0.15s ease-out;
}
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  font-size: 13px; font-weight: 500; color: #374151;
  cursor: pointer; transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--blue-light); color: var(--blue); }
.dropdown-item.danger:hover { background: var(--blue-light); color: var(--blue); }
.dropdown-item .di-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

/* ── CALENDAR LAYOUT ── */
.calendar-wrap {
  flex: 1; overflow-x: auto; overflow-y: hidden;
  display: flex; flex-direction: column;
}
.columns-wrap {
  display: flex; flex: 1; overflow-y: auto; overflow-x: visible;
  min-width: max-content;
}

/* ── COLUMN ── */
.col {
  width: 190px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.col:last-child { border-right: none; }

.col-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--blue);
  padding: 10px 12px 8px;
  border-bottom: 2px solid var(--blue-dark);
  flex-shrink: 0;
}
.col-header.optometrist { background: var(--blue-mid); border-bottom-color: var(--blue); }
.col-header.optika { background: #076ebf; border-bottom-color: #055a9c; }

.col-title { color: white; font-weight: 700; font-size: 12.5px; line-height: 1.2; }
.col-subtitle { color: rgba(255,255,255,0.7); font-size: 11px; margin-top: 1px; }
.col-time { color: rgba(255,255,255,0.55); font-size: 10.5px; margin-top: 3px; }

.col-body { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 0; background: #f8faff; }

/* ── DAY GROUP (měsíční pohled) ── */
.day-group { display: flex; flex-shrink: 0; border-left: 3px solid var(--coral); box-shadow: -1px 0 0 rgba(0,0,0,0.04); }
.day-group + .day-group { margin-left: 10px; }
.col-header-date { color: rgba(255,255,255,0.95); font-size: 11px; font-weight: 700; margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.4px; }

/* ── PRIVATE (obsazené) rezervace ── */
.appt.private {
  background: repeating-linear-gradient(45deg, #f1f5f9, #f1f5f9 6px, #e9eef4 6px, #e9eef4 12px);
  border-left-color: #cbd5e1;
  cursor: default;
}
.appt.private:hover { transform: none; box-shadow: var(--shadow-sm); }
.appt.private .appt-name { color: var(--gray); font-weight: 600; font-style: italic; }
.appt.private .appt-time { color: var(--gray); }

/* ── DOCTOR SECTION inside column ── */
.doctor-section { display: flex; flex-direction: column; margin-bottom: 6px; }
.doctor-gap {
  display: flex; align-items: center; justify-content: center;
  padding: 8px 0; margin: 2px 0;
  color: var(--gray); font-size: 10px; font-weight: 500;
  border-top: 1px dashed #d8dee8; border-bottom: 1px dashed #d8dee8;
  background: transparent;
}
.doctor-section-header {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px;
  background: var(--blue-light);
  border-radius: 7px;
  margin-bottom: 3px;
  border-left: 3px solid var(--blue);
}
.doctor-section-header.optometrist { background: #f3e9f0; border-left-color: var(--blue-mid); }
.doctor-info { flex: 1; min-width: 0; }
.doctor-section-name { font-size: 11.5px; font-weight: 700; color: var(--blue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doctor-section-header.optometrist .doctor-section-name { color: var(--blue-mid); }
.doctor-section-time { font-size: 10px; color: var(--gray); }
.doctor-appts { display: flex; flex-direction: column; gap: 3px; padding: 0 0 0 3px; }

/* ── APPOINTMENT CARD ── */
.appt {
  background: white;
  border-radius: 8px;
  padding: 7px 9px;
  border-left: 3px solid var(--green);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.appt:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.appt.status-green { border-left-color: var(--green); }
.appt.status-red { border-left-color: var(--red); }
.appt.status-orange { border-left-color: var(--orange); }
.appt.status-blue { border-left-color: var(--blue); }
.appt.status-gray { border-left-color: #d1d5db; }

.appt-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 4px; }
.appt-name { font-weight: 600; font-size: 12px; color: #1a1f36; line-height: 1.2; }
.appt-time { font-size: 11px; font-weight: 700; color: var(--blue); white-space: nowrap; flex-shrink: 0; }
.appt-type { font-size: 10.5px; color: var(--gray); margin-top: 2px; line-height: 1.3; }
.appt-arrival { font-size: 10.5px; color: var(--coral); font-weight: 700; margin-top: 3px; }
.appt-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  position: absolute; bottom: 8px; right: 8px;
  flex-shrink: 0;
}
.dot-green { background: var(--green); }
.dot-red { background: var(--red); }
.dot-orange { background: var(--orange); }
.dot-gray { background: #d1d5db; }

/* ── FREE SLOT ── */
.free-slot {
  border-radius: 8px; padding: 6px 9px;
  background: var(--green-light);
  border: 1.5px dashed #6ee7b7;
  display: flex; align-items: center; justify-content: space-between;
}
.free-slot-label { font-size: 11px; font-weight: 600; color: #059669; display: flex; align-items: center; gap: 5px; }
.free-slot-time { font-size: 11px; font-weight: 700; color: #059669; }

/* ── ADD DOCTOR ── */
.add-doctor-btn {
  margin: 6px; padding: 8px;
  border: 1.5px dashed #c3dcf0;
  border-radius: 8px; background: transparent;
  color: var(--blue-mid); font-size: 11.5px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  text-align: center;
  font-family: inherit;
}
.add-doctor-btn:hover { background: var(--blue-light); border-color: var(--blue); }

/* ── PATIENT POPUP ── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(7,110,191,0.18);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
}
.popup {
  background: white;
  border-radius: 14px;
  width: 380px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: popIn 0.2s ease-out;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.popup-header {
  background: var(--coral);
  padding: 12px 16px;
  display: flex; align-items: flex-start; justify-content: space-between;
  position: relative;
}
.popup-name { color: white; font-weight: 700; font-size: 16px; }
.popup-type { color: rgba(255,255,255,0.75); font-size: 13px; margin-top: 2px; }
.popup-time-block { text-align: right; }
.popup-time { color: white; font-weight: 700; font-size: 18px; }
.popup-arrival { color: rgba(255,255,255,0.7); font-size: 12px; margin-top: 2px; }

.popup-body { padding: 12px 16px 0; }
.popup-grid { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; }
.popup-label { color: var(--gray); font-size: 12px; font-weight: 500; padding-top: 1px; }
.popup-val { color: #1a1f36; font-size: 13px; font-weight: 500; }
.popup-val a { color: var(--blue); text-decoration: none; }
.popup-val.card { display: flex; align-items: center; gap: 8px; }
.popup-val-note { color: var(--gray); font-size: 12px; }
.popup-badge { background: var(--blue-light); color: var(--blue); font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; }

.popup-divider { height: 1px; background: var(--border); margin: 14px 0; }

.popup-actions {
  display: grid; grid-template-columns: 1fr 1fr;
  border-top: 1.5px solid var(--border);
  margin-top: 12px;
  margin-left: -16px;
  margin-right: -16px;
}
.action-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border: none;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: white;
  color: #374151;
  font-size: 12px; font-weight: 600;
  font-family: 'Plus Jakarta Sans', sans-serif;
  cursor: pointer;
  transition: all 0.13s;
  text-align: left;
}
.action-btn:nth-child(even) { border-right: none; }
.action-btn:nth-last-child(-n+2) { border-bottom: none; }
.action-btn:last-child { border-radius: 0 0 14px 0; }
.action-btn:nth-last-child(2) { border-radius: 0 0 0 14px; }
.action-btn:hover { background: var(--blue-light); color: var(--blue); }
.action-btn .icon { font-size: 15px; flex-shrink: 0; display: flex; align-items: center; }

/* ── PATIENTS VIEW ── */
.patients-view {
  flex: 1; overflow-y: auto; padding: 28px 32px;
  display: flex; flex-direction: column; gap: 20px;
}
.patients-header { display: flex; align-items: flex-end; justify-content: space-between; }
.patients-title { font-size: 22px; font-weight: 700; color: var(--blue); }
.patients-subtitle { font-size: 13px; color: var(--gray); margin-top: 3px; }

.btn-search { display: flex; align-items: center; gap: 6px; color: #374151; background: white; border-color: var(--border); }
.btn-search:hover { border-color: var(--blue); background: var(--blue-light); }

.patient-card {
  background: white; border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.patient-card-header {
  background: var(--blue); padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.patient-card-name { color: white; font-weight: 700; font-size: 16px; }
.patient-card-id { color: rgba(255,255,255,0.65); font-size: 12px; }
.patient-card-actions { display: flex; gap: 8px; }

.form-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 160px 1fr; align-items: center; gap: 12px; }
.form-label { font-size: 13px; color: var(--gray); font-weight: 500; }
.form-static { font-size: 13px; color: var(--gray); }
.form-input {
  border: 1.5px solid var(--border); border-radius: 8px;
  padding: 7px 11px; font-size: 13px; font-family: inherit;
  color: #1a1f36; background: white;
  transition: border-color 0.14s;
  outline: none;
}
.form-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(7,110,191,0.08); }
.form-input.has-val { border-color: var(--coral); }
.form-input.flex-1 { flex: 1; }
.form-input.input-w240 { max-width: 240px; }
.form-row-group { display: flex; gap: 8px; }
.form-select {
  border: 1.5px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 13px; font-family: inherit;
  color: var(--gray); background: white; cursor: pointer;
  outline: none;
}
.form-section-title { font-size: 13px; font-weight: 700; color: var(--blue); padding-top: 4px; border-top: 1.5px solid var(--border); }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.info-item { display: flex; flex-direction: column; gap: 3px; }
.info-key { font-size: 11px; color: var(--gray); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.info-val { font-size: 13px; font-weight: 600; color: #1a1f36; }
.info-val .badge { display: inline-block; background: var(--blue-light); color: var(--blue); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 5px; margin-left: 6px; }
.info-val .badge.badge--muted { background: var(--gray-light); color: var(--gray); }

[hidden] { display: none !important; }

/* ═══ Externí systém: login + doplňky ═══ */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 36px 32px; width: 360px; box-shadow: 0 10px 30px rgba(26,31,54,.08); }
.login-logo { height: 34px; margin-bottom: 18px; }
.login-title { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { color: var(--gray); margin-bottom: 14px; }
.login-label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 12px; color: #374151; }
.login-card .form-input { width: 100%; }
.login-btn { width: 100%; margin-top: 18px; padding: 10px; border-radius: 8px; font-weight: 600; cursor: pointer; border: none; }
.login-error { background: var(--red-light); color: #b91c1c; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 12.5px; }

.free-slot--click { cursor: pointer; }
.free-slot--click:hover { background: var(--green-light); }
.appt--moje { cursor: pointer; }
.popup--form { width: 480px; max-height: 90vh; overflow-y: auto; }
.form-error { background: var(--red-light); color: #b91c1c; border-radius: 8px; padding: 8px 10px; margin: 10px 0; font-size: 12.5px; }
.rc-nalezen { background: var(--green-light); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.rc-nenalezen { background: var(--orange-light); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.prazdny-mesic { margin: 40px auto; color: var(--gray); font-size: 14px; }
.popup-minule { color: var(--gray); margin-top: 12px; }

/* ── popup okno nové rezervace (window.open) ── */
.popup-okno { display: flex; justify-content: center; padding: 16px; }
.popup-okno .login-card { width: 100%; }
.popup-okno .form-select, .popup-okno .form-input { width: 100%; }

/* ── dostylování popup oken a overlay formulářů ── */
.popup .btn-nav, .popup-okno .btn-nav {
  background: #fff; color: #374151; border: 1.5px solid #d1d5db;
}
.popup .btn-nav:hover, .popup-okno .btn-nav:hover { background: var(--gray-light); border-color: #9ca3af; }
.okno-info {
  display: grid; grid-template-columns: 84px 1fr; gap: 5px 10px;
  margin: 12px 0 18px; font-size: 12.5px;
}
.okno-info dt { color: var(--gray); }
.okno-info dd { font-weight: 600; }
.popup-okno .login-card { padding-bottom: 28px; }
.okno-zavrit { margin: 18px 4px 4px; text-align: center; }

/* ── zvýraznění dnešního dne v kalendáři ── */
.day-group--dnes { border-left-color: var(--green); }
.day-group--dnes .col-header { background: var(--green); border-bottom-color: #0d9668; }

/* ── plovoucí tlačítko žádosti o rezervaci ── */
.btn-zadost {
  position: fixed; right: 24px; bottom: 24px; z-index: 50;
  background: var(--coral); color: #fff; border: none; border-radius: 999px;
  padding: 14px 22px; font-weight: 700; font-size: 13px; cursor: pointer;
  font-family: inherit; box-shadow: 0 6px 20px rgba(7,110,191,0.35);
  transition: all 0.12s;
}
.btn-zadost:hover { background: var(--blue-dark); transform: translateY(-1px); }
