/* ==========================================================================
   909.COM.UA - Modern Responsive Stylesheet
   Focus: Performance (100 PageSpeed), UX, Mobile-First, CRO
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #10b981;
  --accent-dark: #059669;
  --viber: #7360f2;
  --telegram: #229ed9;
  --dark: #0f172a;
  --gray-900: #1e293b;
  --gray-700: #334155;
  --gray-600: #475569;
  --gray-500: #64748b;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --gray-50: #f8fafc;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 12px;
  --transition: all 0.2s ease-in-out;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--gray-700);
  background-color: var(--gray-50);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 70px; /* Space for mobile sticky contact bar */
}

@media (min-width: 768px) {
  body {
    padding-bottom: 0;
  }
}

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

a:hover {
  color: var(--primary-dark);
}

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

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 768px) {
  .container {
    padding: 0 20px;
  }
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  background: var(--white);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-top {
  border-bottom: 1px solid var(--gray-200);
  padding: 8px 0;
  font-size: 0.85rem;
  background: var(--gray-50);
}

.header-top .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.location-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-600);
  font-weight: 500;
  font-size: 0.82rem;
}

.lang-switch {
  display: flex;
  gap: 6px;
  font-weight: 600;
}

.lang-switch a {
  color: var(--gray-500);
  padding: 2px 6px;
  border-radius: 4px;
}

.lang-switch a.active {
  color: var(--primary);
  background: var(--primary-light);
}

.header-main {
  padding: 12px 0;
}

.header-main .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: var(--white);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  box-shadow: var(--shadow-sm);
}

.logo-text .logo-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--dark);
  line-height: 1.2;
  margin: 0;
}

.logo-text p {
  font-size: 0.72rem;
  color: var(--gray-500);
  margin: 0;
}

.nav-links {
  display: none;
  gap: 18px;
  align-items: center;
  list-style: none;
}

@media (min-width: 900px) {
  .nav-links {
    display: flex;
  }
}

.nav-links a {
  color: var(--gray-700);
  font-weight: 600;
  font-size: 0.95rem;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--primary);
}

.header-phones {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.phone-item {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 5px;
}

.phone-item:hover {
  color: var(--primary);
}

.phone-desc {
  font-size: 0.72rem;
  color: var(--accent-dark);
  font-weight: 600;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: var(--white);
  padding: 36px 0;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.25), transparent 60%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  padding: 5px 12px;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #93c5fd;
  margin-bottom: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.hero h1, .hero h2 {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 14px;
  color: var(--white);
}

@media (min-width: 768px) {
  .hero h1, .hero h2 {
    font-size: 2.4rem;
  }
}

.hero p {
  font-size: 1rem;
  color: #cbd5e1;
  margin-bottom: 20px;
  line-height: 1.55;
}

.hero-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.hero-feat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #f1f5f9;
}

.hero-feat-item svg {
  flex-shrink: 0;
  color: #34d399;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ==========================================================================
   Buttons & CTA
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 4px 12px 0 rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: var(--white);
  transform: translateY(-1px);
}

.btn-viber {
  background: var(--viber);
  color: var(--white);
}

.btn-viber:hover {
  background: #5d49e0;
  color: var(--white);
}

.btn-telegram {
  background: var(--telegram);
  color: var(--white);
}

.btn-telegram:hover {
  background: #1c88bd;
  color: var(--white);
}

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

.btn-outline:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* ==========================================================================
   Filter & Tabs
   ========================================================================== */
.filter-section {
  padding: 20px 0 10px;
}

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.filter-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  max-width: 100%;
}

.filter-btn {
  padding: 7px 14px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.filter-btn.active, .filter-btn:hover {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.rent-mode-toggle {
  display: flex;
  background: var(--gray-200);
  padding: 3px;
  border-radius: 30px;
}

.rent-mode-toggle a {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gray-700);
}

.rent-mode-toggle a.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Apartments Grid & Cards
   ========================================================================== */
.apartments-section {
  padding: 16px 0 40px;
}

.section-title-wrap {
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 4px;
}

@media (min-width: 768px) {
  .section-title {
    font-size: 1.85rem;
  }
}

.section-subtitle {
  font-size: 0.95rem;
  color: var(--gray-500);
}

.apartments-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 768px) {
  .apartments-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.apartment-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--gray-200);
  transition: var(--transition);
}

.apartment-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-image-wrap {
  position: relative;
  height: 220px;
  overflow: hidden;
  background: var(--gray-100);
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
  cursor: pointer;
}

.apartment-card:hover .card-img {
  transform: scale(1.02);
}

.card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 2;
}

.badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge-metro {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  color: #38bdf8;
}

.badge-rooms {
  background: var(--primary);
  color: var(--white);
}

.badge-hourly {
  background: var(--accent);
  color: var(--white);
}

.card-price-tag {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(6px);
  color: var(--white);
  padding: 5px 10px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 1rem;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-price-tag small {
  font-size: 0.7rem;
  font-weight: 400;
  color: #94a3b8;
}

.card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 4px;
  line-height: 1.3;
}

.card-title a {
  color: var(--dark);
}

.card-title a:hover {
  color: var(--primary);
}

.card-location {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: 12px;
}

.card-amenities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.amenity-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--gray-100);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--gray-700);
}

.card-desc {
  font-size: 0.88rem;
  color: var(--gray-600);
  margin-bottom: 14px;
  line-height: 1.45;
  flex-grow: 1;
}

.card-pricing-table {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  border: 1px solid var(--gray-200);
}

.pricing-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}

.pricing-row:not(:last-child) {
  border-bottom: 1px dashed var(--gray-200);
}

.pricing-label {
  color: var(--gray-600);
}

.pricing-val {
  font-weight: 700;
  color: var(--dark);
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.card-actions .btn {
  padding: 8px;
  font-size: 0.85rem;
}

/* ==========================================================================
   Apartment Detail Page Responsive Layout (Fixes mobile squeezing!)
   ========================================================================== */
.apartment-detail-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

@media (min-width: 900px) {
  .apartment-detail-layout {
    grid-template-columns: 1.3fr 0.7fr;
    gap: 30px;
  }
}

.apartment-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

@media (min-width: 480px) {
  .apartment-gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
}

@media (min-width: 768px) {
  .apartment-gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.gallery-thumb {
  border-radius: 8px;
  cursor: pointer;
  height: 110px;
  width: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
  border: 1px solid var(--gray-200);
}

.gallery-thumb:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow);
}

.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

@media (min-width: 900px) {
  .detail-sidebar {
    position: sticky;
    top: 85px;
  }
}

/* ==========================================================================
   Benefits & SEO Text
   ========================================================================== */
.benefits-section {
  background: var(--white);
  padding: 40px 0;
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
}

.benefits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.benefit-card {
  background: var(--gray-50);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

.benefit-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 6px;
}

.benefit-card p {
  font-size: 0.88rem;
  color: var(--gray-600);
  line-height: 1.5;
}

.seo-text-section {
  padding: 40px 0;
  background: var(--gray-50);
}

.seo-text-block {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--gray-200);
  line-height: 1.6;
}

@media (min-width: 768px) {
  .seo-text-block {
    padding: 32px;
  }
}

.seo-text-block h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 12px;
}

.seo-text-block h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
  margin: 16px 0 8px;
}

.seo-text-block p {
  margin-bottom: 12px;
  color: var(--gray-700);
  font-size: 0.92rem;
}

.seo-text-block ul {
  padding-left: 20px;
  margin-bottom: 14px;
  font-size: 0.92rem;
}

.seo-text-block li {
  margin-bottom: 4px;
}

/* ==========================================================================
   FAQ Section
   ========================================================================== */
.faq-section {
  padding: 40px 0;
}

.faq-list {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.faq-question {
  width: 100%;
  padding: 16px 18px;
  text-align: left;
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.faq-question:hover {
  color: var(--primary);
}

.faq-icon {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease-out;
  padding: 0 18px;
  color: var(--gray-600);
  line-height: 1.5;
  font-size: 0.92rem;
}

.faq-item.active .faq-answer {
  max-height: 300px;
  padding-bottom: 16px;
}

/* ==========================================================================
   Contacts & Map
   ========================================================================== */
.contact-section {
  padding: 40px 0;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 800px) {
  .contact-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-card {
  background: var(--gray-50);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

.contact-card h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 12px;
}

.contact-numbers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.contact-phone-link {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.contact-messengers {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.map-wrapper {
  background: var(--gray-100);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--gray-200);
  min-height: 280px;
}

.map-wrapper iframe {
  width: 100%;
  height: 100%;
  min-height: 280px;
  border: 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--dark);
  color: #94a3b8;
  padding: 36px 0 18px;
  font-size: 0.88rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.footer-col h4 {
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-links a {
  color: #94a3b8;
}

.footer-links a:hover {
  color: var(--white);
}

.footer-bottom {
  border-top: 1px solid #334155;
  padding-top: 16px;
  text-align: center;
  font-size: 0.78rem;
}

/* ==========================================================================
   Sticky Mobile Bar
   ========================================================================== */
.mobile-sticky-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  padding: 8px 10px;
  gap: 8px;
  z-index: 999;
  border-top: 1px solid var(--gray-200);
}

@media (min-width: 768px) {
  .mobile-sticky-bar {
    display: none;
  }
}

.sticky-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7px 4px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--white);
  text-decoration: none;
}

.sticky-call {
  background: var(--primary);
}

.sticky-viber {
  background: var(--viber);
}

.sticky-telegram {
  background: var(--telegram);
}

/* ==========================================================================
   Lightbox Modal
   ========================================================================== */
.lightbox-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.lightbox-modal.active {
  display: flex;
}

.lightbox-content {
  max-width: 92vw;
  max-height: 80vh;
  position: relative;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--white);
  font-size: 26px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--white);
  font-size: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-prev {
  left: 14px;
}

.lightbox-next {
  right: 14px;
}

.lightbox-caption {
  color: var(--white);
  margin-top: 12px;
  font-size: 0.95rem;
  font-weight: 500;
}
