/* InmoInvestor Pro - High End Obsidian & Gold Luxury Theme */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@500;700&display=swap');

:root {
  --bg-dark: #0b0f17;
  --bg-card: rgba(18, 24, 38, 0.85);
  --bg-card-hover: rgba(26, 34, 52, 0.95);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(212, 175, 55, 0.3);
  
  --primary-gold: #d4af37;
  --primary-gold-light: #f3e5ab;
  --emerald-accent: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.2);
  --cyan-accent: #06b6d4;
  --rose-accent: #f43f5e;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  
  --shadow-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(212, 175, 55, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(6, 182, 212, 0.03) 0px, transparent 70%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-main);
  line-height: 1.6;
  min-height: 100vh;
}

/* Header Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2.5rem;
  background: rgba(11, 15, 23, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary-gold), #aa8010);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #ffffff, var(--primary-gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Quota Badge */
.quota-badge {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  background: rgba(18, 24, 38, 0.9);
  padding: 0.5rem 1.2rem;
  border-radius: 50px;
  border: 1px solid var(--border-gold);
}

.quota-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.quota-pill {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-accent);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-weight: 700;
  font-family: var(--font-display);
}

/* Container */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 2.5rem;
}

/* Preference Intelligence Bar */
.preferences-bar {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.2rem 1.8rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: var(--shadow-card);
}

.pref-info {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.pref-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

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

.pref-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.pref-chip.gold {
  border-color: var(--border-gold);
  color: var(--primary-gold-light);
  background: rgba(212, 175, 55, 0.08);
}

.pref-chip.emerald {
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--emerald-accent);
  background: rgba(16, 185, 129, 0.08);
}

/* Buttons */
.btn {
  padding: 0.65rem 1.3rem;
  border-radius: 10px;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  border: none;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-gold), #b89320);
  color: #0b0f17;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--rose-accent);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.25);
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.city-filter-tabs {
  display: flex;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.3rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.filter-tab {
  padding: 0.4rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab.active {
  background: var(--primary-gold);
  color: var(--bg-dark);
}

/* Grid of Cards */
.opportunities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1.8rem;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-6px);
  border-color: var(--border-gold);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(212, 175, 55, 0.15);
}

.card-image-wrapper {
  position: relative;
  height: 220px;
  overflow: hidden;
}

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

.card:hover .card-image {
  transform: scale(1.05);
}

.badge-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 0.5rem;
}

.badge {
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-city {
  background: rgba(11, 15, 23, 0.85);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.badge-yield {
  background: rgba(16, 185, 129, 0.9);
  color: #0b0f17;
  font-weight: 800;
}

.match-score-pill {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(11, 15, 23, 0.9);
  border: 1px solid var(--border-gold);
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-gold-light);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

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

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.4;
  color: #ffffff;
}

.card-price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}

.card-price {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-gold-light);
}

.card-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 1.2rem;
}

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

.metric-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.metric-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.metric-value.emerald {
  color: var(--emerald-accent);
}

.highlights-list {
  margin-bottom: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.highlight-item {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.card-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: auto;
}

.card-actions .btn {
  flex: 1;
  justify-content: center;
}

/* Rejection Warning Banner */
.rejection-banner {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  color: var(--rose-accent);
}

/* Modal / Drawer */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #0f1523;
  border: 1px solid var(--border-gold);
  border-radius: 24px;
  width: 92%;
  max-width: 1100px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
  position: relative;
  animation: modalSlideUp 0.3s ease-out;
}

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

.modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Before / After Render Comparison */
.render-comparison-box {
  margin: 1.5rem 0;
  background: rgba(0,0,0,0.3);
  border-radius: 16px;
  padding: 1.2rem;
  border: 1px solid var(--border-color);
}

.render-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.render-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.render-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.render-img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

/* Reform Table */
.reform-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.88rem;
}

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

.reform-table th {
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

/* Financial Calculator Sliders */
.calc-panel {
  background: rgba(16, 185, 129, 0.04);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 16px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.slider-group {
  margin-bottom: 1.2rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary-gold);
  cursor: pointer;
}

/* Rules List */
.rules-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin: 1rem 0;
}

.rule-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--primary-gold);
  color: #fff;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow-glow);
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}

/* Idealista Brand Button */
.btn-idealista {
  background: linear-gradient(135deg, #b0ec00, #88be00);
  color: #0b0f17;
  font-weight: 800;
  border: none;
  box-shadow: 0 4px 15px rgba(176, 236, 0, 0.3);
  text-decoration: none;
}

.btn-idealista:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(176, 236, 0, 0.5);
  color: #000;
}

/* Full Photo Gallery Carousel */
.photo-gallery-box {
  margin: 1.5rem 0;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 1.2rem;
}

.gallery-stage {
  position: relative;
  width: 100%;
  height: 420px;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 0.8rem;
  background: #000;
}

.gallery-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.gallery-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(11, 15, 23, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  z-index: 10;
  transition: all 0.2s;
}

.gallery-nav-btn:hover {
  background: var(--primary-gold);
  color: #0b0f17;
}

.gallery-nav-btn.prev { left: 12px; }
.gallery-nav-btn.next { right: 12px; }

.gallery-counter {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(11, 15, 23, 0.85);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  border: 1px solid var(--border-color);
}

.gallery-thumbnails {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
}

.thumb-item {
  width: 90px;
  height: 65px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  opacity: 0.6;
  transition: all 0.2s;
}

.thumb-item.active, .thumb-item:hover {
  border-color: var(--primary-gold);
  opacity: 1;
  transform: scale(1.03);
}


/* ==========================================================================
   MOBILE & TABLET RESPONSIVE DESIGN (Media Queries)
   ========================================================================== */

@media (max-width: 992px) {
  .main-container {
    padding: 1.5rem 1.2rem;
  }

  .opportunities-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.2rem;
  }

  .render-grid {
    grid-template-columns: 1fr;
  }
  
  .render-img {
    height: 230px;
  }
}

@media (max-width: 768px) {
  /* Navbar Mobile */
  .navbar {
    padding: 0.9rem 1.2rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
  }

  .brand {
    justify-content: center;
  }

  .brand-icon {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }

  .brand-text h1 {
    font-size: 1.2rem;
  }

  .quota-badge {
    justify-content: center;
    flex-wrap: wrap;
    padding: 0.6rem 0.8rem;
    border-radius: 16px;
    gap: 0.6rem;
  }

  .quota-item {
    font-size: 0.78rem;
  }

  .quota-item[style*="border-left"] {
    border-left: none !important;
    padding-left: 0 !important;
  }

  /* Preferences Bar Mobile */
  .preferences-bar {
    padding: 1rem;
    border-radius: 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .pref-info {
    gap: 0.8rem;
    flex-direction: column;
    align-items: flex-start;
  }

  .pref-group {
    width: 100%;
    justify-content: space-between;
  }

  .preferences-bar > div:last-child {
    flex-direction: column;
    width: 100%;
  }

  .preferences-bar .btn {
    width: 100%;
    justify-content: center;
  }

  /* Section Header & City Tabs Mobile */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }

  .section-title {
    font-size: 1.2rem;
  }

  .city-filter-tabs {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    display: flex;
    padding: 0.3rem;
    -webkit-overflow-scrolling: touch;
  }

  .filter-tab {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
  }

  /* Opportunities Grid Mobile (1 Column) */
  .opportunities-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }

  .card-image-wrapper {
    height: 190px;
  }

  .card-content {
    padding: 1.2rem;
  }

  .card-title {
    font-size: 1.05rem;
  }

  .card-price {
    font-size: 1.35rem;
  }

  .card-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .card-actions .btn {
    width: 100%;
  }

  /* Modal Mobile */
  .modal-content {
    width: 95%;
    max-height: 94vh;
    padding: 1.2rem 1rem;
    border-radius: 18px;
  }

  .modal-close {
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
  }

  /* Gallery Mobile */
  .gallery-stage {
    height: 250px;
  }

  .gallery-nav-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .gallery-counter {
    font-size: 0.72rem;
    padding: 0.2rem 0.6rem;
  }

  .thumb-item {
    width: 70px;
    height: 50px;
  }

  /* Inspección 2 cols to 1 col */
  .modal-content div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .calc-panel {
    padding: 1rem;
  }

  .calc-panel div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Reform Table Overflow */
  .reform-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .reform-table {
    font-size: 0.8rem;
  }

  .reform-table th, .reform-table td {
    padding: 0.6rem 0.6rem;
  }
}

@media (max-width: 480px) {
  .brand-text p {
    font-size: 0.65rem;
  }

  .card-metrics {
    grid-template-columns: 1fr 1fr 1fr;
    padding: 0.6rem;
    gap: 0.3rem;
  }

  .metric-label {
    font-size: 0.62rem;
  }

  .metric-value {
    font-size: 0.8rem;
  }

  .gallery-stage {
    height: 210px;
  }

  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    font-size: 0.85rem;
  }
}


