/* ==========================================================================
   DELITBEE STORES LOCATOR - FRONTEND STYLES
   ========================================================================== */

.delitbee-stores-wrapper {
    width: 100%;
}

.delitbee-stores-city-section {
    margin-bottom: 60px;
}

.delitbee-stores-city-section:last-child {
    margin-bottom: 0;
}

.delitbee-stores-city-title {
    font-family: var(--e-global-typography-primary-font-family, inherit);
    font-weight: var(--e-global-typography-primary-font-weight, 600);
    font-size: 2rem;
    line-height: 1.2;
    color: var(--e-global-color-ac93fd8, #000);
    margin: 0 0 30px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--e-global-color-primary, #FFD200);
}

.delitbee-stores-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    height: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    contain: unset;
}

.delitbee-stores-list.single-visible {
    height: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
}

.delitbee-stores-list.is-filtering .delitbee-store-item {
    animation: none !important;
    transform: none !important;
}

.delitbee-store-item {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    overflow: hidden;
    box-sizing: border-box;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
    height: auto;              /* quitar fit-content y !important */
    min-height: 0;              /* permitir expansión natural */
    animation: none;            /* quitar animación que fijaba altura inicial */
    will-change: auto;          /* evitar reflujo inesperado */
    transform: none;
}

.delitbee-store-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-color: var(--e-global-color-primary, #FFD200);
}

.delitbee-store-item.selected {
    background: #eff6ff;
    border-left: 3px solid var(--e-global-color-accent, #3b82f6);
    padding-left: 17px;
    transform: none;
}

.delitbee-store-item.hidden {
    display: none !important;
    pointer-events: none;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    animation: none !important;
}

/* Ajustes para corregir alturas y visibilidad de contenido en fichas */

/* LISTA: eliminar contain y segunda definición */
.delitbee-stores-list {
    /* ...existing code... */
    /* eliminar contain y duplicado conflictivo */
    contain: unset;
}

/* FICHA: limpiar reglas conflictivas */
.delitbee-store-item {
    /* ...existing code... */
    height: auto;              /* quitar fit-content y !important */
    min-height: 0;              /* permitir expansión natural */
    animation: none;            /* quitar animación que fijaba altura inicial */
    will-change: auto;          /* evitar reflujo inesperado */
    transform: none;
}

/* Estado seleccionado mantiene estilo sin alterar layout */
.delitbee-store-item.selected {
    /* ...existing code... */
    transform: none;
}

/* Asegurar que los bloques internos no quedan colapsados */
.delitbee-store-item > * {
    flex: 0 0 auto;
    overflow: visible;
}

/* Mostrar siempre horarios y dirección completos */
.delitbee-store-item-schedule,
.delitbee-store-item-address {
    max-height: none;
    overflow: visible;
    display: block;
}

/* Eliminar reglas de ocultación agresivas al filtrar */
.delitbee-store-item.hidden {
    display: none !important;
    height: 0 !important; /* ...existing code... */
    /* quitar padding/margin para evitar saltos bruscos */
}

/* Quitar animación global previa que causaba recálculo erróneo */
@keyframes fadeInUp {
    /* anulado */
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Opcional: transición suave solo de background */
.delitbee-store-item,
.delitbee-store-item.selected {
    transition: background 0.15s ease, border-color 0.15s ease;
}

/* Cuando solo queda una ficha tras filtrar no forzar padding extra */
.delitbee-stores-list.single-visible .delitbee-store-item {
    /* ...existing code... */
    padding-left: 20px;
}

.delitbee-store-map {
    width: 100%;
    height: 200px;
    overflow: hidden;
    pointer-events: none;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
}

.delitbee-store-map iframe {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
}

.delitbee-store-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px;
}

.delitbee-store-name {
    font-family: var(--e-global-typography-primary-font-family, inherit);
    font-weight: var(--e-global-typography-primary-font-weight, 600);
    font-size: 1.4rem;
    line-height: 1.4;
    color: var(--e-global-color-ac93fd8, #000);
    margin: 0;
}

.delitbee-store-address {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-family: var(--e-global-typography-text-font-family, inherit);
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--e-global-color-text, #7A7A7A);
    margin: 0;
}

.delitbee-store-address svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--e-global-color-accent, #011ddc);
}

/* Horarios compactos para modo múltiple */
.delitbee-store-schedules-compact {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.delitbee-schedule-compact {
    font-family: var(--e-global-typography-text-font-family, inherit);
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--e-global-color-text, #7A7A7A);
    margin: 0;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.delitbee-schedule-compact svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-top: 2px;
    fill: var(--e-global-color-accent, #011ddc);
}

.delitbee-schedule-compact strong {
    color: var(--e-global-color-ac93fd8, #000);
    font-weight: 600;
}

.delitbee-stores-error {
    color: #dc2626;
    padding: 16px;
    background: #fef2f2;
    border-left: 4px solid #dc2626;
    border-radius: 6px;
    margin: 20px 0;
}

/* Modo tienda única */
.delitbee-stores-wrapper.single-store-mode {
    padding: 0;
}

.delitbee-single-store-container {
    position: relative;
    width: 100%;
    min-height: 700px;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.delitbee-single-store-map-full {
    width: 100%;
    min-height: 700px;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
}

.delitbee-single-store-map-full iframe {
    width: 100%;
    height: 100%;
    min-height: 700px;
    border: none;
}

.delitbee-single-store-info-card {
    position: absolute;
    top: 40px;
    right: 40px;
    left: 40px;
    max-width: 420px;
    margin-left: auto;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.delitbee-single-store-logo {
    text-align: center;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.delitbee-single-store-logo img {
    max-width: 120px;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.delitbee-single-store-name {
    font-family: var(--e-global-typography-primary-font-family, inherit);
    font-weight: var(--e-global-typography-primary-font-weight, 600);
    font-size: 1.6rem;
    line-height: 1.3;
    color: var(--e-global-color-ac93fd8, #000);
    margin: 0;
}

.delitbee-single-store-address {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-family: var(--e-global-typography-text-font-family, inherit);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--e-global-color-text, #7A7A7A);
    margin: 0;
}

.delitbee-single-store-address svg {
    flex-shrink: 0;
    margin-top: 4px;
    color: var(--e-global-color-accent, #011ddc);
    fill: var(--e-global-color-accent, #011ddc);
}

.delitbee-single-store-schedules {
    width: 100%;
    margin-top: 8px;
}

.delitbee-store-schedule-section {
    margin-bottom: 16px;
}

.delitbee-schedule-title {
    font-family: var(--e-global-typography-primary-font-family, inherit);
    font-weight: var(--e-global-typography-primary-font-weight, 600);
    font-size: 0.95rem;
    color: var(--e-global-color-ac93fd8, #000);
    margin: 0 0 8px 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.delitbee-schedule-title svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
    fill: var(--e-global-color-accent, #011ddc);
}

.delitbee-schedule-text {
    font-family: var(--e-global-typography-text-font-family, inherit);
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--e-global-color-text, #7A7A7A);
    margin: 0;
    white-space: pre-line;
}

.delitbee-single-store-directions-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    background: var(--e-global-color-primary, #FFD200);
    color: var(--e-global-color-5dbcd7b, #000) !important;
    font-family: var(--e-global-typography-primary-font-family, inherit);
    font-weight: var(--e-global-typography-primary-font-weight, 700);
    font-size: 1rem;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.delitbee-single-store-directions-btn:hover {
    background: var(--e-global-color-1619188, #000);
    color: var(--e-global-color-0a83628, #FFF) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.delitbee-single-store-directions-btn svg {
    fill: currentColor;
    margin-right: 8px;
}

/* ========================================
   MODO MULTI-TIENDAS - DISEÑO SEGÚN REFERENCIA
   ======================================== */

.delitbee-stores-multi-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 0;
    height: 700px;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: none;
    background: transparent;
}

/* Sidebar con lista de tiendas */
.delitbee-stores-sidebar {
    background: #fff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    height: 700px;
    overflow: hidden;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
    min-height: 0; /* permite que el hijo con overflow gestione el scroll */
}

.delitbee-stores-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}

.delitbee-stores-header-top {
    display: none; /* Logo oculto del sidebar */
}

.delitbee-stores-sidebar-title {
    display: none;
}

.delitbee-stores-sidebar-count {
    display: none;
}

/* Buscador de tiendas */
.delitbee-stores-search {
    position: relative;
    width: 100%;
}

.delitbee-stores-search input {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: border-color 0.2s ease;
    background: #fff;
}

.delitbee-stores-search input:focus {
    outline: none;
    border-color: #9ca3af;
}

.delitbee-stores-search input::placeholder {
    color: #9ca3af;
}

.delitbee-stores-search svg {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #9ca3af;
    pointer-events: none;
}

/* Lista de tiendas con scroll */
.delitbee-stores-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    contain: content;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.delitbee-stores-list::-webkit-scrollbar {
    width: 6px;
}

.delitbee-stores-list::-webkit-scrollbar-track {
    background: transparent;
}

.delitbee-stores-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.delitbee-stores-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Ficha de tienda */
.delitbee-store-item {
    padding: 18px 20px;
    cursor: pointer;
    transition: background 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
    height: auto;              /* quitar fit-content y !important */
    min-height: 0;              /* permitir expansión natural */
    animation: none;            /* quitar animación que fijaba altura inicial */
    will-change: auto;          /* evitar reflujo inesperado */
    transform: none;
}

.delitbee-store-item:hover {
    background: #f9fafb;
}

.delitbee-store-item.selected {
    background: #eff6ff;
    border-left: 3px solid var(--e-global-color-accent, #3b82f6);
    padding-left: 17px;
    transform: none;
}

.delitbee-store-item.hidden {
    display: none !important;
    pointer-events: none;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    animation: none !important;
}

/* Espaciado entre fichas (1rem) */
.delitbee-store-item {
    margin-bottom: 1rem !important;
}

/* Ciudad tag (pequeño, discreto) */
.delitbee-store-item-city {
    font-size: 11px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.delitbee-store-item-city svg {
    width: 10px;
    height: 10px;
}

/* Nombre de la tienda */
.delitbee-store-item-name {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
    font-size: 15px;
    color: #111827;
    margin: 0;
    line-height: 1.3;
}

/* Dirección */
.delitbee-store-item-address {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 5px;
}

.delitbee-store-item-address svg {
    width: 13px;
    height: 13px;
    margin-top: 2px;
    flex-shrink: 0;
    color: #9ca3af;
}

/* Horarios (compacto) */
.delitbee-store-item-schedule {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    padding: 8px 10px;
    background: #f9fafb;
    border-radius: 4px;
    border-left: 2px solid var(--e-global-color-primary, #fbbf24);
}

.delitbee-store-item-schedule strong {
    display: block;
    color: #374151;
    margin-bottom: 3px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Link "Cómo llegar" */
.delitbee-store-item-link {
    font-size: 13px;
    color: var(--e-global-color-accent, #3b82f6);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.delitbee-store-item-link:hover {
    text-decoration: underline;
}

.delitbee-store-item-link svg {
    width: 13px;
    height: 13px;
}

/* Contenedor del mapa */
.delitbee-stores-map-container {
    position: relative;
    background: #f5f5f5;
    height: 700px;
}

/* Logo flotante sobre el mapa (esquina superior derecha) */
.delitbee-map-brand-logo {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 100px;
    height: 100px;
    background: #fff;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delitbee-map-brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.delitbee-stores-map-full {
    width: 100%;
    height: 100%;
}

.delitbee-stores-map-full iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Responsive tablet */
@media (min-width: 768px) and (max-width: 1023px) {
    .delitbee-stores-multi-layout {
        grid-template-columns: 320px 1fr;
        height: 600px;
    }
    
    .delitbee-stores-sidebar,
    .delitbee-stores-map-container {
        height: 600px;
    }
    
    .delitbee-map-brand-logo {
        width: 80px;
        height: 80px;
        padding: 10px;
    }
}

/* Responsive mobile */
@media (max-width: 767px) {
    .delitbee-stores-multi-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 400px 1fr;
        height: auto;
    }
    
    .delitbee-stores-sidebar {
        height: 400px;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .delitbee-stores-map-container {
        height: 500px;
        order: 2;
    }
    
    .delitbee-map-brand-logo {
        top: 12px;
        right: 12px;
        width: 70px;
        height: 70px;
        padding: 8px;
    }
    
    .delitbee-store-item {
        padding: 14px 16px;
    }
    
    .delitbee-stores-sidebar-header {
        padding: 16px;
    }
}

/* MOBILE: modo tienda única apilar ficha + mapa */
@media (max-width: 767px) {
    .delitbee-stores-wrapper.single-store-mode .delitbee-single-store-container {
        display: flex;
        flex-direction: column;
        min-height: auto;
        border-radius: 16px;
        overflow: hidden;
    }
    .delitbee-stores-wrapper.single-store-mode .delitbee-single-store-info-card {
        position: static;
        top: auto;
        left: auto;
        right: auto;
        max-width: 100%;
        margin: 0;
        padding: 24px 20px;
        box-shadow: 0 2px 8px rgba(0,0,0,.08);
        border-radius: 0;
        border-bottom: 1px solid rgba(0,0,0,.08);
        order: 1;
    }
    .delitbee-stores-wrapper.single-store-mode .delitbee-single-store-logo {
        border-bottom: none;
        padding-bottom: 0;
    }
    .delitbee-stores-wrapper.single-store-mode .delitbee-single-store-map-full {
        position: relative;
        min-height: 240px;
        height: 240px;
        order: 2;
    }
    .delitbee-stores-wrapper.single-store-mode .delitbee-single-store-map-full iframe {
        min-height: 240px;
        height: 100%;
    }
    .delitbee-stores-wrapper.single-store-mode .delitbee-single-store-directions-btn {
        width: 100%;
        border-radius: 50px;
    }
    .delitbee-stores-wrapper.single-store-mode .delitbee-single-store-name {
        font-size: 1.4rem;
    }
    .delitbee-stores-wrapper.single-store-mode .delitbee-single-store-address {
        font-size: .9rem;
        line-height: 1.4;
    }
}

/* Animación de carga */
.delitbee-store-item {
    animation: fadeInUp 0.4s ease-out;
}

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

/* ================================
   OVERRIDES PARA ALTURA CORRECTA
   ================================ */

/* 1. Contenedor de la lista: usar flujo normal (block) y eliminar contain/flex colapsable */
.delitbee-stores-list {
    display: block !important;
    padding: 1rem !important;
    margin: 0 !important;
    contain: none !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* 2. Eliminar efectos especiales en modo single-visible que quitaban scroll */
.delitbee-stores-list.single-visible {
    overflow-y: auto !important;
    height: auto !important;
    max-height: none !important;
}

/* 3. Cards: volver a flujo de bloque, permitir expansión completa del contenido */
.delitbee-store-item {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 18px 20px !important;
    box-sizing: border-box !important;
    border-radius: 12px !important;
    transform: none !important;
    animation: none !important;
    will-change: auto !important;
}

/* 4. Estado seleccionado: mantener estilo sin alterar layout */
.delitbee-store-item.selected {
    border: 1px solid var(--e-global-color-accent, #3b82f6) !important;
    padding-left: 17px !important;
}

/* 5. Contenido interno: asegurar flujo normal y visibilidad */
.delitbee-store-item > * {
    position: static !important;
    overflow: visible !important;
    max-height: none !important;
}

/* 6. Dirección y horarios: evitar recorte */
.delitbee-store-item-address,
.delitbee-store-item-schedule {
    display: block !important;
    overflow: visible !important;
    max-height: none !important;
    white-space: normal !important;
}

/* 7. Ocultación al filtrar: solo ocultar totalmente, sin afectar a hermanos */
.delitbee-store-item.hidden {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

/* 8. Scrollbar estético (se mantiene si antes estaba) */
.delitbee-stores-list::-webkit-scrollbar {
    width: 6px;
}
.delitbee-stores-list::-webkit-scrollbar-track {
    background: transparent;
}
.delitbee-stores-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}
.delitbee-stores-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 9. Eliminar animaciones previas que podían fijar altura inicial */
@keyframes fadeInUp { from { opacity:1; } to { opacity:1; } }

/* 10. Asegurar que el sidebar permite crecimiento interno sin cortar */
.delitbee-stores-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0 !important;
}
