/**
 * SmartDeal — Welcome Popup
 * Style con design system del tema (lima #C5FF3E sobre negro #0A0E12)
 */

.sd-welcome-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.sd-welcome-modal.is-open {
    display: flex;
    animation: sd-welcome-fade-in 0.25s ease-out;
}

@keyframes sd-welcome-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sd-welcome-slide-up { from { opacity: 0; transform: translateY(20px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

.sd-welcome-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 24, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
}

.sd-welcome-modal__content {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    width: 92%;
    max-width: 460px;
    padding: 36px 32px 28px;
    animation: sd-welcome-slide-up 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 92vh;
    overflow-y: auto;
}

.sd-welcome-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f7f9;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    color: #475569;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.sd-welcome-modal__close:hover { background: #e2e8f0; color: #0A0E12; }

/* HERO */
.sd-welcome-modal__hero { text-align: center; margin-bottom: 24px; }
.sd-welcome-modal__eyebrow {
    display: inline-block;
    background: linear-gradient(135deg, #0A0E12, #1F2937);
    color: #C5FF3E;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 14px;
}
.sd-welcome-modal__title {
    font-size: 26px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: #0A0E12;
    margin: 0 0 10px;
}
.sd-welcome-modal__highlight {
    background: linear-gradient(180deg, transparent 60%, #C5FF3E 60%);
    padding: 0 4px;
    color: #0A0E12;
}
.sd-welcome-modal__subtitle {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
}

/* FORM */
.sd-welcome-modal__form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sd-welcome-field { display: flex; flex-direction: column; gap: 6px; }
.sd-welcome-field__label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13px;
    font-weight: 600;
    color: #0A0E12;
}
.sd-welcome-field__optional { font-weight: 400; color: #94a3b8; font-size: 12px; }
.sd-welcome-field__bonus {
    background: #ecfdf5;
    color: #166534;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}
.sd-welcome-field__bonus--extra { background: #ddebc8; color: #166534; }

.sd-welcome-field input {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #fff;
    color: #0A0E12;
    box-sizing: border-box;
}
.sd-welcome-field input:focus {
    outline: none;
    border-color: #0A0E12;
    box-shadow: 0 0 0 3px rgba(197, 255, 62, 0.3);
}
.sd-welcome-field input::placeholder { color: #94a3b8; }
.sd-welcome-field input.has-error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

/* TOTAL */
.sd-welcome-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #0A0E12, #1F2937);
    color: #fff;
    padding: 14px 18px;
    border-radius: 12px;
    margin: 4px 0;
}
.sd-welcome-total__label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
}
.sd-welcome-total__value {
    font-size: 22px;
    font-weight: 900;
    color: #C5FF3E;
    letter-spacing: -0.01em;
}

/* CONSENT */
.sd-welcome-consent { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.sd-welcome-consent__item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12.5px;
    color: #475569;
    line-height: 1.5;
    cursor: pointer;
}
.sd-welcome-consent__item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: #0A0E12;
    cursor: pointer;
}
/* Consent inline atado a cada field (Ley 21.719: consent por dato) */
.sd-welcome-field__consent {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 9px;
    font-size: 12.5px;
    color: #475569;
    line-height: 1.4;
    cursor: pointer;
    margin: 8px 0 0;
    padding: 8px 12px;
    text-align: left;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: border-color 0.15s, background 0.15s;
}
.sd-welcome-field__consent:hover {
    background: #f1f5f9;
}
.sd-welcome-field__consent input[type="checkbox"] {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0;
    cursor: pointer;
    background: #ffffff;
    border: 1.5px solid #94a3b8;
    border-radius: 4px;
    position: relative;
    transition: background 0.15s, border-color 0.15s;
    display: inline-block !important;
    vertical-align: middle;
    box-sizing: border-box;
}
.sd-welcome-field__consent input[type="checkbox"]:hover {
    border-color: #0A0E12;
}
.sd-welcome-field__consent input[type="checkbox"]:checked {
    background: #0A0E12;
    border-color: #0A0E12;
}
.sd-welcome-field__consent input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #C5FF3E;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.sd-welcome-field__consent input[type="checkbox"]:focus-visible {
    outline: 2px solid #C5FF3E;
    outline-offset: 2px;
}
.sd-welcome-field__consent > span {
    flex: 1 1 auto;
    display: inline-block;
    min-width: 0;
}
.sd-welcome-field__consent:has(input:checked) {
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.sd-welcome-field__consent:has(input:checked) > span {
    color: #0A0E12;
    font-weight: 500;
}

/* SUBMIT */
.sd-welcome-modal__submit {
    width: 100%;
    background: #C5FF3E;
    color: #0A0E12;
    border: none;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 4px 14px rgba(197, 255, 62, 0.45);
    font-family: inherit;
    margin-top: 6px;
}
.sd-welcome-modal__submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(197, 255, 62, 0.55);
}
.sd-welcome-modal__submit:active:not(:disabled) { transform: translateY(0); }
.sd-welcome-modal__submit:disabled { opacity: 0.6; cursor: not-allowed; }
.sd-welcome-modal__submit--secondary {
    background: #f5f7f9;
    color: #0A0E12;
    box-shadow: none;
    border: 1px solid #e2e8f0;
}
.sd-welcome-modal__submit--secondary:hover:not(:disabled) {
    background: #e2e8f0;
    box-shadow: none;
}
.sd-welcome-submit__loader { display: none; }
.sd-welcome-modal__submit.is-loading .sd-welcome-submit__label { display: none; }
.sd-welcome-modal__submit.is-loading .sd-welcome-submit__loader { display: inline; }

/* FOOTER */
.sd-welcome-modal__footer {
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
    line-height: 1.55;
    margin: 4px 0 0;
}
.sd-welcome-modal__footer a { color: #475569; text-decoration: underline; }

/* SUCCESS */
.sd-welcome-modal__success { text-align: center; padding: 14px 0; }
.sd-welcome-success__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: #C5FF3E;
    color: #0A0E12;
    border-radius: 50%;
    font-size: 36px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(197, 255, 62, 0.4);
}
.sd-welcome-success__title {
    font-size: 22px;
    font-weight: 900;
    color: #0A0E12;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
}
.sd-welcome-success__text {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
    margin: 0 0 24px;
}

/* ERROR */
.sd-welcome-modal__error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-top: 4px;
}

/* MOBILE */
@media (max-width: 480px) {
    .sd-welcome-modal__content { padding: 30px 22px 22px; width: 94%; }
    .sd-welcome-modal__title { font-size: 22px; }
    .sd-welcome-total__value { font-size: 20px; }
    .sd-welcome-modal__submit { padding: 14px 22px; font-size: 14.5px; }
}
