/* ==========================================================================
   DODACI ZA ADMIN PANEL (osnovni dizajn je u style.css)
   Prvo telefon, a širi prikaz za laptop je pri dnu fajla.
   ========================================================================== */

/* ---------- Prijava ---------- */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-box {
  width: 100%;
  max-width: 420px;
  display: grid;
  gap: 16px;
  padding: 28px 22px;
  background: var(--surface);
  border-top: 3px solid var(--accent);
  box-shadow: var(--hard-shadow);
}
.login-brand {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-family: var(--font-heading);
  font-size: 2rem;
  letter-spacing: .02em;
  line-height: 1;
}
.login-mark { width: auto; height: 110px; flex: none; }
.login-box h1 { font-size: 1.5rem; }
.login-back { justify-self: center; padding: 6px; color: var(--accent); font-size: .9rem; }
.login-note { color: var(--muted); font-size: .8rem; text-align: center; }

/* ---------- Zaglavlje ---------- */
.admin-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: .925rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 3px;
}
.admin-main {
  display: flex;
  flex-direction: column;
  padding-block: 18px calc(40px + env(safe-area-inset-bottom));
}

/* ---------- Danas i broj termina ---------- */
.day-head-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.day-head h1 { font-size: clamp(2.75rem, 13vw, 4.5rem); line-height: .95; }
.day-head-count {
  flex: none;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
  text-align: right;
  line-height: 1.1;
}
.day-head-count b {
  display: block;
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: clamp(2.75rem, 13vw, 4.5rem);
  font-weight: 800;
  line-height: .95;
  font-variant-numeric: tabular-nums;
}
.day-head-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent);
}
.day-head-date { min-width: 0; color: var(--muted); font-size: .9rem; line-height: 1.3; }
.day-head-date .admin-link { display: flex; min-height: 32px; color: var(--accent); }
.filters-toggle { flex: none; }
.filters-toggle[aria-expanded="true"] { background: var(--accent); color: var(--on-accent); }
.filters-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background: var(--text);
  color: var(--bg);
  font-size: .75rem;
  font-weight: 800;
}

/* ---------- Dodavanje i blokiranje ---------- */
.admin-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.admin-actions .btn { padding-inline: 8px; }
.modal-form { display: grid; gap: 12px; margin-top: 14px; }
.modal-box .admin-input-full { width: 100%; }
.field-label { display: block; margin-bottom: 5px; font-size: .875rem; font-weight: 600; }
.form-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.service-picks { max-height: 220px; overflow-y: auto; border: 2px solid var(--line); background: var(--bg); }
.service-pick-cat {
  padding: 6px 10px 2px;
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: .95rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.service-pick { padding: 6px 10px; font-size: .9rem; align-items: center; }
.service-pick input { width: 22px; height: 22px; }
.service-pick small { margin-left: auto; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.service-pick span { flex: 1; min-width: 0; }
.form-total { color: var(--accent); font-weight: 700; font-size: .95rem; }
.form-alert {
  padding: 10px 12px;
  border-left: 3px solid var(--danger);
  background: rgba(224, 121, 107, .1);
  font-size: .875rem;
  line-height: 1.45;
}
.form-alert ul { margin-top: 4px; padding-left: 16px; list-style: square; }
.form-success {
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--success);
  background: rgba(143, 192, 138, .1);
  font-weight: 600;
  line-height: 1.45;
}
.admin-foot .admin-link { display: inline-flex; }

/* ---------- Obavještenje o novom terminu ---------- */
.toasts {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  z-index: 300;
  display: grid;
  gap: 8px;
  justify-items: end;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  width: min(100%, 400px);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 8px 12px 14px;
  background: var(--surface-alt);
  border-left: 4px solid var(--accent);
  box-shadow: var(--hard-shadow-sm), 0 14px 34px rgba(0, 0, 0, .6);
  text-align: left;
  animation: toast-in .32s var(--ease);
}
.toast.is-leaving { animation: toast-out .22s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-18px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-12px); } }
.toast-open { flex: 1; min-width: 0; text-align: left; line-height: 1.35; }
.toast-title { display: block; font-weight: 700; overflow-wrap: anywhere; }
.toast-note { display: block; margin-top: 3px; color: var(--muted); font-size: .78rem; }
.toast-close { flex: none; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }

/* ---------- Filteri ---------- */
.admin-filters {
  display: none;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  margin-top: 12px;
  background: var(--surface);
}
.admin-filters.is-open { display: flex; animation: filters-in .18s var(--ease); }
@keyframes filters-in { from { opacity: 0; transform: translateY(-6px); } }
.date-nav { display: flex; align-items: center; gap: 6px; }
.date-nav .admin-input { flex: 1; min-width: 0; }
.admin-square { border: 2px solid var(--line); }
.admin-input {
  min-height: 48px;
  padding: 8px 12px;
  background: var(--surface-alt);
  border: 2px solid var(--line);
  border-radius: 0;
  font-size: 16px;
  color-scheme: dark;
}
.view-switch { display: flex; border: 2px solid var(--accent); }
.view-switch button {
  flex: 1;
  min-height: 44px;
  padding: 8px 10px;
  font-weight: 700;
  font-size: .875rem;
  transition: background-color .15s, color .15s;
}
.view-switch button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.admin-select { display: flex; align-items: center; gap: 10px; font-size: .9rem; font-weight: 600; }
.admin-select select { flex: 1; min-width: 0; }
.admin-check { padding: 0; }

/* ---------- Lista termina ---------- */
.admin-list { margin-top: 14px; }
.booking-list { display: grid; gap: 8px; }
.booking {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 0 10px;
  align-items: center;
  padding: 10px 8px 10px 12px;
  background: var(--surface);
  border-left: 3px solid var(--accent);
}
.booking.menu-open { z-index: 10; }
.booking-time {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  align-self: start;
}
.booking-end { display: block; color: var(--muted); font-family: var(--font-body); font-size: .75rem; font-weight: 500; }
.booking-main { min-width: 0; }
.booking-service { font-weight: 700; line-height: 1.25; }
.booking-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: .7rem;
  font-weight: 800;
  vertical-align: 1px;
}
.booking-meta { margin-top: 2px; color: var(--muted); font-size: .875rem; line-height: 1.35; overflow-wrap: anywhere; }
.booking-meta b { color: var(--text); font-weight: 600; }
.booking-extra, .booking-price { display: none; }
.booking-tools { display: flex; align-items: center; gap: 2px; }
.booking-call {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--accent);
  color: var(--on-accent);
  transition: background-color .15s;
}
@media (hover: hover) { .booking-call:hover { background: var(--accent-hover); } }
.booking-more { position: relative; }
.booking-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 44px;
  color: var(--muted);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}
.booking-dots[aria-expanded="true"] { color: var(--text); background: var(--surface-alt); }
.booking-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  width: min(270px, 78vw);
  padding: 10px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  box-shadow: var(--hard-shadow-sm);
}
.booking-menu dl { margin: 0; font-size: .875rem; }
.booking-menu dl > div { padding: 5px 0; border-bottom: 1px solid var(--line); }
.booking-menu dt { color: var(--muted); font-size: .75rem; }
.booking-menu dd { margin: 0; overflow-wrap: anywhere; }
.booking-menu dd a { color: var(--accent); }
.menu-cancel {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  color: var(--danger);
  font-size: .9rem;
  font-weight: 700;
  text-align: left;
}
.booking.is-cancelled { border-left-color: var(--line); }
.booking.is-cancelled .booking-time,
.booking.is-cancelled .booking-main { opacity: .62; }
.booking.is-cancelled .booking-service,
.booking.is-cancelled .booking-time { text-decoration: line-through; }
.booking-status { color: var(--danger); font-size: .8rem; font-weight: 700; }
.booking-tag-phone { background: var(--surface-alt); color: var(--text); border: 1px solid var(--line); }

/* Došao / Nije došao */
.booking-attend { grid-column: 2 / -1; display: flex; gap: 6px; margin-top: 6px; }
.attend-btn {
  min-height: 32px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
  transition: background-color .15s, color .15s, border-color .15s;
}
.attend-btn[aria-pressed="true"][data-attend="arrived"] { background: var(--success); border-color: var(--success); color: var(--bg); font-weight: 700; }
.attend-btn[aria-pressed="true"][data-attend="noshow"] { background: var(--danger); border-color: var(--danger); color: var(--bg); font-weight: 700; }

/* Blokirano vrijeme: druga boja i šrafura */
.booking-blocked {
  border-left-color: var(--blocked);
  background-color: var(--surface);
  background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--blocked) 14%, transparent) 0 8px, transparent 8px 16px);
}
.booking-blocked .booking-time, .booking-blocked .booking-service { color: var(--blocked); }
.booking-time-all { font-size: 1rem; line-height: 1.2; }
.menu-remove { color: var(--blocked); }
.admin-empty { padding: 14px; background: var(--surface); color: var(--muted); font-size: .95rem; }

/* 7 dana */
.day-block { margin-bottom: 24px; }
.day-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 1.2rem;
  line-height: 1.15;
}
.day-title::first-letter { text-transform: uppercase; }
.day-title small {
  flex: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: .85rem;
  font-weight: 500;
  letter-spacing: 0;
}
.day-title.is-today { color: var(--accent); }

/* Po barberu */
.barber-columns { display: grid; gap: 22px; }
.barber-column-title {
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 1.5rem;
}
.barber-column-title small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: .85rem;
  font-weight: 500;
  letter-spacing: 0;
}

/* ---------- Brojke ispod liste ---------- */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 26px 0 0;
  background: var(--surface);
  border-top: 3px solid var(--accent);
}
.admin-stats > div { padding: 10px 12px; border-bottom: 1px solid var(--line); min-width: 0; }
.admin-stats > div:nth-child(odd) { border-right: 1px solid var(--line); }
.admin-stats dt { color: var(--muted); font-size: .75rem; font-weight: 600; line-height: 1.25; }
.admin-stats dd {
  margin: 2px 0 0;
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: clamp(1.25rem, 5vw, 2.25rem);
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.admin-foot { margin-top: 22px; }
.admin-demo {
  padding: 8px 12px;
  border-left: 3px solid var(--line);
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.45;
}
.admin-demo span { display: block; }
.admin-foot .admin-link { margin-top: 6px; color: var(--muted); font-size: .85rem; }

/* ---------- Širi prikaz za laptop ---------- */
@media (min-width: 900px) {
  .admin-main { padding-top: 26px; }
  .day-head { order: 1; }
  .admin-actions { order: 2; display: flex; }
  .admin-filters { order: 3; margin-top: 14px; }
  .admin-stats { order: 4; }
  .admin-list { order: 5; }
  .admin-foot { order: 6; }
  .admin-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .admin-stats > div, .admin-stats > div:nth-child(odd) { border-bottom: 0; border-right: 1px solid var(--line); }
  .admin-stats > div:last-child { border-right: 0; }
  .booking-list-wide .booking-attend { grid-column: 2 / 4; }

  .filters-toggle { display: none; }
  .admin-filters,
  .admin-filters.is-open {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    padding: 0;
    background: none;
    animation: none;
  }
  .view-switch { display: inline-flex; }
  .view-switch button { flex: none; padding-inline: 16px; }
  .admin-stats { margin: 18px 0 8px; }
  .admin-stats dt { font-size: .8rem; }
  .admin-list { margin-top: 18px; }

  .barber-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }

  /* Široka kartica: pokazuje i kontakt i cijenu. U kolonama po barberu ostaje kompaktna. */
  .booking-list-wide .booking { grid-template-columns: 70px minmax(0, 1fr) minmax(0, 1fr) 64px 82px; padding-right: 12px; gap: 0 16px; }
  .booking-list-wide .booking-price { text-align: right; }
  .booking-list-wide .booking-tools { justify-content: flex-end; }
  .booking-list-wide .booking-extra { display: block; color: var(--muted); font-size: .875rem; line-height: 1.4; overflow-wrap: anywhere; }
  .booking-list-wide .booking-extra a { color: var(--accent); }
  .booking-list-wide .booking-price {
    display: block;
    color: var(--accent);
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    white-space: nowrap;
  }
}
