/* =============================================
   Emaenz Form – Frontend Styles
   ============================================= */

/* ─── Reset & Base ─────────────────────────── */
.emf-form-wrapper *,
.emf-form-wrapper *::before,
.emf-form-wrapper *::after {
    box-sizing: border-box;
}

/* ─── Fields Layout ─────────────────────────── */
.emf-form-fields-wrap {
    display: flex;
    flex-wrap: wrap;
    column-gap: 10px;
    row-gap: 16px;
}

.emf-field-wrap {
    min-width: 0; /* evita overflow en flex */
}

/* Anchos de columna */
.emf-field-width-100 { width: 100%; }
.emf-field-width-75  { width: calc(75% - 8px); }
.emf-field-width-66  { width: calc(66.66% - 7px); }
.emf-field-width-50  { width: calc(50% - 5px); }
.emf-field-width-33  { width: calc(33.33% - 7px); }
.emf-field-width-25  { width: calc(25% - 8px); }

/* Responsive: todo al 100% en móvil */
@media (max-width: 600px) {
    .emf-field-width-75,
    .emf-field-width-66,
    .emf-field-width-50,
    .emf-field-width-33,
    .emf-field-width-25 {
        width: 100%;
    }
}

/* ─── Campos ocultos ────────────────────────── */
.emf-field-type-hidden { display: none !important; }

.emf-field-hidden {
    display: none !important;
    visibility: hidden;
}

/* ─── Labels ─────────────────────────────────── */
.emf-field-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
}

.emf-required {
    color: #dc3545;
    margin-left: 3px;
}

/* ─── Inputs genéricos ──────────────────────── */
.emf-field-input { position: relative; }

.emf-input {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.emf-input::placeholder {
    color: #aaa;
    opacity: 1;
}

.emf-input:focus {
    border-color: #6563ff;
    box-shadow: 0 0 0 3px rgba(101, 99, 255, 0.18);
}

/* Textarea */
textarea.emf-input {
    resize: vertical;
    min-height: 120px;
}

/* Select */
select.emf-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23555' d='M5 6 0 0h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
    cursor: pointer;
}

/* File */
.emf-file-input {
    padding: 8px 10px;
    cursor: pointer;
    background: #fafafa;
}

/* Number */
input[type="number"].emf-input {
    -moz-appearance: textfield;
}
input[type="number"].emf-input::-webkit-outer-spin-button,
input[type="number"].emf-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

/* ─── Radio & Checkbox ──────────────────────── */
.emf-radio-group,
.emf-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.emf-radio-label,
.emf-checkbox-label,
.emf-acceptance-label {
    display: inline-flex;
    align-items: flex-start;
    gap: 9px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 400;
    color: #444;
}

.emf-radio-label input,
.emf-checkbox-label input,
.emf-acceptance-label input {
    flex-shrink: 0;
    margin-top: 3px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #6563ff;
}

.emf-acceptance-label span a {
    color: #6563ff;
    text-decoration: underline;
}

/* ─── Errores de campo ──────────────────────── */
.emf-field-error {
    display: block;
    min-height: 18px;
    margin-top: 5px;
    font-size: 12px;
    color: #dc3545;
    font-weight: 500;
}

.emf-field-error-wrap .emf-input {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.12) !important;
}

/* ─── Repeater Container ────────────────────── */
.emf-repeater-container {
    margin-top: 24px;
}

.emf-repeater-group {
    background: #f9f9fb;
    border: 1px solid #e3e3e8;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
    animation: emf-fade-in 0.25s ease;
}

@keyframes emf-fade-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.emf-repeater-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e3e3e8;
}

.emf-group-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
}

.emf-repeater-actions {
    margin-top: 8px;
}

/* ─── Botones ────────────────────────────────── */
.emf-submit-btn,
.emf-add-group-btn,
.emf-remove-group-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    transition: background-color 0.22s ease, opacity 0.22s ease, box-shadow 0.22s ease, transform 0.1s ease;
    white-space: nowrap;
}

/* Submit */
.emf-submit-btn {
    background-color: #6563ff;
    color: #fff;
    padding: 13px 32px;
    font-size: 15px;
}
.emf-submit-btn:hover {
    opacity: 0.88;
}
.emf-submit-btn:active {
    transform: scale(0.97);
}
.emf-submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Add */
.emf-add-group-btn {
    background-color: #28a745;
    color: #fff;
    padding: 9px 20px;
    font-size: 14px;
}
.emf-add-group-btn:hover { opacity: 0.88; }

/* Remove */
.emf-remove-group-btn {
    background-color: #dc3545;
    color: #fff;
    padding: 6px 14px;
    font-size: 13px;
}
.emf-remove-group-btn:hover { opacity: 0.88; }

/* Estado deshabilitado compartido */
.emf-btn-disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* Submit wrap (alineación controlada desde Elementor) */
.emf-submit-wrap {
    margin-top: 22px;
}

/* Stretch */
.emf-submit-wrap[style*="stretch"] .emf-submit-btn,
.emf-submit-wrap.emf-stretch .emf-submit-btn {
    width: 100%;
}

/* ─── Spinner ─────────────────────────────────── */
.emf-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: emf-spin 0.55s linear infinite;
    vertical-align: middle;
}

@keyframes emf-spin {
    to { transform: rotate(360deg); }
}

/* ─── Mensajes globales ─────────────────────── */
.emf-form-messages {
    margin-top: 18px;
    padding: 0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.emf-form-messages:not(:empty) {
    padding: 14px 18px;
    border-left: 4px solid currentColor;
}

.emf-success-message {
    background-color: #d4edda;
    color: #155724;
    border-color: #28a745;
}

.emf-error-message {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #dc3545;
}

.emf-warning-message {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffc107;
}
