/**
 * Nuevomega_ProductInterest — frontend styles.
 *
 * Three surfaces, all scoped under .nm-pi so nothing bleeds into Porto:
 *   1. PDP panel for interest-only products (banner + chips + CTA).
 *   2. Interest modal (single-step form → done), shared by PDP and band.
 *   3. "¿Buscas otro producto?" full-width band (homepage / category).
 * Plus .nm-pi-list-btn for the category listing replacement button.
 *
 * Visual language mirrors Nuevomega_PreorderDeal (Technical Precision:
 * navy #000209 / blue #0051d5, compact radii, Inter).
 */

/* =====================================================================
 * Tokens
 * =================================================================== */
.nm-pi,
.nm-pi-band {
    --nm-pi-primary: #000209;
    --nm-pi-primary-container: #001c40;
    --nm-pi-secondary: #0051d5;
    --nm-pi-secondary-hover: #003ea7;
    --nm-pi-secondary-soft: #dbe1ff;
    --nm-pi-surface-card: #ffffff;
    --nm-pi-surface-low: #eff4ff;
    --nm-pi-surface-container: #e5eeff;
    --nm-pi-surface-ice: #f8f9ff;
    --nm-pi-on-surface: #0b1c30;
    --nm-pi-on-surface-variant: #44474e;
    --nm-pi-outline: #74777f;
    --nm-pi-outline-variant: #c4c6cf;
    --nm-pi-error: #ba1a1a;
    --nm-pi-success: #1f8a4c;

    --nm-pi-radius-lg: 4px;
    --nm-pi-radius-xl: 8px;
    --nm-pi-radius-full: 12px;

    --nm-pi-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --nm-pi-shadow-card: 0 1px 2px rgba(11, 28, 48, 0.06);
    --nm-pi-shadow-modal: 0 12px 48px rgba(0, 2, 9, 0.18);
}

/* =====================================================================
 * 1. PDP panel
 * =================================================================== */
.nm-pi {
    margin: 16px 0 8px;
    font-family: var(--nm-pi-font);
    color: var(--nm-pi-on-surface);
}

.nm-pi .nm-pi-panel {
    background: linear-gradient(160deg, var(--nm-pi-surface-ice) 0%, var(--nm-pi-surface-container) 100%);
    border: 1px solid var(--nm-pi-secondary-soft);
    border-radius: var(--nm-pi-radius-full);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--nm-pi-shadow-card);
}

.nm-pi .nm-pi-panel__head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nm-pi .nm-pi-panel__icon {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--nm-pi-surface-card);
    color: var(--nm-pi-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--nm-pi-shadow-card);
}

.nm-pi .nm-pi-panel__icon svg {
    width: 24px;
    height: 24px;
    fill: none !important;
    stroke: currentColor;
}

.nm-pi .nm-pi-panel__icon svg * {
    fill: none !important;
    stroke: currentColor;
}

.nm-pi .nm-pi-panel__headings {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.nm-pi .nm-pi-panel__eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--nm-pi-secondary);
}

.nm-pi .nm-pi-panel__price-note {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
    color: var(--nm-pi-primary);
}

.nm-pi .nm-pi-panel__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--nm-pi-on-surface-variant);
}

.nm-pi .nm-pi-panel__chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nm-pi .nm-pi-panel__chips li {
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--nm-pi-primary-container);
    background: var(--nm-pi-surface-card);
    border: 1px solid var(--nm-pi-secondary-soft);
    border-radius: 999px;
    padding: 5px 12px 5px 26px;
    position: relative;
}

.nm-pi .nm-pi-panel__chips li::before {
    content: '✓';
    position: absolute;
    left: 11px;
    color: var(--nm-pi-success);
    font-weight: 700;
}

.nm-pi .nm-pi-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    border-radius: var(--nm-pi-radius-xl);
    padding: 15px 18px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    text-align: center;
    width: 100%;
    background: var(--nm-pi-secondary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 81, 213, 0.25);
    transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.nm-pi .nm-pi-btn:hover {
    background: var(--nm-pi-secondary-hover);
    color: #ffffff;
}

.nm-pi .nm-pi-btn:active {
    transform: translateY(1px);
}

.nm-pi .nm-pi-btn:focus-visible {
    outline: 2px solid var(--nm-pi-secondary);
    outline-offset: 2px;
}

.nm-pi .nm-pi-panel__foot {
    margin: 0;
    font-size: 12px;
    text-align: center;
    color: var(--nm-pi-on-surface-variant);
}

/* =====================================================================
 * 2. Modal (shared PDP + band)
 * =================================================================== */
.nm-pi-modal-root[hidden] {
    display: none !important;
}

.nm-pi-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--nm-pi-font, 'Inter', sans-serif);
}

.nm-pi-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 2, 9, 0.55);
    backdrop-filter: blur(2px);
    animation: nm-pi-fade-in 0.18s ease;
}

.nm-pi-modal__dialog {
    position: relative;
    background: #f8f9ff;
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0, 2, 9, 0.18);
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: nm-pi-pop-in 0.2s cubic-bezier(0.2, 0.7, 0.3, 1);
    color: #0b1c30;
}

.nm-pi-modal__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 18px 20px 12px;
}

.nm-pi-modal__title {
    flex: 1;
    margin: 0;
    font-family: inherit;
    font-size: 18px;
    font-weight: 600;
    color: #000209;
    text-align: center;
    padding-left: 36px; /* balance the close button */
}

/* Hard reset against Porto's generic button rules. */
.nm-pi-modal-root .nm-pi-modal__close {
    appearance: none;
    -webkit-appearance: none;
    background: transparent none;
    background-image: none;
    border: 1px solid transparent;
    box-shadow: none;
    text-shadow: none;
    text-transform: none;
    letter-spacing: 0;
    min-width: 0;
    margin: 0;
    padding: 0;
    line-height: 1;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #44474e;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.nm-pi-modal-root .nm-pi-modal__close:hover,
.nm-pi-modal-root .nm-pi-modal__close:focus {
    background: rgba(0, 2, 9, 0.06);
    background-image: none;
    border-color: #c4c6cf;
    color: #000209;
    box-shadow: none;
}

.nm-pi-modal-root .nm-pi-modal__close:active {
    transform: scale(0.94);
}

.nm-pi-modal-root .nm-pi-modal__nav-icon {
    display: block;
    width: 18px;
    height: 18px;
    pointer-events: none;
    fill: none !important;
    stroke: currentColor;
    flex: none;
}

.nm-pi-modal-root .nm-pi-modal__nav-icon path {
    fill: none !important;
    stroke: currentColor;
}

.nm-pi-modal__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.nm-pi-modal__footer {
    flex: 0 0 auto;
    padding: 14px 20px 20px;
    border-top: 1px solid #c4c6cf;
    background: #ffffff;
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.nm-pi-modal__footer > * {
    width: 100%;
}

body.nm-pi-modal-open {
    overflow: hidden;
}

@keyframes nm-pi-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes nm-pi-pop-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ----- Product context card + lead ------------------------------- */
.nm-pi-product-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #e5eeff;
    border: 1px solid #dbe1ff;
    border-radius: 8px;
    padding: 12px 14px;
}

.nm-pi-product-card__name {
    font-size: 14px;
    font-weight: 600;
    color: #000209;
}

.nm-pi-product-card__sku {
    font-size: 12px;
    color: #44474e;
}

.nm-pi-step__lead {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: #44474e;
}

/* ----- Fields ------------------------------------------------------ */
.nm-pi-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #ffffff;
    border: 1px solid #c4c6cf;
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 1px 2px rgba(11, 28, 48, 0.06);
}

.nm-pi-field__label {
    font-size: 13px;
    font-weight: 500;
    color: #44474e;
}

.nm-pi-field__label .required {
    color: #ba1a1a;
    margin-left: 2px;
}

.nm-pi-field__optional {
    font-size: 11px;
    font-weight: 400;
    color: #44474e;
    opacity: 0.7;
    margin-left: 4px;
}

.nm-pi-field__input,
.nm-pi-field__textarea {
    appearance: none;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: 15px;
    color: #0b1c30;
    width: 100%;
    padding: 0;
    outline: none;
    box-shadow: none;
    resize: vertical;
    min-height: auto;
}

.nm-pi-field__input:focus,
.nm-pi-field__textarea:focus {
    border: 0;
    box-shadow: none;
    outline: none;
}

.nm-pi-field__input::placeholder,
.nm-pi-field__textarea::placeholder {
    color: #74777f;
}

.nm-pi-field__row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nm-pi-field__row .nm-pi-field__input {
    flex: 1;
}

.nm-pi-field__hint {
    font-size: 12px;
    line-height: 1.35;
    color: #44474e;
    min-height: 16px;
}

.nm-pi-field__hint.is-error { color: #ba1a1a; }
.nm-pi-field__hint.is-success { color: #1f8a4c; }
.nm-pi-field.is-valid { border-color: #1f8a4c; }
.nm-pi-field.has-error { border-color: #ba1a1a; }

.nm-pi-btn-mini {
    appearance: none;
    border: 1px solid #0051d5;
    background: #ffffff;
    color: #0051d5;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    cursor: pointer;
    white-space: nowrap;
}

.nm-pi-btn-mini:hover {
    background: #eff4ff;
    color: #003ea7;
}

.nm-pi-btn-mini:disabled {
    opacity: 0.55;
    cursor: progress;
}

/* ----- Photo drop / preview ---------------------------------------- */
.nm-pi-photo-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 18px 12px;
    border: 1.5px dashed #c4c6cf;
    border-radius: 8px;
    background: #f8f9ff;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.nm-pi-photo-drop:hover {
    border-color: #0051d5;
    background: #eff4ff;
}

.nm-pi-photo-drop__icon {
    width: 26px;
    height: 26px;
    color: #0051d5;
    fill: none !important;
    stroke: currentColor;
}

.nm-pi-photo-drop__icon * {
    fill: none !important;
    stroke: currentColor;
}

.nm-pi-photo-drop__text {
    font-size: 13px;
    font-weight: 600;
    color: #0051d5;
}

.nm-pi-photo-drop__sub {
    font-size: 11px;
    color: #74777f;
}

.nm-pi-photo-preview {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #c4c6cf;
    max-height: 180px;
}

.nm-pi-photo-preview[hidden] {
    display: none !important;
}

.nm-pi-photo-preview img {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.nm-pi-modal-root .nm-pi-photo-preview__remove {
    appearance: none;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 2, 9, 0.65);
    color: #ffffff;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
}

.nm-pi-modal-root .nm-pi-photo-preview__remove:hover {
    background: rgba(186, 26, 26, 0.85);
    color: #ffffff;
}

/* ----- Buttons / error / done -------------------------------------- */
.nm-pi-btn-primary {
    appearance: none;
    border: 0;
    background: #0051d5;
    color: #ffffff;
    border-radius: 8px;
    padding: 13px 18px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.nm-pi-btn-primary:hover {
    background: #003ea7;
    color: #ffffff;
}

.nm-pi-btn-primary:focus-visible {
    outline: 2px solid #0051d5;
    outline-offset: 2px;
}

.nm-pi-btn-primary:disabled {
    opacity: 0.55;
    cursor: progress;
}

.nm-pi-btn-cancel {
    appearance: none;
    background: transparent;
    border: 0;
    color: #44474e;
    font-family: inherit;
    font-size: 13px;
    padding: 6px 0;
    cursor: pointer;
    text-decoration: underline;
    align-self: center;
}

.nm-pi-error-banner {
    margin: 4px 20px 0;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(186, 26, 26, 0.08);
    color: #ba1a1a;
    font-size: 13px;
    line-height: 1.4;
}

.nm-pi-error-banner[hidden] {
    display: none !important;
}

.nm-pi-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    padding: 28px 8px;
}

.nm-pi-center__icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e5eeff;
    color: #1f8a4c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
}

.nm-pi-center__title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #000209;
}

.nm-pi-center__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: #44474e;
    max-width: 360px;
}

/* =====================================================================
 * 3. "¿Buscas otro producto?" band
 * =================================================================== */
.nm-pi-band {
    font-family: var(--nm-pi-font);
    background:
        radial-gradient(1200px 400px at 85% -10%, rgba(0, 81, 213, 0.35), transparent 60%),
        linear-gradient(150deg, #000209 0%, #001c40 70%, #002a66 100%);
    color: #ffffff;
    border-radius: var(--nm-pi-radius-full);
    overflow: hidden;
    margin: 24px 0;
}

.nm-pi-band__inner {
    max-width: 1170px;
    margin: 0 auto;
    padding: 32px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
}

.nm-pi-band__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9db9ff;
    background: rgba(219, 225, 255, 0.12);
    border: 1px solid rgba(219, 225, 255, 0.25);
    border-radius: 999px;
    padding: 6px 14px;
}

.nm-pi-band__title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    color: #ffffff;
    max-width: 640px;
}

.nm-pi-band__subtitle {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    color: #c9d6f5;
    max-width: 640px;
}

.nm-pi-band__trips {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(219, 225, 255, 0.18);
    border-radius: var(--nm-pi-radius-xl);
    padding: 12px 16px;
    max-width: 640px;
    width: 100%;
    box-sizing: border-box;
}

.nm-pi-band__trips-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #9db9ff;
}

.nm-pi-band__trips-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nm-pi-band__trips-list li {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #eaf0ff;
}

.nm-pi-band__trips-list li svg {
    flex: none;
    color: #6fe3a1;
    fill: none !important;
    stroke: currentColor;
}

@media (min-width: 768px) {
    .nm-pi-band__trips-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px 24px;
    }
}

.nm-pi-band__chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nm-pi-band__chips li {
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    color: #dbe1ff;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(219, 225, 255, 0.2);
    border-radius: 999px;
    padding: 6px 13px 6px 28px;
    position: relative;
}

.nm-pi-band__chips li::before {
    content: '✓';
    position: absolute;
    left: 12px;
    color: #6fe3a1;
    font-weight: 700;
}

.nm-pi-band .nm-pi-band__cta {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    border-radius: var(--nm-pi-radius-xl);
    padding: 15px 28px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    background: #ffffff;
    color: #001c40;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: transform 0.12s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    width: 100%;
    text-align: center;
}

.nm-pi-band .nm-pi-band__cta:hover {
    background: #eff4ff;
    color: #001c40;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.nm-pi-band .nm-pi-band__cta:active {
    transform: translateY(0);
}

.nm-pi-band__foot {
    margin: 0;
    font-size: 12px;
    color: #8fa4cf;
}

@media (min-width: 768px) {
    .nm-pi-band__inner {
        padding: 44px 32px;
    }

    .nm-pi-band__title {
        font-size: 32px;
    }

    .nm-pi-band .nm-pi-band__cta {
        width: auto;
    }
}

/* =====================================================================
 * 4. Category listing replacement button
 * =================================================================== */
.products-grid .nm-pi-list-btn,
.products-list .nm-pi-list-btn {
    display: inline-block;
    background: #0051d5;
    color: #ffffff !important;
    border-radius: 6px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none !important;
    transition: background-color 0.15s ease;
}

.products-grid .nm-pi-list-btn:hover,
.products-list .nm-pi-list-btn:hover {
    background: #003ea7;
    color: #ffffff !important;
}

/* Mobile modal fit */
@media (max-width: 767px) {
    .nm-pi-modal {
        padding: 12px;
    }

    .nm-pi-modal__dialog {
        max-width: 100%;
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
    }

    .nm-pi-modal__body {
        padding: 12px 16px 16px;
    }

    .nm-pi-modal__footer {
        padding: 12px 16px 16px;
    }
}
