/* Ramzes — общий стиль публичной части и админки */

:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --ink: #1b1d21;
  --muted: #6b7078;
  --line: #e3e4e8;
  --accent: #d83a1e;
  --accent-dark: #b32f17;
  --accent-soft: #fdeeea;
  --ok: #1c7c3c;
  --ok-soft: #e8f6ec;
  --warn-soft: #fff4e0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 22, 26, .05), 0 8px 24px -12px rgba(20, 22, 26, .18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--accent); }

.container { max-width: 1060px; margin: 0 auto; padding: 0 20px; }

/* ---------- шапка ---------- */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: #15171b; color: #fff;
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; gap: 16px;
}
.logo {
  font-weight: 800; letter-spacing: .14em; font-size: 20px; color: #fff; text-decoration: none;
}
.logo span { color: var(--accent); }
.topbar nav { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.topbar nav a { color: #cfd2d8; text-decoration: none; font-size: 15px; }
.topbar nav a:hover { color: #fff; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: none; border-radius: 10px;
  padding: 12px 22px; font-size: 16px; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: background .15s;
  font-family: inherit;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary {
  background: #fff; color: var(--ink); border: 1px solid var(--line);
}
.btn.secondary:hover { background: var(--bg); }
.btn.small { padding: 7px 14px; font-size: 14px; border-radius: 8px; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }

/* ---------- герой ---------- */

.hero { background: #15171b; color: #fff; padding: 64px 0 72px; }
.hero h1 { margin: 0 0 14px; font-size: clamp(30px, 5vw, 46px); line-height: 1.15; font-weight: 800; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero p { color: #b9bdc5; max-width: 560px; margin: 0 0 28px; font-size: 18px; }
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.badge {
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
  color: #dfe2e7; border-radius: 999px; padding: 6px 14px; font-size: 14px;
}

/* ---------- секции ---------- */

section.block { padding: 44px 0; }
section.block h2 { margin: 0 0 8px; font-size: 28px; }
section.block .sub { color: var(--muted); margin: 0 0 24px; }

.services-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px;
}
.service-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 14px; box-shadow: var(--shadow);
}
.service-card .name { font-weight: 700; margin-bottom: 6px; }
.service-card .meta { color: var(--muted); font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.service-card .price { color: var(--ink); font-weight: 600; white-space: nowrap; }

/* ---------- форма записи ---------- */

.formcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px; margin-top: 8px;
}
fieldset.step {
  border: none; padding: 0; margin: 0 0 30px;
}
fieldset.step:last-of-type { margin-bottom: 12px; }
legend.step-title {
  font-weight: 800; font-size: 18px; padding: 0 0 12px;
  display: flex; align-items: center; gap: 10px;
}
.step-num {
  background: var(--ink); color: #fff; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
}

.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.opt {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 15px; cursor: pointer;
  background: #fff; transition: border-color .12s, background .12s;
}
.opt:hover { border-color: #b9bcc4; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .t { font-weight: 600; display: block; }
.opt .d { color: var(--muted); font-size: 13.5px; display: block; margin-top: 2px; }
.opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.opt.selected .t { color: var(--accent-dark); }

.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; color: #3c4048; }
.field .hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }
input[type=text], input[type=tel], input[type=number], input[type=password], select, textarea {
  font-family: inherit; font-size: 15.5px; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 13px; background: #fff;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 84px; }

/* ---------- фото ---------- */

.photo-picker {
  border: 2px dashed #c9ccd3; border-radius: 12px; padding: 22px; text-align: center;
  color: var(--muted); cursor: pointer; transition: border-color .12s; background: #fafafa;
}
.photo-picker:hover, .photo-picker.drag { border-color: var(--accent); color: var(--accent-dark); }
.photo-picker strong { color: var(--ink); }
.previews { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.preview {
  position: relative; width: 86px; height: 86px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #000;
}
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview .rm {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  border: none; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; font-size: 13px; line-height: 1;
}

/* ---------- календарь ---------- */

.calendar { display: inline-block; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.cal-title { font-weight: 700; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 44px); gap: 5px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border: 1.5px solid transparent; border-radius: 10px; background: #fff; cursor: pointer;
  font-size: 14.5px; position: relative;
}
.cal-day.weekend:not(.free) { color: #c3c6cc; }
.cal-day.off { background: #f1f1f3; color: #b6b9c0; cursor: not-allowed; }
.cal-day.full { background: #f1f1f3; color: #b6b9c0; cursor: not-allowed; text-decoration: line-through; }
.cal-day.free { border-color: #d9dce2; }
.cal-day.free:hover { border-color: var(--accent); }
.cal-day.selected { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.cal-day .dot {
  position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--ok);
}
.cal-day.selected .dot { background: #fff; }

.slots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.slot {
  border: 1.5px solid var(--line); background: #fff; border-radius: 9px; padding: 8px 13px;
  cursor: pointer; font-size: 14.5px; font-weight: 600; font-family: inherit;
}
.slot:hover { border-color: var(--accent); }
.slot.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.slots-note { color: var(--muted); font-size: 14px; margin-top: 10px; }

/* ---------- итоги и статусы ---------- */

.notice { border-radius: 10px; padding: 12px 16px; font-size: 14.5px; margin: 12px 0 0; }
.notice.error { background: #fdecea; color: #8f2013; border: 1px solid #f5c6bd; }
.notice.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #bfe5cb; }

.success-card { text-align: center; padding: 44px 24px; }
.success-card .big { font-size: 44px; margin-bottom: 8px; }
.success-card h3 { font-size: 24px; margin: 0 0 8px; }
.success-card p { color: var(--muted); }
.success-card .num {
  display: inline-block; margin-top: 10px; background: var(--bg); border-radius: 8px;
  padding: 6px 14px; font-weight: 700; letter-spacing: .04em;
}

/* ---------- футер ---------- */

.footer { background: #15171b; color: #9aa0a8; padding: 34px 0; margin-top: 30px; font-size: 14.5px; }
.footer a { color: #cfd2d8; }

/* ============================ админка ============================ */

.admin-shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.admin-side {
  background: #15171b; color: #cfd2d8; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.admin-side .logo { margin: 0 10px 18px; font-size: 17px; }
.admin-tab {
  background: none; border: none; color: #cfd2d8; text-align: left; padding: 10px 12px;
  border-radius: 9px; cursor: pointer; font-size: 15px; font-family: inherit; font-weight: 600;
}
.admin-tab:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.admin-tab.active { background: var(--accent); color: #fff; }
.admin-side .spacer { flex: 1; }
.admin-main { padding: 26px 30px 60px; overflow-x: auto; }

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .v { font-size: 28px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 14px; }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px;
}
.panel h3 { margin: 0 0 14px; font-size: 18px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 140px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.grid th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 13px;
  border-bottom: 1.5px solid var(--line); padding: 8px 10px; white-space: nowrap;
}
table.grid td { border-bottom: 1px solid var(--line); padding: 10px; vertical-align: top; }
table.grid tr.clickable { cursor: pointer; }
table.grid tr.clickable:hover td { background: #fafafb; }

.chip {
  display: inline-block; border-radius: 999px; padding: 3px 11px; font-size: 12.5px; font-weight: 700;
  white-space: nowrap;
}
.chip.new { background: #e8f0fd; color: #1d4fa8; }
.chip.confirmed { background: var(--ok-soft); color: var(--ok); }
.chip.in_progress { background: var(--warn-soft); color: #a05f00; }
.chip.done { background: #eceef1; color: #565b63; }
.chip.cancelled { background: #fdecea; color: #8f2013; }

.status-select { border: 1.5px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 13.5px; font-family: inherit; }

.book-detail { background: var(--bg); border-radius: 12px; padding: 18px; margin: 6px 0 14px; }
.book-detail dl { display: grid; grid-template-columns: 170px 1fr; gap: 7px 14px; margin: 0; font-size: 14.5px; }
.book-detail dt { color: var(--muted); }
.book-detail dd { margin: 0; }
.book-photos { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.book-photos a { display: block; width: 110px; height: 110px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.book-photos img { width: 100%; height: 100%; object-fit: cover; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  width: min(380px, 92vw); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px;
}
.login-card .logo { color: var(--ink); display: block; text-align: center; margin-bottom: 6px; }
.login-card p { text-align: center; color: var(--muted); margin: 0 0 18px; }

.sched-row { display: grid; grid-template-columns: 110px 90px 1fr 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sched-row:last-child { border-bottom: none; }
.sched-row .dayname { font-weight: 600; }

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .admin-side .logo { margin: 0 8px 0 0; }
  .admin-side .spacer { display: none; }
  .sched-row { grid-template-columns: 100px 70px 1fr 1fr; }
}
@media (max-width: 560px) {
  .cal-grid { grid-template-columns: repeat(7, minmax(38px, 1fr)); }
  .topbar nav { display: none; }
  .formcard { padding: 18px 16px; }
  .admin-main { padding: 18px 14px 40px; }
}
