/**
 * Estilos para o Sistema de Mapa Otimizado
 * Marcadores personalizados, instruções e overlays
 */

/* === ESTILO MODERNO DO MAPA === */
#map {
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaflet-container {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 16px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Controles modernos */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1) !important;
}

.leaflet-control-zoom a {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    border: none !important;
    color: #4f46e5 !important;
    font-weight: 600 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-radius: 8px !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 34px !important;
}

.leaflet-control-zoom a:hover {
    background: #4f46e5 !important;
    color: white !important;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4) !important;
}

.leaflet-control-zoom a:first-child {
    border-radius: 8px 8px 0 0 !important;
}

.leaflet-control-zoom a:last-child {
    border-radius: 0 0 8px 8px !important;
}

/* Attribution mais elegante */
.leaflet-control-attribution {
    background: rgba(0, 0, 0, 0.8) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 11px !important;
    border-radius: 12px !important;
    padding: 6px 12px !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.leaflet-control-attribution a {
    color: #60a5fa !important;
    text-decoration: none !important;
}

/* === INSTRUÇÕES DE ZOOM === */
.map-instruction {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: rgba(30, 41, 59, 0.95);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 280px;
    animation: fadeInScale 0.5s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.instruction-content i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--color-primary, #3b82f6);
    animation: zoomBounce 2s infinite;
}

@keyframes zoomBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

.instruction-content p {
    margin: 10px 0 5px 0;
    font-weight: 500;
    font-size: 1rem;
}

.instruction-content small {
    opacity: 0.7;
    font-size: 0.85rem;
    display: block;
    margin-top: 5px;
}

/* === OVERLAY DE CARREGAMENTO === */
.map-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    background: rgba(30, 41, 59, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-content p {
    margin-top: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Spinner pequeno para carregamento */
.loading-spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === POPUPS MODERNOS === */
.modern-property-popup .leaflet-popup-content-wrapper {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
}

.modern-property-popup .leaflet-popup-content {
    margin: 0;
    padding: 0;
    width: auto !important;
    min-width: 320px;
}

.modern-property-popup .leaflet-popup-tip {
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modern-property-popup .leaflet-popup-close-button {
    color: #6b7280 !important;
    font-size: 18px !important;
    width: 30px !important;
    height: 30px !important;
    right: 8px !important;
    top: 8px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.2s ease !important;
}

.modern-property-popup .leaflet-popup-close-button:hover {
    background: #ef4444 !important;
    color: white !important;
    transform: scale(1.1) !important;
}

.modern-popup-card {
    width: 100%;
    max-width: 350px;
    overflow: hidden;
}

.popup-header {
    position: relative;
    height: 160px;
    overflow: hidden;
}

.popup-image-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.popup-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.popup-image:hover {
    transform: scale(1.05);
}

.popup-type-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(10px);
}

.popup-body {
    padding: 20px;
}

.popup-title {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popup-price {
    font-size: 20px;
    font-weight: 800;
    color: #059669;
    margin: 0 0 16px 0;
    background: linear-gradient(135deg, #059669, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.popup-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 16px 0;
}

.detail-item {
    background: #f3f4f6;
    color: #374151;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.detail-item:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.detail-item i {
    color: #6b7280;
    font-size: 12px;
}

.popup-address {
    color: #6b7280;
    font-size: 14px;
    margin: 12px 0 20px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
}

.popup-address i {
    color: #ef4444;
    font-size: 12px;
}

.popup-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
    background: linear-gradient(135deg, #4338ca, #6d28d9);
}

.btn-secondary {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #059669, #047857);
}

.btn-primary:active, .btn-secondary:active {
    transform: translateY(0);
}
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.popup-image-container {
    width: 100%;
    height: 120px;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    position: relative;
}

.popup-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.popup-image:hover {
    transform: scale(1.05);
}

.popup-content {
    padding: 12px;
}

.popup-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: var(--color-text-primary, #1a202c);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popup-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary, #3b82f6);
    margin: 0 0 8px 0;
}

.popup-details {
    display: flex;
    gap: 10px;
    margin: 8px 0;
    font-size: 0.8rem;
    color: var(--color-text-secondary, #64748b);
    flex-wrap: wrap;
}

.popup-details span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.popup-details i {
    width: 12px;
    font-size: 0.75rem;
}

.popup-address {
    font-size: 0.8rem;
    color: var(--color-text-secondary, #64748b);
    margin: 8px 0;
    line-height: 1.2;
}

.popup-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-popup-view, .btn-popup-contact {
    flex: 1;
    padding: 8px 10px;
    font-size: 0.8rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-decoration: none;
}

.btn-popup-view {
    background: var(--color-primary, #3b82f6);
    color: white;
}

.btn-popup-contact {
    background: #25D366;
    color: white;
}

.btn-popup-view:hover, .btn-popup-contact:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-popup-view:active, .btn-popup-contact:active {
    transform: translateY(0);
}

/* === RESPONSIVIDADE === */
@media (max-width: 768px) {
    .map-instruction {
        padding: 15px;
        max-width: 250px;
    }
    
    .instruction-content i {
        font-size: 1.5rem;
    }
    
    .instruction-content p {
        font-size: 0.9rem;
    }
    
    .property-popup-card {
        max-width: 260px;
    }
    
    .popup-image-container {
        height: 100px;
    }
    
    .popup-actions {
        flex-direction: column;
    }
    
    .btn-popup-view, .btn-popup-contact {
        padding: 10px;
    }
}

/* === TEMA ESCURO === */
@media (prefers-color-scheme: dark) {
    .map-instruction {
        background: rgba(15, 23, 42, 0.95);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .custom-property-popup .leaflet-popup-content-wrapper {
        background: var(--color-surface-dark, #1e293b);
        color: var(--color-text-primary-dark, #f1f5f9);
    }
    
    .custom-property-popup .leaflet-popup-tip {
        background: var(--color-surface-dark, #1e293b);
    }
    
    .marker-logo {
        background: var(--color-surface-dark, #1e293b);
    }
}

/* === ANIMAÇÕES DE ENTRADA === */
.custom-property-popup {
    animation: popupSlideIn 0.3s ease-out;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* === ESTADOS DE HOVER GLOBAIS === */
.leaflet-marker-icon:hover {
    z-index: 1000 !important;
}

/* === CLUSTERS PERSONALIZADOS === */
.marker-cluster {
    background: linear-gradient(135deg, var(--color-primary, #3b82f6), var(--color-primary-dark, #2563eb));
    border: 2px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.marker-cluster div {
    background: linear-gradient(135deg, var(--color-primary, #3b82f6), var(--color-primary-dark, #2563eb));
    color: white;
    font-weight: 600;
}

.marker-cluster span {
    color: white;
}

/* === INDICADORES DE STATUS === */
.map-status-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}

.map-status-indicator.optimized {
    background: linear-gradient(135deg, #10b981, #059669);
}

.map-status-indicator i {
    font-size: 0.75rem;
}

/* === TRANSIÇÕES SUAVES === */
* {
    -webkit-tap-highlight-color: transparent;
}

.leaflet-control-zoom a {
    transition: all 0.2s ease;
}

.leaflet-control-zoom a:hover {
    background-color: var(--color-primary, #3b82f6);
    color: white;
}

/* === ACESSIBILIDADE === */
@media (prefers-reduced-motion: reduce) {
    .marker-pulse,
    .instruction-content i {
        animation: none;
    }
    
    .popup-image:hover {
        transform: none;
    }
    
    .btn-popup-view:hover,
    .btn-popup-contact:hover {
        transform: none;
    }
} 