/* Estilos para el mapa de profesionales - Frontend */

/* Contenedor principal del mapa con filtro */
.mp-mapa-container {
    width: 100%;
    margin-bottom: 30px;
}

/* Formulario de filtro del mapa */
.mp-filtro-mapa {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mp-filtro-mapa h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

.mp-filtro-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mp-filtro-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 15px;
    align-items: end;
}

.mp-filtro-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mp-filtro-field label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.mp-filtro-field select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.mp-filtro-field select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.mp-filtro-field select:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

.mp-filtro-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.mp-btn-filtrar,
.mp-btn-limpiar {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.mp-btn-filtrar {
    background: #0073aa;
    color: white;
}

.mp-btn-filtrar:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.mp-btn-limpiar {
    background: #f0f0f0;
    color: #555;
}

.mp-btn-limpiar:hover {
    background: #e0e0e0;
}

.mp-filtro-resultados {
    padding: 10px 0 0 0;
    font-size: 14px;
    color: #666;
}

#mp-filtro-contador {
    font-weight: 500;
}

/* Responsive para filtro */
@media (max-width: 768px) {
    .mp-filtro-row {
        grid-template-columns: 1fr;
    }
    
    .mp-filtro-actions {
        width: 100%;
    }
    
    .mp-btn-filtrar,
    .mp-btn-limpiar {
        flex: 1;
    }
}

#mapa-profesionales {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-height: 500px;
}

/* Estilos para Google Maps InfoWindow - Corregido */
.gm-style-iw {
    max-width: 550px !important;
    background: white !important;
}

.gm-style-iw-d {
    max-height: 350px !important;
    overflow-y: auto !important;
    background: white !important;
}

/* Evitar fondo morado en InfoWindow */
.gm-style-iw-chr {
    background: white !important;
}

.gm-style-iw-t {
    background: white !important;
}

/* Estilo del contenido del popup - FORZAR FONDO BLANCO */
.gm-style-iw .mp-popup-content {
    padding: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: white !important;
    border-radius: 8px;
    overflow: hidden;
    display: flex !important;
    flex-direction: row;
    min-height: 200px;
    width: 100% !important;
}

/* FORZAR TODO BLANCO EN INFOWINDOW */
.gm-style-iw,
.gm-style-iw-d,
.gm-style-iw-chr,
.gm-style-iw-t {
    background: white !important;
    color: #333 !important;
}

/* Corregir clase foto vs image */
.gm-style-iw .mp-popup-photo,
.gm-style-iw .mp-popup-image {
    flex: 0 0 180px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gm-style-iw .mp-popup-info {
    flex: 1 !important;
    padding: 20px !important;
    display: flex !important;
    flex-direction: column;
    background: white !important;
}

.gm-style-iw .mp-popup-info h3,
.gm-style-iw .mp-popup-title {
    font-size: 18px !important;
    font-weight: bold !important;
    color: #333 !important;
    margin-bottom: 8px !important;
    background: transparent !important;
}

/* Asegurar fondo blanco en todos los elementos */
.gm-style-iw .mp-popup-info *,
.gm-style-iw .mp-popup-content *,
.gm-style-iw div,
.gm-style-iw p,
.gm-style-iw a {
    background: transparent !important;
}

/* Estilos para foto en InfoWindow */
.gm-style-iw .mp-popup-photo {
    background: #f8f9fa !important;
}

.gm-style-iw .mp-popup-photo img {
    width: 150px !important;
    height: 150px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 3px solid white !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

.gm-style-iw .mp-default-avatar {
    width: 150px !important;
    height: 150px !important;
    background: #e9ecef !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 60px !important;
    border: 3px solid white !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

/* Marcadores personalizados */
.mp-custom-marker {
    background: transparent !important;
    border: none !important;
}

.mp-marker {
    width: 32px;
    height: 42px;
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    border: 2px solid white;
}

.mp-marker:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: rotate(-45deg) scale(1.15);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

.mp-marker::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Estilos para los popups */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.leaflet-popup.mp-popup .leaflet-popup-content-wrapper {
    background: white;
    border: none;
}

.leaflet-popup-content {
    margin: 0;
    padding: 0;
    width: 550px !important;
    max-height: 350px;
}

.mp-popup-content {
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    min-height: 200px;
    animation: popupFadeIn 0.3s ease-out;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mp-popup-photo {
    background: #f8f9fa;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    width: 150px;
}

.mp-popup-photo img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
    display: block;
}

.mp-popup-photo img:hover {
    transform: scale(1.05);
}

.mp-default-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
}

.mp-popup-info {
    padding: 20px 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.mp-popup-info h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    text-align: left;
    line-height: 1.2;
}

.mp-empresa {
    text-align: left;
    color: #667eea;
    font-size: 12px;
    margin-bottom: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mp-direccion {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 12px;
    border-left: 4px solid #667eea;
    font-size: 13px;
    line-height: 1.3;
}

.mp-direccion strong {
    color: #667eea;
    display: block;
    margin-bottom: 5px;
}

.mp-contacto {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mp-contacto p {
    margin: 0;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mp-contacto p strong {
    min-width: 70px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #7f8c8d;
    flex-shrink: 0;
}

.mp-contacto a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.mp-contacto a:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Iconos usando Unicode */
.mp-contacto p[data-type="telefono"] strong::before {
    content: "📞 ";
    margin-right: 4px;
}

.mp-contacto p[data-type="email"] strong::before {
    content: "✉️ ";
    margin-right: 4px;
}

.mp-contacto p[data-type="web"] strong::before {
    content: "🌐 ";
    margin-right: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .leaflet-popup-content {
        width: 360px !important;
        max-height: 300px;
    }
    
    .mp-popup-content {
        flex-direction: column;
        min-height: auto;
    }
    
    .mp-popup-photo {
        width: 100%;
        padding: 15px;
    }
    
    .mp-popup-photo img,
    .mp-default-avatar {
        width: 70px;
        height: 70px;
    }
    
    .mp-popup-info {
        padding: 15px;
    }
    
    .mp-popup-info h3 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .leaflet-popup-content {
        width: 320px !important;
    }
}

/* Animaciones de carga */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

.mp-loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Mejoras en el contraste del mapa */
.leaflet-control-zoom a {
    background-color: #fff;
    border: 1px solid #ccc;
    color: #333;
}

.leaflet-control-zoom a:hover {
    background-color: #f5f5f5;
    border-color: #999;
}

/* Personalización del popup close button */
.leaflet-popup-close-button {
    color: #999 !important;
    font-size: 18px !important;
    padding: 4px 8px !important;
}

.leaflet-popup-close-button:hover {
    color: #666 !important;
    background-color: rgba(0, 0, 0, 0.05) !important;
}

.leaflet-popup-tip {
    background: white !important;
}

/* RESPONSIVE ESPECÍFICO PARA GOOGLE MAPS */
@media (max-width: 768px) {
    /* Mapa responsive */
    #mapa-profesionales {
        height: 400px !important;
        min-height: 400px;
    }
    
    /* InfoWindow responsive */
    .gm-style-iw {
        max-width: 300px !important;
    }
    
    .gm-style-iw .mp-popup-content {
        flex-direction: column !important;
        min-height: auto !important;
    }
    
    .gm-style-iw .mp-popup-photo {
        flex: none !important;
        height: 120px !important;
        width: 100% !important;
        padding: 15px !important;
        align-items: center;
        justify-content: center;
    }
    
    .gm-style-iw .mp-popup-photo img {
        width: 90px !important;
        height: 90px !important;
    }
    
    .gm-style-iw .mp-default-avatar {
        width: 90px !important;
        height: 90px !important;
        font-size: 36px !important;
    }
    
    .gm-style-iw .mp-popup-info {
        padding: 15px !important;
    }
    
    .gm-style-iw .mp-popup-info h3 {
        font-size: 16px !important;
        margin-bottom: 10px !important;
    }
    
    .gm-style-iw .mp-popup-info .mp-direccion,
    .gm-style-iw .mp-popup-info .mp-contacto {
        font-size: 14px !important;
    }
    
    .gm-style-iw .mp-popup-info .mp-contacto p {
        margin: 5px 0 !important;
    }
}

@media (max-width: 480px) {
    #mapa-profesionales {
        height: 350px !important;
        border-radius: 4px;
    }
    
    .gm-style-iw {
        max-width: 280px !important;
    }
    
    .gm-style-iw .mp-popup-info {
        padding: 12px !important;
    }
    
    .gm-style-iw .mp-popup-photo {
        height: 100px !important;
        padding: 10px !important;
    }
    
    .gm-style-iw .mp-popup-photo img,
    .gm-style-iw .mp-default-avatar {
        width: 70px !important;
        height: 70px !important;
    }
}