/**
 * ArzPaya Live Widget — dark/light price list + settings overlay
 */

/* ------------------------------------------------------------------ */
/* Widget                                                              */
/* ------------------------------------------------------------------ */

.arzlw {
    /* Dark — self-contained tokens (not inherited from site theme) */
    --arzlw-bg: #0b1c33;
    --arzlw-bg-soft: #0f243f;
    --arzlw-line: rgba(255, 255, 255, 0.08);
    --arzlw-text: #ffffff;
    --arzlw-muted: rgba(255, 255, 255, 0.55);
    --arzlw-up: #2dd4a8;
    --arzlw-down: #f07178;
    --arzlw-tone-up-bg: linear-gradient(
        90deg,
        rgba(45, 212, 168, 0.3) 0%,
        rgba(45, 212, 168, 0.14) 38%,
        rgba(45, 212, 168, 0.04) 68%,
        transparent 100%
    );
    --arzlw-tone-down-bg: linear-gradient(
        90deg,
        rgba(240, 113, 120, 0.3) 0%,
        rgba(240, 113, 120, 0.14) 38%,
        rgba(240, 113, 120, 0.04) 68%,
        transparent 100%
    );
    --arzlw-tone-up-ring: rgba(45, 212, 168, 0.18);
    --arzlw-tone-down-ring: rgba(240, 113, 120, 0.18);
    --arzlw-mode-bg: rgba(255, 255, 255, 0.06);
    --arzlw-mode-border: rgba(255, 255, 255, 0.1);
    --arzlw-mode-text: rgba(255, 255, 255, 0.78);
    --arzlw-mode-active-bg: #ffffff;
    --arzlw-mode-active-text: #0b1c33;
    --arzlw-icon-border: rgba(255, 255, 255, 0.14);
    --arzlw-icon-bg: rgba(255, 255, 255, 0.04);
    --arzlw-icon-color: rgba(255, 255, 255, 0.85);
    --arzlw-radius: 16px;
    --arzlw-font: inherit;
    --arzlw-row-h: 64px;
    --arzlw-visible-rows: 7;

    direction: rtl;
    display: flex;
    flex-direction: column;
    background: var(--arzlw-bg);
    color: var(--arzlw-text);
    border-radius: var(--arzlw-radius);
    overflow: hidden;
    font-family: var(--arzlw-font);
    box-shadow: none;
    border: none;
    width: 100%;
    max-width: 420px;
    margin: 0;
    padding: 0;
}

/* Hide until inline boot sets data-arzlw-theme (prevents dark→light flash) */
.arzlw:not([data-arzlw-theme]) {
    visibility: hidden;
}

/* Light — same palette as settings overlay (independent of site data-theme) */
.arzlw[data-arzlw-theme="light"] {
    --arzlw-bg: #ffffff;
    --arzlw-bg-soft: #f8fafc;
    --arzlw-line: #eceef2;
    --arzlw-text: #213364;
    --arzlw-muted: #64748b;
    --arzlw-up: #16a34a;
    --arzlw-down: #dc2626;
    --arzlw-tone-up-bg: linear-gradient(
        90deg,
        rgba(22, 163, 74, 0.2) 0%,
        rgba(22, 163, 74, 0.1) 40%,
        rgba(22, 163, 74, 0.03) 70%,
        transparent 100%
    );
    --arzlw-tone-down-bg: linear-gradient(
        90deg,
        rgba(220, 38, 38, 0.18) 0%,
        rgba(220, 38, 38, 0.09) 40%,
        rgba(220, 38, 38, 0.03) 70%,
        transparent 100%
    );
    --arzlw-tone-up-ring: rgba(22, 163, 74, 0.16);
    --arzlw-tone-down-ring: rgba(220, 38, 38, 0.14);
    --arzlw-mode-bg: rgba(33, 51, 100, 0.05);
    --arzlw-mode-border: #eceef2;
    --arzlw-mode-text: #64748b;
    --arzlw-mode-active-bg: #213364;
    --arzlw-mode-active-text: #ffffff;
    --arzlw-icon-border: #eceef2;
    --arzlw-icon-bg: rgba(33, 51, 100, 0.04);
    --arzlw-icon-color: #213364;
    border: 1px solid #eceef2;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
}

.arzlw[data-arzlw-theme="dark"] {
    --arzlw-bg: #0b1c33;
    --arzlw-bg-soft: #0f243f;
    --arzlw-line: rgba(255, 255, 255, 0.08);
    --arzlw-text: #ffffff;
    --arzlw-muted: rgba(255, 255, 255, 0.55);
    --arzlw-up: #2dd4a8;
    --arzlw-down: #f07178;
    --arzlw-tone-up-bg: linear-gradient(
        90deg,
        rgba(45, 212, 168, 0.3) 0%,
        rgba(45, 212, 168, 0.14) 38%,
        rgba(45, 212, 168, 0.04) 68%,
        transparent 100%
    );
    --arzlw-tone-down-bg: linear-gradient(
        90deg,
        rgba(240, 113, 120, 0.3) 0%,
        rgba(240, 113, 120, 0.14) 38%,
        rgba(240, 113, 120, 0.04) 68%,
        transparent 100%
    );
    --arzlw-tone-up-ring: rgba(45, 212, 168, 0.18);
    --arzlw-tone-down-ring: rgba(240, 113, 120, 0.18);
    --arzlw-mode-bg: rgba(255, 255, 255, 0.06);
    --arzlw-mode-border: rgba(255, 255, 255, 0.1);
    --arzlw-mode-text: rgba(255, 255, 255, 0.78);
    --arzlw-mode-active-bg: #ffffff;
    --arzlw-mode-active-text: #0b1c33;
    --arzlw-icon-border: rgba(255, 255, 255, 0.14);
    --arzlw-icon-bg: rgba(255, 255, 255, 0.04);
    --arzlw-icon-color: rgba(255, 255, 255, 0.85);
    border: none;
    box-shadow: none;
}

.arzlw__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 12px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--arzlw-bg);
}

.arzlw__brand {
    min-width: 0;
}

.arzlw__title {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.35;
    color: var(--arzlw-text);
}

.arzlw__clock {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 4px;
    color: var(--arzlw-muted);
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.arzlw__clock-time {
    letter-spacing: 0.02em;
    direction: ltr;
    unicode-bidi: plaintext;
}

.arzlw__controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.arzlw__mode {
    display: inline-flex;
    align-items: center;
    padding: 3px;
    border-radius: 999px;
    background: var(--arzlw-mode-bg);
    border: 1px solid var(--arzlw-mode-border);
}

.arzlw__mode-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--arzlw-mode-text);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
}

.arzlw__mode-btn.is-active {
    background: var(--arzlw-mode-active-bg);
    color: var(--arzlw-mode-active-text);
}

.arzlw__icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--arzlw-icon-border);
    background: var(--arzlw-icon-bg);
    color: var(--arzlw-icon-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.arzlw__icon-btn:hover {
    filter: brightness(1.08);
}

.arzlw[data-arzlw-theme="light"] .arzlw__icon-btn:hover {
    filter: none;
    background: rgba(33, 51, 100, 0.08);
    border-color: #cbd5e1;
}

.arzlw[data-arzlw-theme="light"] .arzlw__mode-btn:not(.is-active):hover {
    color: #213364;
}

.arzlw__list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 0 1 auto;
    min-height: 0;
    /* Cap at 7 rows; fewer items shrink naturally (no forced empty height) */
    max-height: calc(var(--arzlw-visible-rows) * var(--arzlw-row-h));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.arzlw[data-arzlw-theme="light"] .arzlw__list {
    scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
}

.arzlw__list::-webkit-scrollbar {
    width: 5px;
}

.arzlw__list::-webkit-scrollbar-track {
    background: transparent;
}

.arzlw__list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.28);
    border-radius: 999px;
}

.arzlw[data-arzlw-theme="light"] .arzlw__list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.25);
}

.arzlw__empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--arzlw-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.arzlw__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    border-top: 1px solid var(--arzlw-line);
    box-sizing: border-box;
    height: var(--arzlw-row-h);
    min-height: var(--arzlw-row-h);
    max-height: var(--arzlw-row-h);
    background: transparent;
    transition: background 0.25s ease, box-shadow 0.25s ease;
}

/* Change-mode: status via glassy gradient row background (not text color) */
.arzlw.is-change .arzlw__row[data-tone="up"] {
    background: var(--arzlw-tone-up-bg);
    box-shadow: inset 0 0 0 1px var(--arzlw-tone-up-ring);
}

.arzlw.is-change .arzlw__row[data-tone="down"] {
    background: var(--arzlw-tone-down-bg);
    box-shadow: inset 0 0 0 1px var(--arzlw-tone-down-ring);
}

.arzlw.is-change .arzlw__row[data-tone="neutral"] {
    background: transparent;
    box-shadow: none;
}

.arzlw.is-change .arzlw__row.is-tick-up {
    animation: arzlwRowTickUp 0.9s ease;
}

.arzlw.is-change .arzlw__row.is-tick-down {
    animation: arzlwRowTickDown 0.9s ease;
}

@keyframes arzlwRowTickUp {
    0% {
        filter: brightness(1);
        box-shadow: inset 0 0 0 1px var(--arzlw-tone-up-ring);
    }
    40% {
        filter: brightness(1.12);
        box-shadow:
            inset 0 0 0 1px rgba(45, 212, 168, 0.45),
            inset 0 0 28px rgba(45, 212, 168, 0.28);
    }
    100% {
        filter: brightness(1);
        box-shadow: inset 0 0 0 1px var(--arzlw-tone-up-ring);
    }
}

@keyframes arzlwRowTickDown {
    0% {
        filter: brightness(1);
        box-shadow: inset 0 0 0 1px var(--arzlw-tone-down-ring);
    }
    40% {
        filter: brightness(1.08);
        box-shadow:
            inset 0 0 0 1px rgba(240, 113, 120, 0.45),
            inset 0 0 28px rgba(240, 113, 120, 0.26);
    }
    100% {
        filter: brightness(1);
        box-shadow: inset 0 0 0 1px var(--arzlw-tone-down-ring);
    }
}

.arzlw[data-arzlw-theme="light"].is-change .arzlw__row.is-tick-up {
    animation-name: arzlwRowTickUpLight;
}

.arzlw[data-arzlw-theme="light"].is-change .arzlw__row.is-tick-down {
    animation-name: arzlwRowTickDownLight;
}

@keyframes arzlwRowTickUpLight {
    0% {
        filter: brightness(1);
        box-shadow: inset 0 0 0 1px var(--arzlw-tone-up-ring);
    }
    40% {
        filter: brightness(0.98);
        box-shadow:
            inset 0 0 0 1px rgba(22, 163, 74, 0.4),
            inset 0 0 24px rgba(22, 163, 74, 0.2);
    }
    100% {
        filter: brightness(1);
        box-shadow: inset 0 0 0 1px var(--arzlw-tone-up-ring);
    }
}

@keyframes arzlwRowTickDownLight {
    0% {
        filter: brightness(1);
        box-shadow: inset 0 0 0 1px var(--arzlw-tone-down-ring);
    }
    40% {
        filter: brightness(0.98);
        box-shadow:
            inset 0 0 0 1px rgba(220, 38, 38, 0.35),
            inset 0 0 24px rgba(220, 38, 38, 0.16);
    }
    100% {
        filter: brightness(1);
        box-shadow: inset 0 0 0 1px var(--arzlw-tone-down-ring);
    }
}

.arzlw__asset {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.arzlw__icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--arzlw-icon-bg);
}

.arzlw__icon--fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--arzlw-muted);
}

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

.arzlw__name {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--arzlw-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.arzlw__symbol {
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--arzlw-muted);
    letter-spacing: 0.02em;
    direction: ltr;
    unicode-bidi: plaintext;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.arzlw__prices {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    direction: ltr;
    flex-shrink: 0;
    gap: 2px;
    /* Reserve 2 lines so live/change tabs keep the same row height */
    height: 2.45em;
}

.arzlw__price-sub-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 1.2em;
    direction: ltr;
}

.arzlw__change {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--arzlw-text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-variant-numeric: tabular-nums;
    direction: ltr;
    unicode-bidi: plaintext;
    white-space: nowrap;
    flex-shrink: 0;
}

.arzlw[data-arzlw-theme="light"] .arzlw__change {
    background: rgba(33, 51, 100, 0.06);
    border-color: rgba(33, 51, 100, 0.1);
    color: var(--arzlw-text);
}

/* Match tether number scale in change tab (tether is the larger line there) */
.arzlw.is-change .arzlw__change {
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.2;
    padding: 0 5px;
    border-radius: 5px;
    min-height: 1.15em;
}

.arzlw.is-change .arzlw__change .arzlw__price-spinner {
    width: 11px;
    height: 11px;
}

.arzlw.is-change .arzlw__row[data-tone="up"] .arzlw__change {
    background: rgba(45, 212, 168, 0.18);
    border-color: rgba(45, 212, 168, 0.28);
}

.arzlw.is-change .arzlw__row[data-tone="down"] .arzlw__change {
    background: rgba(240, 113, 120, 0.18);
    border-color: rgba(240, 113, 120, 0.28);
}

.arzlw[data-arzlw-theme="light"].is-change .arzlw__row[data-tone="up"] .arzlw__change {
    background: rgba(22, 163, 74, 0.12);
    border-color: rgba(22, 163, 74, 0.22);
}

.arzlw[data-arzlw-theme="light"].is-change .arzlw__row[data-tone="down"] .arzlw__change {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.2);
}

.arzlw__change.is-loading {
    min-width: 2.25em;
    padding-inline: 8px;
}

.arzlw__change .arzlw__price-spinner {
    width: 12px;
    height: 12px;
    border-width: 1.5px;
}

.arzlw.is-change .arzlw__change .arzlw__price-spinner {
    width: 12px;
    height: 12px;
}

.arzlw__price-main {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--arzlw-text);
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    height: 1.25em;
    display: inline-flex;
    align-items: center;
}

.arzlw__price-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.22);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: arzlwSpin 0.8s linear infinite;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
}

.arzlw[data-arzlw-theme="light"] .arzlw__price-spinner {
    border-color: rgba(33, 51, 100, 0.18);
    border-top-color: #213364;
}

@keyframes arzlwSpin {
    to {
        transform: rotate(360deg);
    }
}

.arzlw__price-sub {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--arzlw-muted);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    height: 1.2em;
}

.arzlw__price-sub .arzlw__price-spinner {
    width: 12px;
    height: 12px;
    border-width: 1.5px;
}

.arzlw__price-sub:empty {
    visibility: hidden;
}

.arzlw__price-sub-row .arzlw__price-sub:empty {
    display: none;
    visibility: visible;
}

/* Change tab: swap toman/tether type scale; keep current colors */
.arzlw.is-change .arzlw__prices {
    height: auto;
    min-height: 2.45em;
    gap: 3px;
}

.arzlw.is-change .arzlw__price-sub-row {
    min-height: 1.25em;
    gap: 8px;
}
.arzlw.is-change .arzlw__price-main {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    height: 1.2em;
    color: var(--arzlw-text);
}

.arzlw.is-change .arzlw__price-sub {
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.25;
    height: 1.25em;
    color: var(--arzlw-muted);
}

/* Live-mode: only digits that moved get status color */
.arzlw__digit {
    color: inherit;
    transition: color 0.2s ease;
}

.arzlw__digit.is-up {
    color: var(--arzlw-up);
}

.arzlw__digit.is-down {
    color: var(--arzlw-down);
}

@media (max-width: 480px) {
    .arzlw {
        max-width: none;
        border-radius: 14px;
        --arzlw-row-h: 62px;
    }

    .arzlw__header {
        padding: 14px 14px 10px;
    }

    .arzlw__row {
        padding: 12px 14px;
    }

    .arzlw__mode-btn {
        padding: 6px 10px;
        font-size: 0.74rem;
    }
}

/* ------------------------------------------------------------------ */
/* Settings overlay (share / howto pattern)                            */
/* ------------------------------------------------------------------ */

body.arzlw-settings-open {
    overflow: hidden;
}

.arzlw-settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 100010;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.arzlw-settings-overlay.is-visible {
    opacity: 1;
}

.arzlw-settings-panel,
.arzlw-settings-suggest,
.arzlw-settings-fav-ghost {
    /* Follows widget effective theme via data-arzlw-theme (not site theme) */
    --arzlw-set-bg: #ffffff;
    --arzlw-set-surface: #f8fafc;
    --arzlw-set-line: #eceef2;
    --arzlw-set-text: #213364;
    --arzlw-set-muted: #64748b;
    --arzlw-set-thumb: rgba(0, 0, 0, 0.25);
    --arzlw-set-close-bg: rgba(100, 116, 139, 0.1);
    --arzlw-set-close-hover: rgba(100, 116, 139, 0.18);
    --arzlw-set-option-hover: #f1f5ff;
    --arzlw-set-option-active-bg: #eff6ff;
    --arzlw-set-option-active: #3b82f6;
    --arzlw-set-dd-bg: #ffffff;
    --arzlw-set-dd-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    --arzlw-set-suggest-shadow: 0 -10px 28px rgba(15, 23, 42, 0.16);
    --arzlw-set-icon-bg: rgba(100, 116, 139, 0.08);
}

.arzlw-settings-panel[data-arzlw-theme="dark"],
.arzlw-settings-suggest[data-arzlw-theme="dark"],
.arzlw-settings-fav-ghost[data-arzlw-theme="dark"] {
    --arzlw-set-bg: #0b1c33;
    --arzlw-set-surface: #0f243f;
    --arzlw-set-line: rgba(255, 255, 255, 0.1);
    --arzlw-set-text: #ffffff;
    --arzlw-set-muted: rgba(255, 255, 255, 0.55);
    --arzlw-set-thumb: rgba(255, 255, 255, 0.28);
    --arzlw-set-close-bg: rgba(255, 255, 255, 0.08);
    --arzlw-set-close-hover: rgba(255, 255, 255, 0.14);
    --arzlw-set-option-hover: rgba(59, 130, 246, 0.1);
    --arzlw-set-option-active-bg: rgba(59, 130, 246, 0.18);
    --arzlw-set-option-active: #60a5fa;
    --arzlw-set-dd-bg: #0f243f;
    --arzlw-set-dd-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    --arzlw-set-suggest-shadow: 0 -10px 28px rgba(0, 0, 0, 0.45);
    --arzlw-set-icon-bg: rgba(255, 255, 255, 0.06);
}

.arzlw-settings-panel {
    position: fixed;
    inset: 0;
    z-index: 100011;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
    visibility: hidden;
}

.arzlw-settings-panel.is-open,
.arzlw-settings-panel.is-animating {
    visibility: visible;
}

.arzlw-settings-panel.is-open {
    pointer-events: auto;
}

.arzlw-settings-panel__sheet {
    position: relative;
    width: 100%;
    height: 100%;
    max-height: 100%;
    background: var(--arzlw-set-bg);
    border-radius: 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
    transform: translate3d(0, calc(100% + 24px), 0);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    outline: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    will-change: transform;
    direction: rtl;
}

.arzlw-settings-panel.is-open .arzlw-settings-panel__sheet {
    transform: translate3d(0, 0, 0);
}

.arzlw-settings-panel__handle {
    width: 44px;
    height: 4px;
    border-radius: 999px;
    background: var(--arzlw-set-line);
    margin: 10px auto 0;
    flex-shrink: 0;
}

.arzlw-settings-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px 12px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--arzlw-set-line);
}

.arzlw-settings-panel__heading {
    min-width: 0;
}

.arzlw-settings-panel__title {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--arzlw-set-text);
    line-height: 1.4;
}

.arzlw-settings-panel__lead {
    margin: 6px 0 0;
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--arzlw-set-muted);
    font-weight: 500;
}

.arzlw-settings-panel__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: var(--arzlw-set-close-bg);
    color: var(--arzlw-set-muted);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.arzlw-settings-panel__close:hover {
    background: var(--arzlw-set-close-hover);
    color: var(--arzlw-set-text);
}

.arzlw-settings-panel__body {
    padding: 12px 20px 28px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--arzlw-set-thumb) transparent;
}

.arzlw-settings-panel__body::-webkit-scrollbar {
    width: 5px;
}

.arzlw-settings-panel__body::-webkit-scrollbar-track {
    background: transparent;
}

.arzlw-settings-panel__body::-webkit-scrollbar-thumb {
    background: var(--arzlw-set-thumb);
    border-radius: 999px;
}

.arzlw-settings-section {
    margin-bottom: 22px;
}

.arzlw-settings-section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.arzlw-settings-section__title {
    margin: 0 0 4px;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--arzlw-set-text);
}

.arzlw-settings-section__head .arzlw-settings-section__title {
    margin-bottom: 0;
}

.arzlw-settings-section__desc {
    margin: 0 0 12px;
    font-size: 0.78rem;
    line-height: 1.7;
    color: var(--arzlw-set-muted);
    font-weight: 500;
}

.arzlw-settings-section__meta {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--arzlw-set-muted);
}

.arzlw-settings-field {
    display: grid;
    gap: 12px;
}

.arzlw-settings-field__label {
    font-size: 0.78rem;
    line-height: 1.7;
    color: var(--arzlw-set-muted);
    font-weight: 500;
}

/* Theme dropdown — trigger matches previous select; panel is custom */
.arzlw-theme-dd {
    position: relative;
    width: 100%;
}

.arzlw-theme-dd__btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    box-sizing: border-box;
    width: 100%;
    height: 46px;
    padding: 0 14px 0 40px;
    border-radius: 12px;
    border: 1px solid var(--arzlw-set-line);
    background: var(--arzlw-set-bg);
    color: var(--arzlw-set-text);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.25;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    text-align: right;
}

.arzlw-theme-dd__btn:hover,
.arzlw-theme-dd__btn.is-open,
.arzlw-theme-dd__btn:focus {
    outline: none;
    border-color: var(--accent-primary, #3d72fe);
    box-shadow: 0 0 0 3px rgba(61, 114, 254, 0.18);
}

.arzlw-theme-dd__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.arzlw-theme-dd__chevron {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    flex-shrink: 0;
    color: var(--arzlw-set-muted);
    pointer-events: none;
    transition: transform 0.2s ease;
}

.arzlw-theme-dd__btn.is-open .arzlw-theme-dd__chevron {
    transform: translateY(-50%) rotate(180deg);
}

.arzlw-theme-dd__panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 30;
    background: var(--arzlw-set-dd-bg);
    border: 1px solid var(--arzlw-set-line);
    border-radius: 12px;
    box-shadow: var(--arzlw-set-dd-shadow);
    overflow: hidden;
}

.arzlw-theme-dd__list {
    list-style: none;
    margin: 0;
    padding: 6px;
}

.arzlw-theme-dd__option {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--arzlw-set-text);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: right;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.arzlw-theme-dd__option:hover {
    background: var(--arzlw-set-option-hover);
}

.arzlw-theme-dd__option.is-active {
    background: var(--arzlw-set-option-active-bg);
    color: var(--arzlw-set-option-active);
}

.arzlw-settings-favs {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    border: 1px solid var(--arzlw-set-line);
    border-radius: 14px;
    overflow: hidden;
    background: var(--arzlw-set-bg);
}

.arzlw-settings-fav {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-top: 1px solid var(--arzlw-set-line);
    background: var(--arzlw-set-bg);
    transition: background 0.15s ease;
}

.arzlw-settings-fav:first-child {
    border-top: none;
}

.arzlw-settings-fav.is-dragging {
    opacity: 0.35;
}

.arzlw-settings-fav.is-drag-over {
    background: rgba(61, 114, 254, 0.08);
}

/* Drag preview — same solid row clone for desktop setDragImage + mobile touch */
.arzlw-settings-fav-ghost {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100040;
    margin: 0;
    list-style: none;
    pointer-events: none;
    box-sizing: border-box;
    border-radius: 0;
    border: none;
    border-top: 1px solid var(--arzlw-set-line);
    background: var(--arzlw-set-bg);
    box-shadow: none;
    opacity: 0.72;
    will-change: transform;
}

body.arzlw-fav-dragging {
    cursor: grabbing;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

body.arzlw-fav-dragging .arzlw-settings-panel__body {
    overflow: hidden;
}

.arzlw-settings-fav__drag {
    width: 28px;
    height: 36px;
    border: none;
    background: transparent;
    padding: 0;
    cursor: grab;
    display: grid;
    grid-template-columns: repeat(2, 5px);
    grid-template-rows: repeat(3, 5px);
    gap: 3px;
    align-content: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--arzlw-set-muted);
}

.arzlw-settings-fav__drag span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
}

.arzlw-settings-fav__drag:active {
    cursor: grabbing;
}

.arzlw-settings-fav__info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.arzlw-settings-fav__icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--arzlw-set-icon-bg);
}

.arzlw-settings-fav__icon--fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--arzlw-set-muted);
}

.arzlw-settings-fav__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.arzlw-settings-fav__name {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--arzlw-set-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.arzlw-settings-fav__sub {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--arzlw-set-muted);
    direction: ltr;
    unicode-bidi: plaintext;
}

.arzlw-settings-empty {
    margin: 0 0 12px;
    padding: 18px 12px;
    text-align: center;
    color: var(--arzlw-set-muted);
    font-size: 0.88rem;
    border: 1px dashed var(--arzlw-set-line);
    border-radius: 12px;
}

.arzlw-settings-add {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    position: relative;
    z-index: 2;
}

.arzlw-settings-combobox {
    position: relative;
    min-width: 0;
}

/* Matches crypto-table .searchInput border/focus behavior */
.arzlw-settings-input {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    min-width: 0;
    border: 1px dashed var(--accent-primary, #3b82f6);
    border-radius: 8px;
    padding: 12px;
    font-family: "IRANSansWeb", sans-serif;
    font-size: inherit;
    line-height: 1.25;
    font-weight: 500;
    background: transparent;
    color: var(--arzlw-set-text);
    transition: all 0.3s ease;
}

.arzlw-settings-input::placeholder {
    color: var(--arzlw-set-muted);
    font-weight: 500;
}

.arzlw-settings-input:focus {
    outline: none;
    border: 1px solid var(--accent-primary, #3b82f6);
    border-radius: 8px;
    padding: 12px;
    font-family: "IRANSansWeb", sans-serif;
    background: transparent;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.arzlw-settings-panel[data-arzlw-theme="dark"] .arzlw-settings-input {
    background: var(--arzlw-set-bg);
    color: var(--arzlw-set-text);
    border: 1px dashed var(--accent-primary, #3b82f6);
}

.arzlw-settings-panel[data-arzlw-theme="dark"] .arzlw-settings-input:focus {
    background: var(--arzlw-set-bg);
    border: 1px solid var(--accent-primary, #3b82f6);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Opens upward above the input — same stacking as theme dropdown (inside sheet) */
.arzlw-settings-suggest {
    position: absolute;
    z-index: 30;
    margin: 0;
    padding: 6px;
    list-style: none;
    max-height: min(200px, 36vh);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    border: 1px solid var(--arzlw-set-line);
    background: var(--arzlw-set-bg);
    box-shadow: var(--arzlw-set-dd-shadow);
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--arzlw-set-thumb) transparent;
}

.arzlw-settings-suggest::-webkit-scrollbar {
    width: 5px;
}

.arzlw-settings-suggest::-webkit-scrollbar-track {
    background: transparent;
}

.arzlw-settings-suggest::-webkit-scrollbar-thumb {
    background: var(--arzlw-set-thumb);
    border-radius: 999px;
}

.arzlw-settings-suggest__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--arzlw-set-text);
}

.arzlw-settings-suggest__item:hover,
.arzlw-settings-suggest__item:focus {
    background: var(--arzlw-set-option-hover);
    outline: none;
}

.arzlw-settings-suggest__item img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}

.arzlw-settings-suggest__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.arzlw-settings-suggest__text strong {
    font-size: 0.88rem;
    color: var(--arzlw-set-text);
}

.arzlw-settings-suggest__text small {
    font-size: 0.72rem;
    color: var(--arzlw-set-muted);
    direction: ltr;
    unicode-bidi: plaintext;
}

.arzlw-settings-suggest__empty {
    padding: 14px 10px;
    text-align: center;
    color: var(--arzlw-set-muted);
    font-size: 0.85rem;
}

.arzlw-settings-btn {
    appearance: none;
    border: 1px solid var(--arzlw-set-line);
    background: transparent;
    color: var(--arzlw-set-text);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 800;
    height: 40px;
    padding: 0 14px;
    border-radius: 11px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.arzlw-settings-btn--primary {
    height: 46px;
    background: var(--accent-primary, #3d72fe);
    border-color: var(--accent-primary, #3d72fe);
    color: #fff;
}

.arzlw-settings-btn--primary:hover {
    background: #2563eb;
    border-color: #2563eb;
    filter: none;
    box-shadow: 0 4px 12px rgba(61, 114, 254, 0.3);
}

.arzlw-settings-fav__remove {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--arzlw-set-line);
    background: transparent;
    color: var(--arzlw-set-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.arzlw-settings-fav__remove:hover {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.28);
    color: #dc2626;
}

.arzlw-settings-btn--ghost:hover {
    background: var(--arzlw-set-close-bg);
}

.arzlw-settings-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 6px;
    width: 100%;
}

.arzlw-settings-actions .arzlw-settings-btn {
    width: 100%;
    justify-content: center;
    display: inline-flex;
    align-items: center;
}

/* Desktop modal */
@media (min-width: 769px) {
    .arzlw-settings-panel {
        align-items: center;
        padding: 24px;
    }

    .arzlw-settings-panel__sheet {
        width: min(100%, 440px);
        max-width: 440px;
        height: auto;
        max-height: min(90vh, 720px);
        border-radius: 16px;
        transform: translate3d(0, 24px, 0) scale(0.96);
        opacity: 0;
        transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
        box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
    }

    .arzlw-settings-panel.is-open .arzlw-settings-panel__sheet {
        transform: translate3d(0, 0, 0) scale(1);
        opacity: 1;
    }

    .arzlw-settings-panel__handle {
        display: none;
    }

    .arzlw-settings-panel__header {
        padding: 20px 20px 12px;
        border-bottom: 1px solid var(--arzlw-set-line);
    }

    .arzlw-settings-panel__body {
        padding: 16px 20px 22px;
    }
}
