/* CSS Moderno e Responsivo para o Formulário PCE */
#orcamento-form {
    max-width: 1200px; /* Muito mais largo */
    width: 95%;
    margin: 20px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    color: #333;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

#orcamento-form h2 {
    text-align: center;
    color: #b22222;
    margin-bottom: 30px;
    font-size: 2.2em;
    font-weight: 300;
}

/* Título principal fora do formulário */
.titulo-principal {
    text-align: center;
    color: #b22222;
    margin: 20px auto 30px;
    font-size: 2.5em;
    font-weight: 300;
    max-width: 1200px;
    width: 95%;
}

/* Layout em Grid para organizar as seções */
.form-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #b22222;
}

.form-section h3 {
    margin: 0 0 15px 0;
    color: #b22222;
    font-size: 1.3em;
    font-weight: 600;
}

/* Grid de 2 colunas para campos */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
    align-items: start; /* Alinha os itens ao topo */
}

/* Grid de 3 colunas para campos menores */
.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
    align-items: start; /* Alinha os itens ao topo */
}

/* Grid de 4 colunas para campos muito pequenos */
.form-row-4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
    align-items: start; /* Alinha os itens ao topo */
}

/* Campo ocupando toda a largura */
.form-row-full {
    margin-bottom: 15px;
}

.form-field {
    display: flex;
    flex-direction: column;
}

/* Alinhamento específico para campos com altura variável */
.form-field small {
    font-size: 0.85em;
    margin-bottom: 2px;
}

.form-field .error {
    min-height: 20px;
    margin-top: 5px;
}

#orcamento-form label {
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
    font-size: 0.95em;
}

#orcamento-form input:not([type="radio"]),
#orcamento-form select,
#orcamento-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 16px;
    color: #495057;
    box-sizing: border-box;
    transition: all 0.3s ease;
    background: #fff;
}

#orcamento-form input:focus,
#orcamento-form select:focus,
#orcamento-form textarea:focus {
    border-color: #b22222;
    box-shadow: 0 0 0 3px rgba(178, 34, 34, 0.1);
    outline: none;
}

/* Estilo especial para campos automaticamente preenchidos */
#nome_empresa, #endereco, #estado {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    font-style: italic;
}

#nome_empresa:focus, #endereco:focus, #estado:focus {
    background-color: #fff;
    border-color: #007bff;
    font-style: normal;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Container especial para telefone e CNPJ */
.telefone-container {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
    align-items: stretch;
}

.telefone-container select,
.telefone-container input {
    margin: 0;
    height: 48px; /* Altura fixa para ambos */
    padding: 12px 15px;
    box-sizing: border-box;
}

.contribuinte-container {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-top: 8px;
}

.contribuinte-container label {
    margin: 0 5px 0 0;
    font-weight: normal;
}

/* Botão de envio melhorado */
#orcamento-form button[type="submit"] {
    width: 100%;
    max-width: 400px;
    margin: 30px auto 0;
    padding: 15px 30px;
    background: linear-gradient(135deg, #b22222, #8b0000);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: block;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#orcamento-form button[type="submit"]:hover {
    background: linear-gradient(135deg, #8b0000, #660000);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(178, 34, 34, 0.3);
}

/* Estilos para campos de arquivo */
.file-upload {
    position: relative;
    display: inline-block;
    cursor: pointer;
    width: 100%;
}

.file-upload input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100px;
    padding: 15px;
    border: 2px dashed #ced4da;
    border-radius: 8px;
    background-color: #f8f9fa;
    color: #6c757d;
    text-align: center;
    transition: all 0.3s ease;
}

.file-upload-label:hover {
    border-color: #b22222;
    color: #b22222;
    background-color: #fff;
}

.file-upload-label.file-selected {
    border-color: #28a745 !important;
    background-color: #d4edda !important;
    color: #155724 !important;
    border-style: solid !important;
    border-width: 2px !important;
    font-weight: bold !important;
    transform: scale(1.02) !important;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3) !important;
}

/* Força aplicação mesmo com outros seletores */
#orcamento-form .file-upload .file-upload-label.file-selected,
.file-upload .file-upload-label.file-selected {
    border-color: #28a745 !important;
    background-color: #d4edda !important;
    color: #155724 !important;
    border-style: solid !important;
    border-width: 2px !important;
    font-weight: bold !important;
}

.file-upload-label small {
    font-size: 0.8em;
    margin-top: 5px;
}

/* Mensagens de erro */
.error {
    color: #dc3545;
    font-size: 0.875em;
    margin-top: 5px;
    display: block;
}

/* Mensagens de status para CNPJ */
#cnpj-erro {
    font-size: 0.875em;
    margin-bottom: 5px;
    display: block;
}

/* Responsividade */
@media (max-width: 768px) {
    .form-row,
    .form-row-3,
    .form-row-4 {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .telefone-container {
        grid-template-columns: 100px 1fr;
        gap: 8px;
    }
    
    #orcamento-form {
        padding: 20px;
        margin: 10px;
    }
}

@media (max-width: 576px) {
    #orcamento-form h2 {
        font-size: 1.8em;
    }
    
    .form-section {
        padding: 15px;
    }
    
    .telefone-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .telefone-container select,
    .telefone-container input {
        width: 100%;
    }
}

/* Estilo melhorado para textarea */
#orcamento-form textarea {
    min-height: 100px;
    resize: vertical;
}

/* Indicador visual para campos obrigatórios */
.form-field label::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

.form-field.optional label::after {
    content: "";
}

/* Estilo para mensagem de sucesso */
.success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 15px 20px;
    margin: 20px auto;
    text-align: center;
    font-weight: 600;
    max-width: 1200px;
    width: 95%;
}
