/*
    Шрифты бренда — Roboto Condensed (текст и заголовки) и Gosha Sans (кнопки).
    Если Gosha Sans не подключён на странице Tilda, добавьте @font-face, например:

    @font-face {
      font-family: 'Gosha Sans';
      src: url('https://static.tildacdn.com/.../GoshaSans-Regular.woff2') format('woff2');
      font-weight: 400;
    }
  */

  #rb-widget {
    --rb-red: #1f1f1f;
    --rb-dark: #1f1f1f;
    --rb-black: #1f1f1f;
    --rb-muted: rgba(31, 31, 31, 0.5);
    --rb-placeholder: rgba(31, 31, 31, 0.5);
    --rb-btn-text: #fffaf1;
    --rb-disabled-bg: #d9dbda;
    --rb-disabled-text: #8a8a8d;
    --rb-border-radius: 0;
    --rb-error: #e02b20;
    font-family: 'Roboto Condensed', 'Futura PT', 'Century Gothic', Arial, sans-serif;
    color: var(--rb-dark);
    max-width: 780px;
    margin: 0 auto;
    position: relative;
    box-sizing: border-box;
    background: #f8ede1;
  }
  #rb-widget .rb-h,
  #rb-widget .rb-summary__title,
  #rb-widget .rb-final__title {
    font-family: 'Roboto Condensed', 'Futura PT', 'Century Gothic', Arial, sans-serif;
    font-weight: 700;
  }
  #rb-widget *, #rb-widget *::before, #rb-widget *::after { box-sizing: border-box; }
  #rb-widget button { font-family: inherit; cursor: pointer; }
  #rb-widget input, #rb-widget select { font-family: inherit; }

  #rb-widget .rb-screen { display: none; }
  #rb-widget .rb-screen.rb-active { display: block; }

  #rb-widget .rb-icon { display: inline-block; vertical-align: middle; flex: none; }

  .rb-form__logo { display: block; margin: 0 auto 40px; width: 189px; height: auto; }

  .rb-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    padding: 0 0 24px;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
  }
  .rb-back:hover { color: #fff; }
  .rb-light .rb-back { color: var(--rb-muted); }
  .rb-light .rb-back:hover { color: var(--rb-red); }
  .rb-final .rb-back { color: var(--rb-muted); padding-bottom: 16px; }

  .rb-error-banner {
    background: rgba(224, 43, 32, 0.08);
    border: 1px solid var(--rb-error);
    border-radius: var(--rb-border-radius);
    color: var(--rb-error);
    font-size: 14px;
    padding: 10px 14px;
    margin-top: 14px;
    display: none;
  }
  .rb-error-banner.rb-visible { display: block; }
  .rb-btn.rb-loading {
    pointer-events: none;
    position: relative;
    color: transparent !important;
  }
  .rb-btn.rb-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border-radius: 50%;
    border: 3px solid var(--rb-btn-text, #fff);
    border-top-color: transparent;
    animation: rb-spin 0.7s linear infinite;
  }
  @keyframes rb-spin { to { transform: rotate(360deg); } }

  .rb-note { font-size: 18px; color: var(--rb-muted); max-width: 320px; margin: 14px 0 0; line-height: 1.25; }



  /* ============ Светлые экраны: общие элементы ============ */
  .rb-light { background: #f8ede1; padding: 45px 40px 60px; }
  .rb-h { font-weight: 700; font-size: 24px; text-transform: uppercase; margin: 0 0 20px; }
  .rb-hr { border: none; border-top: 1px solid rgba(31, 31, 31, 0.2); margin: 32px 0; }
  .rb-topline { display: flex; justify-content: space-between; align-items: baseline; }
  .rb-change {
    background: none;
    border: none;
    padding: 0;
    font-size: 18px;
    color: var(--rb-muted);
    text-decoration: none;
  }
  .rb-change:hover { color: var(--rb-red); }

  .rb-addr { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
  .rb-addr__city { font-size: 18px; }
  .rb-addr__street { font-size: 22px; margin-top: 2px; }

  /* Селект гостей */
  .rb-guests { position: relative; }
  .rb-guests__value {
    width: 100%;
    background: transparent;
    border: 1px solid var(--rb-dark);
    border-radius: var(--rb-border-radius);
    height: 54px;
    padding: 0 20px;
    font-size: 22px;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--rb-dark);
  }
  .rb-guests__value .rb-icon { transform: rotate(-90deg); color: var(--rb-red); transition: transform 0.2s; }
  .rb-guests.rb-open .rb-guests__value .rb-icon { transform: rotate(90deg); }
  .rb-guests__list {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    width: 125px;
    background: var(--rb-red);
    border-radius: 0 0 var(--rb-border-radius) var(--rb-border-radius);
    overflow: hidden;
    z-index: 20;
  }
  .rb-guests.rb-open .rb-guests__list { display: block; }
  .rb-guests__opt {
    display: block;
    width: 100%;
    background: none;
    border: 1px solid rgba(19, 15, 12, 0.6);
    color: #fff;
    font-size: 14px;
    height: 44px;
    text-align: center;
  }
  .rb-guests__opt:hover { background: rgba(0, 0, 0, 0.15); }

  /* Поле даты */
  .rb-datebox { position: relative; }
  .rb-date {
    width: 100%;
    background: transparent;
    border: 1px solid var(--rb-dark);
    border-radius: var(--rb-border-radius);
    min-height: 72px;
    padding: 10px 60px 10px 20px;
    text-align: left;
    color: var(--rb-dark);
    position: relative;
  }
  .rb-date__label { display: block; font-size: 18px; color: var(--rb-muted); }
  .rb-date__value { display: block; font-size: 22px; margin-top: 3px; }
  .rb-date .rb-icon { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--rb-red); }

  /* Календарь */
  .rb-cal {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: -1px;
    width: 280px;
    background: #f8ede1;
    border: 1px solid var(--rb-dark);
    border-radius: 0 0 var(--rb-border-radius) var(--rb-border-radius);
    padding: 16px;
    z-index: 30;
  }
  .rb-datebox.rb-open .rb-cal { display: block; }
  .rb-cal__head { display: flex; align-items: center; justify-content: space-between; }
  .rb-cal__nav { background: none; border: none; padding: 4px; color: var(--rb-dark); display: flex; }
  .rb-cal__nav:disabled { opacity: 0.25; cursor: default; }
  .rb-cal__title { text-align: center; text-transform: uppercase; line-height: 1.1; }
  .rb-cal__month { font-size: 18px; }
  .rb-cal__year { font-size: 14px; }
  .rb-cal__week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-top: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(31, 31, 31, 0.25);
  }
  .rb-cal__wd { font-size: 12px; text-transform: uppercase; text-align: center; }
  .rb-cal__days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
  .rb-cal__day {
    background: none;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 15px;
    color: var(--rb-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
  }
  .rb-cal__day:hover:not(:disabled) { background: rgba(31, 31, 31, 0.08); }
  .rb-cal__day:disabled { color: var(--rb-muted); cursor: default; }
  .rb-cal__day.rb-selected { background: var(--rb-red); color: var(--rb-btn-text); }

  /* Время */
  .rb-time-row { display: flex; align-items: center; justify-content: space-between; margin-top: 22px; }
  .rb-time-row__label { font-size: 22px; }
  .rb-time-btn {
    background: transparent;
    border: 1px solid var(--rb-dark);
    border-radius: var(--rb-border-radius);
    height: 43px;
    width: 124px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 700;
    color: var(--rb-dark);
  }
  .rb-time-btn .rb-icon { color: var(--rb-red); }
  .rb-timepicker { display: none; margin-top: 26px; }
  .rb-timepicker.rb-open { display: block; }
  .rb-timepicker__tabs { display: flex; gap: 24px; margin-bottom: 16px; }
  .rb-timepicker__tab { background: none; border: none; padding: 0; font-size: 18px; color: var(--rb-dark); }
  .rb-timepicker__tab.rb-active { color: var(--rb-red); }
  .rb-timepicker__grid { display: flex; flex-wrap: wrap; gap: 14px; }
  .rb-chip {
    border: 1px solid var(--rb-dark);
    background: transparent;
    border-radius: var(--rb-border-radius);
    min-width: 62px;
    height: 45px;
    padding: 6px 10px;
    font-size: 18px;
    line-height: 1;
    color: var(--rb-dark);
    text-align: center;
  }
  .rb-chip small { display: block; font-size: 13px; margin-top: 3px; }
  .rb-chip:hover:not(:disabled) { background: rgba(31, 31, 31, 0.06); }
  .rb-chip.rb-selected { background: var(--rb-red); border-color: var(--rb-red); color: var(--rb-btn-text); }
  .rb-chip:disabled { background: var(--rb-disabled-bg); border-color: var(--rb-disabled-bg); color: var(--rb-disabled-text); cursor: default; }

  /* Итог + кнопка */
  .rb-summary { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0; }
  .rb-summary__title { font-size: 34px; text-transform: uppercase; line-height: 1.15; margin: 0 0 28px; }
  .rb-btn {
    display: inline-block;
    background: var(--rb-red);
    color: var(--rb-btn-text);
    border: none;
    border-radius: var(--rb-border-radius);
    font-family: 'Gosha Sans', 'Roboto Condensed', Arial, sans-serif;
    font-size: 28px;
    padding: 10px 60px;
    transition: filter 0.15s;
  }
  .rb-btn:hover { filter: brightness(1.08); }

  .rb-form-note {
    font-size: 14px;
    color: var(--rb-muted);
    margin: 8px 0 0;
    line-height: 1.3;
  }

  /* ============ Экран 2: контакты ============ */
  .rb-meta { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
  .rb-meta__row { display: flex; align-items: center; gap: 10px; font-size: 16px; }
  .rb-meta__row .rb-icon { color: var(--rb-red); }
  .rb-fields { display: flex; flex-direction: column; gap: 15px; margin-top: 28px; }
  .rb-input {
    width: 100%;
    height: 44px;
    border: 1px solid var(--rb-dark);
    border-radius: var(--rb-border-radius);
    padding: 0 18px;
    font-size: 16px;
    color: var(--rb-dark);
    background: transparent;
  }
  .rb-input::placeholder { color: var(--rb-placeholder); }
  [data-screen="contact"] .rb-input { border-color: var(--rb-dark); }
  .rb-input.rb-error { border-color: var(--rb-error); box-shadow: 0 0 0 1px var(--rb-error); }
  .rb-req { color: var(--rb-red); }
  .rb-events { display: flex; flex-wrap: wrap; gap: 10px; }
  .rb-event-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--rb-dark);
    border-radius: 0;
    background: transparent;
    color: var(--rb-dark);
    font-size: 15px;
    padding: 9px 12px;
  }
  .rb-event-chip .rb-icon { color: inherit; }
  .rb-event-chip:hover { background: rgba(31, 31, 31, 0.04); }
  .rb-event-chip.rb-selected { background: var(--rb-red); border-color: var(--rb-red); color: var(--rb-btn-text); }
  .rb-consent { display: flex; align-items: center; gap: 14px; margin: 30px 0 0; font-size: 14px; cursor: pointer; user-select: none; }
  .rb-consent input { position: absolute; opacity: 0; pointer-events: none; }
  .rb-consent__box {
    width: 20px; height: 20px; flex: none;
    border: 1px solid var(--rb-dark);
    border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
    color: transparent;
    transition: background 0.15s;
  }
  .rb-consent input:checked + .rb-consent__box { background: var(--rb-red); border-color: var(--rb-red); color: var(--rb-btn-text); }
  .rb-consent.rb-error .rb-consent__box { border-color: var(--rb-error); box-shadow: 0 0 0 1px var(--rb-error); }
  .rb-consent a { color: var(--rb-dark); text-decoration: underline; }
  #rb-widget .rb-btn.rb-btn--wide {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    font-family: 'Gosha Sans', 'Roboto Condensed', Arial, sans-serif;
    font-size: 16px;
    padding: 13px 0;
    border-radius: var(--rb-border-radius);
    margin-top: 22px;
  }

  /* ============ Финальный экран ============ */
  .rb-final { background: #f8ede1; padding: 0 0 60px; }
  .rb-final__photo { width: 100%; height: 300px; object-fit: cover; display: block; }
  .rb-final__body { padding: 45px 40px 0; }
  .rb-final__title { font-weight: 700; font-size: 44px; text-transform: uppercase; line-height: 1.1; margin: 0 0 36px; max-width: 560px; }
  .rb-final__label { font-size: 18px; margin: 0 0 14px; }
  .rb-final__table { border: 1px solid var(--rb-dark); }
  .rb-final__row { display: flex; border-top: 1px solid var(--rb-dark); }
  .rb-final__row:first-child { border-top: none; }
  .rb-final__cell-icon {
    width: 85px; flex: none;
    border-right: 1px solid var(--rb-dark);
    display: flex; align-items: center; justify-content: center;
    color: var(--rb-red);
    padding: 9px 0;
  }
  .rb-final__cell-text { padding: 9px 18px; font-size: 18px; line-height: 1.25; display: flex; flex-direction: column; justify-content: center; }
  .rb-final__save { font-weight: 700; font-size: 22px; text-align: center; margin: 56px 0 22px; }
  .rb-final__apps { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .rb-app-btn {
    height: 40px;
    border: none;
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    text-decoration: none;
  }
  .rb-app-btn img { width: 24px; height: 24px; }
  .rb-app-btn--tg { background: #24a1de; }
  .rb-app-btn--max { background: linear-gradient(63deg, #44ccff 1%, #4b87f7 23%, #4a42db 44%, #5a2ac5 64%, #9933dd 97%); }

  /* ============ Мобильная версия ============ */
  @media (max-width: 599px) {
    .rb-form__logo { width: 140px; margin-bottom: 28px; }
    .rb-light { padding: 30px 20px 45px; }
    .rb-h { font-size: 19px; }
    .rb-hr { margin: 24px 0; }
    .rb-addr__street { font-size: 19px; }
    .rb-guests__value { font-size: 18px; height: 48px; }
    .rb-date__value { font-size: 18px; }
    .rb-cal { width: 100%; }
    .rb-time-row__label { font-size: 17px; }
    .rb-time-btn { width: 112px; font-size: 16px; }
    .rb-summary__title { font-size: 24px; margin-bottom: 20px; }
    .rb-btn { font-size: 20px; padding: 10px 40px; }
    .rb-final__photo { height: 180px; }
    .rb-final__body { padding: 30px 20px 0; }
    .rb-final__title { font-size: 28px; }
    .rb-final__cell-icon { width: 60px; }
    .rb-final__cell-text { font-size: 15px; padding: 8px 12px; }
    .rb-final__apps { grid-template-columns: 1fr; gap: 12px; }
    .rb-final__save { font-size: 18px; margin-top: 40px; }
  }
