/* ==========================================================================
   CSS do Wizard de Gerenciamento de Risco (SPDA)
   ========================================================================== */

/* Container */
.wizard-container {
    max-width: 900px;
    margin: 0 auto;
    background-color: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

/* Barra de Progresso */
.wizard-progress {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 40px;
    padding: 0 20px;
}

.wizard-progress::before {
    content: "";
    position: absolute;
    top: 15px;
    left: 40px;
    right: 40px;
    height: 2px;
    background-color: #e0e0e0;
    z-index: 1;
}

.wizard-progress .step {
    position: relative;
    z-index: 2;
    text-align: center;
    font-weight: 600;
    color: #999;
    font-size: 14px;
    background-color: #fff;
    padding: 0 10px;
}

.wizard-progress .step::before {
    content: attr(data-step);
    display: block;
    width: 32px;
    height: 32px;
    line-height: 30px;
    border-radius: 50%;
    background-color: #fff;
    border: 2px solid #e0e0e0;
    margin: 0 auto 8px auto;
    color: #999;
    font-weight: 700;
    transition: all 0.3s ease;
}

.wizard-progress .step.active {
    color: #0077CC;
}

.wizard-progress .step.active::before {
    border-color: #0077CC;
    background-color: #0077CC;
    color: #fff;
    box-shadow: 0 0 0 4px rgba(0, 119, 204, 0.1);
}

/* Conteúdo dos Passos */
.wizard-step {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.wizard-step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Títulos */
.wizard-step h3 {
    font-size: 22px;
    color: #0D2036;
    margin-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.wizard-step h4 {
    font-size: 16px;
    color: #666;
    margin-top: 20px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

/* Listas Dinâmicas */
.item-lista-dinamica {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.btn-remove-item {
    background: none;
    border: none;
    color: #dc3545;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
}

/* Botões e Ações */
.wizard-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Botões de Adicionar (Tracejados) */
#btn-add-linha, 
#btn-add-zona {
    width: 100%;
    border: 2px dashed #ccc; /* Borda tracejada */
    background-color: #f9f9f9;
    color: #666;
    margin-top: 15px;
    padding: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

#btn-add-linha:hover, 
#btn-add-zona:hover {
    border-color: var(--azul-principal, #0077CC);
    color: var(--azul-principal, #0077CC);
    background-color: #f0f8ff;
}

/* Modais */
.modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 999;
}

.modal {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: #fff; padding: 30px; border-radius: 10px;
    width: 90%; max-width: 500px; z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-actions {
    display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px;
}

/* Resultados */
.result-card {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin-bottom: 15px;
}
.result-card.aprovado { border-left: 5px solid #28a745; }
.result-card.reprovado { border-left: 5px solid #dc3545; }

.status-aprovado { color: #28a745; font-weight: bold; }
.status-reprovado { color: #dc3545; font-weight: bold; }

/* Responsivo */
@media (max-width: 768px) {
    .wizard-container { padding: 20px; }
    .wizard-progress .step { font-size: 0; }
    .wizard-progress .step::before { margin-bottom: 0; }
    .calc-form-row { grid-template-columns: 1fr; }
}

/* Correção do Input Group (Campo NG + Lupa) */
.input-group {
    display: flex;
    align-items: stretch; /* Garante que tenham a mesma altura */
    gap: 8px; /* Espaço pequeno entre input e botão */
    width: 100%;
}

.input-group input {
    flex-grow: 1; /* O input cresce para ocupar o espaço */
    width: auto;  /* Reseta largura fixa se houver */
}

.input-group .btn-search {
    flex-shrink: 0; /* Impede o botão de ser esmagado */
    width: 46px;    /* Tamanho fixo quadrado (altura padrão aproximada de input) */
    padding: 0;     /* Remove padding lateral excessivo */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border-radius: var(--border-radius);
}


/* ==========================================================================
   --- Autocomplete da Cidade --- 
   ========================================================================== */

.autocomplete-container {
    position: relative;
}

.autocomplete-items {
    position: absolute;
    border: 1px solid #d4d4d4;
    border-bottom: none;
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: #fff;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 0 0 5px 5px;
    box-shadow: 0px 4px 6px rgba(0,0,0,0.1);
}

/* Estilo individual de cada cidade na lista */
.autocomplete-items li {
    padding: 10px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid #d4d4d4;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s ease;
}

/* Efeito ao passar o mouse */
.autocomplete-items li:hover {
    background-color: #e9e9e9; 
}

/* Destaca o nome da cidade em azul */
.autocomplete-items li strong {
    color: var(--primary-blue, #0077CC);
}


/* Correção de espaçamento dos botões de navegação */
.wizard-actions {
    display: flex;
    justify-content: space-between; /* Um na esquerda, outro na direita */
    gap: 20px; /* Garante que nunca se toquem */
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Responsividade para botões não quebrarem em telas muito pequenas */
@media (max-width: 480px) {
    .wizard-actions {
        flex-direction: column-reverse; /* Empilha: Próximo em cima, Voltar embaixo */
        gap: 15px;
    }
    .wizard-actions button {
        width: 100%;
    }
}

/* Ajuste para selects com textos muito longos (NBR 5419) */
.full-text-select {
    white-space: normal; /* Tenta quebrar linha se o navegador permitir */
    min-width: 100%;
    text-overflow: ellipsis;
}

.full-text-select option {
    white-space: normal; /* Tenta quebrar linha dentro das opções */
    padding: 5px;
}

/* --- Estilos para Radio Cards (Substituição de Selects Longos) --- */

.radio-list-box {
    max-height: 200px; /* Altura controlada com scroll */
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    padding: 5px;
    background-color: #fff;
    /* Scrollbar fina para ficar elegante */
    scrollbar-width: thin;
    scrollbar-color: var(--medium-gray) transparent;
}

.radio-list-box::-webkit-scrollbar {
    width: 6px;
}
.radio-list-box::-webkit-scrollbar-thumb {
    background-color: var(--medium-gray);
    border-radius: 3px;
}

.radio-card {
    display: flex;
    align-items: flex-start; /* Alinha no topo caso o texto quebre */
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px; /* Leve arredondamento no item */
    margin-bottom: 2px;
}

.radio-card:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.radio-card:hover {
    background-color: #f8f9fa;
}

/* Input Radio Customizado */
.radio-card input[type="radio"],
.radio-card input[type="checkbox"] {
    margin-top: 3px; /* Ajuste fino para alinhar com texto */
    margin-right: 12px;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    accent-color: var(--primary-blue); /* Cor nativa do browser */
    cursor: pointer;
}

/* Texto da opção */
.radio-card span {
    font-size: 14px;
    line-height: 1.4;
    color: #555;
    flex-grow: 1; /* Ocupa o resto do espaço */
}

/* --- ESTADO SELECIONADO (PROJETAGRID BLUE) --- */
.radio-card:has(input:checked) {
    background-color: #e3f2fd; /* Azul bem claro de fundo */
    border: 1px solid #90caf9; /* Borda azul suave */
}

.radio-card:has(input:checked) span {
    color: var(--primary-blue); /* Texto Azul Escuro */
    font-weight: 600;
}

/* Botões da Lista de Zonas */
.zone-actions {
    display: flex;
    gap: 10px;
}

.btn-icon-edit {
    background: none;
    border: none;
    color: var(--primary-blue);
    cursor: pointer;
    font-size: 1.2em;
    transition: transform 0.2s;
}

.btn-icon-remove {
    background: none;
    border: none;
    color: #d32f2f;
    cursor: pointer;
    font-size: 1.4em; /* X um pouco maior */
    line-height: 1;
    transition: transform 0.2s;
}

.btn-icon-edit:hover, .btn-icon-remove:hover {
    transform: scale(1.2);
}

/* Tags de Perda na Lista */
.loss-tag {
    display: inline-block;
    background-color: #eee;
    color: #555;
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 4px;
    font-weight: bold;
}

.risk-tag {
    display: inline-block;
    background-color: #ffebee;
    color: #c62828;
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    border: 1px solid #ffcdd2;
}

/* --- RESULTADOS STEP 5 --- */
.results-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.result-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-align: center;
}

.result-card .card-header {
    background: #f1f3f5;
    padding: 10px;
    font-weight: bold;
    color: #555;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.result-card .card-body {
    padding: 15px;
}

.risk-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.risk-limit {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 10px;
}

.risk-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
    color: #fff;
}

/* Status Colors */
.status-aprovado { background-color: #4caf50; }
.status-reprovado { background-color: #f44336; }
.status-info { background-color: #2196f3; }
.status-wait { background-color: #9e9e9e; }

/* Tabela de Resultados */
.table-responsive {
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.results-table th, .results-table td {
    padding: 10px;
    border: 1px solid #eee;
    text-align: center;
}

.results-table th {
    background-color: var(--primary-blue);
    color: #fff;
    font-weight: 500;
}

.results-table tr:nth-child(even) {
    background-color: #f9f9f9;
}