/*
 Theme Name:   Koidula Arendus
 Theme URI:    https://koidula.ee
 Description:  Astra child theme for Koidula Arendus. Designed for Elementor.
 Author:       KV Investor OÜ
 Template:     astra
 Version:      2.0.0
 License:      GNU General Public License v2 or later
 Text Domain:  koidula
*/

/* ==========================================================================
   CSS CUSTOM PROPERTIES
   ========================================================================== */
:root {
  --stone-50: #fafaf9;  --stone-100: #f5f5f4; --stone-200: #e7e5e4;
  --stone-300: #d6d3d1; --stone-400: #a8a29e;  --stone-500: #78716c;
  --stone-600: #57534e; --stone-700: #44403c;  --stone-800: #292524;
  --stone-900: #1c1917; --stone-950: #0c0a09;
  --emerald-50: #ecfdf5;  --emerald-100: #d1fae5; --emerald-200: #a7f3d0;
  --emerald-300: #6ee7b7; --emerald-400: #34d399;  --emerald-500: #10b981;
  --emerald-600: #059669; --emerald-700: #047857;  --emerald-800: #065f46;
  --emerald-900: #064e3b;
  --orange-100: #ffedd5; --orange-400: #fb923c; --orange-500: #f97316; --orange-700: #c2410c;
  --red-100: #fee2e2; --red-400: #f87171; --red-500: #ef4444; --red-700: #b91c1c;
}
::selection { background-color: var(--emerald-200); }
html { scroll-behavior: smooth; }

/* ==========================================================================
   HEADER — transparent-to-solid scroll effect
   ========================================================================== */
body.koidula-transparent-header .ast-primary-header-bar { transition: background 0.3s, box-shadow 0.3s; }
body.koidula-transparent-header:not(.header-scrolled) .ast-primary-header-bar { background: transparent !important; box-shadow: none !important; }
body.koidula-transparent-header.header-scrolled .ast-primary-header-bar { background: rgba(255,255,255,0.95) !important; backdrop-filter: blur(8px); box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important; }
.main-navigation .menu-item.btn-primary > a { background: var(--emerald-600) !important; color: #fff !important; padding: 10px 20px !important; border-radius: 2px !important; }
.main-navigation .menu-item.btn-primary > a:hover { background: var(--emerald-700) !important; }

/* ==========================================================================
   HERO BUTTONS
   ========================================================================== */
.koidula-hero-buttons {
  display: flex; flex-wrap: wrap; gap: 16px;
}
.koidula-btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--emerald-600); color: #fff !important;
  padding: 16px 32px; font-size: 1.125rem; font-weight: 500;
  text-decoration: none !important; border-radius: 2px; transition: background 0.2s;
}
.koidula-btn-primary:hover { background: var(--emerald-700); color: #fff !important; }
.koidula-btn-ghost {
  display: inline-flex; align-items: center;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.3);
  color: #fff !important; padding: 16px 32px; font-size: 1.125rem; font-weight: 500;
  text-decoration: none !important; border-radius: 2px; backdrop-filter: blur(12px); transition: background 0.2s;
}
.koidula-btn-ghost:hover { background: rgba(255,255,255,0.2); color: #fff !important; }

/* ==========================================================================
   NATIVE IMAGE WIDGET OVERRIDES
   ========================================================================== */
.koidula-img-264 img { height: 264px !important; object-fit: cover !important; width: 100% !important; border-radius: 2px !important; }
.koidula-card-img img { height: 256px !important; object-fit: cover !important; width: 100% !important; }
.koidula-viimistlus-img img { height: 192px !important; object-fit: cover !important; width: 100% !important; border-radius: 2px !important; }

/* ==========================================================================
   HOUSE TYPE CARDS
   ========================================================================== */
.koidula-house-card { overflow: hidden; transition: box-shadow 0.3s !important; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.koidula-house-card:hover { box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important; }
.koidula-text-btn .elementor-button { background: transparent !important; color: var(--emerald-600) !important; padding: 0 !important; border: none !important; font-weight: 500 !important; }
.koidula-text-btn .elementor-button:hover { color: var(--emerald-700) !important; }
.koidula-text-btn .elementor-button::after { content: ' →'; }

/* ==========================================================================
   BENEFIT & VIIMISTLUS CARDS
   ========================================================================== */
.koidula-benefit-card { box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.koidula-viimistlus-card { box-shadow: 0 1px 3px rgba(0,0,0,0.05); overflow: hidden; }
.koidula-viimistlus-premium { position: relative; }

/* ==========================================================================
   GOOGLE MAPS EMBED
   ========================================================================== */
.koidula-map-embed { border-radius: 2px; overflow: hidden; height: 500px; }
.koidula-map-embed iframe { width: 100%; height: 100%; border: 0; }

/* ==========================================================================
   INTERACTIVE MAP SECTION — [koidula_map] shortcode
   ========================================================================== */
.koidula-map-section { padding: 96px 0; background: var(--stone-900); color: #fff; }
.koidula-map-section .section-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.koidula-map-section .section-header { margin-bottom: 64px; }
.koidula-map-section .section-header h2 { font-size: clamp(1.875rem, 4vw, 3rem); font-weight: 300; margin: 0 0 24px; color: #fff; }
.koidula-map-section .section-header p { color: var(--stone-400); font-size: 1.125rem; max-width: 672px; margin: 0; line-height: 1.7; }

.koidula-map-grid { display: grid; grid-template-columns: 1fr; gap: 40px; }
@media (min-width: 1024px) { .koidula-map-grid { grid-template-columns: 2fr 1fr; } }

.koidula-map-container {
  background: var(--stone-800); border-radius: 8px; overflow: hidden;
  border: 1px solid var(--stone-700); position: relative; line-height: 0; font-size: 0;
}
.koidula-map-container img.map-bg { display: block; width: 100%; height: auto; }
.koidula-map-container svg.map-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Polygons — uses data-status attribute */
.house-polygon { fill: transparent; stroke: transparent; stroke-width: 0; cursor: pointer; transition: fill 0.3s, stroke 0.3s, stroke-width 0.3s; }
.house-polygon[data-status="Saadaval"]:hover, .house-polygon[data-status="Saadaval"].active { fill: rgba(16,185,129,0.45); stroke: var(--emerald-400); stroke-width: 4; }
.house-polygon[data-status="Broneeritud"]:hover, .house-polygon[data-status="Broneeritud"].active { fill: rgba(249,115,22,0.45); stroke: var(--orange-400); stroke-width: 4; }
.house-polygon[data-status="Müüdud"]:hover, .house-polygon[data-status="Müüdud"].active { fill: rgba(239,68,68,0.45); stroke: var(--red-400); stroke-width: 4; }
.house-polygon[data-status="Tulekul"]:hover, .house-polygon[data-status="Tulekul"].active { fill: rgba(120,113,108,0.45); stroke: var(--stone-400); stroke-width: 4; }
.house-polygon[data-status="Saadaval"].active { fill: rgba(16,185,129,0.6); }
.house-polygon[data-status="Broneeritud"].active { fill: rgba(249,115,22,0.6); }
.house-polygon[data-status="Müüdud"].active { fill: rgba(239,68,68,0.6); }
.house-polygon[data-status="Tulekul"].active { fill: rgba(120,113,108,0.6); }
.house-label { fill: #fff; font-size: 32px; font-weight: 700; pointer-events: none; }

/* Legend */
.koidula-map-legend { position: absolute; bottom: 16px; left: 16px; background: rgba(28,25,23,0.8); backdrop-filter: blur(8px); padding: 16px; border-radius: 4px; display: flex; gap: 16px; flex-wrap: wrap; border: 1px solid var(--stone-700); font-size: 0.875rem; line-height: normal; }
.legend-item { display: flex; align-items: center; gap: 8px; color: #fff; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; }
.legend-dot.saadaval    { background: rgba(16,185,129,0.5); border: 1px solid var(--emerald-500); }
.legend-dot.broneeritud { background: rgba(249,115,22,0.5); border: 1px solid var(--orange-500); }
.legend-dot.muudud      { background: rgba(239,68,68,0.5);  border: 1px solid var(--red-500); }
.legend-dot.tulekul     { background: rgba(120,113,108,0.5);border: 1px solid var(--stone-500); }

/* Detail panel */
.koidula-detail-panel { background: rgba(6,78,59,0.3); border: 1px solid rgba(6,95,70,0.5); border-radius: 8px; padding: 24px; display: flex; flex-direction: column; justify-content: space-between; min-height: 400px; }
.koidula-detail-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; color: rgba(209,250,229,0.7); padding: 80px 0; }
.koidula-detail-empty svg { margin-bottom: 16px; opacity: 0.5; }
.koidula-detail-empty p { font-size: 1.125rem; margin: 0; }
.koidula-detail-content { display: none; }
.koidula-detail-content.visible { display: flex; flex-direction: column; justify-content: space-between; height: 100%; }
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.detail-header h3 { font-size: 1.5rem; font-weight: 700; color: #fff; margin: 0 0 4px; }
.detail-header .detail-type { color: var(--emerald-400); font-weight: 500; margin: 0; }
.status-badge { padding: 4px 12px; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.status-badge.saadaval    { background: rgba(16,185,129,0.2); color: var(--emerald-300); border: 1px solid rgba(16,185,129,0.3); }
.status-badge.broneeritud { background: rgba(249,115,22,0.2); color: var(--orange-400); border: 1px solid rgba(249,115,22,0.3); }
.status-badge.muudud      { background: rgba(239,68,68,0.2);  color: var(--red-400);     border: 1px solid rgba(239,68,68,0.3); }
.status-badge.tulekul     { background: rgba(120,113,108,0.2);color: var(--stone-300);   border: 1px solid rgba(120,113,108,0.3); }
.detail-rows { margin-bottom: 32px; }
.detail-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(68,64,60,0.5); }
.detail-row:last-child { border-bottom: none; padding-top: 12px; }
.detail-row .label { color: var(--stone-400); }
.detail-row .value { font-weight: 600; color: #fff; }
.detail-row .value.price { font-weight: 700; font-size: 1.25rem; color: var(--emerald-400); }
.detail-cta { display: block; width: 100%; padding: 12px; border-radius: 2px; border: none; font-weight: 500; font-size: 1rem; cursor: pointer; text-align: center; text-decoration: none; transition: background 0.2s; }
.detail-cta.available { background: var(--emerald-600); color: #fff; }
.detail-cta.available:hover { background: var(--emerald-500); color: #fff; }
.detail-cta.sold { background: var(--stone-700); color: var(--stone-500); cursor: not-allowed; }

/* ==========================================================================
   DATA TABLE
   ========================================================================== */
.koidula-table-wrap { margin-top: 40px; overflow-x: auto; }
.koidula-table { width: 100%; border-collapse: collapse; text-align: left; }
.koidula-table thead tr { border-bottom: 1px solid var(--stone-700); }
.koidula-table th { padding: 16px; font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--stone-400); }
.koidula-table td { padding: 16px; color: var(--stone-200); }
.koidula-table tbody tr { border-bottom: 1px solid var(--stone-800); cursor: pointer; transition: background 0.2s, box-shadow 0.2s; }
.koidula-table tbody tr:hover { background: var(--stone-800); }
.koidula-table tbody tr.active { background: rgba(6,78,59,0.4); box-shadow: inset 4px 0 0 var(--emerald-500); }
.koidula-table td:first-child { font-weight: 600; }
.table-status { display: flex; align-items: center; gap: 8px; }
.table-status-dot { width: 8px; height: 8px; border-radius: 50%; }
.table-status-dot.saadaval { background: var(--emerald-400); }
.table-status-dot.broneeritud { background: var(--orange-400); }
.table-status-dot.muudud { background: var(--red-400); }
.table-status-dot.tulekul { background: var(--stone-400); }
.table-status-text.saadaval { color: var(--emerald-400); }
.table-status-text.broneeritud { color: var(--orange-400); }
.table-status-text.muudud { color: var(--red-400); }
.table-status-text.tulekul { color: var(--stone-400); }

/* ==========================================================================
   CONTACT FORM 7 OVERRIDES
   ========================================================================== */
.koidula-cf7-wrap .wpcf7-form { display: flex; flex-direction: column; gap: 24px; }
.koidula-cf7-wrap .form-row-2col { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 768px) { .koidula-cf7-wrap .form-row-2col { grid-template-columns: 1fr 1fr; } }
.koidula-cf7-wrap label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--stone-700); margin-bottom: 8px; }
.koidula-cf7-wrap input[type="text"], .koidula-cf7-wrap input[type="email"], .koidula-cf7-wrap input[type="tel"], .koidula-cf7-wrap select, .koidula-cf7-wrap textarea {
  width: 100%; border: 1px solid var(--stone-300); padding: 12px 16px; border-radius: 2px; font-size: 1rem; font-family: inherit; transition: border-color 0.2s, box-shadow 0.2s; background: #fff;
}
.koidula-cf7-wrap input:focus, .koidula-cf7-wrap select:focus, .koidula-cf7-wrap textarea:focus { outline: none; border-color: transparent; box-shadow: 0 0 0 2px var(--emerald-500); }
.koidula-cf7-wrap input[type="submit"] { width: 100%; background: var(--emerald-600); color: #fff; font-weight: 500; padding: 16px; border: none; border-radius: 2px; font-size: 1rem; cursor: pointer; }
.koidula-cf7-wrap input[type="submit"]:hover { background: var(--emerald-700); }

/* ==========================================================================
   ELEMENTOR CANVAS
   ========================================================================== */
body.elementor-template-canvas { padding: 0; margin: 0; }

/* ==========================================================================
   SINGLE HOUSE PAGE (single-maja.php)
   ========================================================================== */
.koidula-house-header {
  background: rgba(255,255,255,0.95); backdrop-filter: blur(8px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 16px 0;
  position: fixed; width: 100%; z-index: 999; top: 0;
}
.koidula-house-header-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; display: flex; justify-content: space-between; align-items: center; }
.koidula-house-header .koidula-logo { font-weight: 700; font-size: 1.5rem; letter-spacing: -0.05em; color: var(--emerald-900); text-decoration: none; }
.koidula-house-header .koidula-logo span { color: var(--emerald-500); }
.koidula-back-link { color: var(--stone-500); text-decoration: none; font-weight: 500; display: flex; align-items: center; gap: 8px; transition: color 0.2s; }
.koidula-back-link:hover { color: var(--emerald-600); }

.koidula-house-main { padding: 128px 24px 64px; max-width: 1280px; margin: 0 auto; }
.koidula-house-title-row { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--stone-200); padding-bottom: 24px; margin-bottom: 32px; flex-wrap: wrap; gap: 16px; }
.koidula-house-title-row h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 300; color: var(--stone-900); margin: 0; }
.koidula-house-status { font-size: 0.875rem; padding: 4px 16px; border-radius: 2px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.koidula-house-status.saadaval    { background: var(--emerald-100); color: var(--emerald-700); }
.koidula-house-status.broneeritud { background: var(--orange-100); color: var(--orange-700); }
.koidula-house-status.tulekul     { background: var(--stone-200); color: var(--stone-700); }
.koidula-house-status.muudud      { background: var(--red-100); color: var(--red-700); }

/* Gallery */
.koidula-gallery-main { max-height: 600px; overflow: hidden; border-radius: 2px; margin-bottom: 16px; background: var(--stone-200); display: flex; align-items: center; justify-content: center; }
.koidula-gallery-main img { max-width: 100%; max-height: 600px; width: auto; height: auto; object-fit: contain; transition: opacity 0.3s; display: block; }
.koidula-gallery-thumbs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 64px; }
@media (max-width: 767px) { .koidula-gallery-thumbs { grid-template-columns: repeat(4, 1fr); } }
.koidula-gallery-thumb { aspect-ratio: 4/3; overflow: hidden; border-radius: 2px; cursor: pointer; border: 2px solid transparent; opacity: 0.6; transition: all 0.3s; }
.koidula-gallery-thumb:hover, .koidula-gallery-thumb.active { opacity: 1; }
.koidula-gallery-thumb.active { border-color: var(--emerald-500); }
.koidula-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* 2-column details */
.koidula-house-details { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; }
@media (max-width: 991px) { .koidula-house-details { grid-template-columns: 1fr; gap: 32px; } }

.koidula-features-list { list-style: none; padding: 0; margin: 0 0 40px 0; }
.koidula-features-list li { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; color: var(--stone-700); font-weight: 500; }
.koidula-features-list li svg { color: var(--emerald-500); flex-shrink: 0; margin-top: 2px; }

.koidula-action-btn { display: flex; justify-content: space-between; align-items: center; background: #fff; color: var(--stone-800); padding: 16px 24px; border-radius: 2px; border: 1px solid var(--stone-200); box-shadow: 0 1px 3px rgba(0,0,0,0.05); font-weight: 500; text-decoration: none; transition: background 0.2s; margin-bottom: 12px; }
.koidula-action-btn:hover { background: var(--stone-100); }

.koidula-spec-table { background: #fff; border: 1px solid var(--stone-200); border-radius: 2px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.koidula-spec-table table { width: 100%; text-align: left; border-collapse: collapse; }
.koidula-spec-table tr { border-bottom: 1px solid var(--stone-100); }
.koidula-spec-table tr:last-child { border-bottom: none; }
.koidula-spec-table tr:nth-child(even) { background: var(--stone-50); }
.koidula-spec-table td { padding: 20px; font-weight: 600; }
.koidula-spec-table td:first-child { color: var(--stone-500); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.875rem; width: 50%; }
.koidula-spec-table td:last-child { color: var(--stone-900); text-align: right; }
.koidula-spec-price { color: var(--emerald-600) !important; font-size: 1.25rem !important; }

.koidula-house-cta-btn { display: block; width: 100%; margin-top: 32px; background: var(--emerald-600); color: #fff; padding: 12px; border-radius: 2px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.875rem; text-align: center; text-decoration: none; transition: background 0.2s; border: none; cursor: pointer; }
.koidula-house-cta-btn:hover { background: var(--emerald-500); color: #fff; }

/* Contact wrapper reused on house pages */
.koidula-contact-grid { display: grid; grid-template-columns: 2fr 3fr; background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); overflow: hidden; min-height: 500px; }
@media (max-width: 768px) { .koidula-contact-grid { grid-template-columns: 1fr !important; } }

/* Footer reused */
.koidula-footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; color: #a8a29e; font-size: .875rem; }
@media (max-width: 768px) { .koidula-footer-grid { grid-template-columns: 1fr !important; } }
.koidula-footer-grid a { color: #a8a29e; text-decoration: none; transition: color 0.2s; }
.koidula-footer-grid a:hover { color: var(--emerald-400); }

/* Hide Astra default wrappers on house pages */
.single-maja .ast-primary-header-bar { display: none !important; }
.single-maja #masthead { display: none !important; }
.single-maja .ast-above-header, .single-maja .ast-below-header { display: none !important; }
.single-maja .site-content > .ast-container { max-width: 100% !important; padding: 0 !important; }
.single-maja .ast-article-single { padding: 0 !important; margin: 0 !important; }
.single-maja .entry-header { display: none; }
.single-maja .ast-separate-container .ast-article-single { padding: 0 !important; }
.single-maja .ast-separate-container { background: transparent !important; }
