/* Estate Dubai — сайт. Цвета и формы повторяют приложение (Resources/Styles/Colors.xaml). */

@font-face {
  font-family: "Open Sans";
  src: url("fonts/OpenSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Open Sans";
  src: url("fonts/OpenSans-Semibold.ttf") format("truetype");
  font-weight: 600 700;
  font-display: swap;
}

:root {
  --primary: #1E6BFF;
  --primary-hover: #155CE6;
  --primary-tint: #EEF4FF;
  --primary-tint-strong: #D9E6FF;
  --navy: #0E1B3D;
  --text: #0E1B3D;
  --text-2: #6B7488;
  --muted: #9AA3B5;
  --chip: #F2F4F8;
  --line: #E6EAF2;
  --line-strong: #D5DBE7;
  --surface: #FFFFFF;
  --page: #FFFFFF;
  --page-soft: #F5F7FB;
  --bubble: #EEF1F6;
  --success: #22B573;
  --success-tint: #EAF8F0;
  --success-tint-strong: #CDEFDB;
  --accent: #7B5CFA;
  --accent-tint: #F1EEFF;
  --accent-tint-strong: #E0D9FF;
  --orange: #FF8A1F;
  --orange-tint: #FFF1E2;
  --danger: #FF3B30;
  --danger-tint: #FFECEC;
  --price: #F7E7C6;
  --shadow: 0 4px 14px rgba(14, 27, 61, .08);
  --shadow-lg: 0 12px 40px rgba(14, 27, 61, .14);
  --radius: 18px;
  --header-h: 68px;
  --tabbar-h: 64px;
  --gutter: 20px;
  --max: 1200px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Open Sans", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}

body.soft { background: var(--page-soft); }

img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
p { margin: 0; }

.icon { width: 20px; height: 20px; fill: currentColor; flex: none; }
.icon-sm { width: 14px; height: 14px; }
.icon-xs { width: 12px; height: 12px; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Шапка ---------- */

.header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, background .2s;
}
.header.scrolled { border-bottom-color: var(--line); }
.header.over-hero:not(.scrolled) { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.header.over-hero:not(.scrolled) .brand,
.header.over-hero:not(.scrolled) .nav a { color: #fff; }
.header.over-hero:not(.scrolled) .nav a.active { background: rgba(255, 255, 255, .2); color: #fff; }
.header.over-hero:not(.scrolled) .switch { background: rgba(255, 255, 255, .18); }
.header.over-hero:not(.scrolled) .switch button { color: #fff; }
.header.over-hero:not(.scrolled) .switch button.on { background: #fff; color: var(--text); }

.header .container { height: 100%; display: flex; align-items: center; gap: 24px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); white-space: nowrap; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }

.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  padding: 8px 14px; border-radius: 12px; color: var(--text); font-weight: 600; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--chip); }
.nav a.active { background: var(--primary-tint); color: var(--primary); }

.header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.switch { display: flex; background: var(--chip); border-radius: 12px; padding: 3px; }
.switch button {
  padding: 5px 10px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text-2);
  transition: background .15s, color .15s;
}
.switch button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(14, 27, 61, .1); }
.header-contact { margin-left: 4px; gap: 6px; white-space: nowrap; }
.header-contact .icon { width: 18px; height: 18px; fill: currentColor; }

/* ---------- Нижняя панель (телефон) ---------- */

.tabbar { display: none; }

@media (max-width: 860px) {
  :root { --header-h: 58px; --gutter: 16px; }
  .nav { display: none; }
  .brand { font-size: 16px; }
  .brand img { width: 32px; height: 32px; }
  .switch button { padding: 4px 8px; font-size: 12px; }
  .header .container { gap: 12px; }
  .header-tools { gap: 6px; }
  .header-contact { width: 34px; height: 34px; padding: 0; margin-left: 0; flex-shrink: 0; }
  .header-contact span { display: none; }
  body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--muted); font-size: 11px; font-weight: 600;
  }
  .tabbar a .icon { width: 24px; height: 24px; }
  .tabbar a.active { color: var(--primary); }
}

/* На узком телефоне название не помещается рядом с переключателями и кнопкой «Связаться»: остаётся логотип. */
@media (max-width: 420px) {
  .header .brand span { display: none; }
}

/* ---------- Кнопки, чипы, поля ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 24px; border-radius: 14px;
  font-weight: 600; font-size: 16px; white-space: nowrap;
  background: var(--primary); color: #fff;
  transition: background .15s, transform .1s, box-shadow .15s, opacity .15s;
}
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn.secondary:hover { background: var(--chip); }
.btn.light { background: #fff; color: var(--text); }
.btn.light:hover { background: var(--primary-tint); }
.btn.glass { background: rgba(255, 255, 255, .18); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35); backdrop-filter: blur(6px); }
.btn.glass:hover { background: rgba(255, 255, 255, .28); }
.btn.block { width: 100%; }
.btn.sm { height: 40px; padding: 0 16px; font-size: 14px; border-radius: 12px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 12px; border-radius: 14px; background: var(--chip);
  font-weight: 600; font-size: 13px; color: var(--text); white-space: nowrap;
  transition: background .15s, color .15s;
}
.chip:hover { background: #E8EBF2; }
.chip.active { background: var(--primary-tint); color: var(--primary); }
.chip.solid { padding: 8px 20px; border-radius: 18px; }
.chip.solid.active { background: var(--primary); color: #fff; }
.chip .icon { width: 12px; height: 12px; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 600; font-size: 13px; }
.input {
  width: 100%; height: 50px; padding: 0 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: 96px; padding: 12px 14px; resize: vertical; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.input.error { border-color: var(--danger); }
.phone-row { display: grid; grid-template-columns: 112px 1fr; gap: 8px; }
/* Закрытый список показывает только код, раскрытый — страны с кодами: прозрачный select лежит поверх подписи. */
.phone-row .dial { position: relative; display: flex; align-items: center; padding: 0 28px 0 12px; font-weight: 600; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%230E1B3D' d='M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; }
.phone-row .dial:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.phone-row .dial select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font: inherit; }

.consent { font-size: 12px; color: var(--text-2); text-align: center; }
.consent a { text-decoration: underline; color: var(--text-2); }

.section-title { font-size: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-link { font-size: 14px; font-weight: 600; }

/* ---------- Карточки объектов ---------- */

.pc { position: relative; display: flex; flex-direction: column; overflow: hidden; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.pc:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.pc-img { position: relative; aspect-ratio: 16 / 10; background: var(--chip); overflow: hidden; }
.pc-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.pc:hover .pc-img img { transform: scale(1.04); }
.pc-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pc-name { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-meta { display: flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 13px; min-width: 0; }
.pc-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-specs { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--text-2); font-size: 13px; }
.pc-specs > span { display: inline-flex; align-items: center; gap: 4px; }
.pc-price { font-weight: 700; font-size: 18px; }
.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }

.badge {
  position: absolute; left: 10px; top: 10px; z-index: 1;
  padding: 4px 9px; border-radius: 9px; font-size: 12px; font-weight: 600; background: var(--price);
}
.badge.ready { background: var(--success-tint); }
.badge.new { background: var(--accent-tint); }
.price-badge { position: absolute; left: 10px; bottom: 10px; padding: 5px 12px; border-radius: 12px; background: var(--price); font-weight: 600; font-size: 13px; }

.tag { padding: 4px 8px; border-radius: 8px; font-size: 12px; background: var(--primary-tint); color: var(--primary); }
.tag.Green { background: var(--success-tint); color: var(--success); }
.tag.Purple { background: var(--accent-tint); color: var(--accent); }
.tag.Yellow { background: var(--price); color: var(--text); }

.fav {
  position: absolute; right: 10px; top: 10px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 8px rgba(14, 27, 61, .12);
  transition: transform .15s;
}
.fav:hover { transform: scale(1.08); }
.fav svg { width: 18px; height: 18px; fill: none; stroke: var(--text); stroke-width: 2; }
.fav.on svg { fill: var(--danger); stroke: var(--danger); }

.over-budget { align-self: flex-start; padding: 4px 8px; border-radius: 8px; background: var(--price); font-size: 12px; font-weight: 600; }
.pick-reason { padding: 8px 10px; border-radius: 10px; background: var(--primary-tint); font-size: 13px; }

/* ---------- Модальное окно / шторка ---------- */

.modal-root { position: fixed; inset: 0; z-index: 100; display: none; }
.modal-root.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(14, 27, 61, .5); opacity: 0; transition: opacity .25s; }
.modal-root.shown .modal-backdrop { opacity: 1; }
.modal {
  position: absolute; left: 50%; top: 50%;
  width: min(880px, calc(100vw - 48px)); max-height: calc(100vh - 48px);
  transform: translate(-50%, -46%); opacity: 0;
  background: var(--surface); border-radius: 28px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 30px 80px rgba(14, 27, 61, .3);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .25s;
}
.modal.narrow { width: min(520px, calc(100vw - 48px)); }
.modal-root.shown .modal { transform: translate(-50%, -50%); opacity: 1; }
.modal-scroll { overflow-y: auto; overscroll-behavior: contain; }
.modal-close {
  position: absolute; right: 14px; top: 14px; z-index: 5;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .92); box-shadow: 0 2px 10px rgba(14, 27, 61, .15);
}
.modal-close.dark { background: var(--chip); box-shadow: none; }

@media (max-width: 700px) {
  .modal, .modal.narrow {
    left: 0; right: 0; top: auto; bottom: 0; width: 100%;
    max-height: calc(100dvh - 24px); border-radius: 24px 24px 0 0;
    transform: translateY(100%); opacity: 1;
  }
  .modal-root.shown .modal { transform: translateY(0); }
}

body.locked { overflow: hidden; }

/* Экран объекта */
.pd-gallery { position: relative; height: 380px; background: var(--chip); }
.pd-gallery .track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.pd-gallery .track::-webkit-scrollbar { display: none; }
.pd-gallery .track img { flex: none; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: start; }
.pd-gallery .dots { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; gap: 6px; }
.pd-gallery .dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .55); transition: width .2s, background .2s; }
.pd-gallery .dots i.on { width: 20px; border-radius: 4px; background: #fff; }
.pd-gallery .nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .9); box-shadow: 0 2px 10px rgba(14, 27, 61, .15);
}
.pd-gallery .nav-btn.prev { left: 14px; }
.pd-gallery .nav-btn.next { right: 14px; }
.pd-body { padding: 24px 28px 28px; display: flex; flex-direction: column; gap: 22px; }
.pd-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.pd-head h2 { font-size: 28px; }
.pd-price { text-align: right; }
.pd-price small { display: block; color: var(--text-2); font-size: 13px; }
.pd-price b { font-size: 26px; }
.specs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.spec { padding: 12px 14px; border-radius: 16px; background: var(--chip); }
.spec b { display: block; font-size: 16px; }
.spec small { color: var(--text-2); font-size: 12px; }
.pd-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pd-section h3 { font-size: 19px; margin-bottom: 10px; }
.pd-text { color: var(--text); white-space: pre-line; }
.pd-more { margin-top: 6px; font-weight: 600; }
.amenities { display: flex; flex-wrap: wrap; gap: 8px; }
.amenity { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 14px; background: var(--primary-tint); font-size: 14px; }
.amenity .icon { width: 18px; height: 18px; fill: var(--primary); }
.layouts { display: flex; flex-direction: column; gap: 8px; }
.layout { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); }
.layout b { font-size: 15px; }
.layout small { color: var(--text-2); }
.unit-status { font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 8px; background: var(--success-tint); color: var(--success); }
.unit-status.Reserved { background: var(--price); color: var(--text); }
.unit-status.SoldOut { background: var(--chip); color: var(--text-2); }
.pd-map { height: 240px; border-radius: 18px; overflow: hidden; background: var(--chip); }
.pd-video { display: inline-flex; }

@media (max-width: 700px) {
  .pd-gallery { height: 260px; }
  .pd-body { padding: 18px 16px 24px; gap: 18px; }
  .pd-head h2 { font-size: 23px; }
  .pd-price { text-align: left; }
  .specs { grid-template-columns: repeat(2, 1fr); }
  .pd-actions { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr auto; }
  .layout .unit-status { grid-column: 1 / -1; justify-self: start; }
}

/* Форма заявки */
.lead { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.lead h2 { font-size: 24px; padding-right: 40px; }
.lead p.lead-text { color: var(--text-2); }
.sent { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 12px 0; }
.sent-icon { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: var(--success-tint); }
.sent-icon .icon { width: 36px; height: 36px; fill: var(--success); }

@media (max-width: 700px) { .lead { padding: 22px 16px 24px; } }

/* ---------- Уведомление ---------- */

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 200;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 14px;
  background: var(--navy); color: #fff; font-size: 14px; box-shadow: var(--shadow-lg);
  transition: transform .25s, opacity .25s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
@media (max-width: 860px) { .toast { bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); } }

/* ---------- Подвал ---------- */

.footer { background: var(--navy); color: rgba(255, 255, 255, .72); font-size: 13px; padding: 40px 0 32px; }
.footer .container { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; }
.footer h4 { color: #fff; font-size: 15px; margin-bottom: 10px; }
.footer a { color: rgba(255, 255, 255, .85); }
.footer a:hover { color: #fff; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer .brand { color: #fff; margin-bottom: 12px; }
.footer .copy { grid-column: 1 / -1; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .12); }
@media (max-width: 860px) { .footer .container { grid-template-columns: 1fr; gap: 22px; } }

/* ---------- Загрузка ---------- */

.skeleton { background: linear-gradient(90deg, var(--chip) 25%, #E9ECF3 37%, var(--chip) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--primary-tint-strong); border-top-color: var(--primary); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { padding: 48px 20px; text-align: center; color: var(--text-2); }

.fade-in { animation: fadeIn .35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
