* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}
:root {
  --bg: #f7f7f7;
  --text: #111;
  --border: #ddd;
  --accent: #3b82f6;
  --danger: #ef4444;
  --warn: #f59e0b;
  --success: #16a34a;
  --muted: #aaa;
  --radius: 12px;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  --family: "Artegra Sans Extended", system-ui, sans-serif;
  --familyCal: "Inter", system-ui, sans-serif;
}

body {
  font-family: var(--family);
  background: url("../img/bg.webp");
  background-repeat: no-repeat;
  background-size: cover;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  margin: 0;
  padding: 10px;
}

header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
}

.header-phone {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-phone a {
  text-decoration: none;
  color: white;
  font-weight: 600;
  font-size: 18px;
}

h1 {
  font-size: 54px;
  font-weight: 600;
  text-transform: uppercase;
  text-align: center;
}

.subtitle {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 24px;
  text-align: center;
}

.switch {
  display: flex;
  gap: 50px;
  justify-content: space-around;
  flex-wrap: wrap;
  margin-bottom: 26px;
  border-bottom: 1px solid #d9d9d9;
  max-width: 1024px;
  width: 100%;
  margin-top: 1%;
  position: relative;
}

.switch::after {
  content: "";
  position: absolute;
  width: fit-content;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: left, width;
}

.switch button {
  cursor: pointer;
  padding-bottom: 8px;
  font-family: var(--familyCal);
  font-size: 16px;
  font-weight: 500;
  line-height: 125%;
  text-transform: uppercase;
  background: inherit;
  border: none;
  color: #d9d9d9;
  transition: color 0.2s;
  position: relative;
}

.switch button::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

/* active */
.switch button.active {
  color: #fff;
  font-weight: 700;
}

.switch button.active::after {
  transform: scaleX(1);
}

.calHours {
  max-width: 1024px;
  width: 100%;
  display: flex;
  align-items: top;
  gap: 20px;
}

.calendar {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  width: 100%;
  text-align: center;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.month {
  font-size: 20px;
  font-weight: 700;
  text-transform: capitalize;
  font-family: var(--familyCal);
}

.btnsStroke {
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-btn {
  border: none;
  background: transparent;
  font-size: 18px;
  color: black;
  cursor: pointer;
  padding: 4px 8px;
}

.weekdays,
.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.days {
  margin-top: 32px;
  gap: 50px;
}

.weekdays div {
  font-size: 18px;
  color: #000;
  font-family: var(--familyCal);
  font-weight: 800;
  margin-top: 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid #000;
  text-transform: uppercase;
}

.day {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  background: transparent;
  border: none;
  color: var(--text);
  user-select: none;
  border-radius: 50%;
  transition: 0.2s;
  font-family: var(--familyCal);
}

.past {
  opacity: 50%;
}

.partial::after {
  content: "";
  width: 48px;
  height: 48px;
  border-radius: 50%;
  position: absolute;
  border: 3px solid #000;
  font-weight: 600;
  background: transparent;
  color: #000;
}

.day.busy::after {
  content: "";
  width: 48px;
  height: 48px;
  border-radius: 50%;
  position: absolute;
  border: 2px solid #000;
  font-weight: 600;
  background: transparent;
  color: #000;
}

.legend {
  display: flex;
  gap: 50px;
  align-items: center;
  margin: 50px 0 26px;
  font-size: 16px;
  padding-left: 20px;
  color: black;
  flex-wrap: wrap;
  text-transform: uppercase;
  font-family: var(--familyCal);
  font-weight: 600;
}

.dot {
  padding: 5px 7px;
  border-radius: 50%;
  margin-right: 6px;
  border: 2px solid black;
}

.dot.busy {
  background: var(--danger);
  border-color: var(--danger);
}

.cal-btns {
  display: flex;
  max-width: 1024px;
  width: 100%;
  gap: 10px;
  margin-top: 12px;
}

.date-hint {
  font-family: var(--familyCal);
  font-size: 16px;
  color: black;
  margin-top: 10px;
  margin-bottom: 14px;
  font-style: italic;
  text-align: left;
  font-weight: 500;
  display: none;
  transition: 0.25s;
}

.date-hint.show {
  display: block;
}

.book-btn {
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  font-weight: 600;
  width: 100%;
  background: inherit;
  color: white;
  border: 2px solid white;
  border-radius: 12px;
  padding: 20.5px;
  font-family: var(--family);
  font-size: 18px;
  text-transform: uppercase;
  transition: 0.2s;

  &:hover {
    background-color: white;
    color: black;
  }
}

.hours {
  background: white;
  border-radius: 14px;
  padding: 24px;
  height: fit-content;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15);
  transition: right 0.35s ease;
  z-index: 999; /* нижче попапа, але вище сторінки */
  pointer-events: none; /* НЕ блокує календар */
  display: none;
}

.hours.open {
  display: block;
  right: 20px; /* виїжджає */
  pointer-events: auto; /* тепер клікабельна */
}

.hoursLegend {
  font-weight: 400;
  padding-left: 0;
  gap: 16px;
  margin-top: 10%;
}

.hoursLegend .dot {
  font-weight: 600;
  border-radius: 16px;
  border: 2px solid black;
}

.empty-msg {
  margin-top: 20px;
  font-size: 15px;
  color: #777;
  font-family: var(--familyCal);
  text-align: center;
}
.hours h3 {
  font-size: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid black;
  text-align: center;
  font-family: var(--familyCal);
}
#selectedDate {
  font-size: 14px;
  text-underline-offset: 4px;
  opacity: 70%;
}
.slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.slot {
  border-radius: 8px;
  padding: 8px;
  font-size: 16px;
  font-weight: 400;
  border: none;
  text-align: center;
  font-family: var(--familyCal);
}
.slot.busy {
  border: 2px solid black;
  font-weight: 600;
  border-radius: 16px;
}

.popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  backdrop-filter: blur(4px);
}

/* Контент */
.popup-content {
  background: #fff;
  padding: 25px;
  width: 90%;
  max-width: 800px;
  border-radius: 14px;
  position: relative;
  animation: popupShow 0.25s ease;
}

/* Хрестик */
.close-popup {
  position: absolute;
  right: 16px;
  top: 10px;
  font-size: 26px;
  cursor: pointer;
}

/* Внутрішній контент */
.popup-media {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.popup iframe,
.popup video {
  width: 100%;
  height: 260px;
  border-radius: 12px;
  object-fit: cover;
}

@media (max-width: 1000px) {
  body {
    padding: 20px;
  }

  .switch {
    gap: 8px;
    border-bottom: none;
    justify-content: center;
  }

  .switch::after {
    display: none;
  }

  .switch button {
    padding: 12px 16px;
    border: 1px solid;
    border-radius: 12px;
    color: white;
    border-color: white;
    font-weight: bolder;
  }

  button.active {
    color: black !important;
    background-color: white;
  }

  .cal-btns,
  header,
  .calHours {
    flex-direction: column;
  }

  .slots {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Плавна анімація появи */
@keyframes popupShow {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 32px;
    margin: 40px 0 24px;
  }

  .header-phone {
    gap: 10px;
  }

  .switch {
    margin: 24px 0 12px;
    display: grid;
    grid-template-columns: 1fr 1fr; /* Дві колонки */
    gap: 12px;
    width: 100%;
    max-width: 768px;
  }

  .switch button {
    font-size: 13px;
  }

  .switch button:nth-child(1),
  .switch button:nth-child(2) {
    grid-column: span 1;
  }

  .switch button:nth-child(3),
  .switch button:nth-child(4),
  .switch button:nth-child(5) {
    grid-column: 1 / -1;
  }

  .days {
    gap: 20px 0;
  }

  .day.busy::after,
  .partial::after {
    width: 24px;
    height: 24px;
  }

  .weekdays div,
  .day {
    font-size: 14px;
  }

  .nav-btn {
    padding: 0;
  }

  .nav-btn svg {
    width: 25px;
    height: 32px;
  }

  .date-hint {
    font-size: 13px;
  }

  .legend {
    font-size: 14px;
    gap: 30px;
  }

  .book-btn {
    padding: 15.5px;
  }

  .popup-media {
    grid-template-columns: repeat(1, 1fr);
  }

  .calendar {
    padding: 15px 20px;
  }

  .calendar-header {
    font-size: 18px;
  }

  .date-hint {
    margin-top: 0;
    margin-bottom: 8px;
  }

  .legend{
    margin-bottom: 15px;
    padding-left: 0;
  }

  .book-btn {
    font-size: 15px;
  }

  .hoursLegend {
    gap: 15px;
  }
}


.nav-btn.disabled {
    opacity: 0.3;           /* Робимо напівпрозорою */
    cursor: not-allowed;    /* Курсор "заборонено" */
    pointer-events: none;   /* Повністю вимикає кліки по кнопці */
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Клас, який ми будемо додавати через JS */
.calendar.anim-show {
    animation: fadeInScale 0.4s ease-out forwards;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Рух зліва направо (для кнопки НАЗАД) */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Плавна поява (для назви місяця) */
@keyframes fadeInSimple {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Класи, які будемо додавати через JS */
.days.anim-next {
    animation: slideInRight 0.3s ease-out forwards;
}

.days.anim-prev {
    animation: slideInLeft 0.3s ease-out forwards;
}

.month-anim {
    animation: fadeInSimple 0.3s ease-out forwards;
}