/* Estilos para o Radar de Análise */

/* Container do radar na página principal */
.radar-analysis-main {
    width: 100%;
    padding: 20px 0;
}

/* Container do radar dentro do modal */
#radarAnalysis {
    width: 100%;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--muted);
    font-size: 0.95rem;
    min-height: 200px;
    position: relative;
}

.loading-spinner::before {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.1);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-radar {
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--accent-green), #16a34a);
    color: #021018;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 12px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.btn-radar:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.3);
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}

.modal-content {
    background: linear-gradient(180deg, rgba(4, 21, 71, 0.98), rgba(3, 12, 40, 0.95));
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 12px;
    padding: 24px;
    max-width: 1200px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    margin: 20px auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: #e6eef8;
    font-size: 28px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.18s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Radar Header */
.radar-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(34, 197, 94, 0.3);
}

.radar-header h2 {
    color: var(--accent-green);
    font-size: 2rem;
    margin-bottom: 4px;
}

.radar-header p {
    color: var(--muted);
    font-size: 0.95rem;
}

/* Grid de Radar */
.radar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.radar-section {
    background: linear-gradient(135deg, rgba(8, 18, 48, 0.45), rgba(6, 10, 30, 0.7));
    border: 1px solid rgba(59, 130, 246, 0.08);
    border-radius: 10px;
    padding: 16px;
}

.radar-section.full-width {
    grid-column: 1 / -1;
}

/* Fazer o gráfico ocupar duas colunas do grid em telas maiores */
#radarChartSection {
    grid-column: span 2;
}

@media (max-width: 900px) {
    /* Em telas menores, não forçar span para evitar colapsos */
    #radarChartSection {
        grid-column: auto;
    }
}

.radar-section h3 {
    color: var(--accent-green);
    font-size: 1.1rem;
    margin-bottom: 14px;
}

/* Garantir tamanho fixo/limitado para o canvas do radar para evitar expansão infinita */
#radarChart,
.radar-section canvas {
    width: 100% !important;
    height: 340px !important;
    max-height: 480px !important;
    display: block;
    box-sizing: border-box;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(6, 12, 28, 0.35);
    border-left: 4px solid;
    border-radius: 6px;
    transition: transform 0.18s ease;
}

.kpi-card:hover {
    transform: translateX(4px);
}

.kpi-primary { border-color: var(--accent-blue); }
.kpi-success { border-color: var(--accent-green); }
.kpi-warning { border-color: #f59e0b; }
.kpi-info { border-color: #06b6d4; }
.kpi-accent { border-color: #a78bfa; }

.kpi-icon {
    font-size: 1.5rem;
    min-width: 40px;
    text-align: center;
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.kpi-value {
    color: #e6eef8;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.kpi-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
}

.kpi-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), #16a34a);
    border-radius: 2px;
}

/* Análise Geográfica */
.geo-analysis {
    margin-top: 16px;
}

.geo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.geo-point {
    background: rgba(6, 12, 28, 0.45);
    border: 1px solid rgba(59, 130, 246, 0.08);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: transform 0.18s ease;
}

.geo-point:hover {
    transform: translateY(-4px);
    border-color: rgba(34, 197, 94, 0.3);
}

.geo-name {
    display: block;
    color: var(--accent-blue);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.geo-score {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.score-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,
        rgba(34, 197, 94, calc(var(--score) / 10 * 0.3)),
        rgba(34, 197, 94, calc(var(--score) / 10 * 0.15))
    );
    border: 2px solid rgba(34, 197, 94, 0.4);
    color: var(--accent-green);
    font-weight: 700;
    font-size: 1.1rem;
}

.geo-distance {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
}

/* Mapa */
#radarMap {
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 8px;
    margin-bottom: 12px;
}

.leaflet-container {
    background: rgba(4, 21, 71, 0.5) !important;
    border-radius: 8px;
}

.leaflet-tile {
    filter: invert(0.9) hue-rotate(200deg) saturate(0.3);
}

/* Análise de Reviews */
.reviews-analysis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.review-stat {
    background: rgba(6, 12, 28, 0.45);
    border: 1px solid rgba(59, 130, 246, 0.08);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-green);
    margin-bottom: 4px;
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.recent-reviews {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.review-card {
    background: rgba(6, 12, 28, 0.5);
    border: 1px solid rgba(59, 130, 246, 0.08);
    border-radius: 8px;
    padding: 12px;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.review-header strong {
    color: var(--accent-blue);
    font-size: 0.95rem;
}

.review-rating {
    color: #fbbf24;
    font-size: 0.9rem;
}

.review-card p {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
    line-height: 1.4;
}

.review-response,
.no-response {
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 4px;
}

.review-response {
    background: rgba(34, 197, 94, 0.1);
    color: var(--accent-green);
}

.no-response {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Concorrentes Radar */
.competitors-radar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.competitor-card {
    background: rgba(6, 12, 28, 0.45);
    border: 1px solid rgba(59, 130, 246, 0.08);
    border-radius: 8px;
    padding: 12px;
    position: relative;
}

.competitor-rank {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.competitor-card h4 {
    color: var(--accent-blue);
    margin-bottom: 4px;
}

.competitor-card p {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.competitor-score {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
}

.bar span:first-child {
    color: var(--muted);
    flex: 0 0 50px;
}

.bar-fill {
    flex: 1;
    height: 6px;
    background: linear-gradient(90deg, var(--accent-green), #16a34a);
    border-radius: 3px;
}

.bar span:last-child {
    color: var(--accent-green);
    font-weight: 600;
    flex: 0 0 35px;
    text-align: right;
}

/* Pontos Fortes e Fracos */
.strengths-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.strengths-column h4 {
    color: #e6eef8;
    font-size: 1rem;
    margin-bottom: 12px;
}

.strength-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    flex-shrink: 0;
    min-height: auto;
    }

    .strength-item > * {
        flex-shrink: 0;
    background: rgba(6, 12, 28, 0.35);
    border-radius: 6px;
    margin-bottom: 8px;
}

.strength-label {
    color: var(--muted);
    font-size: 0.9rem;
}

.strength-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
}

.strength-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), #16a34a);
    border-radius: 4px;
    transition: width 0.4s ease;
min-width: 0;
}

.strength-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-green);
    text-align: right;
}

.strength-item.strong .strength-fill {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.strength-item.weak .strength-fill {
    background: linear-gradient(90deg, #f59e0b, #ea580c);
}

.strength-item.weak .strength-value {
    color: #f59e0b;
}

/* Responsividade */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 16px;
    }

    .radar-grid {
        flex-direction: column;
    }

    .strengths-wrapper {
        grid-template-columns: 1fr;
    }

    .geo-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .reviews-analysis {
        grid-template-columns: repeat(2, 1fr);
    }

    .recent-reviews {
        grid-template-columns: 1fr;
    }

    .radar-header h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 98%;
        padding: 12px;
    }

    .radar-grid {
        grid-template-columns: 1fr;
    }

    .geo-grid {
        grid-template-columns: 1fr;
    }

    .reviews-analysis {
        grid-template-columns: 1fr;
    }

    .kpi-card {
        gap: 8px;
    }

    .kpi-icon {
        font-size: 1.2rem;
    }
}
