/* ==========================================================================
   Formularios - Frontend Form Styles
   Modern, Minimalist Design — Configurable via WP Admin
   ========================================================================== */

/* --- Root variables (defaults; overridden by inline style) --- */
.formularios-form-wrap {
    --fm-theme: #4F46E5;
    --fm-theme-light: color-mix(in srgb, var(--fm-theme) 10%, white);
    --fm-theme-hover: color-mix(in srgb, var(--fm-theme) 85%, black);
    --fm-theme-shadow: color-mix(in srgb, var(--fm-theme) 25%, transparent);
    --fm-accent: #10B981;
    --fm-accent-light: color-mix(in srgb, var(--fm-accent) 10%, white);
    --fm-white: #FFFFFF;
    --fm-gray-50: #F9FAFB;
    --fm-gray-100: #F3F4F6;
    --fm-gray-200: #E5E7EB;
    --fm-gray-300: #D1D5DB;
    --fm-gray-400: #9CA3AF;
    --fm-gray-500: #6B7280;
    --fm-gray-700: #374151;
    --fm-gray-800: #1F2937;
    --fm-red: #EF4444;
    --fm-radius: 8px;
    --fm-radius-lg: 12px;
    --fm-btn-radius: var(--fm-radius);
    --fm-shadow: 0 1px 3px rgba(0,0,0,0.06);
    --fm-shadow-lg: 0 8px 24px rgba(0,0,0,0.06);
    --fm-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --fm-max-width: 680px;

    font-family: var(--fm-font);
    max-width: var(--fm-max-width);
    margin: 0 auto;
    padding: 0 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Form Container --- */
.formularios-form {
    background: var(--fm-white);
    border-radius: var(--fm-radius-lg);
    box-shadow: var(--fm-shadow-lg);
    padding: 40px;
    overflow: hidden;
    border: 1px solid var(--fm-gray-100);
}

/* --- Progress Bar --- */
.fm-progress-bar {
    height: 4px;
    background: var(--fm-gray-100);
    border-radius: 99px;
    margin-bottom: 32px;
    overflow: hidden;
}

.fm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--fm-theme), var(--fm-accent));
    border-radius: 99px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

/* --- Sections --- */
.fm-section {
    display: none;
}

.fm-section.active {
    display: block;
    animation: fm-slide-in 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.fm-section.fm-section-hidden {
    display: none !important;
}

@keyframes fm-slide-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fm-section-header {
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--fm-gray-100);
}

.fm-section-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--fm-gray-800);
    margin: 0 0 4px;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.fm-section-desc {
    font-size: 15px;
    color: var(--fm-gray-500);
    margin: 0;
    line-height: 1.5;
}

/* --- Fields Row (multi-column layout) --- */
.fm-fields-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.fm-fields-row > .fm-field {
    margin-bottom: 24px;
}

.fm-field-half {
    flex: 0 0 calc(50% - 8px);
    min-width: 0;
}

.fm-field-third {
    flex: 0 0 calc(33.333% - 11px);
    min-width: 0;
}

.fm-field-quarter {
    flex: 0 0 calc(25% - 12px);
    min-width: 0;
}

.fm-field-two_thirds {
    flex: 0 0 calc(66.666% - 8px);
    min-width: 0;
}

.fm-field-custom {
    min-width: 0;
}

@media (max-width: 600px) {
    .fm-fields-row {
        flex-direction: column;
        gap: 0;
    }
    .fm-field-half,
    .fm-field-third,
    .fm-field-quarter,
    .fm-field-two_thirds,
    .fm-field-custom {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* --- Field --- */
.fm-field {
    margin-bottom: 24px;
}

.fm-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--fm-gray-700);
    margin-bottom: 6px;
    line-height: 1.4;
}

.fm-required {
    color: var(--fm-red);
}

/* --- Email Confirmation --- */
.fm-label-confirm {
    margin-top: 12px;
}

.fm-email-match-error {
    font-size: 13px;
    color: var(--fm-red);
    margin-top: 4px;
    display: none;
}

.fm-field.has-error .fm-email-match-error {
    display: block;
}

/* --- Controls --- */
.fm-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 1.5px solid var(--fm-gray-200);
    border-radius: var(--fm-radius);
    color: var(--fm-gray-800);
    background: var(--fm-white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.fm-control:hover {
    border-color: var(--fm-gray-300);
}

.fm-control:focus {
    outline: none;
    border-color: var(--fm-theme);
    box-shadow: 0 0 0 3px var(--fm-theme-light);
}

.fm-control::placeholder {
    color: var(--fm-gray-400);
}

/* Filled state */
.fm-control.fm-filled {
    background: var(--fm-gray-50);
    border-color: var(--fm-gray-300);
}

.fm-control.fm-filled:focus {
    background: var(--fm-white);
}

/* Enhanced border — input fields only */
.fm-control.fm-input {
    border: 2px solid var(--fm-gray-300);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.fm-control.fm-input:hover {
    border-color: var(--fm-gray-400);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.fm-control.fm-input:focus {
    box-shadow: 0 0 0 3px var(--fm-theme-shadow);
}

.fm-control.fm-input.fm-filled {
    border-color: var(--fm-gray-400);
}

.fm-control.fm-textarea {
    resize: vertical;
    min-height: 100px;
}

.fm-control.fm-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 20px;
    padding: 14px 44px 14px 16px;
    font-size: 16px;
    min-height: 52px;
    cursor: pointer;
}

.fm-control.fm-select option {
    font-size: 16px;
    padding: 10px 14px;
    line-height: 1.5;
}

/* --- Choices (Radio / Checkbox) --- */
.fm-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fm-choice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border: 1.5px solid var(--fm-gray-200);
    border-radius: var(--fm-radius);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    font-size: 15px;
    color: var(--fm-gray-700);
    min-height: 50px;
}

.fm-choice:hover {
    border-color: var(--fm-gray-300);
    background: var(--fm-gray-50);
}

.fm-choice:has(input:checked) {
    border-color: var(--fm-theme);
    background: var(--fm-theme-light);
    color: var(--fm-gray-800);
    box-shadow: 0 0 0 1px var(--fm-theme);
}

/* Filled state for file dropzone */
.fm-file-dropzone.fm-filled {
    border-color: var(--fm-gray-300);
    background: var(--fm-gray-50);
    border-style: solid;
}

.fm-choice input[type="radio"],
.fm-choice input[type="checkbox"] {
    accent-color: var(--fm-theme);
    width: 20px;
    height: 20px;
    margin: 0;
    flex-shrink: 0;
}

.fm-choice-label {
    line-height: 1.4;
    font-size: 15px;
}

/* --- Title & Description Block --- */
.fm-title-block {
    margin-bottom: 24px;
    padding: 20px 0;
}

.fm-block-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--fm-gray-800);
    margin: 0 0 6px;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.fm-block-desc {
    font-size: 15px;
    color: var(--fm-gray-500);
    margin: 0;
    line-height: 1.6;
}

/* --- Image Block --- */
.fm-image-block {
    margin-bottom: 24px;
}

.fm-image-block img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--fm-radius);
    box-shadow: var(--fm-shadow);
}

.fm-image-caption {
    font-size: 13px;
    color: var(--fm-gray-400);
    margin: 8px 0 0;
    text-align: center;
}

/* --- Video Block --- */
.fm-video-block {
    margin-bottom: 24px;
}

.fm-video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    border-radius: var(--fm-radius);
    overflow: hidden;
    box-shadow: var(--fm-shadow);
}

.fm-video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.fm-video-caption {
    font-size: 13px;
    color: var(--fm-gray-400);
    margin: 8px 0 0;
    text-align: center;
}

/* --- Navigation Buttons --- */
.fm-nav-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--fm-gray-100);
}

.fm-btn {
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--fm-btn-radius);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    position: relative;
}

.fm-btn-prev {
    background: var(--fm-gray-100);
    color: var(--fm-gray-700);
}

.fm-btn-prev:hover {
    background: var(--fm-gray-200);
}

.fm-btn-prev:active {
    background: var(--fm-gray-300);
}

.fm-btn-next,
.fm-btn-submit {
    background: var(--fm-theme);
    color: var(--fm-white);
}

.fm-btn-next:hover,
.fm-btn-submit:hover {
    background: var(--fm-theme-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px var(--fm-theme-shadow);
}

.fm-btn-next:active,
.fm-btn-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px var(--fm-theme-shadow);
}

.fm-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- Error --- */
.fm-error-msg {
    font-size: 13px;
    color: var(--fm-red);
    margin-top: 4px;
    display: none;
}

.fm-field.has-error .fm-control {
    border-color: var(--fm-red);
}

.fm-field.has-error .fm-choice {
    border-color: var(--fm-red);
}

.fm-field.has-error .fm-error-msg {
    display: block;
}

/* --- Submission Overlay --- */
.fm-submit-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--fm-white);
    border-radius: var(--fm-radius-lg);
    box-shadow: var(--fm-shadow-lg);
    border: 1px solid var(--fm-gray-100);
    padding: 60px 40px;
    animation: fm-slide-in 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.fm-submit-overlay-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 320px;
}

.fm-submit-spinner {
    color: var(--fm-theme);
    animation: fm-spin 1.2s linear infinite;
}

@keyframes fm-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.fm-submit-overlay-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--fm-gray-700);
    margin: 0;
}

.fm-submit-progress-track {
    width: 100%;
    height: 6px;
    background: var(--fm-gray-100);
    border-radius: 99px;
    overflow: hidden;
}

.fm-submit-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--fm-theme), var(--fm-accent));
    border-radius: 99px;
    transition: width 1.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Success --- */
.fm-success-message {
    text-align: center;
    padding: 60px 20px;
    background: var(--fm-white);
    border-radius: var(--fm-radius-lg);
    box-shadow: var(--fm-shadow-lg);
    border: 1px solid var(--fm-gray-100);
    animation: fm-slide-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.fm-success-icon {
    color: var(--fm-accent);
    margin-bottom: 16px;
}

.fm-success-message p {
    font-size: 18px;
    color: var(--fm-gray-700);
    margin: 0;
    line-height: 1.5;
}

/* --- File Upload --- */
.fm-file-upload-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Dropzone */
.fm-file-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 28px 16px;
    border: 2px dashed var(--fm-gray-300);
    border-radius: var(--fm-radius);
    background: var(--fm-gray-50);
    color: var(--fm-gray-400);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
    text-align: center;
}

.fm-file-dropzone:hover,
.fm-file-dropzone-hover {
    border-color: var(--fm-theme);
    background: var(--fm-theme-light);
    color: var(--fm-theme);
}

.fm-file-dropzone:focus-visible {
    outline: none;
    border-color: var(--fm-theme);
    box-shadow: 0 0 0 3px var(--fm-theme-light);
}

.fm-file-dropzone-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--fm-gray-500);
    transition: color 0.2s ease;
}

.fm-file-dropzone:hover .fm-file-dropzone-text,
.fm-file-dropzone-hover .fm-file-dropzone-text {
    color: var(--fm-theme);
}

.fm-file-dropzone-hint {
    font-size: 12px;
    color: var(--fm-gray-400);
}

/* File List */
.fm-file-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.fm-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-top: 6px;
    background: var(--fm-gray-50);
    border: 1px solid var(--fm-gray-200);
    border-radius: var(--fm-radius);
    font-size: 13px;
    color: var(--fm-gray-700);
    animation: fm-slide-in 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.fm-file-item-icon {
    flex-shrink: 0;
    color: var(--fm-theme);
    display: flex;
    align-items: center;
    opacity: 0.6;
}

.fm-file-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.fm-file-item-size {
    flex-shrink: 0;
    color: var(--fm-gray-400);
    font-size: 12px;
}

.fm-file-remove-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--fm-gray-400);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    padding: 0;
}

.fm-file-remove-btn:hover {
    background: var(--fm-red);
    color: var(--fm-white);
}

.fm-field.has-error .fm-file-dropzone {
    border-color: var(--fm-red);
}

/* --- reCAPTCHA badge --- */
.grecaptcha-badge {
    visibility: hidden;
}

/* --- General Error --- */
.formularios-error {
    text-align: center;
    color: var(--fm-gray-500);
    font-style: italic;
    padding: 20px;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .formularios-form {
        padding: 24px 20px;
    }

    .fm-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Consent field: scrollable terms box + acceptance checkbox */
.fm-consent-terms {
    max-height: 200px;
    overflow-y: auto;
    padding: 16px 18px;
    margin-bottom: 12px;
    border: 1.5px solid var(--fm-gray-200);
    border-radius: var(--fm-radius);
    background: var(--fm-gray-50);
    font-size: 14px;
    line-height: 1.6;
    color: var(--fm-gray-700);
    -webkit-overflow-scrolling: touch;
}

.fm-consent-terms:focus-visible {
    outline: 2px solid var(--fm-theme);
    outline-offset: 2px;
}

.fm-consent-terms p {
    margin: 0 0 10px;
}

.fm-consent-terms p:last-child {
    margin-bottom: 0;
}

.fm-consent-terms a {
    color: var(--fm-theme);
}

.fm-field[data-type="consent"] .fm-consent-check {
    align-items: flex-start;
}

.fm-field[data-type="consent"] .fm-consent-check .fm-choice-label {
    font-weight: 500;
}
