/* Estilo base da calculadora */
.cfi-calculadora-wrap {
    border: 1px solid #ddd;
    padding: 20px;
    border-radius: 5px;
    background-color: #f9f9f9;
    max-width: 600px;
    margin: 20px auto;
    font-family: Arial, sans-serif;
}

/* Formulário */
.cfi-form .cfi-form-group {
    margin-bottom: 15px;
}
.cfi-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}
.cfi-form input[type="text"],
.cfi-form input[type="number"] {
    width: calc(100% - 22px);
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}
.cfi-form .cfi-radio-group label {
    font-weight: normal;
    margin-right: 15px;
    display: inline-block;
}
.cfi-form .cfi-radio-group input[type="radio"] {
    margin-right: 5px;
}

/* Botões */
.cfi-form-actions {
    margin-top: 20px;
    text-align: right;
}
.cfi-button {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-left: 10px;
}
.cfi-button-calcular { background-color: #28a745; color: white; }
.cfi-button-calcular:hover { background-color: #218838; }
.cfi-button-limpar { background-color: #dc3545; color: white !important; }
.cfi-button-limpar:hover { background-color: #c82333; }
.cfi-button-ia { background-color: #007bff; color: white; margin-top: 15px; }
.cfi-button-ia:hover { background-color: #0056b3; }

/* Resultados */
.cfi-resultados-wrap {
    margin-top: 30px;
    padding: 20px;
    border: 1px solid #c3e6cb;
    border-radius: 5px;
    background-color: #d4edda;
    color: #155724;
}
.cfi-resultados-wrap h3 {
    margin-top: 0;
    color: #004085;
    border-bottom: 2px solid #004085;
    padding-bottom: 10px;
}
.cfi-resultados-sumario p {
    margin: 6px 0;
    font-size: 13px;
}
.cfi-resultados-sumario strong {
    color: #0f5132;
}
.cfi-resultados-wrap h4 {
    margin-top: 25px;
    margin-bottom: 10px;
    color: #004085;
}

/* Tabela de amortização */
.cfi-tabela-amortizacao-scroll {
    max-height: 400px;
    overflow: auto;
    border: 1px solid #bee5eb;
    width: 100%;
    box-sizing: border-box;
}
.cfi-tabela-amortizacao {
    width: 100%;
    min-width: 750px;
    border-collapse: collapse;
    background-color: #fff;
    font-family: Arial, sans-serif;
    font-size: 12px;
    margin-top: 20px;
}
.cfi-tabela-amortizacao thead tr {
    background-color: #f0f0f0;
    border-bottom: 2px solid #333;
}
.cfi-tabela-amortizacao th,
.cfi-tabela-amortizacao td {
    border: 1px solid #ddd;
    padding: 8px 10px;
    text-align: right;
    white-space: nowrap;
}
.cfi-tabela-amortizacao th {
    position: sticky;
    top: 0;
    background-color: #e9ecef;
    color: #495057;
    font-weight: bold;
    z-index: 1;
}
.cfi-tabela-amortizacao td:first-child,
.cfi-tabela-amortizacao th:first-child {
    text-align: center;
}
.cfi-tabela-amortizacao tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* IA */
.cfi-ia-trigger-container {
    margin-top: 20px;
    text-align: center;
}
.cfi-ia-analise-resultado-container {
    margin-top: 15px;
    padding: 15px;
    border: 1px dashed #007bff;
    border-radius: 4px;
    background-color: #e7f3ff;
}
.cfi-ia-analise-resultado-container p {
    margin: 0 0 10px 0;
}
.cfi-ia-analise-resultado-container p:last-child {
    margin-bottom: 0;
}
.cfi-loading {
    color: #007bff;
    font-style: italic;
}
.cfi-error {
    color: #721c24;
    font-weight: bold;
}

/* Compartilhamento */
.cfi-share-buttons-container {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #bee5eb;
    text-align: center;
}
.cfi-share-buttons-container h4 {
    margin-bottom: 10px;
}
.cfi-share-button {
    margin: 5px;
    padding: 8px 12px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.cfi-share-whatsapp { background-color: #25D366; color: white; }
.cfi-share-whatsapp:hover { background-color: #1DAE54; }
.cfi-share-facebook { background-color: #1877F2; color: white; }
.cfi-share-facebook:hover { background-color: #125EBF; }
.cfi-share-twitter { background-color: #1DA1F2; color: white; }
.cfi-share-twitter:hover { background-color: #0C85D0; }
.cfi-copy-link { background-color: #6c757d; color: white; }
.cfi-copy-link:hover { background-color: #545b62; }

/* Rodapé do PDF */
.cfi-pdf-rodape {
    font-family: sans-serif;
    font-size: 13px;
    text-align: center;
    margin-top: 30px;
    border-top: 1px solid #ccc;
    padding-top: 10px;
}

/* Mobile */
@media (max-width: 767px) {
    .cfi-calculadora-wrap { padding: 15px; }
    .cfi-form input[type="text"],
    .cfi-form input[type="number"] {
        padding: 8px;
        font-size: 15px;
    }
    .cfi-button {
        padding: 8px 12px;
        font-size: 15px;
    }
    .cfi-form-row { flex-direction: column; gap: 0; }
    .cfi-form-row .cfi-form-group {
        flex: 1 1 100%;
        margin-bottom: 15px;
    }
    .cfi-tabela-amortizacao {
        min-width: 850px;
    }
    .cfi-tabela-amortizacao th,
    .cfi-tabela-amortizacao td {
        font-size: 11px;
        padding: 5px;
    }
    .cfi-share-buttons-container {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .cfi-share-button {
        margin: 8px 5px;
        width: 80%;
        max-width: 280px;
        box-sizing: border-box;
    }
}

.cfi-form-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 15px;
}

.cfi-form-row .cfi-form-group {
    flex: 1 1 calc(50% - 10px);
}

.cfi-form-row {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
}

.cfi-form-row .cfi-form-group {
  flex: 1 1 calc(50% - 10px) !important;
  max-width: 48%;
  box-sizing: border-box;
}

@media (max-width: 767px) {
  .cfi-form-row {
    flex-direction: column;
  }

  .cfi-form-row .cfi-form-group {
    max-width: 100%;
  }
}

/* Impressão */
@media print {
    .cfi-share-buttons-container,
    #baixar-pdf-resultados,
    #cfi_analisar_com_ia,
    #cfi_ia_analise_resultado {
        display: none !important;
    }
}