/* Календарь Mini App. Цвета берутся из темы Telegram (--tg-theme-*), акцент и точки наличия — как на сайте. */

:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #1d1d1f);
  --hint: var(--tg-theme-hint-color, #8a8a8e);
  --link: var(--tg-theme-link-color, #8b5a3c);
  --section: var(--tg-theme-secondary-bg-color, #f4f1ed);
  --accent: #8b5a3c;
  --accent-soft: rgba(139, 90, 60, 0.15);
  --on-accent: #ffffff;
  --ok: #34c924;
  --few: #fbec5d;
  --full: #696969;
  --dot-ring: rgba(0, 0, 0, 0.18);
  --error: #c0392b;
  color-scheme: light;
}

:root[data-scheme="dark"] {
  --bg: var(--tg-theme-bg-color, #17181a);
  --text: var(--tg-theme-text-color, #f2f2f3);
  --hint: var(--tg-theme-hint-color, #8d8e93);
  --link: var(--tg-theme-link-color, #d39b74);
  --section: var(--tg-theme-secondary-bg-color, #232427);
  --accent: #9a6545;
  --accent-soft: rgba(196, 136, 98, 0.24);
  --full: #8a8a8a;
  --dot-ring: rgba(255, 255, 255, 0.12);
  --error: #ff6b5e;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--bar, 64px) + 12px);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

.page,
.bar-inner {
  max-width: 560px;
  margin: 0 auto;
}

.top {
  padding: 16px 16px 4px;
}

.top h1 {
  margin: 0 0 6px;
  font: 500 22px/1.2 Georgia, "Times New Roman", serif;
  letter-spacing: 0.01em;
}

.hint {
  margin: 0 0 12px;
  color: var(--hint);
  font-size: 14px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--hint);
  font-size: 13px;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend .note {
  font-style: italic;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dot.ok {
  background: var(--ok);
}

.dot.few {
  background: var(--few);
  box-shadow: inset 0 0 0 1px var(--dot-ring);
}

.dot.full {
  background: var(--full);
}

.banner {
  margin: 12px 16px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--section);
  font-size: 13px;
}

.banner[data-kind="error"] {
  color: var(--error);
}

.placeholder {
  margin: 32px 16px;
  color: var(--hint);
  text-align: center;
}

.month {
  padding: 14px 8px 0;
}

.month-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px 10px;
}

.month-head h2 {
  margin: 0;
  font: 500 17px/1.2 Georgia, "Times New Roman", serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.whole {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  row-gap: 3px;
}

.wd {
  padding: 2px 0 6px;
  color: var(--hint);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
}

.day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 6px 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.day:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.day .num {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.1;
}

.day .price {
  min-height: 12px;
  color: var(--hint);
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

.day .dot {
  position: absolute;
  top: 7px;
  left: calc(50% + 11px); /* у правого верхнего угла числа при любой ширине ячейки */
  width: 6px;
  height: 6px;
}

.day.ok .dot {
  background: var(--ok);
}

.day.few .dot {
  background: var(--few);
  box-shadow: inset 0 0 0 1px var(--dot-ring);
}

.day.full .dot {
  background: var(--full);
}

.day.loading .price::before {
  content: "···";
  opacity: 0.5;
}

.day.today .num {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.day.off {
  opacity: 0.32;
  cursor: default;
}

.day.inside {
  border-radius: 0;
  background: var(--accent-soft);
}

.day.start,
.day.end {
  background: var(--accent);
  color: var(--on-accent);
}

.day.start .price,
.day.end .price {
  color: rgba(255, 255, 255, 0.82);
}

.range .day.start {
  border-radius: 10px 0 0 10px;
}

.range .day.end {
  border-radius: 0 10px 10px 0;
}

.bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  background: var(--bg);
  box-shadow: 0 -1px 0 var(--section), 0 -6px 16px rgba(0, 0, 0, 0.06);
}

.bar-inner {
  padding: 0 16px;
}

.summary {
  margin: 0;
  font-size: 14px;
}

.submit {
  width: 100%;
  margin-top: 10px;
  padding: 13px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.submit:disabled {
  opacity: 0.45;
  cursor: default;
}
