/* Geo Visits Map Pro - Frontend CSS Profesional Mejorado */

:root {
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --marker-blue: #2563eb;
    --marker-shadow: rgba(37, 99, 235, 0.4);
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-900: #0f172a;
}

.geo-visits-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#geo-visits-map {
    height: 400px;
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    margin-bottom: 25px;
    border: 1px solid var(--gray-200);
    position: relative;
    background: var(--gray-50);
}

.geo-visits-info {
    background: var(--white);
    color: var(--gray-900);
    padding: 20px 32px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
    font-weight: 500;
}

.geo-visits-info:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.geo-visits-info .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: var(--marker-blue);
}

.geo-visits-info strong {
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 0.3px;
    color: var(--marker-blue);
}

/* Marcadores personalizados estilo Google Maps */
.geo-marker {
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
}

.geo-marker:hover {
    z-index: 1000 !important;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35));
}

.geo-marker-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    transition: all 0.3s ease;
}

.geo-marker:hover .geo-marker-inner {
    transform: translateY(-4px) scale(1.05);
}

/* Pin estilo Google Maps */
.geo-marker-pin {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.geo-marker-head {
    width: 100%;
    height: 100%;
    border-radius: 50% 50% 50% 0;
    background: var(--marker-blue);
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--white);
    box-shadow: 0 4px 12px var(--marker-shadow);
    position: relative;
    z-index: 2;
}

.geo-marker-content {
    transform: rotate(45deg);
    width: 80%;
    height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    background: var(--white);
}

.geo-flag {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.geo-emoji {
    font-size: 20px;
}

/* Badge de contador mejorado */
.geo-marker-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc2626;
    color: var(--white);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
    border: 2px solid var(--white);
    z-index: 3;
    min-width: 28px;
    text-align: center;
    line-height: 1.2;
}

/* Animación de pulso sutil */
.geo-marker-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: var(--marker-blue);
    opacity: 0.3;
    animation: pulse-wave 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    z-index: 1;
}

@keyframes pulse-wave {
    0% {
        transform: rotate(-45deg) scale(1);
        opacity: 0.3;
    }
    50% {
        transform: rotate(-45deg) scale(1.4);
        opacity: 0;
    }
    100% {
        transform: rotate(-45deg) scale(1);
        opacity: 0;
    }
}

/* Popup mejorado estilo Google Maps */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.leaflet-popup-content {
    margin: 0;
    min-width: 300px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.geo-popup {
    padding: 0;
}

.geo-popup-header {
    background: var(--white);
    color: var(--gray-900);
    padding: 20px 24px;
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--gray-200);
}

.popup-flag {
    width: 36px;
    height: 27px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--gray-200);
}

.geo-popup-body {
    padding: 20px 24px;
    color: var(--gray-700);
    background: var(--white);
}

.geo-popup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-100);
    gap: 20px;
}

.geo-popup-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.geo-popup-item .label {
    font-weight: 500;
    color: var(--gray-600);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.geo-popup-item .value {
    font-weight: 700;
    color: var(--gray-900);
    font-size: 15px;
    text-align: right;
}

.leaflet-popup-tip {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-top: none;
    border-right: none;
}

.leaflet-popup-close-button {
    color: var(--gray-600) !important;
    font-size: 24px !important;
    padding: 8px 12px !important;
    transition: color 0.2s ease;
}

.leaflet-popup-close-button:hover {
    color: var(--gray-900) !important;
}

/* Estado vacío */
.geo-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 500px;
    color: var(--gray-600);
    text-align: center;
    padding: 40px;
    background: var(--white);
}

.empty-icon {
    font-size: 80px;
    margin-bottom: 24px;
    opacity: 0.5;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.geo-empty-state h3 {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--gray-900);
}

.geo-empty-state p {
    font-size: 15px;
    color: var(--gray-600);
    max-width: 400px;
    line-height: 1.6;
}

/* Estado de carga */
.geo-visits-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 700px;
    background: var(--white);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

.geo-visits-loading::after {
    content: "";
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--marker-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mejoras de Leaflet */
.leaflet-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #e5e7eb !important;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    border-radius: 8px !important;
    overflow: hidden;
    border: 1px solid var(--gray-200) !important;
}

.leaflet-control-zoom a {
    width: 38px !important;
    height: 38px !important;
    line-height: 38px !important;
    font-size: 18px !important;
    border: none !important;
    background: var(--white) !important;
    color: var(--gray-700) !important;
    transition: all 0.2s ease !important;
    font-weight: 600 !important;
}

.leaflet-control-zoom a:hover {
    background: var(--gray-50) !important;
    color: var(--gray-900) !important;
}

.leaflet-control-zoom a:active {
    background: var(--gray-100) !important;
}

.leaflet-bar a:first-child {
    border-bottom: 1px solid var(--gray-200) !important;
}

.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(8px);
    border-radius: 6px !important;
    padding: 4px 10px !important;
    font-size: 10px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid var(--gray-200) !important;
}

.leaflet-control-attribution a {
    color: var(--marker-blue) !important;
}

/* Diseño responsivo mejorado */
@media (max-width: 1024px) {
    .geo-visits-container {
        padding: 20px 15px;
    }
    
    #geo-visits-map {
        height: 600px;
        border-radius: 14px;
    }
}

@media (max-width: 768px) {
    .geo-visits-container {
        padding: 15px 10px;
    }
    
    #geo-visits-map {
        height: 500px;
        border-radius: 12px;
    }
    
    .geo-visits-info {
        padding: 16px 24px;
        font-size: 14px;
        flex-direction: row;
        gap: 12px;
    }
    
    .geo-visits-info strong {
        font-size: 18px;
    }
    
    .leaflet-popup-content {
        min-width: 260px;
    }
    
    .geo-popup-header {
        padding: 16px 20px;
        font-size: 16px;
    }
    
    .geo-popup-body {
        padding: 16px 20px;
    }
}

@media (max-width: 480px) {
    #geo-visits-map {
        height: 200px;
        border-radius: 10px;
    }
    
    .geo-visits-info {
        padding: 14px 20px;
        font-size: 13px;
    }
    
    .geo-marker-count {
        font-size: 10px;
        padding: 3px 8px;
        min-width: 24px;
    }
    
    .leaflet-popup-content {
        min-width: 240px;
    }
    
    .geo-popup-header {
        padding: 14px 18px;
        font-size: 15px;
    }
    
    .geo-popup-body {
        padding: 14px 18px;
    }
    
    .geo-popup-item {
        padding: 12px 0;
    }
    
    .empty-icon {
        font-size: 60px;
    }
    
    .geo-empty-state h3 {
        font-size: 18px;
    }
}

/* Estilos de impresión */
@media print {
    .geo-visits-info,
    #geo-visits-map {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .geo-marker-pulse {
        display: none;
    }
}