/**
 * Map Popup Styles - Popups enriquecidos do mapa
 */

/* Popup Container */
.leaflet-popup-content-wrapper {
    background: #1a1f2e !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    color: #e5e7eb;
}

.leaflet-popup-tip {
    background: #1a1f2e !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.leaflet-popup-close-button {
    color: #9ca3af !important;
    font-size: 20px !important;
    top: 8px !important;
    right: 8px !important;
}

.leaflet-popup-close-button:hover {
    color: #fff !important;
}

/* Loading */
.map-popup-loading {
    padding: 24px 32px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
}

.map-popup-loading .spinner-border {
    margin-right: 8px;
}

/* Rich Popup */
.map-popup-rich {
    padding: 0;
    min-width: 280px;
}

/* Header */
.popup-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.popup-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.popup-title h6 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.popup-corredor {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
}

/* Stats Grid */
.popup-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
}

.popup-stat {
    text-align: center;
    padding: 8px 4px;
}

.popup-stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.popup-stat-label {
    display: block;
    font-size: 10px;
    color: #9ca3af;
    text-transform: uppercase;
    margin-top: 2px;
}

/* Sparkline */
.popup-sparkline {
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.popup-sparkline-label {
    display: block;
    font-size: 10px;
    color: #6b7280;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.popup-sparkline .sparkline {
    width: 100%;
    height: 30px;
}

/* Cameras Grid */
.popup-cameras {
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.popup-camera-item {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.popup-camera-item:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    transform: scale(1.02);
}

.popup-camera-thumb {
    width: 100%;
    height: 50px;
    background-size: cover;
    background-position: center;
    background-color: #0a0d12;
}

.popup-camera-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.popup-camera-id {
    font-size: 11px;
    font-family: monospace;
    color: #9ca3af;
}

.popup-camera-status {
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
}

.popup-camera-status.online {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.popup-camera-status.offline {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

.popup-camera-status.erro {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.popup-camera-count {
    padding: 4px 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: #3b82f6;
}

/* Actions */
.popup-actions {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
}

/* Estilos base para todos os botões do popup */
.leaflet-popup .popup-actions .btn,
.leaflet-popup-content .popup-actions .btn,
.map-popup-rich .popup-actions .btn,
.popup-actions .btn.btn-sm,
.popup-actions .btn {
    flex: 1;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 10px 16px !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
}

/* Botão Primário - Ver Estação */
.leaflet-popup .popup-actions .btn.btn-primary,
.leaflet-popup-content .popup-actions .btn.btn-primary,
.map-popup-rich .popup-actions .btn.btn-primary,
.popup-actions .btn.btn-sm.btn-primary,
.popup-actions .btn.btn-primary,
.popup-actions a.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
    background-color: #6366f1 !important;
    border: none !important;
    border-color: transparent !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3) !important;
}

.leaflet-popup .popup-actions .btn.btn-primary:hover,
.leaflet-popup-content .popup-actions .btn.btn-primary:hover,
.popup-actions .btn.btn-primary:hover,
.popup-actions a.btn-primary:hover {
    background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%) !important;
    background-color: #818cf8 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4) !important;
    color: #fff !important;
}

/* Botão Danger Outline - Ao Vivo */
.leaflet-popup .popup-actions .btn.btn-outline-danger,
.leaflet-popup-content .popup-actions .btn.btn-outline-danger,
.map-popup-rich .popup-actions .btn.btn-outline-danger,
.popup-actions .btn.btn-sm.btn-outline-danger,
.popup-actions .btn.btn-outline-danger,
.popup-actions button.btn-outline-danger {
    background: rgba(239, 68, 68, 0.15) !important;
    background-color: rgba(239, 68, 68, 0.15) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #f87171 !important;
}

.leaflet-popup .popup-actions .btn.btn-outline-danger:hover,
.leaflet-popup-content .popup-actions .btn.btn-outline-danger:hover,
.popup-actions .btn.btn-outline-danger:hover,
.popup-actions button.btn-outline-danger:hover {
    background: rgba(239, 68, 68, 0.25) !important;
    background-color: rgba(239, 68, 68, 0.25) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
    color: #fca5a5 !important;
    transform: translateY(-1px) !important;
}

.popup-actions .btn i {
    font-size: 12px !important;
    margin-right: 4px !important;
}

/* Custom Marker animation */
.custom-marker {
    transition: transform 0.2s ease;
}

.custom-marker:hover {
    transform: scale(1.2);
    z-index: 1000 !important;
}

/* Responsive */
@media (max-width: 576px) {
    .map-popup-rich {
        min-width: 240px;
    }

    .popup-cameras {
        grid-template-columns: 1fr;
    }

    .popup-actions {
        flex-direction: column;
    }
}
