/* ============================================
   Пиротска 123 - Основен стилов файл
   Палитра, типография, layout, компоненти
   ============================================ */

:root {
  /* Цветова палитра — топло бежово/сиво в духа на сградата */
  --color-bg: #FAF8F4;
  --color-surface: #FFFFFF;
  --color-text: #2A2A2A;
  --color-text-muted: #6B6B6B;
  --color-border: #E5E0D8;
  --color-primary: #8B6F47;        /* топло кафяво */
  --color-primary-dark: #6B5436;
  --color-accent: #C87850;         /* теракота */
  --color-light: #D4C4A8;          /* бежово */
  --color-dark: #3A3A3A;
  --color-success: #4A7C59;
  --color-warning: #D4A745;
  --color-danger: #B84A4A;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);

  --radius: 6px;
  --radius-lg: 12px;

  --max-width: 1280px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color .2s;
}
a:hover { color: var(--color-accent); }

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 0.5em;
  color: var(--color-dark);
}
h1 { font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); letter-spacing: -0.01em; }
h3 { font-size: 1.25rem; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* =========== Header / Navigation =========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}
.nav-brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-dark);
  letter-spacing: 0.02em;
}
.nav-brand span { color: var(--color-accent); }

.nav-menu {
  display: flex;
  gap: 1.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-menu a {
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
}
.nav-menu a:hover,
.nav-menu a.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: white;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    gap: 0.75rem;
  }
  .nav-menu.open { display: flex; }
}

/* =========== Hero =========== */
.hero {
  position: relative;
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  background: #2a2a2a;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.55) 100%);
  z-index: 1;
}
.hero img.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-content {
  position: relative;
  z-index: 2;
  padding: 2rem 1.5rem;
  max-width: 800px;
}
.hero h1 {
  color: white;
  margin-bottom: 1rem;
  text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.hero p.lead {
  font-size: clamp(1rem, 2vw, 1.25rem);
  margin-bottom: 2rem;
  text-shadow: 0 1px 8px rgba(0,0,0,0.4);
}

/* =========== Buttons =========== */
.btn {
  display: inline-block;
  padding: 0.85rem 1.75rem;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.btn-primary {
  background: var(--color-accent);
  color: white;
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-outline {
  background: transparent;
  color: white;
  border-color: rgba(255,255,255,0.7);
}
.btn-outline:hover {
  background: white;
  color: var(--color-dark);
}
.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-border);
}
.btn-ghost:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* =========== Sections =========== */
section {
  padding: 4rem 0;
}
section.alt {
  background: white;
}
.section-title {
  text-align: center;
  margin-bottom: 0.75rem;
}
.section-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  margin-bottom: 3rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* =========== Cards / Feature grid =========== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.feature-card {
  background: var(--color-surface);
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  transition: transform .2s, box-shadow .2s;
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.feature-card .icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: var(--color-primary-dark);
}
.feature-card h3 { margin-bottom: 0.5rem; }
.feature-card p { color: var(--color-text-muted); margin: 0; font-size: 0.95rem; }

/* =========== Stats =========== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2rem;
  text-align: center;
  margin: 3rem 0;
}
.stat-item .number {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}
.stat-item .label {
  display: block;
  margin-top: 0.5rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* =========== Tables =========== */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: white;
}
table.units {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.units th {
  background: var(--color-bg);
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--color-dark);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
table.units td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
}
table.units tr:hover td { background: #FBF8F2; }
table.units tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* =========== Plan thumbnail button (бутон-миниатюра за план на апартамент) =========== */
.col-plan { width: 80px; text-align: center; }
.plan-thumb-btn {
  display: inline-block;
  padding: 0;
  border: 2px solid var(--color-border);
  background: white;
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  transition: all .18s ease;
  line-height: 0;
  width: 60px;
  height: 60px;
  vertical-align: middle;
}
.plan-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.plan-thumb-btn:hover {
  border-color: var(--color-primary);
  transform: scale(1.06);
  box-shadow: var(--shadow-md);
}
.plan-thumb-btn:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(200, 120, 80, 0.25);
}
.plan-thumb-empty {
  color: var(--color-text-muted);
  font-size: 1.2rem;
}

/* План на апартамента в модала */
.apt-plan-block {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}
.apt-plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.apt-plan-header h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-dark);
  margin: 0;
}
.apt-plan-badge {
  background: var(--color-light);
  color: var(--color-primary-dark);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 12px;
}

/* Табове за превключване Скица / Визуализация */
.apt-plan-tabs {
  display: inline-flex;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.apt-plan-tab {
  background: transparent;
  border: none;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all .15s ease;
  font-family: inherit;
}
.apt-plan-tab:hover {
  color: var(--color-primary);
  background: var(--color-bg);
}
.apt-plan-tab.active {
  background: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* Pane (скица / визуализация) — само активният се показва */
.apt-plan-pane { display: none; }
.apt-plan-pane.active { display: block; }

.apt-plan-img {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  background: white;
  border-radius: var(--radius);
  cursor: zoom-in;
  transition: opacity .15s;
}
.apt-plan-img:hover { opacity: 0.92; }
.apt-plan-note {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0.6rem 0 0;
  line-height: 1.45;
  font-style: italic;
}
/* Warning за ИИ визуализациите */
.apt-plan-note-warning {
  background: #FBF1DC;
  color: #6B5318;
  border-left: 3px solid var(--color-warning);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  font-style: normal;
  font-size: 0.82rem;
  margin-top: 0.85rem;
}

/* =========== Image viewer (full-screen за плана на апартамент) =========== */
.img-viewer {
  display: none;
  position: fixed; inset: 0;
  background: #1a1a1a;
  z-index: 2000;
  flex-direction: column;
}
.img-viewer.open { display: flex; }
.img-viewer-header {
  background: #2a2a2a;
  color: white;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #3a3a3a;
}
.img-viewer-title { font-weight: 600; font-size: 1rem; }
.img-viewer-controls { display: flex; gap: 0.5rem; }
.img-viewer-controls button {
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: background .15s;
}
.img-viewer-controls button:hover { background: rgba(255,255,255,0.2); }
.img-viewer-controls button.close { background: rgba(200,80,80,0.3); }
.img-viewer-controls button.close:hover { background: rgba(200,80,80,0.5); }
.img-viewer-stage {
  flex: 1;
  overflow: hidden;
  cursor: grab;
  position: relative;
  background:
    linear-gradient(45deg, #222 25%, transparent 25%),
    linear-gradient(-45deg, #222 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #222 75%),
    linear-gradient(-45deg, transparent 75%, #222 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}
.img-viewer-stage:active { cursor: grabbing; }
.img-viewer-stage img {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  transform-origin: center center;
  transition: transform .05s ease-out;
  user-select: none;
  -webkit-user-drag: none;
}
.img-viewer-hint {
  background: rgba(0,0,0,0.5);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 0.5rem;
  font-size: 0.85rem;
}
@media (max-width: 768px) {
  .img-viewer-hint { font-size: 0.78rem; }
  .plan-thumb-btn { width: 48px; height: 48px; }
  .col-plan { width: 64px; }
}

/* Status badges */
.status {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.status-available { background: #E8F1EB; color: var(--color-success); }
.status-reserved  { background: #FBF1DC; color: #8C6A1A; }
.status-sold      { background: #F5E0E0; color: var(--color-danger); }

/* =========== Filters =========== */
.filters {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  margin-bottom: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  align-items: end;
}
.filter-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.filter-group select,
.filter-group input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: white;
  font-family: inherit;
}
.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(139, 111, 71, 0.15);
}
.results-summary {
  margin: 1rem 0;
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

/* =========== Floor selector =========== */
.floor-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 2rem;
}
.floor-selector button {
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--color-border);
  background: white;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.floor-selector button:hover {
  border-color: var(--color-primary);
}
.floor-selector button.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* =========== Modal =========== */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 2rem;
}
.modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-muted);
  line-height: 1;
}
.modal h3 { margin-top: 0; padding-right: 2rem; }
.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}
.modal-grid .item {
  background: var(--color-bg);
  padding: 1rem;
  border-radius: var(--radius);
}
.modal-grid .item .label {
  display: block;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}
.modal-grid .item .value {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-dark);
}

/* =========== Gallery =========== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.gallery-item {
  cursor: pointer;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-light);
  position: relative;
  aspect-ratio: 16/10;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.gallery-item:hover img { transform: scale(1.05); }
.gallery-item .caption {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: white;
  padding: 1rem;
  font-weight: 500;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-close {
  position: fixed;
  top: 1rem; right: 1.5rem;
  color: white;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
}

/* =========== Floor view =========== */
.floor-view {
  background: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  text-align: center;
}
.floor-view h3 { margin-top: 0; }
.floor-view img {
  max-width: 100%;
  margin: 1rem auto;
  border-radius: var(--radius);
  cursor: zoom-in;
  border: 1px solid var(--color-border);
}
.floor-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* =========== Forms =========== */
form.contact-form {
  background: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  max-width: 600px;
  margin: 0 auto;
}
form .field { margin-bottom: 1.25rem; }
form label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--color-dark);
}
form input,
form select,
form textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
}
form textarea { min-height: 120px; resize: vertical; }
form .required { color: var(--color-danger); }

/* =========== Footer =========== */
.site-footer {
  background: var(--color-dark);
  color: #C5C5C5;
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-grid h4 {
  color: white;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}
.footer-grid a { color: #C5C5C5; }
.footer-grid a:hover { color: white; }
.footer-grid ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-grid li { padding: 0.25rem 0; font-size: 0.92rem; }
.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid #4A4A4A;
  text-align: center;
  font-size: 0.85rem;
  color: #888;
}

/* =========== Utilities =========== */
.text-muted { color: var(--color-text-muted); }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.text-center { text-align: center; }

/* =========== Info / Alert boxes =========== */
.info-box {
  background: #FBF8F0;
  border-left: 4px solid var(--color-warning);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.info-box strong { color: var(--color-dark); }
