/* ==========================================================================
   Di Prato Propiedades - Estilos Responsivos y Personalizados
   Adaptados para Celulares (iOS/Android), Tablets y Escritorio (Windows/Mac)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --dp-primary: #323e91;
  --dp-green: #0b8e36;
  --dp-red: #e30613;
  --dp-blue: #323e91;
  --dp-dark: #1f1b2d;
  --dp-light: #f8f9fa;
  --dp-border: #e9ecef;
  --dp-text: #1e293b;
  --dp-muted: #64748b;
}

/* Evitar scroll horizontal involuntario en móviles */
html, body {
  max-width: 100%;
  overflow-x: hidden;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--dp-text);
  background-color: #f8fafc;
  -webkit-font-smoothing: antialiased;
}

/* Imagen fluida general */
img {
  max-width: 100%;
  height: auto;
}

/* Navbar con línea superior de firma Di Prato */
.navbar-diprato {
  background-color: #ffffff;
  border-top: 3px solid var(--dp-primary);
  border-image: linear-gradient(90deg, #0b8e36 0%, #0b8e36 33.33%, #323e91 33.33%, #323e91 66.66%, #e30613 66.66%, #e30613 100%) 1;
  border-bottom: 1px solid var(--dp-border);
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.05);
}

/* Hero Banner Sobrio Inmobiliario (Regla 60-30-10: Azul profundo + sello tricolor fino) */
.hero-banner-diprato {
  background: linear-gradient(135deg, #111836 0%, #1d275e 55%, #2b388f 100%);
  color: #ffffff;
  border-radius: 1rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(17, 24, 54, 0.16);
}
.hero-banner-diprato::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0b8e36 0%, #0b8e36 33.33%, #ffffff 33.33%, #ffffff 66.66%, #e30613 66.66%, #e30613 100%);
  z-index: 2;
}
.hero-banner-diprato::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -8%;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(255,255,255,0.09) 0%, transparent 70%);
  pointer-events: none;
}
.hero-badge-diprato {
  background-color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.9);
  color: #1e293b;
  font-weight: 700;
  border-radius: 50rem;
  padding: 0.32rem 0.9rem;
  font-size: 0.78rem;
  letter-spacing: 0.1px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-decoration: none;
  white-space: nowrap;
}
.brand-di { color: var(--dp-green); }
.brand-prato { color: var(--dp-red); }
.brand-prop { color: var(--dp-blue); }

@media (max-width: 575.98px) {
  .brand-title {
    font-size: 1.1rem;
  }
  .navbar-diprato .navbar-brand img {
    width: 34px;
    height: 34px;
  }
}

/* Badges Armonizados para Fotografía Inmobiliaria */
.badge-operation {
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 0.35rem 0.65rem;
  border-radius: 5px;
  backdrop-filter: blur(4px);
}
.badge-venta {
  background-color: rgba(11, 142, 54, 0.94);
  color: #fff;
}
.badge-arriendo {
  background-color: rgba(40, 52, 138, 0.94);
  color: #fff;
}
.badge-type {
  background-color: rgba(15, 23, 42, 0.84);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.7rem;
}
.badge-condition {
  background-color: rgba(248, 250, 252, 0.92);
  color: #1e293b;
  font-size: 0.7rem;
}
.badge-destacada {
  background: linear-gradient(135deg, #b45309 0%, #d97706 100%);
  border: 1px solid rgba(254, 243, 199, 0.35);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
}

/* Títulos completos de hasta 2 líneas en tarjetas de catálogo */
.card-title-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
  min-height: 2.7em;
}

/* Property Cards */
.property-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid var(--dp-border);
  border-radius: 0.85rem;
  overflow: hidden;
  background: #fff;
}

@media (hover: hover) {
  .property-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(31, 27, 45, 0.09) !important;
  }
  .property-card:hover .card-img-container img {
    transform: scale(1.03);
  }
}

.card-img-container {
  position: relative;
  height: 220px;
  overflow: hidden;
  background-color: #f1f1f1;
}

@media (max-width: 575.98px) {
  .card-img-container {
    height: 200px;
  }
}

.card-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Carrusel interactivo de fotos en tarjeta de catálogo (estilo sitio original) */
.property-card-carousel {
  position: relative;
  width: 100%;
  height: 100%;
}
.property-card-carousel .carousel-inner {
  width: 100%;
  height: 100%;
}
.property-card-carousel .carousel-item {
  width: 100%;
  height: 100%;
  background-color: #f1f1f1;
}
.property-card-carousel .carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.card-carousel-btn {
  width: 32px;
  height: 32px;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(31, 27, 45, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
  z-index: 5;
  margin: 0 6px;
  padding: 0;
}
.property-card:hover .card-carousel-btn,
.card-img-container:hover .card-carousel-btn {
  opacity: 0.95;
}
@media (hover: none) {
  .card-carousel-btn {
    opacity: 0.9;
  }
}
.card-carousel-btn:hover {
  background-color: var(--dp-primary);
  border-color: #ffffff;
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}
.card-carousel-btn .carousel-btn-icon {
  color: #ffffff;
  font-size: 13px;
  line-height: 1;
}
.card-photo-counter {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  z-index: 4;
  pointer-events: none;
  backdrop-filter: blur(2px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-price {
  font-weight: 700;
  color: var(--dp-primary);
}

.card-price-primary {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dp-primary);
  line-height: 1.2;
}

.card-price-secondary {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--dp-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.card-features {
  display: flex;
  justify-content: space-around;
  border-top: 1px solid var(--dp-border);
  padding: 0.65rem 0.5rem;
  font-size: 0.85rem;
  color: var(--dp-muted);
  background-color: #fafbfc;
}
.card-features span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Filtros Sidebar & Offcanvas */
.filters-box {
  background: #ffffff;
  border: 1px solid var(--dp-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
}

@media (max-width: 991.98px) {
  .filters-offcanvas {
    width: 320px !important;
    max-width: 85vw !important;
  }
  .filters-offcanvas .offcanvas-body {
    padding: 1.25rem;
  }
}

/* ==========================================================================
   Galería de Fotos Principal en Ficha de Propiedad (propiedad.php)
   ========================================================================== */
.property-gallery-container {
  width: 100%;
}

.property-carousel {
  position: relative;
  background-color: #0b1120;
  border-radius: 0.85rem;
  overflow: hidden;
}

.gallery-slide-stage {
  width: 100%;
  height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #1e293b 0%, #0b1120 100%);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

@media (max-width: 991.98px) {
  .gallery-slide-stage {
    height: 400px;
  }
}

@media (max-width: 575.98px) {
  .gallery-slide-stage {
    height: 280px;
  }
}

.gallery-slide-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.3s ease;
  user-select: none;
}

.gallery-slide-stage:hover .gallery-slide-img {
  transform: scale(1.015);
}

/* Botones laterales para mover al lado (Izquierda / Derecha) */
.gallery-arrow-btn {
  width: 14%;
  max-width: 70px;
  opacity: 0.9;
  transition: all 0.25s ease;
  z-index: 5;
  background: transparent;
  border: 0;
}

.gallery-arrow-btn:hover {
  opacity: 1;
}

.gallery-arrow-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: rgba(15, 23, 42, 0.82);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
}

.gallery-arrow-btn:hover .gallery-arrow-icon {
  background-color: var(--dp-primary);
  border-color: #ffffff;
  transform: scale(1.1);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.6);
}

@media (max-width: 575.98px) {
  .gallery-arrow-btn {
    width: 45px;
  }
  .gallery-arrow-icon {
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
  }
}

/* Contador flotante de fotos (ej: 1 / 5) */
.gallery-counter-badge {
  position: absolute;
  bottom: 15px;
  left: 15px;
  background: rgba(15, 23, 42, 0.82);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 30px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  z-index: 6;
  pointer-events: none;
}

/* Botón Pantalla Completa */
.gallery-fullscreen-btn {
  position: absolute;
  bottom: 15px;
  right: 15px;
  background: rgba(15, 23, 42, 0.82);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 30px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  z-index: 6;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gallery-fullscreen-btn:hover {
  background: var(--dp-primary);
  color: #ffffff;
  border-color: #ffffff;
  transform: translateY(-1px);
}

/* ==========================================================================
   Tira de Miniaturas Inferior (100% Horizontal, NUNCA hacia abajo)
   ========================================================================== */
.thumbnail-strip-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  padding: 8px 10px;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.thumbnail-strip {
  display: flex !important;
  flex-wrap: nowrap !important; /* Estricto: NUNCA hacer wrap hacia abajo */
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px;
  width: 100%;
}

.thumbnail-strip::-webkit-scrollbar {
  height: 5px;
}
.thumbnail-strip::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.thumbnail-strip::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.thumbnail-strip::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.thumb-item {
  flex: 0 0 100px;
  width: 100px;
  height: 68px;
  border-radius: 0.5rem;
  overflow: hidden;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: all 0.2s ease;
  opacity: 0.65;
  background: #0f172a;
}

@media (max-width: 575.98px) {
  .thumb-item {
    flex: 0 0 80px;
    width: 80px;
    height: 56px;
  }
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-item:hover {
  opacity: 0.95;
  transform: translateY(-2px);
}

.thumb-item.active {
  opacity: 1;
  border-color: var(--dp-primary);
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.35);
  transform: scale(1.04);
}

/* Botones para desplazar la tira de miniaturas lateralmente */
.thumb-nav-btn {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.thumb-nav-btn:hover {
  background: var(--dp-primary);
  border-color: var(--dp-primary);
  color: #ffffff;
}

/* Compatibilidad con estilos previos si quedara caché */
.gallery-main-wrapper {
  position: relative;
  background-color: #0b1120;
  border-radius: 0.75rem;
  overflow: hidden;
}
.gallery-main-img {
  width: 100%;
  height: 480px;
  object-fit: contain;
}
.gallery-thumbnail {
  flex: 0 0 90px;
  height: 70px;
  width: 90px;
  object-fit: cover;
  border-radius: 0.5rem;
  cursor: pointer;
  border: 2px solid transparent;
}

/* Tarjeta del Agente */
.agent-card {
  border-radius: 0.75rem;
  border: 1px solid var(--dp-border);
  background: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* Botón flotante de WhatsApp */
.whatsapp-float {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background-color: #25d366;
  color: white;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 4px 14px rgba(0,0,0,0.3);
  font-size: 28px;
  z-index: 1050;
  text-decoration: none;
  transition: transform 0.2s, background-color 0.2s;
}
.whatsapp-float:hover {
  transform: scale(1.1);
  color: white;
  background-color: #20ba59;
}

@media (max-width: 575.98px) {
  .whatsapp-float {
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    font-size: 24px;
  }
}

/* Footer Banner */
.footer-banner {
  background-color: var(--dp-dark);
  color: #fff;
  border-radius: 1rem;
}

/* Barra inferior móvil de acciones rápidas para ficha */
.mobile-action-bar {
  display: none;
}

@media (max-width: 767.98px) {
  .mobile-action-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid var(--dp-border);
    padding: 0.6rem 1rem;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.08);
    z-index: 1030;
    gap: 0.5rem;
  }
  .mobile-action-bar .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.55rem 0.75rem;
  }
  body.has-mobile-bar {
    padding-bottom: 75px;
  }
}

/* Barra de filtros flotante/fija móvil para catálogo */
.mobile-filter-btn {
  display: none;
}
@media (max-width: 991.98px) {
  .mobile-filter-btn {
    display: inline-flex;
    align-items: center;
  }
}

/* Adaptación responsive para panel de administración en celulares (Sin scroll horizontal) */
.table-responsive {
  border-radius: 0.5rem;
}

.property-admin-card {
  border: 1px solid var(--dp-border);
  border-radius: 0.75rem;
  background: #ffffff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}
.property-admin-card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}
.property-admin-card .card-body {
  padding: 0.85rem !important;
}

@media (max-width: 767.98px) {
  /* Evitar cualquier scroll horizontal en móviles */
  body {
    overflow-x: hidden !important;
    width: 100%;
  }

  /* Ajuste de tipografía y tarjetas estadísticas para vista 2x2 */
  .stat-card {
    padding: 0.75rem !important;
  }
  .stat-card h3 {
    font-size: 1.25rem !important;
  }
  .stat-card .rounded-circle {
    padding: 0.5rem !important;
  }

  /* Botones de acción móvil con toque ergonómico */
  .property-admin-card .btn-sm {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}
