/* ==========================================================================
   MODAL DE SCORE & COMPONENTES VISUAIS DE PERFORMANCE
   Stepped Progress Bar, Score Gauge SVG, Visão de Negócio e Legendas
   ========================================================================== */

/* Ícone Gauge nos Cards da Sidebar */
.score-gauge-container {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    user-select: none;
    transition: transform 0.2s ease;
    cursor: pointer;
    outline: none;
    border-radius: 8px;
}

.score-gauge-container:hover,
.score-gauge-container:focus-visible {
    transform: scale(1.08);
}

.score-gauge-container:focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.4);
}

.score-pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 99px;
    color: #fff;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Quadro Flutuante (Modal de Desmembramento do Score) */
.score-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.score-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.score-modal-card {
    background: #ffffff;
    border-radius: 20px;
    width: 95%;
    max-width: 820px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(226, 232, 240, 0.8);
    overflow: hidden;
    transform: scale(0.94) translateY(12px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.score-modal-overlay.active .score-modal-card {
    transform: scale(1) translateY(0);
}

.score-modal-header {
    padding: 1.25rem 1.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
    gap: 1rem;
}

.score-modal-title-area {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.carrier-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #eff6ff;
    color: var(--primary, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.score-modal-title-wrap {
    min-width: 0;
}

.score-modal-title-wrap h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-modal-title-wrap p {
    margin: 0.15rem 0 0;
    font-size: 0.76rem;
    color: #64748b;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-modal-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.score-modal-close-btn {
    background: #f1f5f9;
    border: none;
    color: #64748b;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.score-modal-close-btn:hover,
.score-modal-close-btn:focus-visible {
    background: #e2e8f0;
    color: #0f172a;
    transform: rotate(90deg);
}

.score-modal-close-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.4);
}

.score-modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.score-modal-body::-webkit-scrollbar {
    width: 6px;
}

.score-modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 99px;
}

.eligibility-badge-box {
    border-radius: 12px;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.82rem;
}

.eligibility-badge-box.eligible {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.eligibility-badge-box.ineligible {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.eligibility-badge-box i {
    font-size: 1.2rem;
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.eligibility-title {
    font-weight: 700;
    font-size: 0.88rem;
    margin-bottom: 0.2rem;
}

.eligibility-sub {
    font-size: 0.78rem;
    line-height: 1.45;
    opacity: 0.92;
}

.pillar-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1rem 1.15rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.pillar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.pillar-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pillar-badge {
    font-size: 0.82rem;
    font-weight: 800;
    padding: 0.2rem 0.65rem;
    border-radius: 99px;
    background: #f1f5f9;
    color: #334155;
}

.pillar-desc {
    font-size: 0.76rem;
    color: #64748b;
    margin-bottom: 0.85rem;
    white-space: nowrap;
}

.metric-row {
    background: #f8fafc;
    border: 1px solid #edf2f7;
    border-radius: 12px;
    padding: 0.95rem 1.1rem 0.85rem;
    margin-top: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.metric-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.metric-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    min-width: 0;
}

.metric-name {
    font-size: 0.84rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.metric-title-sep {
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 400;
}

.metric-title-detail {
    font-size: 0.76rem;
    font-weight: 500;
    color: #64748b;
}

.metric-points {
    font-size: 0.9rem;
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
    flex-shrink: 0;
}

.metric-points span.max-pts {
    font-weight: 500;
    color: #94a3b8;
    font-size: 0.75rem;
}

/* Stepped Progress Bar (5 Secções) */
.stepped-bar-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    position: relative;
    margin: 0.25rem 0 0.1rem;
}

.stepped-marker-track {
    position: relative;
    width: 100%;
    height: 25px;
    margin-bottom: 3px;
}

.stepped-floating-marker {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 5;
    transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.stepped-marker-val {
    background: #0f172a;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.12rem 0.5rem;
    border-radius: 6px;
    white-space: nowrap;
    line-height: 1.25;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
    letter-spacing: -0.01em;
}

.stepped-marker-arrow {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #0f172a;
    margin-top: -1px;
}

.stepped-bar-track {
    display: flex;
    width: 100%;
    height: 9px;
    gap: 4px;
}

.stepped-block {
    flex: 1;
    height: 100%;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.stepped-block:first-child {
    border-radius: 6px 4px 4px 6px;
}

.stepped-block:last-child {
    border-radius: 4px 6px 6px 4px;
}

.stepped-block-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* Cores dos 5 Blocos (Vermelho -> Laranja -> Amarelo -> Verde Claro -> Verde Escuro) */
.stepped-b1 { background: #fee2e2; }
.stepped-b1 .stepped-block-fill { background: #ef4444; }

.stepped-b2 { background: #ffedd5; }
.stepped-b2 .stepped-block-fill { background: #f97316; }

.stepped-b3 { background: #fef9c3; }
.stepped-b3 .stepped-block-fill { background: #eab308; }

.stepped-b4 { background: #ecfccb; }
.stepped-b4 .stepped-block-fill { background: #84cc16; }

.stepped-b5 { background: #dcfce7; }
.stepped-b5 .stepped-block-fill { background: #15803d; }

.stepped-bar-labels {
    display: flex;
    width: 100%;
    margin-top: 0.35rem;
    gap: 4px;
}

.stepped-lbl {
    flex: 1;
    font-size: 0.68rem;
    font-weight: 500;
    color: #94a3b8;
    text-align: center;
    white-space: nowrap;
    line-height: 1.2;
}

.stepped-lbl:first-child { text-align: left; }
.stepped-lbl:last-child { text-align: right; }

/* Visão de Negócio (3 Cards) */
.business-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.business-metric-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.business-metric-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
}

.business-metric-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.business-metric-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

/* Resumo Consolidado do Score */
.score-summary-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.score-summary-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.score-summary-number-wrap {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}

.score-summary-number {
    font-size: 2.2rem;
    font-weight: 900;
    line-height: 1;
    font-family: 'Space Grotesk', 'Poppins', sans-serif;
}

.score-summary-max {
    font-size: 0.95rem;
    color: #64748b;
    font-weight: 700;
}

.score-tier-badge {
    padding: 0.35rem 0.85rem;
    border-radius: 99px;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.score-ranges-legend {
    display: flex;
    justify-content: space-between;
    gap: 0.35rem;
    padding-top: 0.6rem;
    border-top: 1px solid #e2e8f0;
    font-size: 0.68rem;
    color: #64748b;
    flex-wrap: wrap;
}

.range-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem 0.45rem;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    font-weight: 600;
}

.range-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

@media (max-width: 860px) {
    .pillar-desc { white-space: normal; }
}

@media (max-width: 640px) {
    .score-modal-card { max-height: 96vh; border-radius: 16px; }
    .score-modal-header { padding: 1rem 1.15rem; }
    .score-modal-body { padding: 1rem 1.15rem; }
    .business-metrics-grid { grid-template-columns: 1fr; gap: 0.5rem; }
    .score-ranges-legend { justify-content: flex-start; }
}
