/*
 * forms-donations — Base Styles
 * BEM naming convention used throughout (fd-block__element--modifier).
 */

.fd-form-wrapper {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 1100px;
    margin: 0 auto;
    color: #333;
}

/* Steps & Fieldsets */
.fd-step__fieldset {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    background: #fff;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.fd-step__legend {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a202c;
    padding: 0 12px;
    margin-bottom: 0;
}

.fd-step__desc {
    margin-top: 0;
    margin-bottom: 24px;
    color: #4a5568;
    font-size: 0.95rem;
}

.fd-divider {
    border: 0;
    border-top: 1px solid #e2e8f0;
    margin: 32px 0 24px;
}

.fd-section-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2d3748;
    margin-bottom: 16px;
}

/* Grid Layout */
.fd-field-row {
    display: grid;
    gap: 12px;
    margin-bottom: 12px;
}

.fd-field-row--2col {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.fd-field-row--3col {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Fields */
.fd-field {
    display: flex;
    flex-direction: column;
}

.fd-field--grow {
    flex-grow: 1;
}

.fd-label {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: #4a5568;
}

.fd-label--required::after {
    content: " *";
    color: #e53e3e;
}

.fd-input,
.fd-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    color: #1a202c;
}

.fd-input:focus,
.fd-select:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2);
}

.fd-input--error {
    border-color: #e53e3e !important;
}

.fd-field-error {
    color: #e53e3e;
    font-size: 0.85rem;
    margin-top: 4px;
}

/* Checkboxes */
.fd-field--checkbox {
    justify-content: center;
    padding-top: 12px;
    /* Align with inputs */
}

.fd-label--checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
}

.fd-checkbox {
    margin-right: 8px;
    width: 18px;
    height: 18px;
}

.fd-seguro-label {
    font-size: 0.85rem;
    color: #718096;
    font-style: normal;
    margin-left: 4px;
}

/* Discount Section */
.fd-discount-row {
    align-items: flex-start;
}

.fd-discount-input-wrap {
    display: flex;
    gap: 12px;
}

.fd-discount-input {
    max-width: 200px;
    font-family: monospace;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.fd-discount-feedback {
    margin-top: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.fd-discount-feedback--loading {
    color: #718096;
}

.fd-discount-feedback--success {
    color: #38a169;
}

.fd-discount-feedback--error {
    color: #e53e3e;
}

/* Repeater */
.fd-repeater {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fd-repeater-row {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    position: relative;
}

/* Inside the modal, the repeater should not look like a card */
.fd-modal .fd-repeater-row {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0 0 16px 0;
}

.fd-modal .fd-repeater-row__header {
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.fd-repeater-row__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #edf2f7;
}

.fd-repeater-row__num {
    font-weight: 600;
    color: #2d3748;
    font-size: 1.1rem;
}

.fd-btn-remove-row {
    background: transparent;
    border: none;
    color: #a0aec0;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.fd-btn-remove-row:hover {
    background: #fed7d7;
    color: #e53e3e;
}

.fd-repeater-actions {
    margin-top: 24px;
    text-align: center;
}

/* Buttons */
.fd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.fd-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.fd-btn--primary {
    background: #b72119;
    color: white;
}

.fd-btn--primary:hover:not(:disabled) {
    background: #9b1c15;
}

.fd-btn--secondary {
    background: #edf2f7;
    color: #4a5568;
    border-color: #cbd5e0;
}

.fd-btn--secondary:hover:not(:disabled) {
    background: #e2e8f0;
}

.fd-btn--outline {
    background: transparent;
    border: 2px dashed #cbd5e0;
    color: #4a5568;
    width: 100%;
}

.fd-btn--outline:hover {
    border-color: #a0aec0;
    background: #f7fafc;
}

.fd-btn--ghost {
    background: transparent;
    color: #4a5568;
}

.fd-btn--ghost:hover {
    background: #edf2f7;
}

/* Step Navigation */
.fd-step-nav {
    display: flex;
    justify-content: flex-end;
    margin-top: 32px;
}

.fd-step-nav--split {
    justify-content: space-between;
}

/* Price Calculator */
.fd-price-summary {
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    border-radius: 6px;
    padding: 16px;
    margin-top: 24px;
}

.fd-price-label {
    margin: 0 0 4px;
    color: #b72119;
    font-size: 0.9rem;
}

.fd-price-amount {
    margin: 0 0 8px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #b72119;
}

.fd-price-note {
    margin: 0;
    font-size: 0.85rem;
    color: #4299e1;
}

.fd-price-total-wrap {
    margin-top: 32px;
    padding: 24px;
    background: #f7fafc;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    text-align: right;
}

.fd-price-total {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    margin-bottom: 8px;
}

.fd-price-total__label {
    font-size: 1.2rem;
    font-weight: 500;
    color: #4a5568;
}

.fd-price-total__amount {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
    line-height: 1;
}

.fd-price-total__badge {
    background: #38a169;
    color: white;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9rem;
}

.fd-price-total__note {
    margin: 0;
    color: #718096;
    font-size: 0.9rem;
}

/* Messages */
.fd-form-messages {
    margin-top: 24px;
    padding: 16px;
    border-radius: 6px;
    font-weight: 500;
    text-align: center;
}

.fd-form-messages:empty {
    display: none;
}

.fd-form-messages--success {
    background: #f0fff4;
    color: #2f855a;
    border: 1px solid #c6f6d5;
}

.fd-form-messages--error {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #fed7d7;
}

.fd-corredors-error {
    margin-top: 24px;
    padding: 16px;
    background: #fff5f5;
    color: #c53030;
    border-left: 4px solid #f56565;
    font-weight: 500;
}

/* Sticky Header */
.fd-sticky-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 24px;
    margin: 0 0 24px 0;
    display: none;
    /* hidden on step 0 */
    justify-content: space-between;
    align-items: center;
}

.fd-form-wrapper {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333;
}

.fd-sticky-header__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
}

.fd-sticky-header__price {
    font-size: 1.25rem;
    color: #b72119;
}

.fd-sticky-header__price strong {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Step Welcome (Paso 0) */
.fd-step-welcome {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 40px 24px;
    margin: 0 0 24px 0;
}

/* Fix for Select appearance in some browsers */
.fd-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234a5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* ─── Modal ────────────────────────────────────────────────────────────────── */

.fd-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.fd-modal.is-open {
    display: flex;
}

.fd-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    cursor: pointer;
}

.fd-modal__box {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 12px;
    max-width: 820px;
    width: 92%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: fdModalIn 0.22s ease-out;
}

@media (max-width: 768px) {
    .fd-modal__box {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
}

.fd-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.fd-modal__header-title {
    margin: 0;
    font-size: 1.25rem;
    color: #2d3748;
    font-weight: 600;
}

.fd-modal__body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

@keyframes fdModalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(8px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.fd-modal__box .fd-form-wrapper {
    max-width: 100%;
    margin: 0;
}

.fd-modal__close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #718096;
    padding: 6px 10px;
    border-radius: 6px;
    line-height: 1;
    transition: all 0.15s;
}

.fd-modal__close:hover {
    background: #f7fafc;
    color: #2d3748;
}

/* File Upload Styles */
.fd-file-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.fd-file-upload-preview img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.fd-file-upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background-color: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: #475569;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
}

.fd-file-upload-btn:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
    color: #334155;
}

.fd-file-upload-icon {
    color: #64748b;
}

.fd-file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ─── Layout Classes ─────────────────────────────────────────────────────── */

.fd-modal__box--wide {
    max-width: 1100px;
    width: 96%;
}

.fd-grid-layout {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .fd-grid-layout {
        grid-template-columns: 1fr;
    }
}

.fd-main-content {
    min-width: 0;
}

.fd-sidebar {
    background: #f7fafc;
    padding: 24px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
}