﻿/* Contenedor principal */
.ibm-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: #f7fafc;
}

/* Header */
.ibm-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 20px;
    color: #fff;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.ibm-title {
    margin: 0 0 10px 0;
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ibm-subtitle {
    margin: 0;
    opacity: 0.95;
}

/* Toolbar */
.ibm-toolbar {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.ibm-toolbar-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

/* Buscador */
.ibm-search-wrap {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.ibm-search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #718096;
}

.ibm-search-input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

    .ibm-search-input:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    }

/* Botones */
.ibm-btn {
    padding: 12px 20px;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease, transform 0.15s ease;
    user-select: none;
}

    .ibm-btn:active {
        transform: translateY(1px);
    }

.ibm-btn-success {
    background: #48bb78;
}

    .ibm-btn-success:hover {
        background: #38a169;
    }

.ibm-btn.is-disabled,
.ibm-btn:disabled {
    background: #cbd5e0 !important;
    cursor: not-allowed;
}

/* Chips categorías */
.ibm-categories {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ibm-chip {
    padding: 8px 16px;
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

    .ibm-chip:hover {
        background: #edf2f7;
    }

    .ibm-chip.is-active {
        background: #667eea;
        color: #fff;
        border-color: #667eea;
    }

/* Grid principal */
.ibm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

/* Card base */
.ibm-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

/* Mapa */
.ibm-map-card {
    /* Ajustamos el alto máximo al alto disponible de la ventana para evitar desbordes */
    max-height: 100vh;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.ibm-card-title {
    margin: 0 0 20px 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #2d3748;
}

.ibm-map {
    background: linear-gradient(180deg, #e6f7ff 0%, #f0f9ff 100%);
    height: 100%;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.ibm-map-grid {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(#cbd5e0 1px, transparent 1px), linear-gradient(90deg, #cbd5e0 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.2;
}

.ibm-user-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: #4299e1;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 6px rgba(66, 153, 225, 0.3);
    z-index: 10;
    animation: ibm-pulse 2s infinite;
}

.ibm-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease, z-index 0s;
    z-index: 5;
}

    .ibm-marker:hover {
        transform: translate(-50%, -50%) scale(1.2);
    }

    .ibm-marker.is-selected {
        z-index: 20;
        filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
    }

.ibm-marker-emoji {
    font-size: 2rem;
}

.ibm-marker-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #667eea;
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
}

/* Lista */
.ibm-list-card {
    /* Igualamos el alto máximo al de la pantalla y habilitamos el scroll vertical */
    max-height: 100vh;
    height: 100%;
    overflow-y: auto;
}

.ibm-list-title {
    margin: 0 0 20px 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #2d3748;
    position: sticky;
    top: 0;
    background: #fff;
    padding-bottom: 10px;
    z-index: 10;
}

.ibm-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ibm-business {
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    background: #fff;
}

    .ibm-business:hover {
        transform: translateX(5px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }

    .ibm-business.is-selected {
        border: 2px solid #667eea;
        background: #f7fafc;
    }

.ibm-business-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.ibm-business-id {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ibm-business-emoji {
    font-size: 2rem;
}

.ibm-business-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3748;
}

.ibm-business-address {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    color: #718096;
}

.ibm-distance-pill {
    background: #e6fffa;
    color: #047857;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.ibm-business-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.ibm-rating {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ibm-rating-score {
    font-weight: 600;
    color: #2d3748;
}

.ibm-rating-reviews {
    font-size: 0.85rem;
    color: #718096;
}

.ibm-open {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 600;
}

    .ibm-open.is-open {
        color: #047857;
    }

    .ibm-open.is-closed {
        color: #e53e3e;
    }

.ibm-services {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.ibm-service {
    background: #f7fafc;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.ibm-see-agenda {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    color: #667eea;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Pulse */
@keyframes ibm-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(66, 153, 225, 0.7);
    }

    50% {
        box-shadow: 0 0 0 15px rgba(66, 153, 225, 0);
    }
}

/* Responsivo */
@media (max-width: 1024px) {
    .ibm-grid {
        grid-template-columns: 1fr;
    }

    .ibm-map-card,
    .ibm-list-card {
        height: 500px;
    }
}

/* Minimal overrides for Index.razor classes to ensure estilos se apliquen */
.inicio-layout {
    /* Comentario: permitimos que la vista utilice el ancho completo disponible en todas las resoluciones */
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 1.5rem 2.5vw;
}
/* Estilos básicos y distribución responsiva entre mapa y comercios */
.inicio-hero { display:flex; justify-content:space-between; align-items:center; padding:1rem; background:linear-gradient(135deg,#667eea,#764ba2); color:#fff; border-radius:12px; }
.filtros-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:1rem; margin-bottom:1rem; }
.categorias-wrapper { margin-top:0.75rem; }
.categoria-chip { margin-right:8px; padding:6px 12px; border-radius:12px; border:1px solid #e2e8f0; background:#f7fafc; }
.categoria-chip.activo { background:#667eea; color:#fff; border-color:#667eea; }
.lista-card { margin-top:1rem; }
.mapa-card { min-height:420px; }
.comercio-item { border:1px solid #e2e8f0; padding:10px; border-radius:8px; margin-bottom:8px; }
.alert { padding:8px 12px; border-radius:8px; }
.inicio-contenido { display:grid; gap:1.5rem; grid-template-columns:1fr; margin-top:1.5rem; }
.mapa-card, .lista-card { background:#fff; border-radius:12px; box-shadow:0 10px 25px rgba(15,23,42,0.08); padding:1.25rem; }
.mapa-interactivo {
    /* Comentario: el contenedor del mapa crece con flex y garantiza una altura mínima en móviles */
    width: 100%;
    height: 100%;
    flex: 1 1 auto;
    min-height: 320px;
    border-radius: 8px;
    overflow: hidden;
}
/* Distribución vertical para igualar las alturas de ambas columnas y permitir desplazamiento interno */
.mapa-card,
.lista-card {
    /* Comentario: ambos contenedores comparten un layout flexible para manejar alturas coherentes */
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: clamp(420px, 72vh, 680px);
}
.lista-card {
    /* Comentario: habilitamos el scroll interno para que conserve la altura compartida con el mapa */
    overflow: hidden;
}


/* Comentario: la cabecera de la lista queda fija y el contenido listado adopta el scroll interno */
.lista-card .lista-header {
    flex-shrink: 0;
}

.lista-comercios {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1 1 auto;    /* Comentario: la lista crece para equiparar la altura con el mapa */
    min-height: 0;
    padding-right: 0;
    overflow: auto;
}

@media (max-width: 1024px) {
    /* Comentario: en pantallas menores permitimos que cada tarjeta defina su propio alto y liberamos el scroll interno */
    .mapa-card,
    .lista-card {
        min-height: auto;
    }

    .lista-comercios {
        overflow-y: visible;
    }
}
@media (max-width: 991.98px) {
    /* Comentario: en móviles dejamos que la lista fluya de forma natural */
    .lista-card {
        height: auto;
        overflow: visible;
    }

    .lista-comercios {
        overflow-y: visible;
        padding-right: 0;
    }
}
@media (min-width: 992px) {
    .inicio-contenido {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        width: 100%;
    }

    .inicio-contenido > .mapa-card,
    .inicio-contenido > .lista-card {
        /* Comentario: igualamos el alto de ambas tarjetas cuando comparten fila en escritorio */
        height: clamp(420px, 72vh, 680px);
        max-height: clamp(420px, 72vh, 680px);
    }

    .mapa-interactivo {
        min-height: 480px;
    }
}

/* Tarjeta de comercio */
.comercio-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 2px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 320px;
}

    .comercio-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 12px 32px rgba(102, 126, 234, 0.2);
        border-color: #667eea;
    }

    .comercio-card.seleccionado {
        border-color: #667eea;
        border-width: 2px;
        box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
    }

/* Imagen */
.comercio-card-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background-color: #f0f9ff;
}

    .comercio-card-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        display: block;
    }

.comercio-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e6f7ff 0%, #f0f9ff 100%);
}

    .comercio-card-placeholder span {
        font-size: 3rem;
        opacity: 0.6;
    }

/* Badge estado */
.comercio-card-status {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    color: #2d3748;
}

.comercio-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: block;
}

    .comercio-status-dot.is-open {
        background-color: #48bb78;
    }

    .comercio-status-dot.is-closed {
        background-color: #e53e3e;
    }

/* Contenido */
.comercio-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

/* Encabezado */
.comercio-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.comercio-card-title-group {
    display: flex;
    gap: 12px;
    flex: 1;
    align-items: flex-start;
}

.comercio-card-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.comercio-card-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3748;
}

.comercio-card-location {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    color: #718096;
}

.comercio-card-rating {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.comercio-rating-value {
    font-size: 1rem;
    font-weight: 700;
    color: #2d3748;
}

.comercio-review-count {
    font-size: 0.75rem;
    color: #718096;
}

/* Badges */
.comercio-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.comercio-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f7fafc;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

/* Botón */
.comercio-card-btn {
    margin-top: auto;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

    .comercio-card-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    }

    .comercio-card-btn:active {
        transform: translateY(0);
    }
/* Near previous definitions, override to ensure scroll is on .lista-card.scroll-card */

/* Make the column container responsible for scrolling */
.lista-card.scroll-card {
    max-height: min(70vh, 640px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Ensure the internal list does not create its own scrollbar */
.lista-comercios {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 0 0 auto; /* don't grow; let parent handle scrolling */
    min-height: 0;
    padding-right: 0;
    overflow: visible !important;
}

/* For small screens revert to natural flow (no constrained heights) */
@media (max-width: 991.98px) {
    .lista-card.scroll-card {
        max-height: none;
        height: auto;
        overflow: visible;
    }
    .lista-comercios { overflow: visible !important; }
}