/**
 * Event Map Component Styles
 * Mapa interactivo con Leaflet
 */

/* Ocultar atribución de Leaflet */
.leaflet-control-attribution {
    display: none !important;
}

/* Layout del mapa */
.map-view {
    display: flex !important;
    flex-direction: row;
    height: 100%;
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    width: 100%;
    position: relative;
}

/* Sidebar */
.map-sidebar {
    width: 320px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e5e7eb;
    background: white;
    height: 100%;
    overflow: hidden;
}

.map-sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.map-sidebar-header-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.map-sidebar-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.map-sidebar-count {
    background: #667eea;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.map-sidebar-reset-btn {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 150ms ease;
    font-size: 1rem;
    flex-shrink: 0;
}

.map-sidebar-reset-btn:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
    transform: scale(1.05);
}

.map-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.map-sidebar-event {
    display: flex;
    gap: 0.75rem;
    padding: 0.625rem;
    background: #f9fafb;
    border: 2px solid transparent;
    border-radius: 0.625rem;
    cursor: pointer;
    transition: all 200ms ease;
}

.map-sidebar-event:hover {
    background: #f3f4f6;
    transform: translateX(4px);
    border-color: #e5e7eb;
}

.map-sidebar-event.active {
    background: linear-gradient(135deg, #ede9fe 0%, #f3e8ff 100%);
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateX(4px);
}

.map-sidebar-event-image {
    width: 60px;
    height: 60px;
    border-radius: 0.5rem;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
}

.map-sidebar-event-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    z-index: 1;
}

.map-sidebar-event-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 2;
}

.map-sidebar-event-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.map-sidebar-event-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.map-sidebar-event-category {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.6875rem;
}

.map-sidebar-event-date {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #667eea;
}

.map-sidebar-event-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.map-sidebar-event-location {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    color: #9ca3af;
}

.map-sidebar-event-location i {
    font-size: 0.75rem;
}

.map-sidebar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    color: #9ca3af;
}

.map-sidebar-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.map-sidebar-empty p {
    margin: 0;
    font-size: 0.9375rem;
}

/* Contenedor del mapa */
.map-container {
    flex: 1;
    position: relative;
    min-width: 0;
    height: 100%;
    overflow: hidden;
}

.map-container > div {
    width: 100%;
    height: 100%;
}

/* Marcadores personalizados */
.custom-marker {
    background: transparent !important;
    border: none !important;
}

.marker-wrapper {
    position: relative;
    width: 30px;
    height: 40px;
}

.marker-pin {
    width: 30px;
    height: 40px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 3px solid white;
    position: relative;
    z-index: 2;
}

.marker-pin i {
    transform: rotate(45deg);
    color: white;
    font-size: 0.875rem;
}

/* Marcador en vivo - Pálpito animado + Levitación */
.live-marker {
    position: relative;
}

/* Animación de levitación para el pin en vivo */
.marker-pin.live-pin {
    animation: marker-float 2s ease-in-out infinite !important;
}

/* Ondas de pálpito */
.marker-live-pulse {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.5);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: marker-pulse-1 2s ease-out infinite;
    pointer-events: none;
    z-index: 1;
}

.marker-live-pulse-2 {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.5);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: marker-pulse-2 2s ease-out infinite;
    animation-delay: 1s;
    pointer-events: none;
    z-index: 1;
}

/* Animación de levitación/flotación */
@keyframes marker-float {
    0%, 100% {
        transform: rotate(-45deg) translateY(0);
    }
    50% {
        transform: rotate(-45deg) translateY(-8px);
    }
}

/* Animación de pálpito 1 */
@keyframes marker-pulse-1 {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Animación de pálpito 2 */
@keyframes marker-pulse-2 {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Popup del mapa - Horizontal con imagen */
.leaflet-popup-content-wrapper {
    border-radius: 0.75rem;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 0;
    width: 280px !important;
}

.leaflet-popup-tip {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.map-popup-horizontal {
    display: flex;
    flex-direction: row;
    background: white;
    min-height: 85px;
    gap: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.map-popup-horizontal:hover {
    background: #f9fafb;
    transform: scale(1.02);
}

.map-popup-content {
    flex: 1;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.375rem;
    min-width: 0;
}

.map-popup-content h4 {
    font-size: 0.875rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.map-popup-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.map-popup-date,
.map-popup-location {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.6875rem;
    color: #6b7280;
    line-height: 1.3;
}

.map-popup-date i,
.map-popup-location i {
    font-size: 0.8125rem;
    color: #667eea;
    flex-shrink: 0;
}

.map-popup-location {
    font-weight: 500;
    color: #374151;
}

.map-popup-price {
    display: inline-flex;
    align-items: center;
    font-size: 0.6875rem;
    color: #667eea;
    font-weight: 600;
    margin-left: 0.25rem;
}

.map-popup-price.free {
    color: #10b981;
}

.map-popup-image {
    width: 90px;
    height: 100%;
    min-height: 85px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
    position: relative;
}

.map-popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Indicador verde sutil en sidebar */
.live-indicator {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    margin-left: auto;
    animation: live-indicator-pulse 2s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
}

@keyframes live-indicator-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Punto verde en popup */
.popup-live-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    margin-left: 0.375rem;
    vertical-align: middle;
    animation: live-indicator-pulse 2s ease-in-out infinite;
}

/* Estado del evento en popup */
.popup-estado {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.25rem;
    width: fit-content;
}

.popup-estado.en-curso {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.popup-estado.finalizado {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

/* Clusters */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: rgba(102, 126, 234, 0.6);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background: rgba(102, 126, 234, 0.8);
    color: white;
    font-weight: 700;
}

/* Prevent body scroll when map view is active on mobile */
body:has(.map-view) {
    overflow-x: hidden;
}

@media (max-width: 768px) {
    body:has(.map-view) {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100vh;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .map-sidebar {
        width: 320px;
    }
}

@media (max-width: 768px) {
    .map-view {
        flex-direction: column-reverse;
        height: calc(100vh - 10rem - 4rem);
        border-radius: 0;
        position: fixed;
        top: 10rem;
        left: 0;
        right: 0;
        bottom: 4rem;
        width: 100vw;
        max-width: 100%;
        overflow: hidden;
    }

    .map-sidebar {
        width: 100%;
        height: 55%;
        max-height: none;
        border-right: none;
        border-top: 2px solid #e5e7eb;
        flex-shrink: 0;
        overflow: hidden;
    }

    .map-sidebar-header {
        padding: 0.875rem 1rem;
    }

    .map-sidebar-header h3 {
        font-size: 0.9375rem;
    }

    .map-sidebar-count {
        font-size: 0.6875rem;
        padding: 0.15rem 0.4rem;
    }

    .map-sidebar-reset-btn {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.875rem;
    }

    .map-sidebar-list {
        padding: 0.625rem;
        padding-bottom: 6rem;
        gap: 0.5rem;
        box-sizing: border-box;
    }

    .map-sidebar-event {
        padding: 0.5rem;
        gap: 0.625rem;
    }

    .map-sidebar-event-image {
        width: 50px;
        height: 50px;
    }

    .map-sidebar-event-name {
        font-size: 0.8125rem;
        -webkit-line-clamp: 2;
    }

    .map-sidebar-event-date {
        font-size: 0.625rem;
    }

    .map-sidebar-event-location {
        font-size: 0.625rem;
    }

    .map-sidebar-event-category {
        width: 1.125rem;
        height: 1.125rem;
        font-size: 0.625rem;
    }

    .map-container {
        height: 45%;
        flex: 1;
        min-height: 0;
        width: 100vw;
        max-width: 100vw;
        position: relative;
    }
    
    .map-container > div {
        width: 100vw !important;
        height: 100% !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
    }
    
    /* Forzar que el contenedor de Leaflet ocupe todo el espacio */
    .map-container .leaflet-container {
        width: 100vw !important;
        height: 100% !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
    }
    
    /* Asegurar que los tiles cubran todo */
    .map-container .leaflet-tile-container {
        width: 100vw !important;
    }

    /* Popup horizontal en mobile */
    .leaflet-popup-content {
        width: 260px !important;
    }

    .map-popup-horizontal {
        min-height: 75px;
    }

    .map-popup-content {
        padding: 0.625rem;
        gap: 0.3rem;
    }

    .map-popup-content h4 {
        font-size: 0.8125rem;
        line-height: 1.2;
    }

    .map-popup-info {
        gap: 0.15rem;
    }

    .map-popup-date,
    .map-popup-location {
        font-size: 0.625rem;
    }

    .map-popup-date i,
    .map-popup-location i {
        font-size: 0.6875rem;
    }

    .map-popup-image {
        width: 75px;
        min-height: 75px;
        height: 100%;
    }

    /* Indicadores en mobile */
    .live-indicator {
        width: 7px;
        height: 7px;
    }

    .popup-live-dot {
        width: 5px;
        height: 5px;
    }

    /* Estado del evento en mobile */
    .popup-estado {
        font-size: 0.5625rem;
        padding: 0.1rem 0.3rem;
    }
}
