/* ====================================================================
   chmuto-houses Modern Styling (Telegram Mini App & Web Portal)
   ==================================================================== */

:root {
  --bg-primary: #090d16;
  --bg-card: #131d2e;
  --bg-card-hover: #1e2c44;
  --bg-input: #0b1322;
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-dim: #94a3b8;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.25);
  --accent-hover: #0284c7;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: #23354f;
  --border-light: rgba(255, 255, 255, 0.12);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

body.in-telegram {
  --bg-primary: var(--tg-theme-bg-color, #090d16);
  --bg-card: var(--tg-theme-secondary-bg-color, #131d2e);
  --text-main: var(--tg-theme-text-color, #f8fafc);
  --text-muted: var(--tg-theme-hint-color, #cbd5e1);
  --accent: var(--tg-theme-button-color, #38bdf8);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: 90px;
  line-height: 1.5;
  padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Ecosystem Top Bar */
.ecosystem-bar {
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.ecosystem-links {
  display: flex;
  gap: 14px;
}

.ecosystem-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.ecosystem-links a.active, .ecosystem-links a:hover {
  color: var(--accent);
}

.currency-selector {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.curr-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.curr-btn.active {
  background: var(--accent);
  color: #090d16;
}

/* Hero Section */
.hero {
  position: relative;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.12) 0%, rgba(9, 13, 22, 0) 100%);
  border-radius: var(--radius-lg);
  padding: 32px 20px 24px;
  text-align: center;
  margin: 16px 0 20px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.wind-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  padding: 4px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}

h1 {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #ffffff 30%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 600px;
  margin: 0 auto 18px;
}

/* Perks Grid */
.perks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.perk-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.perk-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.perk-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.perk-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Filter / Dates Card */
.filter-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.date-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn:hover, .preset-btn:active {
  background: var(--accent);
  color: #090d16;
  border-color: var(--accent);
}

.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.input-group input, .input-group select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.input-group input:focus, .input-group select:focus {
  border-color: var(--accent);
}

/* Navigation Tabs */
.tabs-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 20px;
  scrollbar-width: none;
}
.tabs-container::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 9px 18px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #090d16;
  font-weight: 800;
}

/* Rooms Grid & Cards */
.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 20px;
}

.room-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s;
}

.room-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
}

/* Room Photo Showcase & Mini-slider */
.room-photo-wrapper {
  position: relative;
  width: 100%;
  height: 210px;
  background: #000;
  overflow: hidden;
  cursor: pointer;
}

.room-photo-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.room-photo-wrapper:hover img {
  transform: scale(1.03);
}

.photo-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
}

/* Photo Dots Indicator on Card */
.photo-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  padding: 4px 8px;
  border-radius: 9999px;
  z-index: 10;
}

.photo-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.2s;
}

.photo-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

.photo-count {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.room-content {
  padding: 16px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.house-tag {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.room-title {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}

.room-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 12px;
}

.amenities-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
}

.amenity-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 6px;
  color: #e2e8f0;
}

.room-footer {
  padding: 14px 16px;
  background: rgba(9, 13, 22, 0.6);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.price-box {
  display: flex;
  flex-direction: column;
}

.price-main {
  font-size: 19px;
  font-weight: 800;
  color: #fff;
}

.price-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-book {
  background: var(--accent);
  color: #090d16;
  border: none;
  font-size: 13px;
  font-weight: 800;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-book:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-book:active {
  transform: scale(0.97);
}

/* Houses Overview Cards */
.house-overview-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}

.house-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.house-status-badge.active { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.house-status-badge.coming_soon { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.house-status-badge.draft { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

/* Lightbox Modal with Next/Prev Controls */
.lightbox-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.93);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.lightbox-content {
  position: relative;
  max-width: 92vw;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px rgba(0,0,0,0.8);
}

.lightbox-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 1001;
}

.lightbox-btn:hover {
  background: var(--accent);
  color: #090d16;
  border-color: var(--accent);
}

.lightbox-btn.prev { left: -20px; }
.lightbox-btn.next { right: -20px; }

@media (max-width: 600px) {
  .lightbox-btn.prev { left: 10px; }
  .lightbox-btn.next { right: 10px; }
}

.lightbox-close {
  position: absolute;
  top: -45px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 999;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  padding: 24px;
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
}

.booking-summary {
  background: rgba(9, 13, 22, 0.6);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 16px;
  font-size: 13.5px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  color: var(--text-muted);
}

.summary-row.total {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 8px;
  font-weight: 800;
  color: #fff;
  font-size: 16px;
}

.floorplan-wrapper {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 14px;
  overflow: hidden;
  margin-bottom: 24px;
  cursor: pointer;
}
.floorplan-wrapper svg, .floorplan-wrapper img {
  width: 100%;
  height: auto;
  display: block;
}
