/* ============================================================
   /v3/css/batch-register.css
   Bulk Registration — cart FAB + Add-to-cart button + drawer add-ons.

   Layers ON TOP of batch-sheet.css (which provides .v3-batch-drawer,
   .v3-batch-queue-item, .v3-batch-preflight etc.).  This file adds
   only register-specific pieces prefixed .v3-batch-register-*.

   Depends: tokens.css, batch-sheet.css
   Spec:    v3/specs/Bulk-Registration/Spec.md §14 · §16.2
   ============================================================ */

/* ============================================================
   Cart FAB — icon-only square button in header (bên Connect)
   Inspired by SNS.id: minimal cart glyph + red count badge.
   Sits comfortably alongside the Connect Wallet pill.
   ============================================================ */
.v3-batch-register-cart-fab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 10px;
    color: #D4DAE5;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 160ms ease, border-color 160ms ease,
                color 160ms ease, transform 140ms ease;
    text-decoration: none;
    line-height: 1;
}
.v3-batch-register-cart-fab:hover {
    background: rgba(37, 170, 225, 0.14);
    border-color: rgba(37, 170, 225, 0.45);
    color: #FFFFFF;
}
.v3-batch-register-cart-fab:active { transform: scale(0.94); }
.v3-batch-register-cart-fab i,
.v3-batch-register-cart-fab-icon {
    display: block;
    width: 18px;
    height: 18px;
    line-height: 1;
    /* SVG uses currentColor stroke — inherits btn color state */
}

/* Count badge — top-right corner, red like SNS */
.v3-batch-register-cart-fab-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: #FFFFFF;
    border: 1.5px solid #050608;
    border-radius: 999px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.55);
    line-height: 1;
    animation: v3-batch-badge-pop 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}
@keyframes v3-batch-badge-pop {
    0%   { transform: scale(0.6); opacity: 0; }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* Empty state — HIDDEN entirely.  Cart FAB only appears once the
   user has staged at least one domain.  Reduces header noise for
   first-time visitors browsing /search or /mydomains. */
.v3-batch-register-cart-fab.is-empty {
    display: none !important;
}

/* Not-empty state — cyan accent to hint items inside */
.v3-batch-register-cart-fab:not(.is-empty) {
    background: rgba(37, 170, 225, 0.12);
    border-color: rgba(37, 170, 225, 0.40);
    color: #5DC8F0;
}

/* ============================================================
   Add-to-cart button — 28×28 subtle square, matching AI-Recommended
   card buttons (see components.css .v3-ai-card-btn).  Sits beside
   the "Register" pill on TLD result rows, aligned via
   .v3-tld-action { align-items: center }.
   3 stacked icons swap via opacity (no width jitter, no transform).
     - default   → cart-plus (subtle grey/cyan)
     - is-added  → check (bright cyan/green)
     - is-added:hover → trash (red hint)
   ============================================================ */
.v3-batch-register-add-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    /* No transform on active — avoids the jitter chú spotted on click */
    transition: background 160ms ease, border-color 160ms ease,
                color 160ms ease;
    text-decoration: none;
    flex-shrink: 0;
    line-height: 1;
    vertical-align: middle;
}
.v3-batch-register-add-btn:hover {
    background: rgba(37, 170, 225, 0.10);
    border-color: rgba(37, 170, 225, 0.30);
    color: #5DC8F0;
}

/* Icons stacked absolutely so widths never jitter on state swap.
   SVGs (Feather-style) — currentColor inherits btn color, precise center.
   14px matches .v3-ai-card-btn icon size for visual parity. */
.v3-batch-register-add-btn .v3-br-svg,
.v3-batch-register-add-btn i {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    font-size: 13px;
    transform: translate(-50%, -50%);
    line-height: 1;
    opacity: 0;
    transition: opacity 140ms ease;
    pointer-events: none;
    display: block;
}
.v3-batch-register-add-btn .add-icon    { opacity: 1; }
.v3-batch-register-add-btn .added-icon,
.v3-batch-register-add-btn .remove-icon { opacity: 0; }

/* Post-add — subtle cyan fill, check icon.  Match AI-cta accent. */
.v3-batch-register-add-btn.is-added {
    background: rgba(37, 170, 225, 0.14);
    border-color: rgba(37, 170, 225, 0.42);
    color: #5DC8F0;
}
.v3-batch-register-add-btn.is-added .add-icon    { opacity: 0; }
.v3-batch-register-add-btn.is-added .added-icon  { opacity: 1; }
.v3-batch-register-add-btn.is-added .remove-icon { opacity: 0; }

/* is-added hover — red hint, trash icon reveals */
.v3-batch-register-add-btn.is-added:hover {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.42);
    color: #FCA5A5;
}
.v3-batch-register-add-btn.is-added:hover .added-icon  { opacity: 0; }
.v3-batch-register-add-btn.is-added:hover .remove-icon { opacity: 1; }

/* Disabled (cart full / domain unavailable) */
.v3-batch-register-add-btn:disabled,
.v3-batch-register-add-btn.is-disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.v3-batch-register-add-btn:disabled:hover,
.v3-batch-register-add-btn.is-disabled:hover {
    background: rgba(95, 227, 168, 0.08);
    color: #5FE3A8;
    border-color: rgba(95, 227, 168, 0.32);
    transform: none;
}

/* ============================================================
   Drawer body layout — mirror Batch Transfer/Burn behaviour:
     • Body itself is flex-column with overflow:hidden (from
       batch-sheet.css .v3-batch-drawer-body).
     • Queue slot [data-br-queue] takes leftover height and lets
       its inner .v3-batch-queue-list scroll — so with 10 items
       the queue scrolls internally instead of pushing preflight
       and summary below the drawer footer.
     • Preflight + summary stay fixed height (flex:0 0 auto).
   Without this, all sections grow by content and the total row
   ends up hidden behind the CONFIRM footer.
   ============================================================ */
#v3-batch-register-drawer [data-br-queue] {
    flex: 1 1 auto;
    min-height: 180px;      /* never collapse below ~5 items */
    display: flex;
    flex-direction: column;
}
#v3-batch-register-drawer [data-br-preflight],
#v3-batch-register-drawer [data-br-summary] {
    flex: 0 0 auto;
}

/* ============================================================
   Preflight block polish — extra breathing room around the
   .v3-batch-preflight strip inside our drawer so it visually
   separates from the QUEUE box above and SUMMARY below.
   Also bumps padding, weight, and left accent for clarity.
   ============================================================ */
#v3-batch-register-drawer [data-br-preflight] {
    margin: 10px 0;
}
#v3-batch-register-drawer [data-br-preflight] .v3-batch-preflight {
    padding: 12px 14px;
    border-left-width: 3px;
    font-weight: 500;
}
#v3-batch-register-drawer [data-br-preflight] .v3-batch-preflight strong {
    color: inherit;
    font-weight: 700;
}

/* ============================================================
   Drawer additions — total row + saving hint
   ============================================================ */
.v3-batch-register-summary {
    padding: 16px 0 4px;
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.v3-batch-register-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #A8B3C5;
}
.v3-batch-register-summary-row .value {
    color: #D4DAE5;
    font-weight: 500;
}
.v3-batch-register-summary-row.is-saving .value {
    color: #5FE3A8;
    font-weight: 700;
}
/* Total row — hero moment.  Filled cyan panel with tokens.css accent
   gradient background, thick top border, oversized value on the right.
   Draws the eye immediately before the user commits payment. */
.v3-batch-register-summary-row.is-total {
    margin-top: 10px;
    padding: 14px 16px;
    border: 1px solid rgba(37, 170, 225, 0.30);
    border-radius: 12px;
    background: linear-gradient(135deg,
        rgba(37, 170, 225, 0.14),
        rgba(95, 227, 168, 0.06));
    box-shadow: 0 4px 18px rgba(37, 170, 225, 0.10),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    font-size: 13px;
    color: #D4DAE5;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    align-items: center;
}
.v3-batch-register-summary-row.is-total > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #A8B3C5;
    font-family: 'JetBrains Mono', monospace;
}
.v3-batch-register-summary-row.is-total > span:first-child::before {
    content: '';
    width: 4px;
    height: 18px;
    border-radius: 2px;
    background: linear-gradient(180deg, #5DC8F0, #5FE3A8);
    display: inline-block;
}
.v3-batch-register-summary-row.is-total .value {
    color: #FFFFFF;
    font-family: 'Satoshi', system-ui, sans-serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1;
    /* Gradient stroke for the number — cyan → green, matches accent bar */
    background: linear-gradient(135deg, #FFFFFF 0%, #A0EFC6 60%, #5DC8F0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 24px rgba(93, 200, 240, 0.15);
}

/* Compact tally strip — sits ABOVE the queue box in in-flight state.
   3 inline pills: accepted (green) · processing (grey) · failed (red)
   Small, unobtrusive — leaves queue area for row detail. */
.v3-batch-register-tally-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 0 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    letter-spacing: 0.04em;
}
.v3-batch-register-tally-strip .cell {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    color: #A8B3C5;
    text-transform: lowercase;
}
.v3-batch-register-tally-strip .cell b {
    font-family: 'Satoshi', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #D4DAE5;
    line-height: 1;
}
.v3-batch-register-tally-strip .cell.is-ok {
    background: rgba(95, 227, 168, 0.08);
    border-color: rgba(95, 227, 168, 0.24);
    color: rgba(95, 227, 168, 0.85);
}
.v3-batch-register-tally-strip .cell.is-ok b { color: #5FE3A8; }
.v3-batch-register-tally-strip .cell.is-inprogress {
    background: rgba(37, 170, 225, 0.08);
    border-color: rgba(37, 170, 225, 0.20);
    color: rgba(93, 200, 240, 0.85);
}
.v3-batch-register-tally-strip .cell.is-inprogress b { color: #5DC8F0; }
.v3-batch-register-tally-strip .cell.is-err {
    /* Amber not red — these items are BE-refunded, not lost. */
    background: rgba(255, 185, 80, 0.06);
    border-color: rgba(255, 185, 80, 0.22);
    color: rgba(255, 185, 80, 0.85);
}
.v3-batch-register-tally-strip .cell.is-err b { color: #FFB950; }

/* Result-tally block (success/refunded/summary) */
.v3-batch-register-tally {
    display: flex;
    justify-content: space-around;
    padding: 20px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.v3-batch-register-tally-cell {
    text-align: center;
}
.v3-batch-register-tally-cell .num {
    font-family: 'Satoshi', system-ui, sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1;
}
.v3-batch-register-tally-cell.is-ok .num  { color: #5FE3A8; }
.v3-batch-register-tally-cell.is-err .num { color: #FCA5A5; }
.v3-batch-register-tally-cell .label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: #7A8599;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 6px;
}

/* Prevent footer buttons from wrapping on narrow drawer widths */
#v3-batch-register-drawer .v3-batch-drawer-foot-btn {
    white-space: nowrap;
    min-width: 0;
}
/* Preflight — ensure single-line where possible; wrap gracefully */
#v3-batch-register-drawer .v3-batch-preflight {
    flex-wrap: wrap;
}

/* Accept-all button in drawer footer (step 4) */
.v3-batch-register-accept-all {
    background: linear-gradient(135deg, #5FE3A8, #A0EFC6) !important;
    color: #052016 !important;
    font-weight: 700;
}

/* ============================================================
   Recovery banner — shown when boot() finds a checkpoint
   ============================================================ */
.v3-batch-register-recovery-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg,
        rgba(250, 199, 117, 0.10),
        rgba(239, 68, 68, 0.06));
    border: 1px solid rgba(250, 199, 117, 0.35);
    border-radius: 12px;
    margin-bottom: 16px;
    color: #FDE68A;
    font-size: 12.5px;
}
.v3-batch-register-recovery-banner-icon {
    font-size: 20px;
    color: #FAC775;
    flex-shrink: 0;
}
.v3-batch-register-recovery-banner-msg {
    flex: 1;
    line-height: 1.4;
}
.v3-batch-register-recovery-banner-msg strong {
    color: #FFFFFF;
    display: block;
    margin-bottom: 2px;
}
.v3-batch-register-recovery-banner-btn {
    padding: 8px 14px;
    background: linear-gradient(135deg, #FAC775, #FFDBA0);
    color: #050608;
    border: none;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    outline: none;
}
.v3-batch-register-recovery-banner-btn:hover {
    filter: brightness(1.08);
}

/* ============================================================
   Responsive — mobile (≤600px)
   Drawer inherits full-screen slide from batch-sheet.css @media.
   These rules tune bulk-register specifics so touch targets stay
   ≥40px and the total-hero row doesn't overflow the viewport.
   ============================================================ */
@media (max-width: 600px) {

    /* Header title — allow wrap on ultra-narrow so "· N domains"
       doesn't clip.  Reduce size slightly to keep single line on
       most phones (iPhone SE = 375px). */
    #v3-batch-register-drawer .v3-batch-drawer-title {
        font-size: 15px;
        line-height: 1.25;
    }

    /* Drawer body — trim horizontal padding to reclaim ~16px for
       queue name text (some XRPNames can be 30+ chars). */
    #v3-batch-register-drawer .v3-batch-drawer-body {
        padding: 14px 14px;
        gap: 12px;
    }
    #v3-batch-register-drawer .v3-batch-drawer-foot {
        padding: 12px 14px;
    }

    /* Queue container — reduce internal padding + preserve scroll */
    #v3-batch-register-drawer .v3-batch-queue { padding: 8px; }

    /* Queue item — tighten grid gap so long fullnames fit; keep icon
       + name comfortable, ellipsis handles overflow already. */
    #v3-batch-register-drawer .v3-batch-queue-item {
        gap: 8px;
        padding: 8px 8px;
    }
    #v3-batch-register-drawer .v3-batch-queue-item-name {
        font-size: 12px;
    }
    #v3-batch-register-drawer .v3-batch-queue-item-detail {
        font-size: 10.5px;
        gap: 6px !important;
    }
    /* Remove-X → touch-friendly 32×32 while keeping 22×22 visual */
    #v3-batch-register-drawer .v3-batch-queue-item-remove {
        width: 32px;
        height: 32px;
        margin: -5px -5px;      /* absorb the extra padding visually */
    }

    /* Preflight strip — tighter, still readable */
    #v3-batch-register-drawer [data-br-preflight] {
        margin: 6px 0;
    }
    #v3-batch-register-drawer [data-br-preflight] .v3-batch-preflight {
        padding: 10px 12px;
        font-size: 11.5px;
    }

    /* Summary rows — smaller labels */
    .v3-batch-register-summary { padding: 12px 0 2px; }
    .v3-batch-register-summary-row { font-size: 11.5px; }

    /* Total hero — shrink so 3-digit + decimals fit on 375px viewport */
    .v3-batch-register-summary-row.is-total {
        padding: 12px 14px;
    }
    .v3-batch-register-summary-row.is-total .value {
        font-size: 22px;
    }

    /* In-flight tally cells — 3 cells side-by-side on narrow */
    .v3-batch-register-tally { padding: 14px 8px; gap: 6px; }
    .v3-batch-register-tally-cell .num { font-size: 22px; }
    .v3-batch-register-tally-cell .label {
        font-size: 9px;
        letter-spacing: 1.5px;
    }

    /* Recovery banner — stack vertical so the button fits */
    .v3-batch-register-recovery-banner {
        flex-wrap: wrap;
        gap: 10px;
    }
    .v3-batch-register-recovery-banner-btn {
        flex: 1 1 100%;
        text-align: center;
    }

    /* TLD row Add-to-cart — bump touch target to 32×32 without
       changing visual chip padding.  Rule pairs with .v3-tld-action
       flex gap so Register pill + Add btn still align. */
    .v3-batch-register-add-btn {
        width: 32px;
        height: 32px;
    }
    .v3-batch-register-add-btn .v3-br-svg,
    .v3-batch-register-add-btn i {
        width: 16px;
        height: 16px;
        font-size: 14px;
    }

    /* Cart FAB — round it to 34×34 icon-only, larger tap target than
       Connect pill neighbour, but not so big it dominates header. */
    .v3-batch-register-cart-fab {
        width: 36px;
        height: 36px;
        border-radius: 999px;    /* fully round on mobile */
    }
    .v3-batch-register-cart-fab-badge {
        min-width: 18px;
        height: 18px;
        top: -5px;
        right: -5px;
    }
}

/* Ultra-narrow (≤360px, iPhone SE portrait) — one more compression */
@media (max-width: 360px) {
    #v3-batch-register-drawer .v3-batch-queue-item-name { font-size: 11.5px; }
    .v3-batch-register-summary-row.is-total .value { font-size: 20px; }
    .v3-batch-register-tally-cell .num { font-size: 20px; }
}

/* ============================================================
   Queue header — "Clear all" affordance beside "Queue (N)"
   Compact ghost button; hover promotes to red so users read
   it as a destructive action (matches row trash icon).
   ============================================================ */
#v3-batch-register-drawer .v3-batch-queue-clear-all {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    height: 24px;
    font-family: var(--v3-mono, ui-monospace, monospace);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: none;
    color: var(--v3-muted, #7A8599);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    cursor: pointer;
    transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}
#v3-batch-register-drawer .v3-batch-queue-clear-all:hover {
    color: #FF6B6B;
    border-color: rgba(255, 107, 107, 0.45);
    background: rgba(255, 107, 107, 0.06);
}
#v3-batch-register-drawer .v3-batch-queue-clear-all:active {
    transform: translateY(1px);
}
#v3-batch-register-drawer .v3-batch-queue-clear-all i {
    font-size: 11px;
    opacity: 0.85;
}
