/* ============================================================
   БРИДЖ ХАУС — компоненты: хедер, меню, формы, календарь,
   лайтбокс, карточки, мобильная панель
   ============================================================ */

/* ---------- хедер ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 120;
  transition: background .35s ease, box-shadow .35s ease, transform .35s ease;
}
.header-inner { display: flex; align-items: center; gap: 16px; height: var(--header-h); }
.site-header.scrolled {
  background: rgba(7, 24, 40, .86);
  backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 10px 34px rgba(5, 16, 30, .35);
}

.logo { display: inline-flex; align-items: center; gap: 12px; color: var(--white); }
.logo:hover { color: var(--white); }
.logo-mark { width: 46px; height: 28px; color: var(--gold-400); flex: none; }
.logo-text { display: flex; flex-direction: column; line-height: 1.15; font-family: var(--ff-logo); font-weight: 700; font-size: 1.06rem; letter-spacing: .02em; }
.logo-text small { font-family: var(--ff-text); font-size: .6rem; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; color: rgba(255,255,255,.62); margin-top: 4px; }

/* главное меню */
.main-nav { margin-left: auto; min-width: 0; }
.nav-list { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; }
.nav-item { position: relative; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 8px; border-radius: 10px; white-space: nowrap;
  color: rgba(255,255,255,.86); font-weight: 600; font-size: .9rem;
}
.nav-link:hover { color: var(--white); background: rgba(255,255,255,.1); }
.nav-item.current .nav-link { color: var(--gold-400); }
.nav-link-book { color: var(--gold-400); font-weight: 800; }
.nav-link-book:hover { color: var(--gold-400); background: rgba(201,164,92,.12); }
.caret { transition: transform .25s; }
.nav-item:hover .caret { transform: rotate(180deg); }

/* выпадающее меню апартаментов */
.dropdown {
  position: absolute; top: calc(100% + 14px); left: 50%; transform: translate(-50%, 8px);
  width: 560px; padding: 14px; border-radius: var(--radius-lg);
  background: var(--white); box-shadow: var(--shadow-pop);
  border: 1px solid rgba(201,164,92,.25);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
.nav-item:hover .dropdown, .nav-item:focus-within .dropdown {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0);
}
.dropdown::before {
  content: ""; position: absolute; top: -7px; left: 50%; transform: translateX(-50%) rotate(45deg);
  width: 14px; height: 14px; background: var(--white); border-radius: 3px;
}
.dropdown-head {
  display: block; padding: 10px 14px; margin-bottom: 8px;
  border-radius: var(--radius-sm); font-weight: 800; color: var(--navy-800); background: var(--sand-100);
}
.dropdown-head:hover { background: var(--gold-100); color: var(--navy-800); }
.dropdown-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.dropdown-link {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--ink-900);
}
.dropdown-link:hover { background: var(--sand-100); }
.dropdown-link img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; flex: none; }
.dropdown-link b { display: block; font-size: .93rem; }
.dropdown-link small { display: block; font-size: .78rem; color: var(--ink-500); }

/* телефон + кнопка в хедере */
.header-cta { display: flex; align-items: center; gap: 10px; flex: none; }
.header-phone {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--white); font-weight: 800; font-size: .92rem; letter-spacing: .01em; white-space: nowrap;
}
.header-phone svg { color: var(--gold-400); }
.header-phone:hover { color: var(--gold-400); }

/* бургер */
.burger { display: none; width: 46px; height: 46px; border: 0; background: none; position: relative; z-index: 130; }
.burger span { position: absolute; left: 10px; right: 10px; height: 2px; background: var(--white); border-radius: 2px; transition: transform .3s ease, top .3s ease, opacity .3s; }
.burger span:nth-child(1) { top: 15px; }
.burger span:nth-child(2) { top: 22px; }
.burger span:nth-child(3) { top: 29px; }
.burger.open span:nth-child(1) { top: 22px; transform: rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { top: 22px; transform: rotate(-45deg); }

/* мобильное меню */
.mobile-menu {
  position: fixed; inset: 0; z-index: 125;
  background: linear-gradient(165deg, var(--navy-900), var(--navy-950));
  padding: 14px 24px 32px;
  overflow-y: auto; overflow-x: hidden;
  transform: translateY(-102%); transition: transform .4s cubic-bezier(.7, 0, .2, 1);
  visibility: hidden;
}
.mobile-menu.open { transform: translateY(0); visibility: visible; }
.mm-top-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.mm-top-bar .mm-install-btn {
  flex: 1; min-width: 0; margin-bottom: 0;
}
.mm-top-bar .mm-install-text {
  overflow: hidden; text-overflow: ellipsis;
}
.mm-close {
  flex: none;
  width: 42px; height: 42px; border: none; border-radius: 12px;
  background: rgba(255,255,255,.08); color: rgba(255,255,255,.7);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.mm-close:hover { background: rgba(255,255,255,.15); color: var(--white); }
.mm-link {
  display: block; padding: 13px 4px; border-bottom: 1px solid rgba(255,255,255,.09);
  color: rgba(255,255,255,.92); font-size: 1.12rem; font-weight: 700;
}
.mm-link:hover { color: var(--gold-400); }
.mm-link.current { color: var(--gold-400); }
.mm-sub { padding: 4px 0 10px 14px; border-bottom: 1px solid rgba(255,255,255,.09); }
.mm-sub a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 2px; color: rgba(255,255,255,.6); font-weight: 600; }
.mm-sub a small { color: rgba(255,255,255,.38); font-size: .8rem; white-space: nowrap; }
.mm-link-book { color: var(--gold-400); font-size: 1.25rem; }
.mm-phone { display: block; margin-top: 22px; text-align: center; font-size: 1.3rem; font-weight: 800; color: var(--white); }
.mm-phone:hover { color: var(--gold-400); }

/* кнопка установки PWA в мобильном меню */
.mm-install-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 12px 14px;
  border: 1px solid rgba(201,164,92,.35); border-radius: 14px; cursor: pointer;
  background: rgba(201,164,92,.08);
  backdrop-filter: blur(8px);
  color: var(--gold-400); font-size: .88rem; font-weight: 700; font-family: inherit;
  letter-spacing: .01em; text-align: left;
  transition: background .2s ease, border-color .2s ease;
}
.mm-install-btn:hover { background: rgba(201,164,92,.15); border-color: rgba(201,164,92,.55); }
.mm-install-btn:active { background: rgba(201,164,92,.2); }
.mm-install-btn svg { flex: none; }
.mm-install-btn .mm-install-icon {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, rgba(201,164,92,.25), rgba(201,164,92,.1));
  border: 1px solid rgba(201,164,92,.2);
}
.mm-install-btn .mm-install-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mm-install-btn .mm-install-text small {
  font-size: .68rem; font-weight: 500; color: rgba(255,255,255,.45); letter-spacing: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 400px) {
  .mm-install-btn .mm-install-text small { display: none; }
}

/* ---------- формы ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: 7px; color: var(--ink-700); }
.field label .req { color: var(--busy-600); }
.input, .select, .textarea {
  width: 100%; padding: 13px 16px;
  border: 1.5px solid var(--sand-300); border-radius: 12px;
  background: var(--white); color: var(--ink-900);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--gold-500);
  box-shadow: 0 0 0 4px rgba(201,164,92,.18);
}
.input[readonly] { cursor: pointer; background: var(--white); }
.textarea { min-height: 96px; resize: vertical; }
.field-hint { font-size: .8rem; color: var(--ink-300); margin-top: 5px; }
.field.err .input, .field.err .select { border-color: var(--busy-600); }
.hp-field { position: absolute !important; left: -9999px !important; top: -9999px !important; opacity: 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .span2 { grid-column: span 2; }

/* переключатель апартаментов в форме */
.apt-radio { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(165px, 100%), 1fr)); gap: 8px; }
.apt-radio input { position: absolute; opacity: 0; }
.apt-radio label {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  padding: 10px 14px; border: 1.5px solid var(--sand-300); border-radius: 12px;
  cursor: pointer; font-weight: 700; color: var(--ink-700); font-size: .9rem;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.apt-radio label small { font-weight: 600; color: var(--ink-300); font-size: .78rem; }
.apt-radio label:hover { border-color: var(--gold-400); }
.apt-radio input:checked + label {
  border-color: var(--gold-500); background: var(--gold-100);
  box-shadow: 0 0 0 3px rgba(201,164,92,.22); color: var(--navy-800);
}

/* карточки с фото (страница бронирования) */
.apt-radio-cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.apt-radio-cards label {
  padding: 0; overflow: hidden; gap: 0;
}
.apt-radio-cards label img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  border-bottom: 1px solid var(--sand-200);
}
.apt-radio-info { padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.apt-radio-num { font-weight: 800; font-size: .95rem; color: var(--navy-900); }
.apt-radio-link { font-size: .8rem; font-weight: 700; color: var(--sea-600); margin-top: 4px; }
.apt-radio-link:hover { color: var(--sea-500); }
.apt-radio input:checked + label img { border-bottom-color: var(--gold-500); }

/* чекбокс согласия */
.check-row { display: flex; align-items: flex-start; gap: 10px; font-size: .88rem; color: var(--ink-500); margin: 6px 0 18px; }
.check-row input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--gold-600); flex: none; }

/* ---------- календарь занятости ---------- */
.cal-popup {
  position: absolute; z-index: 60; margin-top: 8px;
  background: var(--white); border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop); border: 1px solid var(--sand-200);
  padding: 16px; display: none;
}
.cal-popup.open { display: flex; gap: 20px; }
.cal-inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 26px; }
.cal-month { min-width: 262px; }
.cal-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title b { font-family: var(--ff-text); font-weight: 800; font-size: 1.05rem; color: var(--navy-900); }
.cal-nav { width: 34px; height: 34px; border-radius: 10px; border: 1.5px solid var(--sand-300); background: var(--white); display: inline-flex; align-items: center; justify-content: center; color: var(--ink-700); }
.cal-nav:hover:not(:disabled) { border-color: var(--gold-500); color: var(--gold-600); }
.cal-nav:disabled { opacity: .35; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-size: .72rem; font-weight: 800; color: var(--ink-300); text-transform: uppercase; padding: 6px 0; }
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: .88rem; font-weight: 600; color: var(--ink-900);
  border-radius: 9px; background: var(--sand-100); cursor: pointer;
  transition: background .15s, color .15s, transform .15s;
}
.cal-day:hover { background: var(--gold-100); }
.cal-day.empty { background: transparent; cursor: default; }
.cal-day.past { color: var(--ink-300); background: transparent; cursor: default; }
.cal-day.busy { background: var(--busy-100); color: var(--busy-600); text-decoration: line-through; font-weight: 800; cursor: not-allowed; }
.cal-day.checkin-only { background: #EAF3FB; color: var(--sea-600); }
.cal-day.in-range { background: var(--gold-100); color: var(--gold-600); font-weight: 800; }
.cal-day.selected { background: linear-gradient(135deg, var(--gold-400), var(--gold-600)); color: var(--white) !important; font-weight: 800; box-shadow: 0 4px 12px rgba(176,141,69,.4); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--sea-500); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; font-size: .8rem; color: var(--ink-500); }
.cal-legend span { display: inline-flex; align-items: center; gap: 7px; }
.cal-legend i { width: 14px; height: 14px; border-radius: 5px; display: inline-block; }
.cal-legend .l-free { background: var(--sand-100); }
.cal-legend .l-busy { background: var(--busy-100); }
.cal-legend .l-sel { background: linear-gradient(135deg, var(--gold-400), var(--gold-600)); }

/* ---------- лайтбокс ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200; display: none;
  background: rgba(5, 16, 30, .95);
  backdrop-filter: blur(8px);
}
.lightbox.open { display: flex; align-items: center; justify-content: center; }
.lb-stage { position: relative; max-width: min(1200px, 92vw); max-height: 88vh; width: 100%; }
.lb-stage img { max-height: 88vh; width: 100%; object-fit: contain; border-radius: 10px; margin: 0 auto; }
.lb-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 54px; height: 54px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.12); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.lb-btn:hover { background: rgba(201,164,92,.85); }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lb-close { position: absolute; top: 20px; right: 24px; width: 48px; height: 48px; transform: none; }
.lb-count { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.8); font-size: .9rem; letter-spacing: .1em; }

/* ---------- мобильная нижняя панель ---------- */
.mobile-bar { display: none; }

/* ---------- таблицы (правила, оплата) ---------- */
.info-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-card); }
.info-table th, .info-table td { padding: 15px 20px; text-align: left; border-bottom: 1px solid var(--sand-200); font-size: .96rem; }
.info-table th { background: var(--navy-800); color: var(--white); font-weight: 700; }
.info-table tr:last-child td { border-bottom: 0; }
.info-table tr:nth-child(even) td { background: var(--sand-100); }

/* ---------- cookie-баннер ---------- */
.cookie-banner {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(140%);
  z-index: 200; width: calc(100% - 48px); max-width: 720px;
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(7, 24, 40, .25);
  border: 1px solid var(--sand-200);
  padding: 24px 28px; display: flex; align-items: center; gap: 20px;
  transition: transform .4s cubic-bezier(.7, 0, .2, 1);
}
.cookie-banner.show { transform: translateX(-50%) translateY(0); }
.cookie-banner-text { flex: 1; font-size: .9rem; line-height: 1.5; color: var(--ink-700); }
.cookie-banner-text b { color: var(--navy-900); }
.cookie-banner-text a { color: var(--sea-600); font-weight: 600; }
.cookie-banner-actions { display: flex; gap: 10px; flex: none; }
.cookie-banner-close {
  position: absolute; top: 10px; right: 12px; width: 28px; height: 28px;
  border: 0; background: none; color: var(--ink-300); font-size: 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.cookie-banner-close:hover { background: var(--sand-100); color: var(--ink-700); }

@media (max-width: 720px) {
  .cookie-banner { flex-direction: column; align-items: stretch; gap: 14px; padding: 20px; bottom: 78px; width: calc(100% - 24px); }
  .cookie-banner-actions { flex-direction: column; }
  .cookie-banner-actions .btn { width: 100%; text-align: center; }
}

/* ---------- алерты ---------- */
.alert { padding: 16px 20px; border-radius: var(--radius-sm); font-weight: 600; margin-bottom: 22px; border: 1.5px solid transparent; }
.alert-error { background: var(--busy-100); color: var(--busy-600); border-color: #EDC4BF; }
.alert-ok { background: var(--ok-100); color: var(--ok-600); border-color: #BEE3D0; }

@media (max-width: 1060px) {
  .main-nav { display: none; }
  .header-cta .btn { display: none; }
  .burger { display: block; margin-left: auto; }
  .header-inner { gap: 14px; }
  .main-nav { margin-left: 0; }
}
@media (max-width: 720px) {
  :root { --header-h: 68px; }
  .header-cta { display: none; }
  .logo-text { font-size: .96rem; }
  .logo-mark { width: 38px; height: 24px; }
  .cal-popup.open { flex-direction: column; }
  .cal-popup { padding: 12px; }
  .cal-month { min-width: 0; }
  .cal-inline { grid-template-columns: 1fr; gap: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
  .mobile-bar {
    display: flex; position: fixed;
    left: 10px; right: 10px; bottom: 0; z-index: 110;
    background: rgba(7, 24, 40, .92); backdrop-filter: blur(12px);
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    gap: 8px; border-radius: 30px;
  }
  .mobile-bar-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 11px; border-radius: 999px; font-weight: 800; font-size: .88rem;
    white-space: nowrap; overflow: hidden;
    background: rgba(255,255,255,.1); color: var(--white);
  }
  .mobile-bar-btn svg { width: 17px; height: 17px; flex: none; }
  .mobile-bar-book { background: linear-gradient(135deg, var(--gold-400), var(--gold-600)); color: var(--navy-950); }
  body { padding-bottom: 0; }
  .footer-bottom { padding-bottom: 90px; }
  .footer-bottom-inner { flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; }
}
