/* ==========================================
   UyTop Real Estate Theme - Premium CSS Style
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  /* Colors - Dark Theme (Default) */
  --bg-primary: #070c14;
  --bg-secondary: rgba(19, 27, 46, 0.45);
  --bg-tertiary: rgba(30, 41, 66, 0.55);
  --bg-glass: rgba(11, 15, 25, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-emerald: #10b981;
  --accent-emerald-hover: #059669;
  --accent-emerald-light: rgba(16, 185, 129, 0.15);
  
  --accent-gold: #f59e0b;
  --accent-gold-hover: #d97706;
  --accent-gold-light: rgba(245, 158, 11, 0.15);
  
  --danger: #ef4444;
  
  /* Layout & Animations */
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 30px -3px rgba(0, 0, 0, 0.25), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 50px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  --scrollbar-size: 10px;
  --scrollbar-size-thin: 6px;
  --scrollbar-track: rgba(11, 15, 25, 0.55);
  --scrollbar-thumb: rgba(16, 185, 129, 0.42);
  --scrollbar-thumb-hover: rgba(16, 185, 129, 0.68);
  --scrollbar-thumb-border: rgba(7, 12, 20, 0.65);
}

/* Light Theme Variables */
html.light-theme,
body.light-theme {
  --bg-primary: #f1f5f9;
  --bg-secondary: rgba(255, 255, 255, 0.65);
  --bg-tertiary: rgba(241, 245, 249, 0.75);
  --bg-glass: rgba(248, 250, 252, 0.75);
  --border-color: rgba(15, 23, 42, 0.08);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --accent-emerald: #059669;
  --accent-emerald-hover: #047857;
  --accent-emerald-light: rgba(5, 150, 105, 0.1);
  
  --accent-gold: #d97706;
  --accent-gold-hover: #b45309;
  --accent-gold-light: rgba(217, 119, 6, 0.1);
  
  --shadow-md: 0 10px 30px -3px rgba(15, 23, 42, 0.05), 0 4px 6px -2px rgba(15, 23, 42, 0.02);
  --shadow-lg: 0 20px 50px -5px rgba(15, 23, 42, 0.05), 0 10px 10px -5px rgba(15, 23, 42, 0.02);

  --scrollbar-track: rgba(241, 245, 249, 0.55);
  --scrollbar-thumb: rgba(5, 150, 105, 0.34);
  --scrollbar-thumb-hover: rgba(5, 150, 105, 0.52);
  --scrollbar-thumb-border: rgba(241, 245, 249, 0.85);
}

/* Glassmorphism Global Styles */
.glass-panel, 
.card, 
.search-container, 
.stats-banner, 
.form-container, 
.detail-info, 
.contact-card, 
.api-section, 
.leaflet-popup-content-wrapper,
.map-sidebar,
.ai-chat-window {
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid var(--border-color) !important;
  background-color: var(--bg-secondary) !important;
  box-shadow: var(--shadow-md) !important;
}

/* Lucide Vector Icons Styles */
.card-icon, .btn-icon, .feature-icon, .spec-icon, .header-icon {
  width: 1.15rem;
  height: 1.15rem;
  display: inline-block;
  vertical-align: middle;
  stroke-width: 2px;
  color: inherit;
  fill: none;
}

.feature-item i, .card-location i, .detail-address i {
  color: var(--accent-emerald);
  margin-right: 0.35rem;
}

/* Collapsible filters styling */
.collapsible-filters {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), margin-top 0.4s;
}

.collapsible-filters.show {
  max-height: 500px;
  margin-top: 1.5rem;
}

.btn-toggle-filters {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-toggle-filters i {
  transition: transform 0.3s ease;
}

.btn-toggle-filters.active i {
  transform: rotate(180deg);
}

/* General Resets */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background-color 0.3s, color 0.3s;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

html {
  color-scheme: dark;
  height: 100%;
}

html.light-theme {
  color-scheme: light;
}

/* Custom scrollbars — theme-aware */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

html.light-theme * {
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--scrollbar-thumb), var(--scrollbar-thumb-hover));
  border-radius: 999px;
  border: 2px solid var(--scrollbar-thumb-border);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

*::-webkit-scrollbar-corner {
  background: var(--scrollbar-track);
}

html.light-theme *::-webkit-scrollbar-track,
html.light-theme *::-webkit-scrollbar-corner {
  background: var(--scrollbar-track);
}

html.light-theme *::-webkit-scrollbar-thumb {
  border-color: var(--scrollbar-thumb-border);
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Header & Navigation */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  flex-shrink: 0;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.25rem;
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-emerald);
  letter-spacing: -0.5px;
  flex-shrink: 0;
  line-height: 1;
}

header nav {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}

nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: clamp(0.65rem, 1.5vw, 1.35rem);
  margin: 0;
  padding: 0;
}

nav a {
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.35rem 0;
  position: relative;
  white-space: nowrap;
  line-height: 1.2;
}

.logo span {
  color: var(--text-primary);
}

nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-emerald);
  transition: var(--transition);
}

nav a:hover, nav a.active {
  color: var(--accent-emerald);
}

nav a:hover::after, nav a.active::after {
  width: 100%;
}

.nav-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0.5rem;
}

.nav-auth-guest,
.nav-auth-user {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-actions .btn-ghost,
.nav-actions .btn-outline {
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
}

.nav-submit-btn {
  white-space: nowrap;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
}

.lang-select {
  min-width: 5.5rem;
  max-width: 6.5rem;
  padding: 0.45rem 0.5rem;
  font-size: 0.85rem;
}

.theme-toggle {
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.btn-primary {
  background-color: var(--accent-emerald);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--accent-emerald-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-secondary);
  border-color: var(--accent-emerald);
}

.btn-outline {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--text-primary);
}

.theme-toggle, .lang-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.theme-toggle:hover, .lang-toggle:hover {
  background-color: var(--bg-tertiary);
}

.lang-toggle {
  font-size: 0.9rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
}

/* Hero Section */
.hero {
  position: relative;
  padding: 6rem 2rem;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 1200px;
  margin: 0 auto;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1.5rem;
  letter-spacing: -1px;
}

.hero h1 span {
  color: var(--accent-emerald);
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.2rem;
  max-width: 700px;
  margin-bottom: 3rem;
}

/* Filter Bar */
.search-container {
  width: 100%;
  max-width: 1000px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.search-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 1.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.tab-btn.active {
  background-color: var(--accent-emerald-light);
  color: var(--accent-emerald);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  text-align: left;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group select, .filter-group input {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.filter-group select:focus, .filter-group input:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 2px var(--accent-emerald-light);
}

/* Global native select — hidden when custom dropdown is active */
select.uytop-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.uytop-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.uytop-select.is-open {
  z-index: 50;
}

.uytop-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.uytop-select-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uytop-select-chevron {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-emerald);
  transition: transform 0.25s ease;
}

.uytop-select-chevron svg,
.uytop-select-chevron i {
  width: 1rem;
  height: 1rem;
  stroke-width: 2.5px;
}

.uytop-select.is-open .uytop-select-chevron {
  transform: rotate(180deg);
}

.uytop-select-trigger:hover,
.uytop-select.is-open .uytop-select-trigger {
  border-color: var(--accent-emerald);
  background-color: var(--bg-secondary);
}

.uytop-select-trigger:focus-visible {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 2px var(--accent-emerald-light);
}

.uytop-select-menu {
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.35rem;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(16, 185, 129, 0.22);
  box-shadow: var(--shadow-lg);
  animation: uytopSelectFadeIn 0.18s ease-out;
}

.uytop-select-menu--portaled {
  position: fixed;
  z-index: 4000;
}

@keyframes uytopSelectFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.uytop-select.is-open-up .uytop-select-menu--portaled {
  animation-name: uytopSelectFadeInUp;
}

@keyframes uytopSelectFadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.uytop-select-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.uytop-select-option:hover,
.uytop-select-option.is-highlighted {
  background: var(--accent-emerald-light);
  color: var(--text-primary);
}

.uytop-select-option.is-selected {
  background: var(--accent-emerald-light);
  color: var(--accent-emerald);
  font-weight: 700;
}

.uytop-select-option.is-selected::after {
  content: '✓';
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--accent-emerald);
}

.uytop-select--lang {
  width: auto;
  min-width: 7.5rem;
  max-width: 9.5rem;
}

.uytop-select--lang .uytop-select-trigger {
  height: 36px;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
}

.uytop-select--sort {
  width: auto;
  min-width: 11rem;
  max-width: 16rem;
}

.uytop-select--filter .uytop-select-trigger {
  min-height: 45px;
}

.uytop-select--form .uytop-select-trigger {
  min-height: 48px;
}

.search-container,
.map-sidebar .sidebar-header,
.filter-group {
  overflow: visible;
}

/* Fallback for selects not yet enhanced */
select:not(.uytop-select-native) {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important; /* Emerald chevron dropdown */
  background-repeat: no-repeat !important;
  background-position: right 1.15rem center !important;
  background-size: 1.1rem !important;
  padding-right: 2.75rem !important;
  cursor: pointer;
}

select:hover {
  border-color: var(--accent-emerald) !important;
  background-color: var(--bg-secondary) !important;
}

select:focus {
  border-color: var(--accent-emerald) !important;
  box-shadow: 0 0 0 2px var(--accent-emerald-light) !important;
}

/* Specific styling for range inputs inside price/area blocks to hide spinner arrows and ensure readable placeholder width */
.price-range-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.price-range-inputs input {
  width: 50% !important;
  min-width: 85px !important;
}

/* Hide input number spinner arrows */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

/* Search Row Spacing Adjustments */
.search-main-row {
  display: flex;
  gap: 1.5rem !important;
  align-items: flex-end;
  flex-wrap: wrap;
  width: 100%;
  margin-bottom: 0.5rem;
}

/* Stats Section */
.stats-banner {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 2rem;
  margin: 2rem auto;
  max-width: 1200px;
  padding: 2rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.stat-item {
  text-align: center;
}

.stat-val {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent-emerald);
}

.stat-lbl {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Content Container */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  flex: 1 0 auto;
  width: 100%;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
}

.sort-select {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  outline: none;
}

/* Listings Grid & Cards */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-8px);
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.4);
}

.card-img-container {
  height: 220px;
  overflow: hidden;
  position: relative;
}

.card-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.card:hover .card-img-container img {
  transform: scale(1.08);
}

.badge {
  position: absolute;
  top: 1rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 10;
}

.badge-rent {
  background-color: #3b82f6;
  color: #ffffff;
  left: 1rem;
}

.badge-sale {
  background-color: var(--accent-emerald);
  color: #ffffff;
  left: 1rem;
}

.badge-vip {
  background-color: var(--accent-gold);
  color: #ffffff;
  right: 1rem;
  box-shadow: 0 0 10px var(--accent-gold-light);
  animation: pulse-vip 2s infinite;
}

@keyframes pulse-vip {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-price-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.75rem;
}

.price-primary {
  font-size: 1.6rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--text-primary);
}

.price-secondary {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.4;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 3rem;
}

.card-location {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.card-features {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  margin-top: auto;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Map Search Interface (Fullscreen style) */
.map-page-layout {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

body.page-map {
  overflow: hidden;
}

.map-sidebar {
  width: 450px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 10;
  transition: transform 0.3s;
  overflow: visible;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  overflow: visible;
  position: relative;
  z-index: 20;
}

.sidebar-filters {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.sidebar-listings-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.sidebar-listings {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sidebar-listings-header {
  flex-shrink: 0;
  margin: 0;
  padding: 0.7rem 1.25rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}

.map-sidebar-card {
  display: flex;
  gap: 0.85rem;
  padding: 0.7rem;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
  flex-shrink: 0;
}

.map-sidebar-card__img-wrap {
  position: relative;
  flex-shrink: 0;
}

.map-sidebar-card__img-wrap .favorite-btn {
  top: 0.35rem;
  right: 0.35rem;
  width: 32px;
  height: 32px;
}

.map-sidebar-card__img,
.map-sidebar-card__body {
  color: inherit;
  text-decoration: none;
}

.map-sidebar-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.map-sidebar-card__img {
  position: relative;
  display: block;
  width: 104px;
  height: 78px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-primary);
}

.map-sidebar-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-sidebar-card__badges {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  padding: 0.35rem;
  pointer-events: none;
}

.map-sidebar-card__badge {
  width: fit-content;
  max-width: calc(100% - 0.2rem);
  padding: 0.18rem 0.42rem;
  border-radius: 4px;
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
  line-height: 1.2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}

.map-sidebar-card__badge.badge-sale {
  align-self: flex-start;
  background: var(--accent-emerald);
}

.map-sidebar-card__badge.badge-rent {
  align-self: flex-start;
  background: #3b82f6;
}

.map-sidebar-card__badge-vip {
  align-self: flex-end;
  background: var(--accent-gold);
}

.map-sidebar-card__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.map-sidebar-card__price {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.map-sidebar-card__price-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.map-sidebar-card__title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.map-sidebar-card__location {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.map-sidebar-card__meta {
  display: flex;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.map-sidebar-card__meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.map-sidebar-card__meta i,
.map-sidebar-card__meta svg {
  width: 0.72rem;
  height: 0.72rem;
}

.map-container-wrap {
  flex-grow: 1;
  height: 100%;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Leaflet Custom Styles */
.leaflet-popup-content-wrapper {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md) !important;
  font-family: var(--font-body) !important;
  padding: 0;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0 !important;
  width: 250px !important;
}

.leaflet-popup-tip {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--border-color);
}

.map-popup-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px 20px 0 0;
  clip-path: inset(0 round 20px 20px 0 0);
}

.map-popup-info {
  padding: 1rem;
}

.map-popup-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-popup-info .price {
  color: var(--accent-emerald);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.map-popup-info .link {
  font-size: 0.8rem;
  color: var(--accent-gold);
  font-weight: 600;
  text-decoration: underline;
  display: block;
  margin-top: 0.5rem;
}

/* Submit Form Page */
.form-container {
  max-width: 800px;
  margin: 2rem auto;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
}

.form-container h2 {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  margin-bottom: 2rem;
  text-align: center;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input, .form-group textarea, .form-group select {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 2px var(--accent-emerald-light);
}

.form-map-picker {
  height: 320px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  margin-top: 0.5rem;
}

.form-section-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0.5rem 0 0.25rem;
  text-align: center;
  color: var(--text-primary);
}

.form-map-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Photo upload zone */
.photo-upload-group > label {
  margin-bottom: 0.35rem;
}

.photo-upload-zone {
  margin-top: 0.35rem;
}

.photo-upload-zone__drop {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 2rem 1.5rem;
  border: 2px dashed rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.06), rgba(16, 185, 129, 0.02));
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-align: center;
}

.photo-upload-zone__drop:hover,
.photo-upload-zone--drag .photo-upload-zone__drop {
  border-color: var(--accent-emerald);
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.04));
  color: var(--text-primary);
  transform: translateY(-1px);
}

.photo-upload-zone__icon {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-emerald-light);
  color: var(--accent-emerald);
  margin-bottom: 0.25rem;
}

.photo-upload-zone__icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.photo-upload-zone__title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.photo-upload-zone__hint {
  font-size: 0.9rem;
}

.photo-upload-zone__meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.photo-upload-zone--filled .photo-upload-zone__drop {
  padding: 1.25rem;
}

.photo-upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.photo-upload-preview__item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.photo-upload-preview__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-upload-preview__remove {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 1.65rem;
  height: 1.65rem;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 12, 20, 0.72);
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
}

.photo-upload-preview__remove:hover {
  background: var(--danger);
}

.photo-upload-preview__remove svg {
  width: 0.9rem;
  height: 0.9rem;
}

.photo-upload-preview__add {
  aspect-ratio: 1;
  border: 2px dashed rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.04);
  color: var(--accent-emerald);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--transition);
}

.photo-upload-preview__add:hover {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.1);
}

.photo-upload-preview__add svg {
  width: 1.25rem;
  height: 1.25rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2rem;
}

/* Listing Details Page */
.detail-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2.5rem;
  margin-top: 2rem;
}

.detail-info {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
}

.detail-header {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
}

.detail-meta-tags {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.detail-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.detail-address {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.detail-features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  background-color: var(--bg-tertiary);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
}

.detail-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
}

.detail-feature .value {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.detail-feature .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.detail-description h3 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.detail-description p {
  color: var(--text-secondary);
  line-height: 1.7;
  white-space: pre-wrap;
}

/* Sidebar Contact Card */
.sidebar-sticky {
  position: sticky;
  top: 93px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.contact-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.contact-price {
  margin-bottom: 1.5rem;
}

.contact-price .primary {
  font-size: 2.2rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--accent-emerald);
}

.contact-price .secondary {
  font-size: 1rem;
  color: var(--text-secondary);
}

.agent-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

.agent-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent-emerald);
  font-size: 1.25rem;
  border: 1px solid var(--border-color);
}

.agent-name {
  font-weight: 600;
  font-size: 1.05rem;
}

.agent-role {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.contact-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.btn-tg {
  background-color: #0088cc;
  color: white;
}

.btn-tg:hover {
  background-color: #0077b3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
}

/* API Docs Styling */
.api-docs-container {
  max-width: 1000px;
  margin: 3rem auto;
  padding: 0 1rem;
  flex: 1 0 auto;
  width: 100%;
}

.api-docs-container h1 {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.api-docs-container p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.api-section {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2.5rem;
}

.api-method-badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.8rem;
  margin-right: 0.5rem;
}

.api-method-badge.post {
  background-color: var(--accent-emerald-light);
  color: var(--accent-emerald);
}

.api-method-badge.get {
  background-color: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.api-url {
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: 600;
  background-color: var(--bg-tertiary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  word-break: break-all;
  display: inline-block;
}

pre {
  background-color: #0d1117 !important; /* GitHub dark theme background */
  color: #c9d1d9 !important; /* GitHub dark theme text color */
  border: 1px solid rgba(240, 246, 252, 0.1) !important;
  border-radius: var(--radius-md) !important;
  padding: 1.5rem !important;
  overflow-x: auto !important;
  font-family: monospace !important;
  margin: 1rem 0 1.5rem !important;
  font-size: 0.9rem !important;
  line-height: 1.5 !important;
  text-align: left !important;
}

code {
  font-family: monospace !important;
}

table.params-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  text-align: left;
}

table.params-table th, table.params-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

table.params-table th {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

table.params-table td.param-name {
  font-family: monospace;
  font-weight: 600;
  color: var(--accent-gold);
}

/* Footer styling */
footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  margin-top: auto;
  flex-shrink: 0;
  text-align: center;
  color: var(--text-secondary);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  text-align: left;
}

.footer-content p {
  margin: 0;
  flex: 1;
  text-align: right;
}

@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .footer-content p {
    text-align: center;
  }
}

/* Animations & Utilities */
.text-emerald { color: var(--accent-emerald); }
.text-gold { color: var(--accent-gold); }

/* Responsive adjustments */
@media (max-width: 1024px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
  .sidebar-sticky {
    position: static;
  }
}

@media (max-width: 768px) {
  nav ul {
    gap: 1rem;
  }
  .hero h1 {
    font-size: 2.2rem;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-group.full-width {
    grid-column: span 1;
  }
  .map-page-layout {
    flex-direction: column-reverse;
  }
  .map-sidebar {
    width: 100%;
    height: 50%;
  }
  .map-container-wrap {
    height: 50%;
  }
}

/* ==========================================
   Phase 2: Advanced Specifications, Similar Listings, and AI Assistant
   ========================================== */

/* Advanced Specs Detail Table */
.specs-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.specs-table tr {
  border-bottom: 1px solid var(--border-color);
}

.specs-table tr:last-child {
  border-bottom: none;
}

.specs-table td {
  padding: 1rem 1.5rem;
  font-size: 0.95rem;
}

.specs-table td.spec-label {
  color: var(--text-secondary);
  font-weight: 500;
  width: 40%;
}

.specs-table td.spec-value {
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
}

/* Similar Listings Section */
.similar-section {
  margin-top: 4rem;
  border-top: 1px solid var(--border-color);
  padding-top: 3rem;
}

.similar-section h2 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  margin-bottom: 2rem;
}

/* AI Assistant Floating Chat Widget */
.ai-chat-widget {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
  font-family: var(--font-body);
}

/* Floating Toggle Button */
.ai-chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent-emerald);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.4);
  border: none;
  transition: var(--transition);
  position: relative;
}

.ai-chat-toggle:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 12px 40px rgba(16, 185, 129, 0.6);
}

/* Pulsing notification ring */
.ai-chat-toggle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--accent-emerald);
  animation: pulse-ring 2s infinite;
  opacity: 0;
  pointer-events: none;
}

@keyframes pulse-ring {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(1.3); opacity: 0; }
}

/* Chat Window Container */
.ai-chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 520px;
  background-color: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
  transform: scale(0.8) translateY(50px);
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom right;
}

.ai-chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Chat Header */
.ai-chat-header {
  padding: 1.25rem;
  background-color: var(--bg-tertiary) !important;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-header-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ai-avatar-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: white;
}

.ai-header-title h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
}

.ai-header-title span {
  font-size: 0.75rem;
  color: var(--accent-emerald);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.ai-header-title span::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
}

.ai-chat-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
}

.ai-chat-close:hover {
  color: var(--text-primary);
}

/* Chat Messages Content */
.ai-chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ai-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.ai-msg-user {
  align-self: flex-end;
}

.ai-msg-assistant {
  align-self: flex-start;
}

.ai-msg-assistant.has-cards {
  max-width: min(100%, 320px);
}

.ai-msg-assistant:not(.has-cards) {
  max-width: min(100%, 92%);
}

.ai-msg-bubble {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.55;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
}

.ai-msg-user .ai-msg-bubble {
  background: linear-gradient(145deg, #047857, #059669);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ai-msg-user .ai-msg-bubble p,
.ai-msg-user .ai-msg-content,
.ai-msg-user .ai-msg-content p {
  margin: 0;
  color: #ffffff !important;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.01em;
}

body.light-theme .ai-msg-user .ai-msg-bubble {
  background: linear-gradient(145deg, #047857, #059669);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.28);
}

.ai-msg-assistant .ai-msg-bubble {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.ai-msg-assistant .ai-msg-content p {
  color: var(--text-secondary);
}

body.light-theme .ai-msg-assistant .ai-msg-bubble {
  background-color: #ffffff;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
}

.ai-msg-content p {
  margin: 0 0 0.65rem;
}

.ai-msg-content p:last-child {
  margin-bottom: 0;
}

.ai-msg-content strong {
  color: var(--accent-emerald);
  font-weight: 700;
}

.ai-md-list {
  margin: 0.15rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

.ai-md-list li {
  color: var(--text-secondary);
  line-height: 1.5;
  position: relative;
  padding-left: 0.85rem;
}

.ai-md-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-emerald);
  opacity: 0.7;
}

.ai-detail-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--accent-emerald) !important;
  padding-left: 0 !important;
  margin-bottom: 0.15rem;
}

.ai-detail-title::before {
  display: none;
}

.ai-detail-row {
  padding-left: 0 !important;
}

.ai-detail-row::before {
  display: none;
}

.ai-detail-label {
  font-weight: 700;
  color: var(--accent-emerald);
}

.ai-detail-value {
  color: var(--text-secondary);
}

.ai-detail-link {
  display: inline-flex;
  align-items: center;
  margin-top: 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-gold);
  text-decoration: none;
  transition: var(--transition);
}

.ai-detail-link:hover {
  color: var(--accent-emerald);
}

.ai-card-recommendations {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.ai-card-recommendations:empty {
  display: none;
  margin-top: 0;
}

/* Suggested quick inputs */
.ai-msg-suggested {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.suggest-btn {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.suggest-btn:hover {
  border-color: var(--accent-emerald);
  color: var(--text-primary);
  background-color: var(--bg-secondary);
}

/* Typing pulse animation */
.ai-typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 8px;
  align-items: center;
  height: 20px;
}

.ai-typing-indicator span {
  width: 6px;
  height: 6px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.ai-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Embedded interactive listing card */
.ai-embedded-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.ai-embedded-card:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: var(--shadow-md);
}

.ai-embedded-link-wrap {
  display: block;
  color: inherit;
  text-decoration: none;
}

.ai-embedded-img {
  width: 100%;
  height: 118px;
  overflow: hidden;
}

.ai-embedded-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.ai-embedded-card:hover .ai-embedded-img img {
  transform: scale(1.04);
}

.ai-embedded-info {
  padding: 0.75rem 0.85rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.ai-embedded-info h5 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ai-embedded-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.ai-embedded-city {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-embedded-price {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent-emerald);
  white-space: nowrap;
}

.ai-embedded-features {
  font-size: 0.76rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.ai-embedded-features > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.ai-embedded-features i,
.ai-embedded-features svg {
  width: 0.78rem;
  height: 0.78rem;
  display: inline-block;
  vertical-align: middle;
}

.ai-embedded-cta {
  font-size: 0.74rem;
  color: var(--accent-gold);
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}

.ai-embedded-link {
  font-size: 0.75rem;
  color: var(--accent-gold);
  font-weight: 600;
  text-decoration: underline;
}

/* Chat Input Bar */
.ai-chat-input-bar {
  padding: 0.85rem 1.25rem;
  background-color: var(--bg-tertiary) !important;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ai-chat-input-bar input {
  flex-grow: 1;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 20px;
  outline: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: var(--transition);
}

.ai-chat-input-bar input:focus {
  border-color: var(--accent-emerald);
}

.ai-chat-send {
  background: none;
  border: none;
  color: var(--accent-emerald);
  font-size: 1.35rem;
  cursor: pointer;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.ai-chat-send:hover {
  color: var(--accent-gold);
  transform: scale(1.1);
}

.ai-chat-send:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

/* Mobile responsive chat resizing */
@media (max-width: 480px) {
  .ai-chat-widget {
    bottom: 20px;
    right: 20px;
  }
  .ai-chat-window {
    width: calc(100vw - 40px);
    height: 480px;
    bottom: 70px;
  }
}

/* Centering Lucide icon in chat toggle */
.ai-chat-toggle {
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.ai-chat-toggle svg, .ai-chat-toggle i {
  display: block !important;
  margin: 0 !important;
}

/* Property Details — Photo Gallery */
.detail-gallery {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(19, 27, 46, 0.72), rgba(11, 15, 25, 0.65));
  border: 1px solid rgba(16, 185, 129, 0.18);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

body.light-theme .detail-gallery {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(241, 245, 249, 0.88));
  border-color: rgba(5, 150, 105, 0.18);
}

.main-image {
  position: relative;
  width: 100%;
  height: min(52vh, 500px);
  min-height: 320px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  background:
    radial-gradient(circle at 50% 20%, rgba(16, 185, 129, 0.08), transparent 55%),
    var(--bg-tertiary);
}

.gallery-image-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(to top, rgba(7, 12, 20, 0.55) 0%, transparent 38%),
    linear-gradient(to bottom, rgba(7, 12, 20, 0.18) 0%, transparent 22%);
}

body.light-theme .gallery-image-overlay {
  background:
    linear-gradient(to top, rgba(15, 23, 42, 0.28) 0%, transparent 38%),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.08) 0%, transparent 22%);
}

.gallery-photo-counter {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 5;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
  background: rgba(7, 12, 20, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

body.light-theme .gallery-photo-counter {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(15, 23, 42, 0.08);
}

.main-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
}

.main-image:hover img {
  transform: scale(1.02);
}

.gallery-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(7, 12, 20, 0.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 6;
  transition: var(--transition);
  opacity: 0;
}

.main-image:hover .gallery-nav-btn,
.gallery-nav-btn:focus-visible {
  opacity: 1;
}

.main-image.gallery-single .gallery-nav-btn {
  display: none;
}

.gallery-nav-btn svg,
.gallery-nav-btn i {
  width: 1.35rem;
  height: 1.35rem;
  stroke-width: 2.5px;
}

.gallery-nav-btn:hover {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  transform: translateY(-50%) scale(1.06);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
}

.gallery-nav-btn.prev {
  left: 1rem;
}

.gallery-nav-btn.next {
  right: 1rem;
}

.gallery-thumbs-track {
  position: relative;
  padding: 0.15rem 0;
}

.gallery-thumbs-track::before,
.gallery-thumbs-track::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
  z-index: 2;
  pointer-events: none;
}

.gallery-thumbs-track::before {
  left: 0;
  background: linear-gradient(to right, var(--bg-secondary), transparent);
}

.gallery-thumbs-track::after {
  right: 0;
  background: linear-gradient(to left, var(--bg-secondary), transparent);
}

.gallery-thumbs {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.35rem 0.15rem;
  scroll-snap-type: x mandatory;
  background: transparent;
}

.gallery-thumbs::-webkit-scrollbar {
  height: var(--scrollbar-size-thin);
}

.thumb {
  width: 96px;
  height: 68px;
  border: none;
  border-radius: 0;
  overflow: visible;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
  background: transparent;
  opacity: 0.78;
  scroll-snap-align: center;
  padding: 0;
  box-shadow: none;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 12px;
  transition: transform 0.35s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.thumb:hover {
  transform: translateY(-3px);
  opacity: 1;
}

.thumb:hover img {
  transform: scale(1.04);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

.thumb.active {
  opacity: 1;
  transform: translateY(-2px);
}

.thumb.active img {
  box-shadow:
    0 0 0 2px var(--accent-emerald),
    0 8px 22px rgba(16, 185, 129, 0.28);
}

@media (max-width: 768px) {
  .detail-gallery {
    padding: 0.75rem;
  }

  .main-image {
    min-height: 260px;
    height: 42vh;
  }

  .gallery-nav-btn {
    opacity: 1;
    width: 42px;
    height: 42px;
  }

  .thumb {
    width: 82px;
    height: 58px;
  }
}

/* Yandex Maps balloon — map page, modal & details */
#map [class*="balloon-pane"],
.map-container-wrap [class*="balloon-pane"],
#map-modal [class*="balloon-pane"],
#modal-map [class*="balloon-pane"],
#detail-map [class*="balloon-pane"] {
  z-index: 2500 !important;
  overflow: visible !important;
}

#map [class*="balloon"],
.map-container-wrap [class*="balloon"],
#map-modal [class*="balloon"],
#modal-map [class*="balloon"],
#detail-map [class*="balloon"] {
  pointer-events: auto;
}

/* Outer Yandex balloon shell — transparent, no sharp box */
#map [class*="balloon_layout"],
#map [class*="balloon_to_"],
.map-container-wrap [class*="balloon_layout"],
.map-container-wrap [class*="balloon_to_"],
#map-modal [class*="balloon_layout"],
#map-modal [class*="balloon_to_"],
#modal-map [class*="balloon_layout"],
#modal-map [class*="balloon_to_"],
#detail-map [class*="balloon_layout"],
#detail-map [class*="balloon_to_"] {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 20px !important;
  overflow: hidden !important;
  filter: none !important;
}

#map [class*="balloon__shadow"],
.map-container-wrap [class*="balloon__shadow"],
#map-modal [class*="balloon__shadow"],
#modal-map [class*="balloon__shadow"],
#detail-map [class*="balloon__shadow"] {
  display: none !important;
}

#map [class*="balloon__layout"],
.map-container-wrap [class*="balloon__layout"],
#map-modal [class*="balloon__layout"],
#modal-map [class*="balloon__layout"],
#detail-map [class*="balloon__layout"] {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 20px !important;
  overflow: hidden !important;
  padding: 0 !important;
}

body.light-theme #map [class*="balloon__layout"],
body.light-theme .map-container-wrap [class*="balloon__layout"],
body.light-theme #map-modal [class*="balloon__layout"],
body.light-theme #modal-map [class*="balloon__layout"],
body.light-theme #detail-map [class*="balloon__layout"] {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

#map [class*="balloon__content"],
.map-container-wrap [class*="balloon__content"],
#map-modal [class*="balloon__content"],
#modal-map [class*="balloon__content"],
#detail-map [class*="balloon__content"] {
  background: transparent !important;
  color: #0f172a !important;
  border-radius: 20px !important;
  padding: 0 !important;
  border: none !important;
  font-family: var(--font-body) !important;
  overflow: hidden !important;
}

#map [class*="balloon__tail"],
.map-container-wrap [class*="balloon__tail"],
#map-modal [class*="balloon__tail"],
#modal-map [class*="balloon__tail"],
#detail-map [class*="balloon__tail"] {
  display: none !important;
}

#map [class*="balloon__close"],
.map-container-wrap [class*="balloon__close"],
#map-modal [class*="balloon__close"],
#modal-map [class*="balloon__close"],
#detail-map [class*="balloon__close"] {
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.92) !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  opacity: 1 !important;
  top: 10px !important;
  right: 10px !important;
  z-index: 12 !important;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12) !important;
}

#map [class*="balloon__close"]:hover,
.map-container-wrap [class*="balloon__close"]:hover,
#map-modal [class*="balloon__close"]:hover,
#modal-map [class*="balloon__close"]:hover,
#detail-map [class*="balloon__close"]:hover {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  color: #fff !important;
}

#map [class*="balloon__close"] + [class*="balloon__content"],
.map-container-wrap [class*="balloon__close"] + [class*="balloon__content"],
#map-modal [class*="balloon__close"] + [class*="balloon__content"],
#modal-map [class*="balloon__close"] + [class*="balloon__content"],
#detail-map [class*="balloon__close"] + [class*="balloon__content"] {
  margin-right: 0 !important;
}

.map-popup-card,
.uytop-map-balloon {
  width: 248px;
  border-radius: 20px;
  overflow: hidden;
  font-family: var(--font-body);
  background: #ffffff;
  border: 1px solid rgba(5, 150, 105, 0.14);
  box-shadow:
    0 20px 44px rgba(15, 23, 42, 0.14),
    0 4px 12px rgba(15, 23, 42, 0.06);
  isolation: isolate;
}

.map-popup-card__image {
  position: relative;
  width: 100%;
  height: 132px;
  overflow: hidden;
  border-radius: 20px 20px 0 0;
  background: #e2e8f0;
  line-height: 0;
}

.map-popup-card__image::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.14), transparent 50%);
  pointer-events: none;
}

.map-popup-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 20px 20px 0 0;
  clip-path: inset(0 round 20px 20px 0 0);
}

.map-popup-info {
  padding: 0.9rem 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  border-radius: 0 0 20px 20px;
  background: #ffffff;
}

.map-popup-info h4 {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  color: #0f172a;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.map-popup-address {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.35;
  color: #64748b;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.map-popup-info .price {
  color: #059669;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.05rem;
  margin: 0;
}

.map-popup-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.78rem;
  color: #475569;
  flex-wrap: wrap;
}

.map-popup-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.map-popup-info .link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  color: #fff !important;
  font-weight: 700;
  text-decoration: none !important;
  background: var(--accent-emerald);
  border-radius: 999px;
  transition: var(--transition);
  align-self: flex-start;
}

.map-popup-info .link:hover {
  background: var(--accent-emerald-hover);
  transform: translateY(-1px);
}

.map-popup-info .link svg,
.map-popup-info .link i {
  width: 0.85rem;
  height: 0.85rem;
  stroke-width: 2.5px;
}

/* Legacy ymaps version-specific selector fallback */
[class*="balloon__content"] {
  background-color: transparent !important;
  color: #0f172a !important;
  border-radius: 20px !important;
  padding: 0 !important;
  border: none !important;
  overflow: hidden !important;
}

[class*="balloon__layout"] {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 20px !important;
  overflow: hidden !important;
  padding: 0 !important;
}

[class*="balloon_layout"],
[class*="balloon_to_top"],
[class*="balloon_to_bottom"] {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 20px !important;
  overflow: hidden !important;
}

[class*="balloon__shadow"] {
  display: none !important;
}

/* Yandex stretchy price labels on map */
#map [class*="StretchyIcon"],
#modal-map [class*="StretchyIcon"],
#detail-map [class*="StretchyIcon"],
.map-container-wrap [class*="StretchyIcon"] {
  border-radius: 999px !important;
  overflow: hidden !important;
  cursor: pointer !important;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.16) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

#map [class*="StretchyIcon"]:hover,
#modal-map [class*="StretchyIcon"]:hover,
#detail-map [class*="StretchyIcon"]:hover,
.map-container-wrap [class*="StretchyIcon"]:hover {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.2) !important;
}

#map [class*="stretchy"][class*="text"],
#modal-map [class*="stretchy"][class*="text"],
#detail-map [class*="stretchy"][class*="text"],
#map [class*="StretchyIcon"] [class*="content"],
#modal-map [class*="StretchyIcon"] [class*="content"],
#detail-map [class*="StretchyIcon"] [class*="content"] {
  font-family: var(--font-heading) !important;
  font-weight: 800 !important;
  font-size: 12px !important;
  line-height: 1.15 !important;
  padding: 5px 10px !important;
  border-radius: 999px !important;
}

#map [class*="places-pane"],
#modal-map [class*="places-pane"],
#detail-map [class*="places-pane"] {
  z-index: 2001 !important;
  pointer-events: auto !important;
}

#map [class*="places-pane"] ymaps,
#modal-map [class*="places-pane"] ymaps,
#detail-map [class*="places-pane"] ymaps {
  cursor: pointer;
}

/* Yandex Map Modal Layout */
.map-modal {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(16, 185, 129, 0.1), transparent 45%),
    rgba(7, 12, 20, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.map-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.map-modal-content {
  width: min(920px, 100%);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transform: scale(0.96) translateY(10px);
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background: linear-gradient(145deg, rgba(19, 27, 46, 0.94), rgba(11, 15, 25, 0.9));
  border: 1px solid rgba(16, 185, 129, 0.18);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  color: #f8fafc;
}

.map-modal.show .map-modal-content {
  transform: scale(1) translateY(0);
}

.map-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.map-modal-header-text {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.map-modal-header h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.3rem;
  color: #f8fafc !important;
}

.map-modal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.map-modal-legend .map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: rgba(248, 250, 252, 0.72);
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot-primary {
  background: #ffb300;
  box-shadow: 0 0 8px rgba(255, 179, 0, 0.55);
}

.legend-dot-similar {
  background: var(--accent-emerald);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.map-modal-frame {
  position: relative;
  height: min(58vh, 520px);
  min-height: 360px;
  border-radius: var(--radius-md);
  overflow: visible;
  background: #0a1018;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

#modal-map.uytop-yandex-map {
  border-radius: var(--radius-md);
  overflow: hidden;
}

#modal-map.uytop-yandex-map,
#modal-map.uytop-yandex-map > ymaps {
  width: 100% !important;
  height: 100% !important;
}

/* Map modal — hide native Yandex footer clutter */
#map-modal [class*="copyrights-pane"],
#map-modal [class*="open-block"],
#map-modal [class*="type-selector"],
#map-modal [class*="map-tools"],
#map-modal [class*="gototaxi"],
#map-modal [class*="gototech"],
#map-modal [class*="map-copyrights-promo"],
#map-modal [class$="-copyright"] {
  display: none !important;
}

#map-modal [class*="map-bg"] {
  background-color: #0a1018 !important;
}

.map-modal-footer-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem 0.55rem 3.85rem;
  background: linear-gradient(180deg, transparent 0%, rgba(7, 12, 20, 0.88) 35%, rgba(7, 12, 20, 0.94) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.map-modal-footer-bar a,
.map-modal-footer-left {
  pointer-events: auto;
}

.map-modal-footer-left {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.66rem;
  color: rgba(148, 163, 184, 0.85);
}

.map-modal-footer-left a,
.map-modal-footer-open {
  color: rgba(148, 163, 184, 0.9);
  text-decoration: none;
  transition: color 0.2s ease;
}

.map-modal-footer-left a:hover,
.map-modal-footer-open:hover {
  color: var(--accent-emerald);
}

.map-modal-footer-sep {
  opacity: 0.45;
  user-select: none;
}

.map-modal-footer-open {
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}

body.light-theme .map-modal-footer-bar {
  background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.92) 35%, rgba(255, 255, 255, 0.96) 100%);
  border-top-color: rgba(15, 23, 42, 0.06);
}

body.light-theme .map-modal-footer-left,
body.light-theme .map-modal-footer-left a,
body.light-theme .map-modal-footer-open {
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .map-modal-footer-bar {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.5rem 0.65rem 0.5rem 3.35rem;
    gap: 0.25rem;
  }

  .map-modal-footer-open {
    font-size: 0.64rem;
  }
}

/* Map modal — Yandex zoom control */
#map-modal [class*="controls-pane"] {
  top: auto !important;
  bottom: 2.65rem !important;
  left: 1rem !important;
}

#map-modal [class$="-zoom"] {
  width: 44px !important;
  height: auto !important;
  border-radius: var(--radius-md) !important;
  overflow: hidden !important;
  background: linear-gradient(180deg, rgba(19, 27, 46, 0.95), rgba(11, 15, 25, 0.92)) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  border: 1px solid rgba(16, 185, 129, 0.32) !important;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.38),
    0 0 20px rgba(16, 185, 129, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

#map-modal [class*="zoom__plus"],
#map-modal [class*="zoom__minus"] {
  width: 44px !important;
  height: 44px !important;
  background: transparent !important;
  border: none !important;
  color: var(--text-primary) !important;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease !important;
  cursor: pointer !important;
}

#map-modal [class*="zoom__plus"] {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
}

#map-modal [class*="zoom__minus"] {
  border-top: 1px solid rgba(255, 255, 255, 0.07) !important;
}

#map-modal [class*="zoom__plus"]:hover,
#map-modal [class*="zoom__minus"]:hover {
  background: var(--accent-emerald-light) !important;
  color: var(--accent-emerald) !important;
}

#map-modal [class*="zoom__plus"]:active,
#map-modal [class*="zoom__minus"]:active {
  background: rgba(16, 185, 129, 0.28) !important;
  transform: scale(0.94);
}

#map-modal [class*="zoom__icon"] {
  opacity: 0.92 !important;
  filter: brightness(0) invert(1) !important;
  transition: filter 0.2s ease, opacity 0.2s ease !important;
}

#map-modal [class*="zoom__plus"]:hover [class*="zoom__icon"],
#map-modal [class*="zoom__minus"]:hover [class*="zoom__icon"] {
  filter: brightness(0) saturate(100%) invert(55%) sepia(68%) saturate(462%) hue-rotate(118deg) brightness(94%) contrast(91%) !important;
  opacity: 1 !important;
}

#map-modal [class*="zoom__scale"] {
  width: 44px !important;
  margin: 0 !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)) !important;
  border: none !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04) !important;
}

#map-modal [class*="zoom__runner"] {
  width: 16px !important;
  height: 16px !important;
  left: 50% !important;
  margin-left: -8px !important;
  border-radius: 50% !important;
  background: linear-gradient(145deg, #6ee7b7, var(--accent-emerald)) !important;
  border: 2px solid rgba(255, 255, 255, 0.92) !important;
  box-shadow:
    0 2px 10px rgba(16, 185, 129, 0.5),
    0 0 0 3px rgba(16, 185, 129, 0.15) !important;
  transition: transform 0.15s ease, box-shadow 0.2s ease !important;
}

#map-modal [class*="zoom__runner"]:hover {
  box-shadow:
    0 3px 14px rgba(16, 185, 129, 0.65),
    0 0 0 4px rgba(16, 185, 129, 0.2) !important;
}

body.light-theme #map-modal [class$="-zoom"] {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 245, 249, 0.94)) !important;
  border-color: rgba(5, 150, 105, 0.28) !important;
  box-shadow:
    0 8px 24px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

body.light-theme #map-modal [class*="zoom__icon"] {
  filter: brightness(0) saturate(100%) invert(12%) sepia(12%) saturate(1200%) hue-rotate(176deg) brightness(95%) contrast(92%) !important;
}

body.light-theme #map-modal [class*="zoom__scale"] {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.04), rgba(15, 23, 42, 0.1), rgba(15, 23, 42, 0.04)) !important;
}

@media (max-width: 768px) {
  .map-modal-frame {
    min-height: 300px;
    height: 52vh;
  }
}

.btn-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 1.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-close:hover {
  background-color: var(--danger);
  border-color: var(--danger);
  color: white;
  transform: rotate(90deg);
}

body.light-theme .btn-close {
  background-color: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.1);
}

body.light-theme .btn-close:hover {
  background-color: var(--danger);
  color: white;
}

/* ==========================================
   Auth, mobile nav, map toggle, responsive extras
   ========================================== */

[hidden] {
  display: none !important;
}

.nav-auth-guest,
.nav-auth-user {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.auth-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.auth-input {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.auth-input:focus {
  outline: none;
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.auth-submit-btn {
  width: 100%;
  margin-top: 0.75rem;
}

.auth-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.auth-switch {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0.5rem 0 1rem;
}

.auth-switch a {
  color: var(--accent-emerald);
  font-weight: 600;
  margin-left: 0.35rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle .header-icon,
.nav-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

.auth-page {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.auth-card {
  width: min(100%, 440px);
  padding: 2rem;
  border-radius: var(--radius-lg);
}

.auth-card h1,
.auth-card h2 {
  font-family: var(--font-heading);
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.auth-error {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.14), rgba(239, 68, 68, 0.06));
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fecaca;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.45;
  animation: field-error-in 0.28s ease;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.12);
}

.auth-error__icon,
.validation-alert__icon,
.field-error__icon,
.form-validation-banner__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  color: #f87171;
}

.auth-error svg,
.validation-alert svg,
.field-error svg,
.form-validation-banner svg {
  width: 1.2rem;
  height: 1.2rem;
}

/* Custom field validation */
.form-validation-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(245, 158, 11, 0.05));
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fde68a;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.45;
  animation: field-error-in 0.28s ease;
  box-shadow: 0 8px 22px rgba(245, 158, 11, 0.1);
}

.form-validation-banner__icon {
  color: var(--accent-gold);
}

.field-error {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin-top: 0.45rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.4;
  color: #fecaca;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.05));
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-sm);
  animation: field-error-in 0.25s ease;
}

.field-has-error .field-error[hidden] {
  display: none !important;
}

.field-has-error input,
.field-has-error textarea,
.field-has-error select,
input.field-invalid,
textarea.field-invalid,
select.field-invalid,
.auth-input.field-invalid,
.auth-code-input.field-invalid {
  border-color: rgba(239, 68, 68, 0.65) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14) !important;
}

.auth-input.field-shake,
.auth-code-input.field-shake {
  animation: field-shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.field-shake {
  animation: field-shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes field-error-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes field-shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-5px); }
  30% { transform: translateX(5px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

body.light-theme .auth-error {
  color: #b91c1c;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(254, 226, 226, 0.85));
}

body.light-theme .form-validation-banner {
  color: #92400e;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(254, 243, 199, 0.9));
}

body.light-theme .field-error {
  color: #b91c1c;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(254, 226, 226, 0.75));
}

.auth-code-input {
  width: 100%;
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  font-size: 1.25rem;
  letter-spacing: 0.35em;
  text-align: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-google {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
  padding: 0.7rem 1.25rem;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: var(--radius-md);
  font-family: 'Roboto', var(--font-body), sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
  transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.btn-google:hover:not(:disabled) {
  background: #f8f9fa;
  border-color: #d2d4d8;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.15);
  transform: none;
  color: #3c4043;
}

.btn-google:active:not(:disabled) {
  background: #f1f3f4;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.12);
}

.btn-google:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f8f9fa;
}

.btn-google__icon {
  flex-shrink: 0;
  display: block;
}

body.light-theme .btn-google,
body:not(.light-theme) .btn-google {
  background: #fff;
  color: #3c4043;
}

.auth-google-hint {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
  text-align: center;
}

.auth-google-hint a {
  color: var(--accent-emerald);
  font-weight: 600;
}

.auth-google-redirect-help {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.auth-google-redirect-help__title {
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.5rem;
}

.auth-google-redirect-help__steps {
  margin: 0 0 0.65rem 1.1rem;
  padding: 0;
}

.auth-redirect-uri-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.auth-redirect-uri-box code {
  flex: 1;
  font-size: 0.75rem;
  word-break: break-all;
  color: var(--accent-emerald);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  width: min(100%, 960px);
  margin: 0 auto;
}

.profile-card {
  width: 100%;
}

.profile-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.profile-user__avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-emerald);
}

.profile-user__label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.profile-user__name {
  font-weight: 700;
  font-size: 1.1rem;
}

.profile-user__email {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.auth-2fa-setup {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

.auth-2fa-qr {
  display: block;
  width: min(100%, 200px);
  margin: 0 auto 1rem;
  border-radius: var(--radius-md);
  background: #fff;
  padding: 0.5rem;
}

.map-mobile-toggle {
  display: none;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.map-mobile-toggle .btn {
  flex: 1;
  justify-content: center;
}

.api-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.api-table-scroll .params-table {
  min-width: 640px;
  margin-top: 0;
}

@media (max-width: 900px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-toggle {
    display: inline-flex;
  }

  header .nav-container {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
  }

  header .logo {
    order: 1;
    flex: 1;
  }

  header .nav-toggle {
    order: 2;
  }

  header .nav-actions {
    order: 3;
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
  }

  header nav {
    order: 4;
    width: 100%;
    display: none;
  }

  header.nav-open nav {
    display: block;
  }

  header nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.5rem 0 0.25rem;
  }

  .map-mobile-toggle {
    display: flex;
  }

  .map-page-layout {
    flex-direction: column;
    height: calc(100vh - var(--header-height, 72px) - 52px);
    min-height: 420px;
  }

  .map-page-layout.map-view-list .map-container-wrap {
    display: none;
  }

  .map-page-layout.map-view-list .map-sidebar {
    width: 100%;
    height: 100%;
    flex: 1;
  }

  .map-page-layout.map-view-map .map-sidebar {
    display: none;
  }

  .map-page-layout.map-view-map .map-container-wrap {
    width: 100%;
    height: 100%;
    flex: 1;
  }

  .detail-features-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-chat-widget.open .ai-chat-panel {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    max-width: none;
    height: min(85vh, 640px);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin: 0;
  }

  .ai-chat-widget.open {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.45);
  }

  .auth-card {
    padding: 1.5rem;
  }

  .nav-actions .btn-primary {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .detail-features-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .hero h1 {
    font-size: 1.85rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Favorites & listing status */
.favorite-btn {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 4;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease;
}

.favorite-btn:hover {
  transform: scale(1.06);
  background: rgba(15, 23, 42, 0.72);
}

.favorite-btn.is-active {
  background: rgba(239, 68, 68, 0.92);
  color: #fff;
}

.favorite-btn.is-active svg {
  fill: currentColor;
}

.detail-favorite-slot {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 5;
}

.detail-favorite-slot .favorite-btn {
  position: static;
}

.badge-deal {
  background: rgba(59, 130, 246, 0.9);
  color: #fff;
}

.badge-sold {
  background: rgba(100, 116, 139, 0.95);
  color: #fff;
}

.card-sold {
  opacity: 0.82;
}

.card-sold .card-img-container img {
  filter: grayscale(0.35);
}

.page-title {
  font-family: var(--font-heading);
  margin-bottom: 0.35rem;
}

.page-subtitle {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.profile-listings-section {
  padding: 1.5rem 2rem;
}

.profile-listings-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.profile-listing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.profile-listing-row__title {
  font-weight: 600;
  color: var(--text-primary);
}

.profile-listing-row__meta {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.listing-status-select {
  min-width: 140px;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.85rem;
}

.detail-owner-panel {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.detail-owner-panel label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

@media (max-width: 768px) {
  .profile-listing-row {
    flex-direction: column;
    align-items: stretch;
  }

  .listing-status-select {
    width: 100%;
  }
}

/* Admin + CRM funnel */
.admin-page {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.admin-panel {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 1.75rem;
  border-radius: var(--radius-lg);
}

.admin-panel__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-panel h1 {
  font-family: var(--font-heading);
  margin-bottom: 0.25rem;
}

.admin-tabs {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
}

.admin-tab {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.55rem 1rem;
  border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer;
  transition: var(--transition);
}

.admin-tab:hover {
  color: var(--text-primary);
}

.admin-tab.active {
  background: var(--accent-emerald-light);
  color: var(--accent-emerald);
}

.crm-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.crm-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(200px, 1fr));
  gap: 0.85rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.crm-column {
  min-width: 200px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.crm-column__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.crm-column__head h3 {
  font-size: 0.85rem;
  font-weight: 700;
}

.crm-column__count {
  min-width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent-emerald-light);
  color: var(--accent-emerald);
}

.crm-column__list {
  padding: 0.65rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.crm-column__empty {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
  padding: 1rem 0.5rem;
}

.crm-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-shadow: var(--shadow-sm);
}

.crm-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.35rem;
}

.crm-card__phone {
  font-size: 0.92rem;
  color: var(--accent-emerald);
}

.crm-card__source {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

.crm-card__name {
  font-weight: 600;
  font-size: 0.85rem;
}

.crm-card__message {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.crm-card__props {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.crm-card__link {
  font-size: 0.72rem;
  color: var(--accent-gold);
  text-decoration: none;
}

.crm-card__link:hover {
  text-decoration: underline;
}

.crm-card__notes {
  width: 100%;
  resize: vertical;
  min-height: 2.5rem;
  font-family: inherit;
  font-size: 0.78rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.crm-card__footer {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.crm-stage-select {
  width: 100%;
  font-size: 0.78rem;
  padding: 0.35rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.crm-card__date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.crm-card__delete {
  align-self: flex-end;
  margin-top: 0.15rem;
}

.crm-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.crm-modal[hidden] {
  display: none !important;
}

.crm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.crm-modal__dialog {
  position: relative;
  width: min(100%, 420px);
  padding: 1.5rem;
  border-radius: var(--radius-lg, 16px);
}

.crm-modal__dialog h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
}

.crm-modal__form .form-group {
  margin-bottom: 1rem;
}

.crm-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

@media (max-width: 1100px) {
  .crm-board {
    grid-template-columns: repeat(5, minmax(240px, 1fr));
  }
}

@media (max-width: 768px) {
  .admin-panel {
    padding: 1.1rem;
  }

  .admin-panel__head {
    flex-direction: column;
  }

  .admin-tabs {
    width: 100%;
  }

  .admin-tab {
    flex: 1;
  }
}
