/* Split from the original style.css; loaded in original order (after style.css). */
/* ── Proxy (rotation / forwarding) tab ──────────────────────────────────── */
/* Toolbar on top (provider picker + actions), one card per key below.
   The provider itself is a <select>, not a card: per-provider cards turned into
   very tall columns once a provider had more than a handful of keys.

   The toolbar shares its framed surface with .dk-filter-panel above,
   while the empty state reuses .state-card. */
.proxy-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.proxy-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Keep toolbar captions styled identically to .field-label in dead-keys/modals. */
.proxy-toolbar-label,
.proxy-summary-label,
.proxy-model-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Two separate translucent-tinted capsules matching --control-h beside the model
   controls, spaced identically to the label-to-capsule gap (0.75rem). */
.proxy-summary-group {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.proxy-summary-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    height: var(--control-h);
    /* Fixed width sized for up to 3 digits (max 999 keys total) + padding + 2px border. */
    width: calc(3ch + 1.5rem + 2px);
    padding: 0 0.75rem;
    border-radius: var(--radius-sm);
    text-align: center;
}

.proxy-summary-ok {
    background: rgba(34, 197, 94, 0.15);
    color: var(--ok-soft);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.proxy-summary-fail {
    background: rgba(239, 68, 68, 0.15);
    color: var(--fail-soft);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.proxy-summary-num {
    font-size: var(--text-base);
    font-weight: 700;
    line-height: 1;
}

.proxy-toolbar-row {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Controls in these rows share --control-h with single-line inputs/selects.
   .btn-sm stays on the HTML for tighter horizontal padding, while vertical
   padding and font size match adjacent selects so the band reads as one line. */
.proxy-toolbar-row .btn:not(.btn-icon),
.keys-toolbar .btn:not(.btn-icon),
.add-header-btn {
    min-height: var(--control-h);
}

.proxy-toolbar-row .btn:not(.btn-icon) {
    height: var(--control-h);
    padding-block: 0;
    font-size: var(--text-sm);
}

/* The two rows must end on the same x so 转发地址 and 密钥状态 sit in one
   parallel column. The 测试模型 heading is 33.6px wider than the 供应商 label
   (one more CJK glyph + the info icon), so the provider select compensates by
   being 33.6px wider than the model select: 15rem + 2.1rem = 17.1rem. Both
   selects then share the same right edge and no blank gap opens after the
   shorter label. (The old 21.25rem card-parity width is gone: parallel
   columns win.) */
.proxy-provider-col {
    flex: 0 0 17.1rem;
    min-width: 0;
    max-width: 100%;
}

.proxy-provider-col .input-select {
    width: 100%;
}

/* The provider row is a select and the URL beside it. Both are one control tall,
   so they share the same top and centre line. */
.proxy-toolbar-row--provider {
    align-items: center;
}

/* Row two: probe model selector and key-state counts left-aligned together,
   with batch test / recover actions anchored against the right edge. */
.proxy-toolbar-row--model {
    align-items: center;
}

.proxy-provider-group,
.proxy-url-group,
.proxy-model-group,
.proxy-action-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.proxy-provider-group {
    flex: 0 0 auto;
    max-width: 100%;
}

.proxy-url-group {
    flex: 1 1 20rem;
    min-width: 0;
}

.proxy-model-group {
    flex-wrap: wrap;
}

.proxy-toolbar-row--model .proxy-action-group {
    margin-left: auto;
    flex-wrap: wrap;
}

.proxy-model-heading {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

/* The probe model now comes from the provider's own Models list (来源管理), so it
   is a select too — 15rem, enough for the longest model name without taking a
   third of the row. `flex: none` plus an explicit width matter for the group's
   intrinsic size: with a shrinkable flex-basis the group measured only the
   select's text width and wrapped its last two buttons onto a second line. */
.proxy-model-select,
.proxy-model-group > .custom-select {
    flex: none;
    width: 15rem;
    max-width: 100%;
}

.proxy-url-wrap {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

/* Square copy button matching the select/URL row height (--control-h) at every
   breakpoint, with its vector icon scaled up proportionally. */
.btn.proxy-url-copy {
    width: var(--control-h);
    height: var(--control-h);
    padding: 0;
}

.btn.proxy-url-copy svg {
    width: 1.15rem;
    height: 1.15rem;
}

/* Display-only forwarding URL box paired with a uniform copy button. */
.proxy-url {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    padding: 0 0.9rem;
    line-height: calc(var(--control-h) - 2px);
    background: var(--bg-3);
    color: var(--text);
    font-family: var(--mono);
    font-size: var(--text-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.proxy-key-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}

/* Typography & truncation are shared with .provider-card-host above.
   min-width: 0 + padding: 0 + background: none drop the inline <code> chip box. */
.proxy-key-mask {
    flex: 1;
    min-width: 0;
    padding: 0;
    background: none;
    font-family: var(--mono);
    color: var(--text);
}

.proxy-key-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.proxy-key-card-btns {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

/* ── Proxy top-right toast stack ────────────────────────────────────────── */
.proxy-toast-stack {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 400;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.6rem;
    width: min(24rem, calc(100vw - 2rem));
    pointer-events: none;
}

.proxy-toast {
    pointer-events: auto;
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--text);
    box-shadow: var(--shadow);
    font-size: var(--text-sm);
    line-height: 1.45;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.proxy-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.proxy-toast.is-leaving {
    position: absolute;
    left: 0;
    right: 0;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.proxy-toast--ok {
    border-color: rgba(34, 197, 94, 0.35);
    color: var(--ok);
}

.proxy-toast--fail {
    border-color: rgba(239, 68, 68, 0.35);
    color: var(--fail);
}

.proxy-toast--info {
    border-color: rgba(99, 102, 241, 0.35);
    color: var(--text);
}

.proxy-toast-msg {
    flex: 1;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
}

.proxy-toast-close {
    flex: none;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.1rem 0.2rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.proxy-toast-close:hover {
    color: var(--text);
}

/* ── Proxy key grid pagination ──────────────────────────────────────────── */
.proxy-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.proxy-page-btn {
    width: var(--control-h);
    height: var(--control-h);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.proxy-page-box {
    display: inline-flex;
    align-items: center;
    height: var(--control-h);
    padding: 0 0.7rem;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-variant-numeric: tabular-nums;
    transition: border-color 0.15s;
}

.proxy-page-box:focus-within {
    border-color: var(--accent);
}

.proxy-page-input {
    width: 3ch;
    height: 100%;
    padding: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--font);
    font-size: var(--text-sm);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.proxy-page-sep {
    margin: 0 0.35rem;
    font-size: var(--text-sm);
    color: var(--text-muted);
    user-select: none;
}

.proxy-page-total {
    width: 3ch;
    text-align: left;
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
