/**
 * Estilos CSS para Formulários de Orçamento
 * Inclui estilos para CNPJ, empresa, validação e animações
 */

#orcamento-form {
    margin: auto;
    padding: 20px;
    background: linear-gradient(45deg, #ffffff, #f0f0f0);
    border-radius: 10px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    color: #333;
}

#orcamento-form label {
    display: block;
    margin-top: 10px;
    font-weight: bold;
}

#orcamento-form input, 
#orcamento-form select, 
#orcamento-form textarea {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 5px;
    color: #333;
    box-sizing: border-box;
}

#orcamento-form button {
    display: block;
    width: 100%;
    margin-top: 15px;
    padding: 10px;
    background: #b22222;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

#orcamento-form button:hover {
    background: #8b0000;
}

.produto-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    margin-top: 10px;
}

.telefone-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.telefone-container select {
    width: 40%;
    margin: 0;
}

.telefone-container input {
    width: 60%;
}

#endereco {
    margin-top: 5px;
}

.error {
    color: red;
    font-size: 12px;
    margin-top: 2px;
    display: block;
}

#orcamento-form textarea {
    background-color: #f8f8f8;
    border: 1px dashed #ccc;
    resize: vertical;
    min-height: 80px;
}

#orcamento-form label[for="observacao"] {
    font-weight: normal;
    color: #666;
}

/* Estilos específicos para CNPJ e empresa */
#empresa-container {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-top: 10px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { 
        opacity: 0; 
        transform: translateY(-10px); 
        max-height: 0;
    }
    to { 
        opacity: 1; 
        transform: translateY(0);
        max-height: 200px;
    }
}

#cnpj-status {
    font-size: 12px;
    font-weight: bold;
    margin-left: 5px;
    display: inline-block;
}

#cnpj {
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    font-size: 14px;
}

#nome_empresa[readonly] {
    background-color: #f0f0f0;
    color: #555;
    border: 1px solid #ddd;
    cursor: not-allowed;
}

#nome_empresa:not([readonly]) {
    background-color: #fff;
    border: 2px solid #ffa500;
    animation: highlight 0.5s ease-in-out;
}

@keyframes highlight {
    0% { background-color: #fff; }
    50% { background-color: #fff8dc; }
    100% { background-color: #fff; }
}

#nome_empresa:not([readonly])::placeholder {
    color: #999;
    font-style: italic;
}

.loading-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 5px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Estilos para status de validação */
.status-success {
    color: #27ae60;
    font-weight: bold;
}

.status-error {
    color: #e74c3c;
    font-weight: bold;
}

.status-warning {
    color: #f39c12;
    font-weight: bold;
}

.status-info {
    color: #3498db;
    font-weight: bold;
}

/* Melhorias na aparência dos campos obrigatórios */
input:required:invalid {
    border-color: #e74c3c;
    box-shadow: 0 0 5px rgba(231, 76, 60, 0.3);
}

input:required:valid {
    border-color: #27ae60;
    box-shadow: 0 0 5px rgba(39, 174, 96, 0.3);
}

/* Estilos para campo de contribuinte */
.contribuinte-container {
    margin-top: 5px;
}

.contribuinte-container table {
    width: 100%;
    border-collapse: collapse;
}

.contribuinte-container td {
    padding: 5px;
    text-align: left;
}

.contribuinte-container input[type="radio"] {
    width: auto;
    margin-right: 5px;
}

.contribuinte-container label {
    font-weight: normal;
    margin-top: 0;
    display: inline;
    cursor: pointer;
}

/* Responsividade */
@media (max-width: 600px) {
    #orcamento-form {
        margin: 10px;
        padding: 15px;
    }
    
    .telefone-container {
        flex-direction: column;
        gap: 5px;
    }
    
    .telefone-container select,
    .telefone-container input {
        width: 100%;
    }
}

/* Estilos para tooltip/ajuda */
.help-text {
    font-size: 11px;
    color: #666;
    font-style: italic;
    margin-top: 2px;
    display: block;
}

/* Animação para campos que aparecem dinamicamente */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Estilos para indicador de campo preenchido automaticamente */
.auto-filled {
    position: relative;
}

.auto-filled::after {
    content: "✓";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #27ae60;
    font-weight: bold;
    font-size: 16px;
}

/* Melhorias para acessibilidade */
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
    border-color: #3498db;
}

/* Estilos para campos desabilitados */
input:disabled,
select:disabled,
textarea:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
    opacity: 0.7;
}
