/* ===================================================================
   Puntos de Venta - Estilos del mapa y panel de listado
   =================================================================== */

/* ── Hero / Cabecera ─────────────────────────────────────────────── */
.pv-hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, #005bb5 100%);
    color: var(--color-white);
    padding: 2.5rem 0 2rem;
    text-align: center;
}

.pv-hero h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.pv-hero p {
    font-size: 1.05rem;
    opacity: 0.9;
    max-width: 560px;
    margin: 0 auto;
}

/* ── Barra de controles (búsqueda + filtro zona) ─────────────────── */
.pv-controls {
    background: var(--color-white);
    border-bottom: 2px solid var(--color-light-gray);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.pv-controls .container {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.pv-search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.pv-search-wrap .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-gray);
    font-size: 1rem;
    pointer-events: none;
}

.pv-input {
    width: 100%;
    padding: 0.65rem 0.75rem 0.65rem 2.5rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    font-family: var(--font-primary);
}

.pv-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.pv-select {
    padding: 0.65rem 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--color-white);
    color: var(--color-dark-gray);
    min-width: 180px;
    cursor: pointer;
    transition: border-color 0.2s;
    font-family: var(--font-primary);
}

.pv-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.pv-counter {
    font-size: 0.85rem;
    color: var(--color-gray);
    white-space: nowrap;
    margin-left: auto;
}

.pv-counter strong {
    color: var(--color-primary);
    font-weight: 700;
}

/* ── Layout principal (lista + mapa) ─────────────────────────────── */
.pv-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    height: calc(100vh - 130px);
    min-height: 560px;
}

/* ── Panel izquierdo: lista de puntos ────────────────────────────── */
.pv-list-panel {
    border-right: 2px solid var(--color-light-gray);
    overflow-y: auto;
    background: #fafafa;
}

.pv-list-panel::-webkit-scrollbar { width: 5px; }
.pv-list-panel::-webkit-scrollbar-track { background: #f1f1f1; }
.pv-list-panel::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
.pv-list-panel::-webkit-scrollbar-thumb:hover { background: var(--color-primary); }

.pv-list-empty {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--color-gray);
}

.pv-list-empty .empty-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

/* Tarjeta de punto en la lista */
.pv-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e8e8e8;
    cursor: pointer;
    transition: background-color 0.15s, border-left-color 0.15s;
    border-left: 3px solid transparent;
    background: var(--color-white);
}

.pv-item:hover {
    background: #eef4ff;
    border-left-color: var(--color-primary);
}

.pv-item.active {
    background: #e0ecff;
    border-left-color: var(--color-secondary);
}

.pv-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
    color: var(--color-white);
}

.pv-item.active .pv-item-icon {
    background: var(--color-secondary);
}

.pv-item-info {
    flex: 1;
    min-width: 0;
}

.pv-item-nombre {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-dark-gray);
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pv-item-zona {
    font-size: 0.78rem;
    color: var(--color-primary);
    font-weight: 500;
    margin-bottom: 0.15rem;
}

.pv-item-dir {
    font-size: 0.8rem;
    color: var(--color-gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Panel derecho: mapa ─────────────────────────────────────────── */
.pv-map-panel {
    position: relative;
    overflow: hidden;
    padding: 0rem !important;
}

#pv-mapa {
    width: 100%;
    height: 100%;
}

/* Overlay de carga del mapa */
.pv-map-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    gap: 1rem;
    color: var(--color-primary);
    font-weight: 600;
}

.pv-map-loading .spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(0, 61, 122, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Mensaje de error del mapa */
.pv-map-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    background: #fff8e1;
    z-index: 10;
    display: none;
}

.pv-map-error .error-icon { font-size: 3rem; margin-bottom: 1rem; }
.pv-map-error h3 { color: var(--color-primary); margin-bottom: 0.5rem; }
.pv-map-error p  { color: var(--color-gray); font-size: 0.9rem; max-width: 400px; }

/* ── Popup compacto (InfoWindow de Google Maps) ──────────────────── */
.pv-popup {
    font-family: var(--font-primary, 'Roboto', sans-serif);
    min-width: 200px;
    max-width: 260px;
    padding: 0.1rem 0;
}

.pv-popup-nombre {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-primary, #003d7a);
    margin-bottom: 0.2rem;
    line-height: 1.3;
}

.pv-popup-zona {
    font-size: 0.75rem;
    font-weight: 600;
    color: #005bb5;
    background: #e0ecff;
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    margin-bottom: 0.4rem;
}

.pv-popup-dir {
    font-size: 0.82rem;
    color: #555;
    margin-bottom: 0.6rem;
    line-height: 1.4;
}

.pv-popup-acciones {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.pv-popup-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: none;
    border-radius: 7px;
    padding: 0.42rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.1s;
    font-family: inherit;
    white-space: nowrap;
}

.pv-popup-btn:hover { opacity: 0.85; transform: translateY(-1px); }

.pv-popup-btn.primary {
    background: var(--color-primary, #003d7a);
    color: #fff;
}

.pv-popup-btn.secondary {
    background: #f0f4ff;
    color: var(--color-primary, #003d7a);
    border: 1.5px solid #c8d8f5;
}

/* ── Modal ampliado ──────────────────────────────────────────────── */
.pv-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.pv-modal-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.pv-modal {
    background: var(--color-white, #fff);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.22);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.93) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.pv-modal-overlay.visible .pv-modal {
    transform: scale(1) translateY(0);
}

.pv-modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid var(--color-light-gray, #eee);
    position: sticky;
    top: 0;
    background: var(--color-white, #fff);
    border-radius: 16px 16px 0 0;
    z-index: 1;
}

.pv-modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-primary, #003d7a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.pv-modal-titulo {
    flex: 1;
    min-width: 0;
}

.pv-modal-titulo h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-primary, #003d7a);
    margin-bottom: 0.15rem;
    line-height: 1.3;
}

.pv-modal-cerrar {
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #666;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.pv-modal-cerrar:hover {
    background: #fde8e8;
    color: var(--color-error, #d32f2f);
}

.pv-modal-body {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pv-modal-campo {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.pv-modal-campo .campo-icono {
    font-size: 1.15rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.pv-modal-campo .campo-texto {
    font-size: 0.9rem;
    color: var(--color-dark-gray, #333);
    line-height: 1.4;
}

.pv-modal-campo .campo-label {
    display: block;
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--color-gray, #777);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.15rem;
}

.pv-modal-campo .campo-valor {
    color: var(--color-dark-gray, #333);
    text-decoration: none;
}

.pv-modal-campo a.campo-valor:hover {
    color: var(--color-primary, #003d7a);
    text-decoration: underline;
}

.pv-modal-footer {
    padding: 0.5rem 1.5rem 1.5rem;
    border-top: 1px solid var(--color-light-gray, #eee);
    margin-top: -0.25rem;
}

/* ── Shared: zona badge, horarios, próximamente ──────────────────── */
.zona-badge {
    display: inline-block;
    background: #e0ecff;
    color: var(--color-primary, #003d7a);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
}

.pv-horarios { margin-top: 0.4rem; }

.pv-horario-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    padding: 0.2rem 0;
    border-bottom: 1px dashed #eee;
}

.pv-horario-row:last-child { border-bottom: none; }
.pv-horario-row .dia { font-weight: 500; color: var(--color-dark-gray, #333); }
.pv-horario-row .hora { color: var(--color-gray, #777); }
.pv-horario-row.cerrado .hora { color: var(--color-error, #d32f2f); }

.pv-proximamente {
    font-size: 0.8rem;
    color: var(--color-gray, #777);
    font-style: italic;
    background: var(--color-light-gray, #f5f5f5);
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    display: inline-block;
}

/* ── Botón "Cómo llegar" ─────────────────────────────────────────── */
.btn-como-llegar {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: 8px;
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.15s;
    text-decoration: none;
    margin-top: 0.5rem;
}

.btn-como-llegar:hover {
    background: #005bb5;
    transform: translateY(-1px);
}

/* ── Marcador personalizado (cuando NO se usa AdvancedMarker) ──────── */
.pv-pin {
    width: 34px;
    height: 44px;
    cursor: pointer;
    filter: drop-shadow(0 3px 5px rgba(0,0,0,0.35));
    transition: transform 0.15s;
}

.pv-pin:hover { transform: scale(1.15) translateY(-3px); }
.pv-pin.activo { transform: scale(1.2) translateY(-4px); }

/* ── Skeleton loader de la lista ─────────────────────────────────── */
.pv-skeleton {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.skel-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(90deg, #eee 25%, #ddd 50%, #eee 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
    flex-shrink: 0;
}

.skel-lines { flex: 1; }

.skel-line {
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(90deg, #eee 25%, #ddd 50%, #eee 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
    margin-bottom: 6px;
}

.skel-line.wide  { width: 80%; }
.skel-line.mid   { width: 55%; }
.skel-line.short { width: 40%; }

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .pv-layout {
        grid-template-columns: 280px 1fr;
    }
}

@media (max-width: 768px) {
    .pv-hero h1 { font-size: 1.5rem; }

    .pv-controls .container {
        flex-wrap: wrap;
    }

    .pv-search-wrap { min-width: 100%; }
    .pv-select       { min-width: 140px; flex: 1; }

    .pv-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 450px 1fr;
        height: auto;
        min-height: unset;
    }

    .pv-map-panel  { order: -1; height: 450px; }
    .pv-list-panel { max-height: 50vh; }

    /* Modal ocupa casi toda la pantalla en móvil */
    .pv-modal-overlay { padding: 0; align-items: flex-end; }
    .pv-modal {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 85vh;
    }
    .pv-modal-header { border-radius: 20px 20px 0 0; }
}

@media (max-width: 480px) {
    .pv-hero { padding: 1.5rem 0 1.25rem; }
    .pv-hero h1 { font-size: 1.3rem; }
}
