/* ========================================================================== 1. VARIABLES Y RESET ========================================================================== */
:root { --topbar-h: 36px; --header-h: 72px; --tiza: #fdfcf7; --arena: #E5D9C5; --crema: #F2EADF; }
*, *::before, *::after { box-sizing: border-box; }
html, body, .layout, .container, .container-fluid, main { background-color: var(--crema) !important; margin: 0; padding: 0; overflow-x: hidden; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
body { padding-top: calc(var(--topbar-h) + var(--header-h)); }
.card, .tienda, .foto, .login-box, .calendario-fecha, .calendario-fecha .dia, .topbar, .header.scrolled .desktop-only { background-color: inherit; }

/* ========================================================================== 2. ESTRUCTURA GLOBAL (80-20) ========================================================================== */
.container, .layout { width: 92%; margin: 0 auto; }
.layout { display: flex; gap: 30px; padding-top: 20px; }
.section { flex: 0 0 80%; background-color: transparent !important; }
.menuLateral { flex: 0 0 20%; }
.menuLateral ul { list-style: none; padding: 0; }
.menuLateral ul li { border-bottom: 1px solid #ddd; padding: 8px 0; }
.menuLateral ul li a { text-decoration: none; color: #333; transition: 0.3s ease; }
.menuLateral ul li a:hover { color: #000; font-weight: bold; font-size: 1.1em; }
.desktop-only { display: flex; }
.mobile-only { display: none; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 25px; width: 100%; margin: 0; }

.menuLateral { flex: 0 0 20%; }
.menuLateral ul { list-style: none; padding: 0; }
.menuLateral ul li { border-bottom: 1px solid #ddd; padding: 8px 0; }
.menuLateral ul li a { text-decoration: none; color: #333; transition: 0.3s ease; }
.menuLateral ul li a:hover { color: #000; font-weight: bold; font-size: 1.1em; }

.desktop-only { display: flex; }
.mobile-only { display: none; }

/* ==========================================================================
   CABECERA (Topbar & Header Desktop)
   ========================================================================== */
.topbar { position: fixed; top: 0; left: 0; width: 100%; height: var(--topbar-h); background-color: #222; z-index: 2100; display: flex; justify-content: space-between; align-items: center; padding: 0 4%; color: #fff; }
.topbar .left, .topbar .right { font-size: 14px; display: flex; align-items: center; gap: 15px; }
.topbar a { color: #fff !important; text-decoration: none !important; font-size: 14px; transition: all 0.2s ease; white-space: nowrap; }
.topbar a:hover { font-size: 1.1em; font-weight: bold; }

.header {
  position: fixed; top: var(--topbar-h); left: 0; width: 100%; height: var(--header-h);
  z-index: 2000; transition: all 0.4s ease; display: flex; align-items: center;
}

.header .desktop-only {
  width: 100%; display: flex; align-items: center; justify-content: flex-start;
  gap: 30px; padding: 0 5%; height: 100%; background: transparent;
}

.header.scrolled .desktop-only {
  background: var(--tiza); box-shadow: 0 2px 6px rgba(0,0,0,0.1); border-bottom: 1px solid #eee;
}

.logo img { height: 48px; width: auto; }
.header .nav { display: flex; gap: 20px; }
.header .nav a { color: #000 !important; text-decoration: none !important; font-size: 14px; transition: 0.2s; }
.header .nav a:hover { font-size: 1.1em; font-weight: bold; }

/* ==========================================================================
   COMPONENTES (Carrusel, Productos, Eventos)
   ========================================================================== */
.carousel {position: relative; width: 100vw; height: 500px; overflow: hidden; left: 50%; transform: translateX(-50%); margin-top: calc((var(--topbar-h) + var(--header-h)) * -1); background-color: #000;}
.slides {display: flex; height: 100%; transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);}
.slide {width: 100vw; flex: 0 0 100vw; height: 100%;}
.slide img {width: 100%; height: 100%; object-fit: cover; object-position: center center;}

.products { margin: 60px 0 100px 0; }
.products h1 { text-align: center; font-family: verdana; font-size: 1.75rem; margin-bottom: 50px; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 25px; }
.card {background-color: var(--arena) !important; border: 1px solid #dcd4c9; transition: 0.4s ease; display: flex; flex-direction: column; overflow: hidden; position: relative; height: 100%;}
.card:hover { transform: translateY(-8px); box-shadow: 0 12px 25px rgba(0,0,0,0.08); }
.image-wrapper { position: relative; width: 100%; aspect-ratio: 3 / 4; overflow: hidden; }
.image-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: 0.6s; }
.card:hover .image-wrapper img { transform: scale(1.08); }

.overlay-btn {position: absolute; bottom: -60px; left: 0; width: 100%; background-color: rgba(34, 34, 34, 0.9); color: var(--tiza) !important;text-align: center; padding: 15px 0; text-decoration: none !important; text-transform: uppercase; font-size: 13px; letter-spacing: 2px; transition: 0.4s; z-index: 2;}
.card:hover .overlay-btn { bottom: 0; color: #fff !important; font-weight: bold; font-size: 15px; }

.info { padding: 18px 15px; text-align: center; display: flex; flex-direction: column; flex-grow: 1; }
.info .name { font-size: 14px; font-weight: 600; text-transform: uppercase; margin-bottom: 10px; }
.info .price-tachado { font-size: 16px; text-decoration: line-through; color: #444; margin-bottom: 2px; }
.info .price-oferta { font-size: 16px; font-weight: bold; color: #e74c3c; margin-bottom: 10px; }
.info .price-normal { font-size: 16px; font-weight: bold; color: #008000; margin-bottom: 10px; }
.info .codigo { margin-top: auto; font-size: 11px; color: #777; border-top: 1px solid rgba(0,0,0,0.08); padding-top: 12px; }

/* ==========================================================================
   CARRUSEL SECCION DESTACADOS
   ========================================================================== */
.carrusel-seccion {max-width: 1200px; margin: 40px auto; padding: 0 15px; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;}
.carrusel-titulo {font-size: 28px; font-weight: 600; color: #333; text-align: center; margin-bottom: 30px;}

/* El truco del carrusel: En desktop se alinea usando tablas/bloques estables */
  .carrusel-contenedor { width: 100%; overflow: hidden; position: relative; padding-bottom: 15px; }
  .carrusel-track { display: flex; transition: transform 0.6s ease-in-out; width: 100%; }
  .carrusel-item { flex: 0 0 31.33%; margin-right: 2%; height: 480px; position: relative; border-radius: 8px; overflow: hidden; text-decoration: none; box-shadow: 0 4px 12px rgba(0,0,0,0.1); transition: transform 0.3s ease; }

.carrusel-item:last-child { margin-right: 0;}
.carrusel-item:hover {transform: translateY(-4px);}
.card-img { width: 100%; height: 100%; object-fit: cover; display: block;}

.icono-img { width: 24px; height: 24px; display: inline-block; vertical-align: middle; margin-right: 8px; color: #ffffff; }
.icono-img svg { width: 100%; height: 100%; display: block;}

/* --- Degradado Oscuro en el Fondo --- */
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Genera el sombreado negro desde abajo hacia el medio de la imagen */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.4) 50%, rgba(0, 0, 0, 0) 100%);
}

/* --- Contenedor de Textos (Abajo de todo) --- */
.card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
    color: #ffffff;
}

.propiedad-nombre {
    font-size: 18px;
    text-transform: uppercase;
    font-weight: bold;
    margin: 0 0 4px 0;
    letter-spacing: 0.5px;
}

.propiedad-direccion {
    font-size: 13px;
    color: #ccc;
    margin: 0 0 16px 0;
}

.propiedad-bajada {
    font-size: 11px;
    color: #bbb;
    display: block;
}

.propiedad-precio {
    font-size: 22px;
    font-weight: bold;
    margin: 2px 0 16px 0;
}

/* --- Bloque de Iconos inferiores --- */
.propiedad-iconos {
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 12px;
    display: block;
    width: 100%;
}

.icono-item {
    display: inline-block;
    width: 48%;
    vertical-align: middle;
}

.icono-img {
    font-size: 20px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.icono-texto {
    display: inline-block;
    vertical-align: middle;
    line-height: 1.2;
}

.icono-texto strong {
    display: block;
    font-size: 13px;
}

.icono-texto span {
    font-size: 10px;
    color: #ccc;
    text-transform: uppercase;
}


/* ==========================================================================
   ADAPTACIÓN RESPONSIVE (Móviles y Tablets)
   ========================================================================== */
  @media (max-width: 992px) 
    { .carrusel-item { flex: 0 0 47%; margin-right: 3%; height: 420px; } }

  @media (max-width: 576px) 
    { 
      .carrusel-item { flex: 0 0 85%; margin-right: 4%; height: 400px; } 
      .carrusel-titulo { font-size: 22px; text-align: left; }
    }

/* ==========================================================================
   5. TIENDAS Y LOGIN
   ========================================================================== */
.tiendas { display: flex; flex-wrap: wrap; gap: 25px; margin-top: 30px; }
.tienda { flex: 0 0 calc(50% - 13px); max-width: calc(50% - 13px); border: 1px solid #dcd4c9; background: #fff; display: flex; flex-direction: column; transition: 0.3s; }
.tienda:hover { transform: translateY(-5px); box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.tienda img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.tienda .info { padding: 25px; background-color: var(--arena); flex-grow: 1; text-align: left; }
.tienda .info h2 { font-size: 1.4rem; color: #222; margin-bottom: 12px; text-transform: none; font-weight: 600; }
.tienda .info p { font-size: 16px; color: #444; line-height: 1.5; margin-bottom: 10px; text-transform: none; }
.tienda .info .telefono a { text-decoration: none; color: #222; font-weight: bold; font-size: 17px; display: inline-flex; align-items: center; gap: 10px; }

.login-container { display: flex; justify-content: center; padding: 40px 0; }
.login-box { width: 100%; max-width: 450px; background: #fff; border: 1px solid #dcd4c9; padding: 40px; }
.login-box h1 { font-family: verdana; font-size: 1.6rem; text-align: center; }
.login-form input { width: 100%; padding: 12px 15px; border: 1px solid #ddd; background: var(--tiza); margin-bottom: 20px; }
.btn-login { width: 100%; padding: 14px; background-color: var(--arena); color: #222; border: 1px solid #dcd4c9; font-weight: bold; cursor: pointer; }

/* ==========================================================================
   8. VISTA DETALLE DE TIENDA (Estilos Visuales)
   ========================================================================== */
.tienda-header { text-align: left; margin-bottom: 25px; }
.tienda-header h1 { font-size: 2.2rem; color: #888; letter-spacing: 1px; margin-bottom: 5px; }
.tienda-header h2 { font-family: verdana; font-size: 1.8rem; color: #222; margin-bottom: 12px; }
.tienda-datos { font-size: 16px; color: #666; line-height: 1.6; }
.tienda-datos i { color: #25D366; font-size: 1.3rem; margin-right: 5px; }
.separador-tienda { border: 0; border-top: 1px solid #dcd4c9; margin-bottom: 35px; }
.pagination-container { display: flex; justify-content: center; gap: 15px; margin: 60px 0; }
.vidriera-aviso { padding: 40px 0; }
.vidriera-aviso h2 { font-family: verdana; color: #444; margin-bottom: 15px; }
.vidriera-img { margin-top: 30px; max-width: 900px; border-radius: 4px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); }

/* ==========================================================================
   9. AJUSTE QUIRÚRGICO: TIENDA ANCHO COMPLETO (Estructura Anti-Scroll)
   ========================================================================== */
/* Solo se activa cuando usas la clase 'tienda-full-width' en el PHP */
.layout.tienda-full-width {
    display: block !important; 
    width: 92% !important;
    max-width: 92% !important;
    margin: 0 auto !important;
    overflow: hidden !important; 
}

.tienda-full-width .section {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important; 
    padding: 0 !important;
}

.tienda-full-width .grid {
    width: 100% !important;
    margin: 0 !important;
}

/* ==========================================================================
   10. DETALLE DE PRODUCTO (Título Full + Galería Vertical)
   ========================================================================== */

/* Título arriba ocupando todo el 80% de la sección */
.producto-header-full h1 {
    font-family: verdana;
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: #222;
    text-align: left;
}

.producto-detalle {
    display: flex;
    gap: 30px; /* Separación entre Galería e Info */
    margin-top: 20px;
}

/* --- BLOQUE IZQUIERDO: GALERÍA (65% del ancho) --- */
.producto-galeria {
    flex: 0 0 65%; /* Ancho aumentado para alojar miniaturas + foto grande */
    display: flex; /* Flex interno para poner miniaturas al lado de la foto */
    gap: 15px;
    height: 600px; /* Altura fija para controlar el scroll de miniaturas si hay muchas */
}

/* Columna de Miniaturas (Izquierda de la foto) */
.fotos-miniaturas-vertical {
    display: flex;
    flex-direction: column; /* Vertical */
    gap: 10px;
    width: 90px; /* Ancho fijo para la tira de fotos */
    flex-shrink: 0;
    overflow-y: auto; /* Scroll si hay muchas fotos */
    padding-right: 5px; /* Espacio para el scroll */
}

.miniatura {
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 1px solid #dcd4c9;
    cursor: pointer;
    opacity: 0.6;
    transition: 0.3s;
}

.miniatura:hover, .miniatura.active {
    opacity: 1;
    border-color: #222;
}

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

/* Foto Principal (Toma el resto del espacio de la galería) */
.foto-principal {
    flex-grow: 1;
    height: 100%;
    background-color: #fff;
    border: 1px solid #dcd4c9;
    overflow: hidden;
}

.foto-principal img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ajuste perfecto */
    cursor: zoom-in;
}

/* ========================================================================== 10. DETALLE DE PRODUCTO (Ajuste Real al Ancho de Imagen) ========================================================================== */
.producto-header-full h1 { font-family: verdana; font-size: 1.8rem; margin-bottom: 10px; color: #222; text-align: left; }
.producto-detalle { display: flex; gap: 40px; margin-top: 20px; align-items: flex-start; width: 100%; }
.producto-galeria { display: flex; gap: 15px; flex-shrink: 0; }
.fotos-miniaturas-vertical { display: flex; flex-direction: column; gap: 10px; width: 80px; flex-shrink: 0; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; height: 600px; }
.fotos-miniaturas-vertical::-webkit-scrollbar { display: none; }
.miniatura { width: 100%; aspect-ratio: 1 / 1; border: 1px solid #dcd4c9; cursor: pointer; opacity: 0.6; transition: 0.3s; overflow: hidden; }
.miniatura.active { opacity: 1; border-color: #222; }
.foto-principal { border: 1px solid #dcd4c9; background: #fff; height: 600px; display: table; width: auto; flex-shrink: 0; }
.foto-principal img { height: 100%; width: auto; display: block; object-fit: contain; cursor: zoom-in; }
.producto-info { flex: 1; text-align: left; display: flex; flex-direction: column; padding-left: 10px; }
.info-titulo { font-size: 1.4rem; color: #333; margin: 0; font-weight: 500; }
.linea-fina { border: 0; border-top: 1px solid #ddd; margin: 10px 0; width: 100%; }
.info-precio-normal { font-size: 1.8rem; text-align: center; font-weight: bold; color: #111; }
.info-precio-tachado { font-size: 1.8rem; text-align: center; text-decoration: line-through; font-weight: bold; color: #999; }
.info-precio-oferta { font-size: 1.8rem; text-align: center; font-weight: bold; color: #e74c3c; }
.info-codigo { font-size: 14px; text-align: center; color: #777; margin-bottom: 15px; text-transform: none; display: block; }
.info-descripcion { font-size: 15px; line-height: 1.6; color: #444; margin-bottom: 25px; }
.info-stock { width: 100%; font-size: 14px; font-weight: bold; color: #555; padding: 12px; background: var(--arena); border-radius: 4px; text-align: center; box-sizing: border-box; }
.btn-whatsapp-consulta { width: 100%; background-color: #25D366; color: #fff; text-align: center; padding: 15px; border-radius: 4px; text-decoration: none; font-weight: bold; font-size: 16px; margin-top: 15px; display: flex; align-items: center; justify-content: center; gap: 10px; transition: 0.3s ease; border: none; cursor: pointer; box-sizing: border-box; }
.btn-whatsapp-consulta:hover { background-color: #128C7E; color: #fff; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.btn-whatsapp-consulta i { font-size: 1.4rem; }
/* ========================================================================== 11. AJUSTE RESPONSIVO (MOBILE) ========================================================================== */
@media (max-width: 768px) {
    .producto-detalle { flex-direction: column; gap: 20px; }
    .producto-galeria { width: 100%; max-width: 100%; flex-direction: column-reverse; height: auto; min-height: auto; }
    .fotos-miniaturas-vertical { flex-direction: row; width: 100%; height: auto; overflow-x: auto; padding-bottom: 5px; }
    .miniatura { width: 70px; flex: 0 0 auto; }
    .foto-principal { display: block; width: 100%; height: auto; aspect-ratio: 3/4; }
    .foto-principal img { width: 100%; height: 100%; object-fit: cover; }
    .producto-info { width: 100%; padding-left: 0; }
    .info-precio-normal { font-size: 1.6rem; text-align: center; color: #111; }
    .info-precio-tachado { font-size: 1.6rem; text-align: center; text-decoration: line-through; color: #999; }
    .info-precio-oferta { font-size: 1.6rem; text-align: center; color: #e74c3c; }
    .info-stock { font-size: 15px; padding: 15px; }
}

/* ==========================================================================
   6. FOOTER (Desktop Default)
   ========================================================================== */
.footer { background: #222; color: #fff; padding: 40px 5%; position: relative; z-index: 10; }
.footer .columns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.footer ul { list-style: none; padding: 0; }
.footer ul li a { color: #ccc; text-decoration: none; transition: 0.3s ease; }
.footer ul li a:hover { color: #fff; font-weight: bold; }
.footer-breadcrumb { grid-column: 1 / -1; padding: 8px 0 0 0; margin-top: 20px; font-size: 12px; color: #aaa; line-height: 1.4; }
.footer-breadcrumb a { color: #aaa; text-decoration: none; padding: 0 4px; }
.footer-breadcrumb a:hover, .footer-breadcrumb a:active { color: #fff; text-decoration: underline; }
.footer-links { grid-column: 1 / -1; text-align: center; border-top: 1px solid #444; padding-top: 20px; margin-top: 4px; }

/* ==========================================================================
   7. MEDIA QUERIES (Mobile Adjustments)
   ========================================================================== */
@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: block !important; }
  .topbar { display: none !important; }
  body { padding-top: 56px; }

  /* Barra Superior */
  .mobile-only .header-bar { 
    position: fixed; top: 0; left: 0; right: 0; height: 56px; background: var(--tiza); 
    display: flex; justify-content: space-between; align-items: center; padding: 0 16px; 
    z-index: 2200; box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
  }

  /* 3.1 - Limpieza Botón Menú */
  .mobile-only button, .mobile-only .header-bar div, .mobile-only .header-bar i { 
    border: none !important; background: transparent !important; outline: none !important; box-shadow: none !important; 
  }

  /* 3.2 - Menú desplegable a la Izquierda */
  .mobile-only .nav { position: fixed; top: 56px; left: 0; width: 100%; height: calc(100vh - 56px); background-color: #222 !important; display: none; z-index: 2100; overflow-y: auto; }
  .mobile-only .nav.show { display: flex !important; flex-direction: column; padding: 20px 5px; }
  .mobile-only .nav a { color: #fff !important; padding: 15px 4px; text-decoration: none; font-size: 18px; display: block; border-bottom: 1px solid #333; text-align: left !important; }

  /* Layout y Grillas */
  .layout { flex-direction: column; width: 100%; }
  .section, .menuLateral { flex: 0 0 100%; padding: 10px 20px; }
  .grid { grid-template-columns: repeat(2, 1fr); display: grid; gap: 15px; }
  .galeria .row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .galeria [class*="col-"] { flex: 0 0 100%; max-width: 100%; }
  .tienda { flex: 0 0 100%; max-width: 100%; }

  /* 3.3 - Footer Mobile (Vertical e Izquierda) */
  .footer .columns { 
    display: flex !important; flex-direction: column !important; 
    gap: 30px; text-align: left !important; 
  }
  .footer .columns > div { width: 100%; }
  .footer-links { 
    display: flex !important; flex-direction: column !important; 
    align-items: flex-start !important; gap: 12px; text-align: left !important; 
  }
}