/**
 * Estilos frontend do plugin Propostas JuriSensus - v7.0.0
 * REFATORAÇÃO COMPLETA: Design replicado do formulário de referência
 */

/* === VARIÁVEIS CSS === */
:root {
    --js-primary: #14284A;
    --js-secondary: #2955BB;
    --js-accent: #3366CC;
    --js-light: #EBF4FF;
    --js-input-bg: #EBF4FF;
    --js-input-border: #E7E6E6;
    --js-input-focus: #3366CC;
    --js-text-dark: #000000;
    --js-text-gray: #6B7280;
    --js-text-help: #9CA3AF;
    --js-required: #DC2626;
    --js-success: #28a745;
    --js-warning: #ffc107;
    --js-danger: #dc3545;
    --js-border-radius: 8px;
    --js-transition: all 0.2s ease;
}

/* === RESET E BASE === */
.propostas-widget,
.propostas-widget * {
    box-sizing: border-box;
}

.propostas-widget {
    font-family: Inter !important;
    font-size: 16px;
    line-height: 1.5;
    color: var(--js-text-dark);
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
}

/* === CONTAINER PRINCIPAL === */
.propostas-form-container {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none;
    overflow: visible;
    margin: 0;
    padding: 0;
}

/* === FORMULÁRIO === */
.propostas-form {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* === CAMPOS DO FORMULÁRIO === */
.propostas-form-fields {
    padding: 0;
    margin: 0;
    background: #fff !important;
    display: block;
}

.field-group {
    margin: 0 0 24px 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    display: block;
}

/* === LABELS === */
.field-group label {
    display: block;
    font-weight: 400;
    color: var(--js-text-dark);
    margin: 0 0 8px 0;
    padding: 0;
    font-size: 16px;
    line-height: 1.5;
    text-transform: none;
    letter-spacing: normal;
    background: transparent;
    border: none;
}

/* === INPUTS === */
.field-group input,
.field-group select,
.field-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--js-input-border) !important;
    border-radius: var(--js-border-radius);
    font-size: 16px;
    font-family: Inter !important;
    background: #fafafa !important;
    color: var(--js-text-dark);
    transition: var(--js-transition);
    box-shadow: none;
    outline: none;
    margin: 0;
    line-height: 1.5;
    font-weight: 400;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    border: 1px solid var(--js-input-border) !important;
    background: #f0f8ff !important;
    box-shadow: none !important;
    outline: none !important;
}

.field-group input::placeholder,
.field-group textarea::placeholder {
    color: var(--js-text-help);
    opacity: 1;
    font-weight: 400;
}

/* === TEXTOS DE AJUDA === */
.field-help,
.field-description {
    font-size: 14px;
    color: var(--js-text-help);
    margin: 4px 0 0 0;
    padding: 0;
    line-height: 1.4;
    background: transparent;
    border: none;
    font-weight: 400;
    display: block;
}

/* === MENSAGENS DE ERRO === */
.field-error {
    color: var(--js-danger);
    font-size: 14px;
    margin-top: 4px;
    display: none;
    padding: 0;
    background: transparent;
    border: none;
    font-weight: 400;
}

.field-group.error input,
.field-group.error select,
.field-group.error textarea {
    border-color: var(--js-danger);
    background: #FEF2F2;
}

.field-group.error .field-error.show {
    display: block;
}

/* === BOTÕES === */
.propostas-form-actions {
    padding: 32px 0 0 0;
    margin: 0;
    background: transparent;
    border: none;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
}

/* Botão Principal */
.btn-gerar-proposta {
    background: #2955bb !important;
    background-color: #2955bb !important);
    color: white;
    border: none !important;
    border-color: transparent !important;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 5px !important;
    cursor: pointer;
    transition: var(--js-transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: none;
    outline: none;
    margin: 0;
    min-width: 200px;
    line-height: 1.5;
}

.btn-gerar-proposta:hover {
    background: #2074ff !important;
    background-color: #2074ff !important;
    box-shadow: none !important;
    border: none !important;
    border-color: transparent !important;
}

.btn-gerar-proposta:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* === LOADING STATES === */
.btn-gerar-proposta .btn-text {
    display: inline;
}

.btn-gerar-proposta .btn-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-gerar-proposta.loading .btn-text {
    display: none;
}

.btn-gerar-proposta.loading .btn-loading {
    display: flex;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === PROPOSTA GERADA === */
.proposta-resultado {
    display: none;
    margin: 32px 0 0 0;
    padding: 0;
}

.proposta-resultado.show {
    display: block;
}

.proposta-container {
    background: white;
    padding: 40px;
    margin: 0;
    border-radius: var(--js-border-radius);
    border: 1px solid #E5E7EB;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-family: Inter !important;
    line-height: 1.6;
    color: var(--js-text-dark);
    text-align: justify !important;
}

/* === BOTÃO IMPRIMIR === */
.proposta-acoes-topo {
    text-align: right;
    margin-bottom: 24px;
    padding: 0;
    background: transparent;
    border: none;
}

.btn-imprimir {
    background: var(--js-accent);
    background-color: var(--js-accent);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px !important;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: none;
    box-shadow: none;
    outline: none;
}

.btn-imprimir:hover {
    background: #4773fb !important;
    background-color: #4773fb !important;
    box-shadow: none !important;
}

/* === CABEÇALHO DA PROPOSTA === */
.proposta-header {
    text-align: center;
    margin-bottom: 32px;
    padding: 0;
    background: transparent;
    border: none;
}

.proposta-header h1 {
    color: var(--js-primary);
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.proposta-header h2 {
    color: var(--js-secondary);
    font-size: 22px;
    font-weight: 600;
    margin: 0;
}

/* === SEÇÕES DA PROPOSTA === */
.proposta-secao {
    margin-bottom: 28px;
    padding: 0;
    background: transparent;
    border: none;
}

.proposta-secao h3 {
    color: var(--js-primary);
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--js-light);
    padding-bottom: 8px;
}

.proposta-secao p {
    margin: 10px 0;
    line-height: 1.6;
    color: var(--js-text-dark);
    text-align: justify !important;
}

.proposta-secao strong {
    color: var(--js-primary);
    font-weight: 600;
}

/* === ASSINATURA === */
.proposta-assinatura {
    margin-top: 48px;
    padding: 24px 0 0 0;
    text-align: center;
    border-top: 1px solid #E5E7EB;
}

.data-local {
    font-size: 16px;
    color: var(--js-text-dark);
    margin-bottom: 24px;
    font-weight: 500;
}

.dados-assinante {
    margin-top: 16px;
}

.dados-assinante p {
    margin: 4px 0;
    font-size: 14px;
    color: var(--js-text-gray);
}

/* === AUTENTICIDADE === */
.proposta-autenticidade-reformulada {
    margin-top: 32px;
    padding: 20px;
    background: var(--js-light);
    border-radius: var(--js-border-radius);
    border: 1px solid var(--js-input-border);
}

.proposta-autenticidade-reformulada p {
    margin: 8px 0;
    font-size: 14px;
    color: var(--js-text-gray);
    text-align: center;
    line-height: 1.6;
}

.proposta-autenticidade-reformulada strong {
    color: var(--js-text-dark);
    font-weight: 600;
}

/* === MODAL === */
.propostas-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: var(--js-border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h4 {
    margin: 0;
    color: var(--js-text-dark);
    font-weight: 600;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--js-text-gray);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--js-transition);
}

.modal-close:hover {
    background: #F3F4F6;
    color: var(--js-text-dark);
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    margin: 0;
    line-height: 1.6;
    color: var(--js-text-dark);
}

/* === RESPONSIVIDADE === */
@media (max-width: 768px) {
    .propostas-form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-gerar-proposta {
        width: 100%;
    }
    
    .proposta-container {
        padding: 24px;
    }
}

/* === IMPRESSÃO === */
@media print {
    .proposta-acoes-topo,
    .btn-imprimir {
        display: none;
    }
    
    .proposta-container {
        box-shadow: none;
        border: none;
        padding: 0;
    }
    
    body > *:not(.propostas-widget) {
        display: none;
    }
}

/* === PROTEÇÃO CONTRA CONFLITOS === */
.propostas-widget input:not([type="submit"]):not([type="button"]),
.propostas-widget select,
.propostas-widget textarea {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.propostas-widget button,
.propostas-widget input[type="button"],
.propostas-widget input[type="submit"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Limpar estilos de autofill */
.propostas-widget input:-webkit-autofill,
.propostas-widget input:-webkit-autofill:hover,
.propostas-widget input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--js-input-bg) inset;
    -webkit-text-fill-color: var(--js-text-dark);
    transition: background-color 5000s ease-in-out 0s;
}