/* Nešto slobodno? — one stylesheet. Colors only via the variables below (see docs/DIZAJN.md). */
:root {
  --bg:        #F6EEE3; /* krem pozadina, ~60% */
  --surface:   #E6E6DE; /* svetla sage za kartice i polja */
  --sage:      #A5A79B; /* ivice, razdelnici, neaktivni dani */
  --text:      #2A2320; /* glavni tekst */
  --muted:     #5E5A55; /* sporedni tekst */
  --accent:    #590907; /* burgundi: akcije i izbor */
  --on-accent: #FFFFFF;
  --danger:    #B42318;
  --success:   #2F6B3A;
  --whatsapp:  #25D366; /* samo ikonica WhatsApp dugmeta */
  --warning:   #A15C07; /* tabla: pretplata uskoro ističe */
  --info:      #1F4E9C; /* tabla: probni period */
  --radius:    12px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gap: 16px;
  --tap: 44px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--gap);
}

h1, h2, h3 { line-height: 1.25; font-weight: 700; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 .75em; }

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.muted { color: var(--muted); }
/* Login: app name as a word mark ("nešto" in text color + "slobodno?" in burgundy) */
.app-name { margin: 0 0 12px; font-size: 1.35rem; font-weight: 700; color: var(--text); }
.app-name span { color: var(--accent); }
.text-success { color: var(--success); }

/* Header */
.salon-header {
  display: flex;
  gap: var(--gap);
  align-items: center;
  margin-bottom: var(--gap);
}
.salon-header p { margin: 0; }
.salon-logo {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface);
  flex-shrink: 0;
}
.phone-link { font-weight: 600; text-decoration: none; }

/* Cards and alerts */
.card, .step {
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--gap);
  margin-bottom: var(--gap);
}
.alert {
  border-radius: var(--radius);
  padding: 12px var(--gap);
  border: 1px solid currentColor;
  background: var(--bg);
}
.alert-error { color: var(--danger); }

/* Public page of the demo salon (studio-demo) only */
.demo-banner {
  margin: 0 0 var(--gap);
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Summary */
.summary {
  background: var(--surface);
  border: 1px solid var(--sage);
  border-radius: var(--radius);
  padding: 8px var(--gap);
  margin-bottom: var(--gap);
}
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
}
.summary-row + .summary-row { border-top: 1px solid var(--sage); }
.summary-label { display: block; font-size: .8rem; color: var(--muted); }

/* Buttons */
button { font: inherit; color: inherit; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 0;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:disabled { opacity: .7; cursor: default; }
.btn-block { width: 100%; margin-top: 8px; }
.link-btn {
  background: none;
  border: 0;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  min-height: var(--tap);
  padding: 0 4px;
  cursor: pointer;
}

/* Step 1: services */
.service-list { display: grid; gap: 8px; }
.service {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--sage);
  border-radius: var(--radius);
  padding: 12px var(--gap);
  min-height: var(--tap);
  cursor: pointer;
}
.service-name { font-weight: 700; }
.service-price { font-weight: 700; grid-column: 2; grid-row: 1; white-space: nowrap; }
.service-meta, .service-desc { color: var(--muted); font-size: .9rem; grid-column: 1 / -1; }
.service[aria-pressed="true"] { border: 2px solid var(--accent); }

/* Step 2: day strip and time grid */
.day-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
  scroll-snap-type: x proximity;
}
.day {
  flex: 0 0 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  background: var(--bg);
  border: 1px solid var(--sage);
  border-radius: var(--radius);
  cursor: pointer;
  scroll-snap-align: start;
}
.day-weekday { font-size: .85rem; color: var(--muted); }
.day-date { font-weight: 700; }
.day:disabled {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
  opacity: .55;
  cursor: not-allowed;
}
.day[aria-pressed="true"], .time[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.day[aria-pressed="true"] .day-weekday { color: var(--on-accent); }

.time-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 380px) {
  .time-grid { grid-template-columns: repeat(3, 1fr); }
}
.time {
  min-height: var(--tap);
  background: var(--bg);
  border: 1px solid var(--sage);
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
}

/* Step 3: form */
.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field input[type="text"],
.field input[type="tel"],
.field input[type="email"],
.field textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--sage);
  border-radius: var(--radius);
}
.field-check { display: flex; gap: 10px; align-items: flex-start; }
.field-check input { width: 22px; height: 22px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--accent); }
.field-check label { font-weight: 400; margin: 0; }
.hint { font-size: .85rem; color: var(--muted); margin: 4px 0 0; }
.field-error { color: var(--danger); font-size: .9rem; margin: 4px 0 0; }

/* Honeypot: off-screen, not display:none (some bots skip hidden fields) */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Appointment details */
.details { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0 0 12px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 600; }

/* ---------------------------------------------------------------------------
   Owner panel
   --------------------------------------------------------------------------- */
body.panel .container { padding-bottom: 96px; }
.panel-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: var(--gap); }
.panel-header h1 { margin: 0; }
.panel-header > p { width: 100%; margin: 0; }
.small { font-size: .85rem; }
.messages .alert { margin: 0 0 var(--gap); }
.alert-success { color: var(--success); }

.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--sage); text-decoration: none; }
.btn-danger { background: var(--bg); color: var(--danger); border: 1px solid var(--danger); }
.btn-primary { text-decoration: none; }
.btn-small { min-height: 36px; padding: 6px 14px; font-size: .9rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { margin: 0; }
.actions-bottom { margin-top: var(--gap); }
.actions-bottom .btn { flex: 1; }
.actions-stack form + form { margin-top: 8px; }
.icon-btn { width: var(--tap); height: var(--tap); border-radius: var(--radius); border: 1px solid var(--sage); background: var(--bg); cursor: pointer; font-size: 1.1rem; }
.icon-btn:disabled { opacity: .4; cursor: default; }

/* Bottom navigation */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--sage);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 60px; font-size: .8rem; color: var(--muted); text-decoration: none;
}
.bottom-nav .nav-icon { font-size: 1.25rem; line-height: 1.2; }
.bottom-nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }

/* Tabs and date navigation */
.tabs { display: flex; gap: 4px; background: var(--surface); border-radius: var(--radius); padding: 4px; width: 100%; }
.tabs a { flex: 1; text-align: center; padding: 8px; border-radius: 8px; text-decoration: none; color: var(--text); min-height: 40px; }
.tabs a[aria-current="page"] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.date-nav { display: flex; align-items: center; gap: 8px; width: 100%; }
.date-nav h1 { flex: 1; text-align: center; font-size: 1.05rem; }
.date-nav .btn { padding: 0; width: var(--tap); font-size: 1.4rem; }

/* Appointment lists */
.appt-list, .plain-list, .service-admin-list { list-style: none; margin: 0; padding: 0; }
.appt-row { padding: 12px 0; border-top: 1px solid var(--sage); min-width: 0; }
.appt-row:first-child { border-top: 0; }
.appt-main { display: block; min-width: 0; color: var(--text); text-decoration: none; }
.appt-line1 { display: flex; align-items: center; gap: 10px; min-width: 0; }
.appt-time { flex: none; font-size: 1.25rem; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.appt-time small { font-size: .75rem; font-weight: 600; color: var(--muted); }
.appt-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt-line1 .badge { flex: none; margin-left: auto; }
.appt-line2 { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .9rem; }
.contact-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin-top: 10px; }
.btn-contact { gap: 6px; width: 100%; min-height: var(--tap); padding: 6px 10px; white-space: nowrap; text-decoration: none; }
.icon { flex: none; display: block; }
.icon-phone { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-wa .wa-bubble { fill: var(--whatsapp); }
.icon-wa .wa-handset { fill: var(--on-accent); stroke: none; }
.msg-preview { margin-top: 8px; overflow-wrap: anywhere; }
.alert .btn { margin-top: 8px; }
.appt-row .actions { display: flex; gap: 8px; margin-top: 8px; }
.appt-row .actions form { flex: 1; }
.appt-row .actions .btn { width: 100%; }
.appt-row.status-cancelled, .appt-row.status-rejected, .appt-row.status-no_show { opacity: .6; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; border: 1px solid var(--sage); background: var(--bg); color: var(--text); white-space: nowrap; }
.badge-pending { border-color: var(--accent); color: var(--accent); }
.badge-confirmed { border-color: var(--success); color: var(--success); }
.badge-rejected, .badge-cancelled, .badge-no_show { color: var(--muted); }

.plain-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--sage); }
.plain-list li:first-child { border-top: 0; }
.plain-list form { margin: 0; }

/* Day timeline */
.timeline { position: relative; margin: 8px 0 0 48px; border-left: 1px solid var(--sage); }
.tl-hour { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--sage); }
.tl-hour span { position: absolute; left: -48px; top: -0.7em; font-size: .75rem; color: var(--muted); width: 42px; text-align: right; }
.tl-item {
  position: absolute; left: 6px; right: 0;
  border-radius: 8px; padding: 2px 8px; overflow: hidden;
  font-size: .8rem; line-height: 1.3; text-decoration: none;
  display: flex; flex-direction: column;
}
.tl-appt { background: var(--surface); border: 1px solid var(--sage); border-left: 4px solid var(--success); color: var(--text); }
.tl-appt.status-pending { border-left-color: var(--accent); }
.tl-appt.status-no_show { border-left-color: var(--muted); opacity: .7; }
.tl-gray {
  background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 6px, var(--bg) 6px, var(--bg) 12px);
  border: 1px solid var(--sage); color: var(--muted);
}

/* Week view: horizontal scroll on phones */
.week-scroll { overflow-x: auto; margin: 0 calc(-1 * var(--gap)); padding: 0 var(--gap) 8px; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); gap: 6px; min-width: 770px; }
.week-col { background: var(--surface); border-radius: var(--radius); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-height: 120px; }
.week-col.is-closed { background: transparent; border: 1px dashed var(--sage); }
.week-col.is-today .week-head { color: var(--accent); }
.week-head { text-align: center; text-decoration: none; color: var(--text); font-size: .85rem; padding-bottom: 4px; border-bottom: 1px solid var(--sage); }
.week-item { display: block; font-size: .75rem; line-height: 1.3; padding: 4px 6px; border-radius: 6px; background: var(--bg); border-left: 3px solid var(--success); color: var(--text); text-decoration: none; }
.week-item.status-pending { border-left-color: var(--accent); }
.week-item.status-no_show { border-left-color: var(--muted); opacity: .7; }
.week-item.tl-gray { border-left-width: 1px; }
.week-item span { color: var(--muted); }
/* Wider screens (tablet, computer): use up to 1000 px, no horizontal scroll */
body.panel-wide .container { max-width: 1000px; }
body.panel-wide .panel-header { max-width: 560px; margin-left: auto; margin-right: auto; }
@media (min-width: 800px) {
  .week-scroll { overflow-x: visible; margin: 0; padding: 0; }
  .week-grid { min-width: 0; grid-template-columns: repeat(7, minmax(0, 1fr)); }
}

/* Settings */
.menu-list { display: grid; gap: 8px; margin-bottom: var(--gap); }
.menu-list a { display: flex; flex-direction: column; padding: 12px var(--gap); background: var(--surface); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.logout-form { margin-top: var(--gap); }
.service-admin-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--sage); }
.service-admin-list li.is-hidden .service-admin-main { opacity: .55; }
.service-admin-main { flex: 1; display: flex; flex-direction: column; color: var(--text); text-decoration: none; }
.service-admin-actions { display: flex; align-items: center; gap: 4px; }
.service-admin-actions form { margin: 0; }
.field select, .field input[type="date"], .field input[type="time"], .field input[type="number"],
.field input[type="password"], .field input[type="file"], .field input[type="url"] {
  width: 100%; min-height: var(--tap); padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--sage); border-radius: var(--radius);
}
.field input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); }
.hours-day { margin: 0 0 var(--gap); }
.hours-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); }
.hours-head h2 { font-size: 1.05rem; margin: 0; }
.hours-closed { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); cursor: pointer; white-space: nowrap; }
.hours-closed input { width: 22px; height: 22px; margin: 0; flex-shrink: 0; accent-color: var(--accent); }
.hours-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; margin-top: 8px; }
.hours-grid .field { min-width: 0; }
.hours-day.is-closed .hours-grid { display: none; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; min-height: var(--tap); padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--sage); border-radius: var(--radius); }
.qr svg { width: 100%; max-width: 280px; height: auto; display: block; margin: 0 auto var(--gap); background: var(--on-accent); }

/* QR print page */
.print-page { background: var(--on-accent); color: var(--text); }
.print-sheet { max-width: 520px; margin: 40px auto; text-align: center; padding: 24px; border: 2px solid var(--accent); border-radius: var(--radius); }
.print-kicker { font-size: 1.6rem; font-weight: 700; color: var(--accent); margin: 0; }
.print-sheet h1 { font-size: 2rem; margin: 8px 0 16px; }
.qr-print svg { max-width: 360px; }
.print-url { font-size: 1rem; word-break: break-all; }
.no-print { text-align: center; }
@media print {
  .no-print { display: none; }
  .print-sheet { margin: 0 auto; }
}

/* ---------------------------------------------------------------------------
   FSDev control board (/<ADMIN_URL>tabla/): desktop and phone
   --------------------------------------------------------------------------- */
body.tabla .container { max-width: 1180px; }
.tabla-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding-bottom: 12px; margin-bottom: var(--gap); border-bottom: 1px solid var(--sage); }
.tabla-nav a { color: var(--text); text-decoration: none; padding: 8px 0; }
.tabla-nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }
.tabla-brand { font-weight: 800; margin-right: auto; }
.tabla-narrow { max-width: 560px; }
.tabla-head .actions { margin-bottom: var(--gap); }
.tabla-cols { display: grid; gap: var(--gap); align-items: start; }
@media (min-width: 900px) { .tabla-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: var(--gap); }
.stat { display: flex; flex-direction: column; padding: 12px 14px; background: var(--surface); border-radius: var(--radius); }
.stat-value { font-size: 1.4rem; font-weight: 800; }
.stat-label { font-size: .85rem; color: var(--muted); }

.tabla-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--gap); }
.tabla-filter input, .tabla-filter select { min-height: 36px; padding: 6px 10px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--sage); border-radius: var(--radius); }
.tabla-filter input { flex: 1 1 220px; min-width: 0; }

.tabla-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabla-table th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--sage); }
.tabla-table td { padding: 10px 8px; border-bottom: 1px solid var(--sage); vertical-align: top; }
.tabla-table tr.is-off td { opacity: .65; }
.tabla-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.tabla-actions form { margin: 0; }

.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; border: 1px solid currentColor; background: var(--bg); white-space: nowrap; }
.chip-paid { color: var(--success); }
.chip-expiring { color: var(--warning); }
.chip-expired { color: var(--danger); }
.chip-trial { color: var(--info); }
.chip-none, .chip-off { color: var(--muted); }

.payment-list li { padding: 6px 0; border-top: 1px solid var(--sage); }
.payment-list li:first-child { border-top: 0; }
.tabla-narrow .actions { margin-top: 12px; }
.access-text { width: 100%; padding: 10px 12px; font: inherit; font-size: .95rem; color: var(--text); background: var(--bg); border: 1px solid var(--sage); border-radius: var(--radius); resize: vertical; }
.field ul, .field div[id^="id_plan"] { list-style: none; margin: 0; padding: 0; }
.field input[type="radio"] { width: 20px; height: 20px; accent-color: var(--accent); vertical-align: middle; }
.field input[type="search"] { width: 100%; }

/* Phone: table rows become cards */
@media (max-width: 760px) {
  .tabla-table thead { display: none; }
  .tabla-table, .tabla-table tbody, .tabla-table tr, .tabla-table td { display: block; width: 100%; }
  .tabla-table tr { background: var(--surface); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 12px; }
  .tabla-table td { border: 0; padding: 4px 0; display: grid; grid-template-columns: 9em minmax(0, 1fr); gap: 8px; overflow-wrap: anywhere; }
  .tabla-table td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; }
  .tabla-table td.tabla-actions-cell { display: block; padding-top: 8px; }
  .tabla-table td.tabla-actions-cell::before { content: none; }
}
