/**
 * WM Emails Checkout — mailbox-step.css
 *
 * Styles specific to the mailbox creation step.
 * Loaded alongside domain-step.css on the mailbox step page.
 * All classes use the `wm-ec-` prefix.
 */

/* ── Page layout: product card on top, entries full-width below ───────── */
.wm-ec-wrap {
    flex-direction: column;
    gap: 20px;
}

/* Horizontal product card strip */
.wm-ec-product-card {
    flex: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    position: static;
    padding: 0;
    overflow: hidden;
    width: 100%;
}

.wm-ec-product-card__img {
    width: 90px;
    height: 90px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: var(--wm-ec-radius, 8px) 0 0 var(--wm-ec-radius, 8px);
}

.wm-ec-product-card__body {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    column-gap: 20px;
    row-gap: 4px;
    padding: 14px 20px;
    flex: 1 1 auto;
    align-items: start;
    justify-content: space-between;
}

.wm-ec-product-card__name {
    margin: 0;
    white-space: nowrap;
}

.wm-ec-product-card__tagline {
    margin: 0;
    flex: 1 1 auto;
}

/* Description hidden on mailbox step */
.wm-ec-product-card__desc {
    display: none !important;
}

.wm-ec-product-card__price {
    font-size: 1rem;
    white-space: nowrap;
}

.wm-ec-mailbox-plan-info {
    margin-top: 0;
    white-space: nowrap;
}

/* ── Remove button icon ────────────────────────────────────────────────── */
.wm-ec-remove-row {
    font-size: 13px;
}

/* ── Mailbox box ──────────────────────────────────────────────────────── */
.wm-ec-mailbox-box {
    flex: 1 1 auto;
    background: var(--wm-ec-white, #ffffff);
    border: 1px solid var(--wm-ec-border, #e5e7eb);
    border-radius: var(--wm-ec-radius, 8px);
    box-shadow: var(--wm-ec-shadow, 0 4px 24px rgba(11, 3, 68, .08));
    padding: 36px 40px;
    min-width: 0;
}

/* ── Box header (title + meta row) ───────────────────────────────────── */
.wm-ec-mailbox-box__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.wm-ec-mailbox-box__title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--wm-ec-navy, #0b0344);
}

/* ── Meta row (domain badge + counter) ───────────────────────────────── */
.wm-ec-mailbox-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.wm-ec-mailbox-domain-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 5px 10px;
    background: #f0f4ff;
    border: 1px solid #c5d5fd;
    border-radius: 20px;
    font-size: .85rem;
    color: var(--wm-ec-muted, #494b51);
    font-family: 'Courier New', Courier, monospace;
}

.wm-ec-mailbox-domain-badge strong {
    color: var(--wm-ec-blue, #4175fc);
    font-weight: 700;
}

.wm-ec-mailbox-counter {
    font-size: .85rem;
    font-weight: 600;
    color: var(--wm-ec-muted, #494b51);
}

#wm-ec-mailbox-count {
    color: var(--wm-ec-blue, #4175fc);
}

#wm-ec-mailbox-max {
    color: var(--wm-ec-navy, #0b0344);
}

/* ── Plan info badge (on product card) ───────────────────────────────── */
.wm-ec-mailbox-plan-info {
    margin-top: 12px;
    padding: 8px 10px;
    background: #f0f4ff;
    border-radius: 6px;
    font-size: .82rem;
    color: var(--wm-ec-blue, #4175fc);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Column header row ────────────────────────────────────────────────── */
.wm-ec-grid-header {
    display: grid;
    grid-template-columns: 28px 1.4fr 1fr 1fr 38px;
    gap: 8px;
    padding: 4px 0 8px;
    border-bottom: 2px solid var(--wm-ec-border, #e5e7eb);
    font-size: .72rem;
    font-weight: 700;
    color: var(--wm-ec-muted, #494b51);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.wm-ec-grid-header__req {
    font-style: normal;
    color: #c0392b;
    margin-left: 2px;
}

/* ── Mailbox rows container ───────────────────────────────────────────── */
#wm-ec-mailbox-rows {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

/* ── Individual mailbox row (inline 5-column grid) ────────────────────── */
.wm-ec-mailbox-row {
    display: grid;
    grid-template-columns: 28px 1.4fr 1fr 1fr 38px;
    gap: 8px;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--wm-ec-border, #e5e7eb);
}

.wm-ec-mailbox-row:last-child {
    border-bottom: none;
}

/* Row number badge */
.wm-ec-row-num {
    font-size: .78rem;
    font-weight: 700;
    color: var(--wm-ec-muted, #494b51);
    text-align: center;
    line-height: 1;
    user-select: none;
}

/* ── Address field ────────────────────────────────────────────────────── */
.wm-ec-address-wrap {
    display: flex;
    align-items: center;
    min-width: 0;
}

.wm-ec-address-wrap .wm-ec-input {
    border-right: none;
    border-radius: 6px 0 0 6px;
    flex: 1;
    min-width: 0;
}

.wm-ec-address-suffix {
    display: inline-flex;
    align-items: center;
    padding: 10px 8px 10px 6px;
    background: var(--wm-ec-border, #e5e7eb);
    border: 1.5px solid var(--wm-ec-border, #e5e7eb);
    border-left: none;
    border-radius: 0 6px 6px 0;
    font-size: .78rem;
    color: var(--wm-ec-muted, #494b51);
    white-space: nowrap;
    line-height: 1;
    font-family: 'Courier New', Courier, monospace;
    user-select: none;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wm-ec-address-wrap:focus-within .wm-ec-input {
    border-color: var(--wm-ec-blue, #4175fc);
    box-shadow: 0 0 0 3px rgba(65, 117, 252, .15);
    background: var(--wm-ec-white, #ffffff);
}

.wm-ec-address-wrap:focus-within .wm-ec-address-suffix {
    border-color: var(--wm-ec-blue, #4175fc);
    background: #edf2ff;
}

/* Name input (plain, no wrap) */
.wm-ec-input--name {
    width: 100%;
    min-width: 0;
}

/* ── Password field ───────────────────────────────────────────────────── */
.wm-ec-password-wrap {
    display: flex;
    align-items: center;
    min-width: 0;
}

.wm-ec-password-wrap .wm-ec-input {
    border-right: none;
    border-radius: 6px 0 0 6px;
    flex: 1;
    min-width: 0;
}

.wm-ec-password-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 9px;
    height: 42px;
    background: var(--wm-ec-bg, #f3f5f5);
    border: 1.5px solid var(--wm-ec-border, #e5e7eb);
    border-left: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    color: var(--wm-ec-muted, #494b51);
    transition: background-color 180ms ease, color 180ms ease;
    flex-shrink: 0;
}

.wm-ec-password-toggle:hover {
    background: #edf2ff;
    color: var(--wm-ec-blue, #4175fc);
}

.wm-ec-password-wrap:focus-within .wm-ec-input {
    border-color: var(--wm-ec-blue, #4175fc);
    box-shadow: 0 0 0 3px rgba(65, 117, 252, .15);
    background: var(--wm-ec-white, #ffffff);
}

.wm-ec-password-wrap:focus-within .wm-ec-password-toggle {
    border-color: var(--wm-ec-blue, #4175fc);
}

/* ── Remove row button (danger) ───────────────────────────────────────── */
.wm-ec-remove-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #c0392b;
    border: none;
    cursor: pointer;
    color: #ffffff;
    transition: background-color 180ms ease;
    flex-shrink: 0;
    justify-self: center;
}

.wm-ec-remove-row:hover {
    background: #a93226;
}

/* ── Controls row (Add + Upgrade) ─────────────────────────────────────── */
.wm-ec-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 22px;
    flex-wrap: wrap;
}

/* ── Add another mailbox button ───────────────────────────────────────── */
.wm-ec-btn--add {
    background: transparent;
    color: var(--wm-ec-blue, #4175fc);
    border: 2px dashed var(--wm-ec-blue, #4175fc);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: .85rem;
    font-weight: 600;
    gap: 6px;
}

.wm-ec-btn--add:hover {
    background: #edf2ff;
}

/* ── Upgrade plan dropdown ────────────────────────────────────────────── */
.wm-ec-upgrade-wrap {
    position: relative;
    display: inline-flex;
}

.wm-ec-btn--upgrade {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 2px solid var(--wm-ec-blue, #4175fc);
    color: var(--wm-ec-blue, #4175fc);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: .85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 180ms ease;
}

.wm-ec-btn--upgrade:hover {
    background: #edf2ff;
}

.wm-ec-upgrade-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 270px;
    background: var(--wm-ec-white, #ffffff);
    border: 1px solid var(--wm-ec-border, #e5e7eb);
    border-radius: 8px;
    box-shadow: var(--wm-ec-shadow, 0 4px 24px rgba(11, 3, 68, .12));
    z-index: 100;
    overflow: hidden;
}

.wm-ec-upgrade-option {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    border-bottom: 1px solid var(--wm-ec-border, #e5e7eb);
    color: var(--wm-ec-navy, #0b0344);
    transition: background-color 140ms ease;
}

.wm-ec-upgrade-option:last-child {
    border-bottom: none;
}

.wm-ec-upgrade-option:hover {
    background: #f0f4ff;
}

.wm-ec-upgrade-option__name {
    display: block;
    font-weight: 700;
    color: var(--wm-ec-navy, #0b0344);
    font-size: .9rem;
}

.wm-ec-upgrade-option__meta {
    display: block;
    font-size: .8rem;
    color: var(--wm-ec-muted, #494b51);
    margin-top: 2px;
}

/* ── Form error ───────────────────────────────────────────────────────── */
.wm-ec-form-error {
    margin-top: 8px;
    font-size: .87rem;
    color: #c0392b;
    font-weight: 500;
}

/* ── Input error highlight ────────────────────────────────────────────── */
.wm-ec-input--error {
    border-color: #c0392b !important;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, .15) !important;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media ( max-width: 900px ) {
    .wm-ec-mailbox-box {
        padding: 24px 20px;
    }
}

@media ( max-width: 700px ) {
    /* Hide column headers — layout becomes stacked */
    .wm-ec-grid-header {
        display: none;
    }

    /* Switch each row to a 2-column grid: num | fields block */
    .wm-ec-mailbox-row {
        grid-template-columns: 28px 1fr;
        grid-template-rows: auto auto auto auto;
        row-gap: 6px;
        column-gap: 8px;
        padding: 10px 0;
        border-bottom: 2px solid var(--wm-ec-border, #e5e7eb);
    }

    /* Row num spans first column, rows 1-4 */
    .wm-ec-row-num {
        grid-row: 1 / 4;
        align-self: start;
        padding-top: 10px;
    }

    /* Inputs each take the full second column */
    .wm-ec-address-wrap,
    .wm-ec-input--name,
    .wm-ec-password-wrap {
        grid-column: 2;
    }

    /* Remove button at the end, spanning full width */
    .wm-ec-remove-row {
        grid-column: 1 / 3;
        justify-self: end;
    }

    .wm-ec-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .wm-ec-btn--add,
    .wm-ec-btn--upgrade {
        width: 100%;
        justify-content: center;
    }

    .wm-ec-upgrade-menu {
        left: 0;
        right: 0;
        min-width: 0;
    }

    .wm-ec-mailbox-box__header {
        flex-direction: column;
        align-items: flex-start;
    }
}
