/* ============================================
   ECODIVINO - DISEÑO PROFESIONAL REAL ESTATE
   Tonos Azules - Promoción El Tigre
   ============================================ */

/* Variables CSS - Paleta Azul Profesional */
:root {
  /* Azules principales */
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a8a;
  --blue-950: #172554;
  
  /* Colores principales */
  --primary: var(--blue-600);
  --primary-dark: var(--blue-700);
  --primary-light: var(--blue-500);
  --accent: var(--blue-500);
  
  /* Fondos */
  --bg-white: #ffffff;
  --bg-gray-50: #f9fafb;
  --bg-gray-100: #f3f4f6;
  
  /* Texto */
  --text-900: #111827;
  --text-700: #374151;
  --text-500: #6b7280;
  --text-400: #9ca3af;
  
  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Espaciado */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-900);
  background: var(--bg-white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* ============================================
   HEADER
   ============================================ */
.appbar {
  background: linear-gradient(135deg, var(--blue-700) 0%, var(--blue-800) 100%);
  color: white;
  padding: var(--space-4) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.appbar h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.appbar .subtitle {
  font-size: 0.875rem;
  opacity: 0.9;
  font-weight: 400;
  margin-top: 2px;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: var(--space-2) var(--space-3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   HERO SECTION - EL TIGRE
   ============================================ */
.hero-section {
  background: linear-gradient(135deg, var(--blue-600) 0%, var(--blue-800) 100%);
  color: white;
  padding: var(--space-16) var(--space-6);
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse"><path d="M 40 0 L 0 0 0 40" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  opacity: 0.3;
}

.hero-content {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-text {
  animation: fadeInUp 0.6s ease;
}

.hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  padding: var(--space-2) var(--space-4);
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: var(--space-4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: var(--space-4);
  letter-spacing: -0.03em;
}

.hero-description {
  font-size: 1.125rem;
  opacity: 0.95;
  margin-bottom: var(--space-6);
  line-height: 1.7;
}

.hero-features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.hero-feature {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.hero-feature svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.hero-feature span {
  font-size: 0.9375rem;
  font-weight: 500;
}

.hero-cta {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.btn-hero-primary {
  background: white;
  color: var(--blue-700);
  padding: var(--space-4) var(--space-8);
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  display: inline-block;
}

.btn-hero-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.btn-hero-secondary {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  color: white;
  padding: var(--space-4) var(--space-8);
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
}

.btn-hero-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

.hero-image {
  position: relative;
  animation: fadeInRight 0.6s ease;
}

.hero-image-container {
  background: white;
  border-radius: 16px;
  padding: var(--space-4);
  box-shadow: var(--shadow-xl);
  position: relative;
  overflow: hidden;
}

.hero-image-container::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(37, 99, 235, 0.1), transparent);
  animation: shine 3s infinite;
}

@keyframes shine {
  0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.hero-image-container img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  position: relative;
  z-index: 1;
}

.hero-image-badge {
  position: absolute;
  top: var(--space-6);
  right: var(--space-6);
  background: var(--blue-600);
  color: white;
  padding: var(--space-2) var(--space-4);
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  z-index: 2;
  box-shadow: var(--shadow-md);
}

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

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================
   BÚSQUEDA Y FILTROS
   ============================================ */
.search-section {
  background: var(--bg-gray-50);
  padding: var(--space-8) var(--space-6);
  border-bottom: 1px solid var(--blue-200);
}

.search-input {
  width: 100%;
  padding: var(--space-4) var(--space-5);
  border: 2px solid var(--blue-200);
  border-radius: 12px;
  font-size: 1rem;
  background: white;
  margin-bottom: var(--space-4);
  transition: all 0.2s;
  font-family: inherit;
}

.search-input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-chips {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  padding: var(--space-2) var(--space-5);
  border: 2px solid var(--blue-200);
  border-radius: 24px;
  background: white;
  color: var(--text-700);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s;
}

.chip:hover {
  border-color: var(--blue-400);
  background: var(--blue-50);
}

.chip.active {
  background: var(--blue-600);
  color: white;
  border-color: var(--blue-600);
}

/* ============================================
   CONTENIDO PRINCIPAL
   ============================================ */
.main-content {
  padding: var(--space-12) var(--space-6);
  background: var(--bg-white);
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-900);
  margin-bottom: var(--space-8);
  text-align: center;
  letter-spacing: -0.02em;
}

/* Loading */
.loading {
  text-align: center;
  padding: var(--space-16);
}

.spinner {
  border: 4px solid var(--blue-100);
  border-top: 4px solid var(--blue-600);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 0.8s linear infinite;
  margin: 0 auto var(--space-4);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Grid de terrenos */
.terrenos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
}

/* Card de terreno */
.terreno-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s;
  cursor: pointer;
  border: 1px solid var(--blue-100);
}

.terreno-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--blue-300);
}

.image-container {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
  background: var(--bg-gray-100);
}

.terreno-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

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

.terreno-badge {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: var(--blue-600);
  color: white;
  padding: var(--space-1) var(--space-3);
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: var(--shadow);
}

.terreno-content {
  padding: var(--space-5);
}

.terreno-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-900);
  margin-bottom: var(--space-2);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.terreno-location {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-500);
  font-size: 0.875rem;
  margin-bottom: var(--space-4);
}

.terreno-location svg {
  width: 16px;
  height: 16px;
  color: var(--blue-500);
}

.terreno-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-4);
  border-top: 1px solid var(--blue-100);
}

.terreno-area {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-700);
  font-size: 0.875rem;
  font-weight: 500;
}

.terreno-area svg {
  width: 16px;
  height: 16px;
  color: var(--blue-500);
}

.terreno-price {
  color: var(--blue-600);
  font-size: 1.25rem;
  font-weight: 700;
}

/* Estado vacío */
.empty-state {
  text-align: center;
  padding: var(--space-16);
  color: var(--text-500);
}

.empty-state svg {
  margin-bottom: var(--space-4);
  color: var(--text-400);
}

.empty-state h2 {
  margin-bottom: var(--space-4);
  color: var(--text-700);
}

/* Banner inferior */
.bottom-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, var(--blue-700) 0%, var(--blue-800) 100%);
  color: white;
  padding: var(--space-3) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
  z-index: 50;
  font-size: 0.875rem;
}

.bottom-banner a {
  background: white;
  color: var(--blue-700);
  padding: var(--space-2) var(--space-4);
  border-radius: 20px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
}

.bottom-banner a:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--blue-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--text-900);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-500);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
}

.close-btn:hover {
  background: var(--bg-gray-100);
  color: var(--text-900);
}

.modal-body {
  padding: var(--space-6);
}

.form-group {
  margin-bottom: var(--space-5);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 600;
  color: var(--text-700);
  font-size: 0.875rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: var(--space-3);
  border: 2px solid var(--blue-200);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-footer {
  padding: var(--space-6);
  border-top: 1px solid var(--blue-100);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* Botones */
.btn-primary {
  background: var(--blue-600);
  color: white;
  border: none;
  padding: var(--space-3) var(--space-6);
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  background: var(--blue-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: white;
  color: var(--blue-600);
  border: 2px solid var(--blue-600);
  padding: var(--space-3) var(--space-6);
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--blue-50);
}

/* Responsive */
@media (max-width: 968px) {
  .hero-content {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
  
  .hero-title {
    font-size: 2.25rem;
  }
  
  .hero-features {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .hero-section {
    padding: var(--space-10) var(--space-4);
  }
  
  .hero-title {
    font-size: 1.875rem;
  }
  
  .terrenos-grid {
    grid-template-columns: 1fr;
  }
  
  .container {
    padding: 0 var(--space-4);
  }
}

/* ============================================
   CHATBOT
   ============================================ */
.chatbot-widget {
  position: fixed;
  bottom: 80px; /* Espacio suficiente para el bottom-banner */
  right: var(--space-6);
  z-index: 9999;
  font-family: inherit;
}

.chatbot-button {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--blue-600) 0%, var(--blue-700) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s;
  position: relative;
}

.chatbot-button:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-xl);
}

.chatbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  border: 2px solid white;
}

.chatbot-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 600px;
  max-height: calc(100vh - 120px);
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-widget.open .chatbot-window {
  display: flex;
  transform: translateY(0) scale(1);
  opacity: 1;
}

.chatbot-header {
  background: linear-gradient(135deg, var(--blue-600) 0%, var(--blue-700) 100%);
  color: white;
  padding: var(--space-4) var(--space-5);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chatbot-header-info h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 2px 0;
}

.chatbot-status {
  font-size: 0.75rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chatbot-status::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
}

.chatbot-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: var(--bg-gray-50);
}

.chatbot-message {
  display: flex;
  animation: fadeInUp 0.3s ease;
}

.chatbot-message.user {
  justify-content: flex-end;
}

.chatbot-message.bot {
  justify-content: flex-start;
}

.chatbot-message-content {
  max-width: 75%;
  padding: var(--space-3) var(--space-4);
  border-radius: 12px;
  font-size: 0.9375rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chatbot-message.user .chatbot-message-content {
  background: var(--blue-600);
  color: white;
  border-bottom-right-radius: 4px;
}

.chatbot-message.bot .chatbot-message-content {
  background: white;
  color: var(--text-900);
  border: 1px solid var(--blue-100);
  border-bottom-left-radius: 4px;
}

.chatbot-message.typing .chatbot-message-content {
  background: white;
  border: 1px solid var(--blue-100);
  padding: var(--space-4);
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--blue-400);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

.chatbot-input-container {
  padding: var(--space-4);
  background: white;
  border-top: 1px solid var(--blue-100);
  display: flex;
  gap: var(--space-2);
}

.chatbot-input {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--blue-200);
  border-radius: 12px;
  font-size: 0.9375rem;
  font-family: inherit;
  transition: all 0.2s;
}

.chatbot-input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chatbot-send {
  width: 44px;
  height: 44px;
  background: var(--blue-600);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chatbot-send:hover {
  background: var(--blue-700);
  transform: scale(1.05);
}

.chatbot-send:active {
  transform: scale(0.95);
}

/* Responsive Chatbot */
@media (max-width: 640px) {
  .chatbot-widget {
    bottom: 70px; /* Espacio para el bottom-banner en móvil */
    right: var(--space-4);
  }
  
  .chatbot-window {
    width: calc(100vw - 32px);
    max-width: 380px;
    height: calc(100vh - 100px);
    max-height: 600px;
    bottom: 80px;
    right: 0;
  }
  
  .chatbot-button {
    width: 56px;
    height: 56px;
  }
}
