/* ============================================================
   📝 CADASTRAR.CSS
   Estilos específicos do formulário de cadastro de carros
   ============================================================ */

/* Container do Formulário */
.formulario {
    background-color: var(--surface-color);
    max-width: 900px;
    margin: 2rem auto;
    padding: 2.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
}

.formulario h2 {
    color: var(--primary-dark);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.75rem;
    font-weight: 700;
}

/* Fieldsets e Grupos */
fieldset.grupo {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background-color: white;
}

fieldset.grupo legend {
    font-weight: 700;
    color: var(--primary-dark);
    padding: 0 0.5rem;
    font-size: 1.1rem;
}

/* Grid System (Linha/Coluna) */
.linha {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.coluna {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
}

.coluna label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary-dark);
    font-size: 0.9rem;
}

.linha-controles {
    display: flex;
    gap: 8px;
    align-items: center;
}

.linha-controles .hidden {
    display: none;
}

.linha-controles input {
    flex: 1;
}

.justify-end {
    justify-content: flex-end;
}

.text-hint {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 4px;
}

/* Accordion (Collapsible) */
.fieldset-collapsible {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    overflow: hidden;
    background-color: white;
}

.fieldset-header {
    background-color: var(--secondary-light);
    padding: 1rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--primary-dark);
    transition: background-color 0.2s;
}

.fieldset-header:hover {
    background-color: #E2E8F0;
}

.fieldset-content {
    padding: 1.5rem;
    display: none;
    /* JS controla display block */
    border-top: 1px solid var(--border-color);
}

.fieldset-content.active {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toggle-icon {
    font-size: 0.8rem;
    transition: transform 0.3s;
}

.fieldset-header.active .toggle-icon {
    transform: rotate(180deg);
}

/* Checkbox Grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: background-color 0.2s;
}

.checkbox-grid label:hover {
    background-color: #F1F5F9;
}

input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary-color);
}

/* Avarias Layout */
.avarias-container {
    background: white;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-top: 0.5rem;
}

.checkbox-grid-avarias {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.checkbox-grid-avarias label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-color);
    cursor: pointer;
}

.outros-avarias {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
}

.outros-avarias label {
    font-weight: 700;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 4px;
    display: block;
}

/* Custos Layout */
.custos-container {
    background: white;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-top: 0.5rem;
}

.tabela-moderna {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.85rem;
}

.tabela-moderna thead th {
    background-color: #f8fafc;
    color: #64748b;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.tabela-moderna tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-color);
}

.tabela-moderna tfoot td {
    padding: 1rem;
    color: var(--primary-dark);
}

.btn-success {
    background-color: #10B981;
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.btn-success:hover {
    background-color: #059669;
}

/* Upload de Fotos */
input[type="file"] {
    padding: 0.5rem;
    background-color: white;
    font-size: 0.9rem;
}

#listaFotosSelecionadas {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
    padding-left: 1.5rem;
}

/* Botões de Ação */
#btnCadastrar {
    width: 100%;
    padding: 1rem;
    background-color: #10B981;
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 1rem;
    box-shadow: var(--shadow-md);
    transition: all 0.2s;
}

#btnCadastrar:hover {
    background-color: #059669;
    transform: translateY(-1px);
}

.btn-voltar {
    width: 100%;
    padding: 0.75rem;
    background-color: transparent;
    color: var(--primary-dark);
    border: 1px solid #cbd5e1;
    border-radius: var(--border-radius);
    margin-top: 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-voltar:hover {
    background-color: #f1f5f9;
    border-color: var(--primary-dark);
}

#mensagemCadastro {
    text-align: center;
    margin-top: 1rem;
    font-weight: 600;
    min-height: 1.5rem;
}

/* ============================================================ 
   MODAL STYLES (Padronizado)
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.hidden {
    display: none !important;
}

.btn-confirm {
    background-color: #10B981;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.btn-confirm:hover {
    background-color: #059669;
}

.btn-cancel {
    background-color: transparent;
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.btn-cancel:hover {
    background-color: #F1F5F9;
}

/* ============================================================ 
   CANAIS DE DIVULGAÇÃO (Estilo Card Selecionável)
   ============================================================ */
.canais-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.canal-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    min-width: 150px;
    transition: all 0.2s ease;
    user-select: none;
}

.canal-card:hover {
    border-color: var(--primary-color);
    background-color: #F8FAFC;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.canal-card input[type="checkbox"],
.canal-card input[type="radio"] {
    accent-color: var(--primary-color);
    width: 1.1rem;
    height: 1.1rem;
}

.canal-card span {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.95rem;
}

/* Seção CRM (Dados Internos) Padronizada */
fieldset.grupo-crm {
    background-color: #F8FAFC;
    border: 1px solid #E2E8F0;
}

fieldset.grupo-crm legend {
    color: #475569;
    /* Slate 600 */
}

.titulo-secao-crm {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #64748B;
    /* Slate 500 */
    font-weight: 700;
    border-bottom: 1px solid #E2E8F0;
    padding-bottom: 0.5rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.titulo-secao-crm.destaque-vermelho {
    color: #EF4444;
    /* Red 500 */
    border-color: #FECACA;
}