:root {
  --primary: #3D5266;
  --accent: #3498DB;
  --bg: #f5f7fa;
  --text: #333;
  --text-secondary: #666;
  --white: #fff;
  --radius: 12px;
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.screen { min-height: 100vh; display: flex; flex-direction: column; }

/* WELCOME SCREEN */
.welcome { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; background: var(--primary); }
.welcome-brand { position: absolute; top: 24px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; gap: 12px; z-index: 10; width: max-content; }
.brand-logo { width: 50px; height: 50px; object-fit: contain; border-radius: 8px; background: var(--white); padding: 4px; }
.brand-company { font-size: 18px; font-weight: 700; color: var(--white); text-transform: uppercase; letter-spacing: 0.5px; }
.welcome-img { width: 100%; max-width: 480px; height: auto; max-height: 55vh; border-radius: 16px; box-shadow: 0 8px 24px rgba(0,0,0,0.35); margin-top: 60px; margin-bottom: 24px; object-fit: cover; display: block; }
.welcome-bottom { text-align: center; width: 100%; max-width: 480px; }
.welcome-main-title { font-size: 24px; font-weight: 800; color: var(--white); margin: 0 0 10px 0; }
.welcome-sub { color: rgba(255,255,255,0.85); margin-bottom: 20px; font-size: 16px; }

/* BUTTON */
.btn-primary {
  background: var(--accent);
  color: #ffffff !important;
  border: none;
  padding: 16px 28px;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  cursor: pointer;
  width: 100%;
  max-width: 480px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}
.btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
}

/* HEADER & BURGER */
.header {   background: var(--primary);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 2000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  gap: 8px;
  flex-wrap: nowrap;
}

.menu-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-size: 22px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  padding: 0;
  line-height: 1;
  z-index: 2002;
}
.menu-btn:active {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0.95);
}

/* ✅ КНОПКА НАЗАД - ВСТРОЕНА В ШАПКУ */
.header-back-btn {
  background: rgba(255, 255, 255, 0.2);
  color: var(--white);
  border: none;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;   transition: all 0.2s;
  flex-shrink: 0;
  white-space: nowrap;
}
.header-back-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}
.header-back-btn:active {
  transform: scale(0.95);
}
.header-back-btn .back-arrow {
  font-size: 16px;
  font-weight: bold;
  line-height: 1;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  justify-content: center;
}
.header-brand .brand-logo {
  width: 32px;
  height: 32px;
  padding: 3px;
  flex-shrink: 0;
}
.header-brand .brand-title {
  font-size: clamp(12px, 4vw, 16px);
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  color: var(--white);
}

/* FILTERS */
.filters-toggle { padding: 12px 16px; background: var(--white); border-bottom: 1px solid #eee; }
.filters-toggle-btn { background: none; border: 1px solid var(--primary); color: var(--primary); padding: 8px 14px; border-radius: 8px; cursor: pointer; width: 100%; font-size: 14px; }
.filters-block { background: var(--white); padding: 14px 16px; border-bottom: 1px solid #eee; max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.filters-block:not(.hidden) { max-height: 500px; }
.filter-group { margin-bottom: 14px; }
.filter-group label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; }
.price-buttons { display: flex; gap: 8px; flex-wrap: wrap; }.price-btn { flex: 1; min-width: 60px; padding: 8px; border: 1px solid #ddd; background: var(--white); border-radius: 6px; cursor: pointer; font-size: 12px; }
.price-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.checkbox-group { display: flex; flex-direction: column; gap: 8px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.checkbox-label input { width: 18px; height: 18px; accent-color: var(--primary); }

/* VIEW TOGGLE */
.view-toggle { display: flex; padding: 12px 16px; gap: 10px; background: var(--bg); }
.view-btn { flex: 1; padding: 10px; border: 1px solid #ddd; background: var(--white); border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; }
.view-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* LISTINGS */
.listings { padding: 14px 16px; flex: 1; overflow-y: auto; }
.listing-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; cursor: pointer; transition: transform 0.2s; opacity: 0; transform: translateY(20px); animation: fadeInUp 0.4s ease forwards; }
.listing-card:active { transform: scale(0.99); }
.listing-image { width: 100%; height: 170px; object-fit: cover; }
.listing-info { padding: 14px; }
.listing-info h3 { font-size: 17px; margin-bottom: 8px; color: var(--primary); }
.listing-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; }
.listing-meta span { background: #f0f2f5; padding: 4px 8px; border-radius: 4px; }
.listing-price { font-size: 19px; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.price-per-sqm { font-size: 12px; color: var(--text-secondary); font-weight: 400; margin-left: 8px; }
.listing-status { font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 4px; display: inline-block; margin-bottom: 12px; }
.status-Сдан { background: #d4edda; color: #155724; }
.status-Строится { background: #fff3cd; color: #856404; }
.consult-btn-inline { width: 100%; padding: 10px; background: var(--primary); color: var(--white); border: none; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 14px; }
.map-container { height: calc(100vh - 130px); }

/* MODALS */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; transition: opacity 0.3s ease; }
.modal:not(.hidden) { opacity: 1; }
.modal-content { background: var(--white); width: 92%; max-width: 520px; max-height: 90vh; overflow-y: auto; border-radius: var(--radius); padding: 70px 22px 22px 22px; position: relative; transform: scale(0.9) translateY(20px); transition: transform 0.3s ease; }
.modal:not(.hidden) .modal-content { transform: scale(1) translateY(0); }
.modal-close { position: absolute; top: 15px; right: 15px; background: none; border: none; font-size: 32px; color: #999; cursor: pointer; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: all 0.2s; z-index: 10; }
.modal-close:active { background: #f0f0f0; color: #333; }
.modal-gallery { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; padding-bottom: 8px; }
.modal-price { font-size: 22px; font-weight: 700; color: var(--accent); margin-bottom: 12px; }
.modal-meta { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; font-size: 14px; color: var(--text-secondary); }
.modal-desc { font-size: 14px; line-height: 1.5; margin-bottom: 14px; }
.modal-features ul { padding-left: 20px; margin-bottom: 14px; }
.modal-features li { margin-bottom: 4px; font-size: 14px; }
.floor-plans-text { font-size: 14px; margin-bottom: 14px; white-space: pre-wrap; }
.form-modal h3 { margin-bottom: 12px; }
.form-object { font-weight: 600; margin-bottom: 8px; color: var(--primary); }
.form-hint { font-size: 12px; color: var(--text-secondary); margin-bottom: 14px; }
.form-modal input { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; margin-bottom: 12px; font-size: 16px; }
.empty-state { text-align: center; padding: 35px 16px; color: var(--text-secondary); }
.tg-btn { background: var(--primary); color: var(--white); border: none; padding: 12px; border-radius: 8px; font-weight: 600; cursor: pointer; width: 100%; font-size: 14px; }

/* LOADING */.loading { background: var(--primary); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; }
.loading-spinner { width: 50px; height: 50px; border: 4px solid rgba(255, 255, 255, 0.3); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--white); font-size: 18px; font-weight: 600; }
#loadingScreen { position: fixed !important; top: 0 !important; left: 0 !important; width: 100vw !important; height: 100vh !important; background: var(--primary) !important; z-index: 9999 !important; display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 20px; }
#loadingScreen.hidden { display: none !important; }

/* MENU & PAGES */
.menu-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 3000; transition: opacity 0.3s ease; }
.menu-overlay.hidden { display: none; opacity: 0; }
.menu-overlay:not(.hidden) { opacity: 1; }
.side-menu { position: fixed; top: 0; left: 0; width: 280px; height: 100%; background: var(--white); z-index: 3001; padding: 20px; display: flex; flex-direction: column; transform: translateX(-100%); transition: transform 0.3s ease; box-shadow: 2px 0 15px rgba(0,0,0,0.2); }
.side-menu.hidden { transform: translateX(-100%); }
.side-menu:not(.hidden) { transform: translateX(0); }
.menu-close { align-self: flex-end; background: none; border: none; font-size: 32px; color: #999; cursor: pointer; margin-bottom: 20px; }
.menu-nav { display: flex; flex-direction: column; gap: 10px; }
.menu-nav button { background: #f8f9fa; border: none; padding: 15px; border-radius: 10px; font-size: 16px; text-align: left; cursor: pointer; color: var(--text); font-weight: 500; transition: background 0.2s; }
.menu-nav button:active { background: #e2e6ea; }
.page { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; background: var(--bg); z-index: 1500; display: none; flex-direction: column; animation: fadeIn 0.2s ease; }
.page.hidden { display: none !important; }
.page:not(.hidden) { display: flex; }
.page-header { background: var(--primary); padding: 14px 16px; color: var(--white); display: flex; align-items: center; gap: 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.page-header h2 { margin: 0; font-size: 18px; font-weight: 600; }
.page-back-btn { background: rgba(255,255,255,0.2); border: none; color: var(--white); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.page-content { padding: 20px; overflow-y: auto; line-height: 1.6; color: var(--text); }
.page-content ul { padding-left: 20px; margin-bottom: 15px; }
.page-content li { margin-bottom: 8px; }

/* ✅ КОНТАКТЫ & АВАТАР */
.contact-card { background: var(--white); padding: 20px; border-radius: 16px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 15px; margin-bottom: 20px; }
.agent-avatar {
  width: 60px;
  height: 60px;
  background: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  overflow: hidden;
  flex-shrink: 0;
}
.agent-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.agent-info h3 { margin: 0 0 5px 0; color: var(--primary); }
.agent-info p { margin: 0; color: var(--text-secondary); font-size: 14px; }.agency-block { background: var(--white); padding: 15px; border-radius: 12px; margin-bottom: 25px; }
.agency-block h4 { margin: 0 0 10px 0; color: var(--primary); font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; }
.agency-block p { margin: 5px 0; font-size: 15px; }
.address-text { color: var(--text-secondary); }
.contact-actions { display: flex; flex-direction: column; gap: 12px; }
.btn-tg { background: #0088cc; color: white; border: none; padding: 16px; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; width: 100%; }
.btn-phone { background: var(--accent); color: var(--primary); border: none; padding: 16px; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; width: 100%; }

@keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ==========================================
   ✅ КАРУСЕЛИ (ГАЛЕРЕЯ И ПЛАНИРОВКИ)
   ========================================== */
.carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 8px;
  padding-bottom: 8px;
}
.carousel-track::-webkit-scrollbar { display: none; }

.slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
}

.slide img {
  width: 100%;
  height: 280px;
  object-fit: contain;
  border-radius: 12px;
  background: #f8f9fa;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.dot {
  width: 8px;  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: background 0.2s;
  cursor: pointer;
}
.dot.active { background: var(--accent); }

.plans-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin: 20px 0 10px 0;
}

/* ✅ ФОТО НА СТРАНИЦЕ "ОБО МНЕ" */
.about-agent-photo {
  display: block;
  margin: 0 auto 20px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border: 3px solid var(--white);
}
