/**
 * CRM Registration Form - Estilos alinhados à identidade do painel
 * Usa variáveis CSS do tema (--main, --heading, --border-cl, etc.)
 */

.dashboard-page .jws-crm-registration-form-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

.dashboard-page .crm-form-container {
    background: transparent;
    padding: 0;
}

.dashboard-page .form-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--heading);
    font-family: var(--body-font);
}

/* Indicador de progresso - identidade do painel */
.dashboard-page .form-progress {
    margin-bottom: 32px;
}

.dashboard-page .progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    margin-bottom: 0;
}

.dashboard-page .progress-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-cl);
    z-index: 0;
}

.dashboard-page .step-item {
    position: relative;
    z-index: 1;
    text-align: center;
    flex: 1;
}

.dashboard-page .step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-light, #f0f0f0);
    color: var(--body-cl);
    border: 2px solid var(--border-cl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.25s ease;
}

.dashboard-page .step-item.active .step-number {
    background: var(--main);
    border-color: var(--main);
    color: var(--light, #fff);
}

.dashboard-page .step-item.completed .step-number {
    background: var(--third);
    border-color: var(--third);
    color: var(--light, #fff);
}

.dashboard-page .step-label {
    font-size: var(--fs-smallc, 12px);
    color: var(--body-cl);
    font-weight: 500;
}

.dashboard-page .step-item.active .step-label {
    color: var(--main);
    font-weight: 600;
}

.dashboard-page .step-item.completed .step-label {
    color: var(--body-cl);
}

/* Etapas do formulário */
.dashboard-page .form-step {
    display: none;
}

.dashboard-page .form-step.active {
    display: block;
    animation: crm-form-fadeIn 0.3s ease;
}

@keyframes crm-form-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-page .crm-registration-form .step-title {
    font-size: 1.0625rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--heading);
    border-bottom: 2px solid var(--main);
    padding-bottom: 10px;
    font-family: var(--body-font);
}

/* Campos */
.dashboard-page .crm-registration-form .form-row {
    margin-bottom: 20px;
}

.dashboard-page .crm-registration-form .form-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--heading);
    font-size: var(--fs-small);
}

.dashboard-page .crm-registration-form .form-row .required {
    color: #d63638;
}

.dashboard-page .crm-registration-form .form-row input[type="text"],
.dashboard-page .crm-registration-form .form-row input[type="email"],
.dashboard-page .crm-registration-form .form-row input[type="tel"],
.dashboard-page .crm-registration-form .form-row input[type="number"],
.dashboard-page .crm-registration-form .form-row input[type="date"],
.dashboard-page .crm-registration-form .form-row textarea,
.dashboard-page .crm-registration-form .form-row select,
.dashboard-page .crm-registration-form .form-row .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-cl);
    border-radius: 8px;
    font-size: var(--fs-small);
    font-family: var(--body-font);
    background: #fff;
    color: var(--heading);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.dashboard-page .crm-registration-form .form-row input::placeholder,
.dashboard-page .crm-registration-form .form-row textarea::placeholder {
    color: var(--body-cl);
}

.dashboard-page .crm-registration-form .form-row input:focus,
.dashboard-page .crm-registration-form .form-row textarea:focus,
.dashboard-page .crm-registration-form .form-row select:focus,
.dashboard-page .crm-registration-form .form-row .form-control:focus {
    outline: none;
    border-color: var(--main);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

.dashboard-page .crm-registration-form .form-row input.error,
.dashboard-page .crm-registration-form .form-row textarea.error,
.dashboard-page .crm-registration-form .form-row select.error {
    border-color: #d63638;
}

.dashboard-page .crm-registration-form .error-message {
    color: #d63638;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

/* Ações do formulário - botões no padrão do painel */
.dashboard-page .crm-registration-form .form-actions {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-cl);
}

.dashboard-page .crm-registration-form .form-actions .button-default {
    background: var(--main);
    color: var(--light, #fff);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: var(--fs-small);
    cursor: pointer;
    transition: opacity 0.2s, background-color 0.2s;
    border: none;
}

.dashboard-page .crm-registration-form .form-actions .button-default:hover:not(:disabled) {
    opacity: 0.95;
}

.dashboard-page .crm-registration-form .form-actions .button-default:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.dashboard-page .crm-registration-form .form-actions .button-border {
    background: transparent;
    color: var(--heading);
    border: 2px solid var(--border-cl);
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 500;
    font-size: var(--fs-small);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.dashboard-page .crm-registration-form .form-actions .button-border:hover {
    border-color: var(--main);
    color: var(--main);
}

/* Loading */
.dashboard-page .crm-registration-form.form-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.dashboard-page .crm-registration-form.form-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 2px solid var(--main);
    border-top-color: transparent;
    border-radius: 50%;
    animation: crm-form-spin 0.6s linear infinite;
}

@keyframes crm-form-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsivo */
@media (max-width: 768px) {
    .dashboard-page .jws-crm-registration-form-wrapper {
        padding: 0;
    }

    .dashboard-page .progress-steps {
        flex-wrap: wrap;
        gap: 16px;
    }

    .dashboard-page .progress-steps::before {
        display: none;
    }

    .dashboard-page .step-item {
        flex: 0 0 auto;
        margin-bottom: 8px;
    }

    .dashboard-page .crm-registration-form .form-actions {
        flex-direction: column;
        gap: 10px;
    }

    .dashboard-page .crm-registration-form .form-actions .button-default,
    .dashboard-page .crm-registration-form .form-actions .button-border {
        width: 100%;
        justify-content: center;
    }
}

/* Override específico para formulário de etapas dentro do widget */
.jws-crm-registration-form .form-row {
    margin-bottom: 15px;
}

.jws-crm-registration-form .form-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.jws-crm-registration-form input.error,
.jws-crm-registration-form textarea.error,
.jws-crm-registration-form select.error {
    border-color: #d63638;
}

/* ============================================
   Formatação no frontend (Elementor / página sem .dashboard-page)
   Garante mesma aparência do formulário por etapas
   ============================================ */
.jws-crm-registration-form-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
    box-sizing: border-box;
}

.jws-crm-registration-form-wrapper .crm-form-container {
    background: transparent;
    padding: 0;
}

.jws-crm-registration-form-wrapper .form-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a1a;
    font-family: inherit;
}

.jws-crm-registration-form-wrapper .form-progress {
    margin-bottom: 32px;
}

.jws-crm-registration-form-wrapper .progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    margin-bottom: 0;
}

.jws-crm-registration-form-wrapper .progress-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e0e0e0;
    z-index: 0;
}

.jws-crm-registration-form-wrapper .step-item {
    position: relative;
    z-index: 1;
    text-align: center;
    flex: 1;
}

.jws-crm-registration-form-wrapper .step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f0f0;
    color: #555;
    border: 2px solid #e0e0e0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.25s ease;
}

.jws-crm-registration-form-wrapper .step-item.active .step-number {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #fff;
}

.jws-crm-registration-form-wrapper .step-item.completed .step-number {
    background: #2e7d32;
    border-color: #2e7d32;
    color: #fff;
}

.jws-crm-registration-form-wrapper .step-label {
    font-size: 12px;
    color: #555;
    font-weight: 500;
}

.jws-crm-registration-form-wrapper .step-item.active .step-label {
    color: #1a1a1a;
    font-weight: 600;
}

.jws-crm-registration-form-wrapper .form-step {
    display: none;
}

.jws-crm-registration-form-wrapper .form-step.active {
    display: block;
    animation: crm-form-fadeIn 0.3s ease;
}

.jws-crm-registration-form-wrapper .crm-registration-form .step-title {
    font-size: 1.0625rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: #1a1a1a;
    border-bottom: 2px solid #1a1a1a;
    padding-bottom: 10px;
    font-family: inherit;
}

.jws-crm-registration-form-wrapper .crm-registration-form .form-row {
    margin-bottom: 20px;
}

.jws-crm-registration-form-wrapper .crm-registration-form .form-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #1a1a1a;
    font-size: 14px;
}

.jws-crm-registration-form-wrapper .crm-registration-form .form-row .required {
    color: #d63638;
}

.jws-crm-registration-form-wrapper .crm-registration-form .form-row input[type="text"],
.jws-crm-registration-form-wrapper .crm-registration-form .form-row input[type="email"],
.jws-crm-registration-form-wrapper .crm-registration-form .form-row input[type="tel"],
.jws-crm-registration-form-wrapper .crm-registration-form .form-row input[type="number"],
.jws-crm-registration-form-wrapper .crm-registration-form .form-row input[type="date"],
.jws-crm-registration-form-wrapper .crm-registration-form .form-row input[type="file"],
.jws-crm-registration-form-wrapper .crm-registration-form .form-row textarea,
.jws-crm-registration-form-wrapper .crm-registration-form .form-row select,
.jws-crm-registration-form-wrapper .crm-registration-form .form-row .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #1a1a1a;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.jws-crm-registration-form-wrapper .crm-registration-form .form-row input::placeholder,
.jws-crm-registration-form-wrapper .crm-registration-form .form-row textarea::placeholder {
    color: #888;
}

.jws-crm-registration-form-wrapper .crm-registration-form .form-row input:focus,
.jws-crm-registration-form-wrapper .crm-registration-form .form-row textarea:focus,
.jws-crm-registration-form-wrapper .crm-registration-form .form-row select:focus,
.jws-crm-registration-form-wrapper .crm-registration-form .form-row .form-control:focus {
    outline: none;
    border-color: #1a1a1a;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

.jws-crm-registration-form-wrapper .crm-registration-form .form-actions {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.jws-crm-registration-form-wrapper .crm-registration-form .form-actions .button-default {
    background: #1a1a1a;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s, background-color 0.2s;
    border: none;
}

.jws-crm-registration-form-wrapper .crm-registration-form .form-actions .button-default:hover:not(:disabled) {
    opacity: 0.9;
}

.jws-crm-registration-form-wrapper .crm-registration-form .form-actions .button-default:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.jws-crm-registration-form-wrapper .crm-registration-form .form-actions .button-border {
    background: transparent;
    color: #1a1a1a;
    border: 2px solid #ddd;
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.jws-crm-registration-form-wrapper .crm-registration-form .form-actions .button-border:hover {
    border-color: #1a1a1a;
    color: #1a1a1a;
}

@media (max-width: 768px) {
    .jws-crm-registration-form-wrapper {
        padding: 16px;
    }
    .jws-crm-registration-form-wrapper .progress-steps {
        flex-wrap: wrap;
        gap: 16px;
    }
    .jws-crm-registration-form-wrapper .progress-steps::before {
        display: none;
    }
    .jws-crm-registration-form-wrapper .step-item {
        flex: 0 0 auto;
    }
    .jws-crm-registration-form-wrapper .crm-registration-form .form-actions {
        flex-direction: column;
    }
    .jws-crm-registration-form-wrapper .crm-registration-form .form-actions .button-default,
    .jws-crm-registration-form-wrapper .crm-registration-form .form-actions .button-border {
        width: 100%;
        justify-content: center;
    }
}
