/**
 * Map Animations - Efeitos visuais para rotas e marcadores
 * @version 1.0.0
 */

/* ==============================
   Pulsação de Marcadores
   ============================== */

@keyframes pulse-blue {
    0% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(0, 191, 255, 0.7);
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 20px rgba(0, 191, 255, 0);
    }
}

@keyframes pulse-green {
    0% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(0, 255, 0, 0.7);
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 20px rgba(0, 255, 0, 0);
    }
}

@keyframes pulse-gold {
    0% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.9);
    }
    50% {
        transform: scale(1.4);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 30px rgba(255, 215, 0, 0);
    }
}

.pulse-marker-lote {
    animation: pulse-blue 2s infinite;
}

.pulse-marker-cto {
    animation: pulse-green 2s infinite;
}

.pulse-marker-selected {
    animation: pulse-gold 1.5s infinite;
}

/* ==============================
   Marcadores Customizados
   ============================== */

.custom-marker {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.custom-marker:hover {
    transform: scale(1.1);
}

.marker-lote {
    background: linear-gradient(135deg, #00bfff, #0080ff);
    color: white;
    border: 3px solid white;
}

.marker-cto {
    background: linear-gradient(135deg, #00ff00, #00aa00);
    color: white;
    border: 3px solid white;
}

.marker-cto-selected {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: white;
    border: 4px solid white;
}

/* ==============================
   Popup Customizado
   ============================== */

.route-popup {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.route-popup-header {
    background: linear-gradient(135deg, #00bfff, #0080ff);
    color: white;
    padding: 12px 16px;
    border-radius: 8px 8px 0 0;
    font-weight: bold;
    font-size: 16px;
}

.route-popup-body {
    padding: 16px;
    background: white;
}

.route-popup-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.route-popup-row:last-child {
    border-bottom: none;
}

.route-popup-label {
    font-weight: 600;
    color: #555;
}

.route-popup-value {
    color: #222;
    font-weight: bold;
}

.route-popup-button {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #00ff00, #00aa00);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.3s ease;
}

.route-popup-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 170, 0, 0.4);
}

/* ==============================
   Loading Spinner
   ============================== */

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.route-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.route-loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #00bfff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

.route-loading-text {
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

/* ==============================
   Painel Lateral de CTOs
   ============================== */

.cto-ranking-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.cto-ranking-card {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.cto-ranking-card:hover {
    background: #f8f8f8;
    transform: translateX(4px);
}

.cto-ranking-card.active {
    background: linear-gradient(135deg, #e6f7ff, #bae7ff);
    border-left: 4px solid #00bfff;
}

.cto-ranking-number {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cto-ranking-info {
    margin-left: 48px;
}

.cto-ranking-title {
    font-weight: bold;
    font-size: 16px;
    color: #222;
    margin-bottom: 4px;
}

.cto-ranking-distance {
    color: #00bfff;
    font-weight: 600;
    font-size: 14px;
}

.cto-ranking-drops {
    color: #666;
    font-size: 13px;
    margin-top: 4px;
}

/* ==============================================
   6. DROP MARKERS (Cliente / CTO)
   ============================================== */

.drop-marker {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: #00E5FF;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 2px 8px rgba(0, 229, 255, 0.4), 0 0 12px rgba(0, 229, 255, 0.2);
    pointer-events: auto;
    cursor: pointer;
}

.drop-marker .material-icons {
    font-size: 20px;
    line-height: 1;
}

.drop-marker-cto {
    background: linear-gradient(135deg, #00E676, #00C853);
    box-shadow: 0 2px 8px rgba(0, 230, 118, 0.4), 0 0 12px rgba(0, 230, 118, 0.2);
}

/* ==============================================
   7. DROP POPUP
   ============================================== */

.drop-popup {
    min-width: 180px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    padding: 4px;
}

.drop-popup-title {
    font-weight: 700;
    font-size: 14px;
    color: #00C853;
    margin-bottom: 6px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 4px;
}

.drop-popup-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: #424242;
    padding: 2px 0;
}

/* Backward compat: keep old route-marker class non-interactive */
.route-marker {
    pointer-events: none;
}

/* ==============================================
   8. CTO CLICK POPUP
   ============================================== */

.cto-click-popup {
    font-family: 'Segoe UI', system-ui, sans-serif;
    min-width: 200px;
    padding: 4px 0;
}

.cto-click-title {
    font-weight: 700;
    font-size: 14px;
    color: #212121;
}

.cto-click-subtitle {
    font-size: 11px;
    color: #757575;
    margin-bottom: 6px;
}

.cto-click-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    margin: 6px 0;
    overflow: hidden;
}

.cto-click-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.cto-click-stats {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #616161;
    margin-bottom: 4px;
}

.cto-click-route-btn {
    width: 100%;
    padding: 6px 0;
    margin-top: 8px;
    background: linear-gradient(135deg, #00E5FF, #00B0FF);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.cto-click-route-btn:hover {
    opacity: 0.85;
}

