/**
 * CryptoExchange WP — Buyer Widget CSS
 * Theme B1: Crypto Dark Exchange
 *
 * Mobile-first, max-width 480px widget.
 * CSS custom properties allow easy light/dark theming.
 */

/* =========================================================
   CSS CUSTOM PROPERTIES — Dark (default)
   ========================================================= */
.cex-buyer-widget {
    --cex-bg:           #0d1117;
    --cex-card:         #161b22;
    --cex-card2:        #1c2128;
    --cex-border:       #21262d;
    --cex-accent:       #f7931a;
    --cex-accent-light: #ffaa44;
    --cex-accent-dark:  #d97c0d;
    --cex-green:        #3fb950;
    --cex-red:          #f85149;
    --cex-blue:         #58a6ff;
    --cex-text:         #e6edf3;
    --cex-text-muted:   #8b949e;
    --cex-text-dim:     #484f58;
    --cex-radius:       8px;
    --cex-radius-lg:    12px;
    --cex-radius-xl:    16px;
    --cex-shadow:       0 8px 32px rgba(0,0,0,0.5);
    --cex-transition:   0.16s ease;
}

/* =========================================================
   LIGHT THEME OVERRIDE
   ========================================================= */
.cex-buyer-widget.theme-light {
    --cex-bg:           #f8fafc;
    --cex-card:         #ffffff;
    --cex-card2:        #f1f5f9;
    --cex-border:       #e2e8f0;
    --cex-accent:       #f7931a;
    --cex-accent-light: #ffaa44;
    --cex-accent-dark:  #d97c0d;
    --cex-green:        #22c55e;
    --cex-red:          #ef4444;
    --cex-blue:         #3b82f6;
    --cex-text:         #0f172a;
    --cex-text-muted:   #64748b;
    --cex-text-dim:     #cbd5e1;
    --cex-shadow:       0 8px 32px rgba(0,0,0,0.12);
}

/* =========================================================
   OUTER WRAPPER
   ========================================================= */
.cex-buyer-widget {
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    background: var(--cex-bg);
    border: 1px solid var(--cex-border);
    border-radius: var(--cex-radius-xl);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--cex-text);
    box-shadow: var(--cex-shadow);
    position: relative;
    animation: cexWidgetMount 0.3s ease both;
}

@keyframes cexWidgetMount {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cex-buyer-widget *,
.cex-buyer-widget *::before,
.cex-buyer-widget *::after {
    box-sizing: border-box;
}

/* Scrollbar */
.cex-buyer-widget *::-webkit-scrollbar { width: 4px; }
.cex-buyer-widget *::-webkit-scrollbar-track { background: transparent; }
.cex-buyer-widget *::-webkit-scrollbar-thumb { background: var(--cex-border); border-radius: 2px; }

/* =========================================================
   WIDGET HEADER
   ========================================================= */
.cex-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--cex-card);
    border-bottom: 1px solid var(--cex-border);
    gap: 8px;
}

.cex-widget-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.cex-widget-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* =========================================================
   USER AVATAR
   ========================================================= */
.cex-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--cex-border);
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--cex-border);
    cursor: pointer;
    transition: border-color var(--cex-transition);
}

.cex-user-avatar:hover { border-color: var(--cex-accent); }

.cex-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cex-user-avatar .avatar-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--cex-accent);
    background: rgba(247,147,26,0.15);
}

.cex-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--cex-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =========================================================
   SUPPORT BUTTON + UNREAD BADGE
   ========================================================= */
.cex-support-btn {
    position: relative;
    background: transparent;
    border: 1px solid var(--cex-border);
    border-radius: var(--cex-radius);
    color: var(--cex-text-muted);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color var(--cex-transition), border-color var(--cex-transition), background var(--cex-transition);
    font-size: 16px;
}

.cex-support-btn:hover {
    color: var(--cex-text);
    border-color: var(--cex-accent);
    background: rgba(247,147,26,0.08);
}

.cex-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--cex-red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    animation: cexPulse 2s ease-in-out infinite;
}

.cex-unread-badge[hidden] { display: none; }

@keyframes cexPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(248,81,73,0.5); }
    50%       { transform: scale(1.1); box-shadow: 0 0 0 5px rgba(248,81,73,0); }
}

/* Language switcher */
.cex-lang-switcher {
    background: transparent;
    border: 1px solid var(--cex-border);
    border-radius: var(--cex-radius);
    color: var(--cex-text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    cursor: pointer;
    text-transform: uppercase;
    transition: color var(--cex-transition), border-color var(--cex-transition);
    font-family: inherit;
}

.cex-lang-switcher:hover {
    color: var(--cex-text);
    border-color: var(--cex-accent);
}

/* =========================================================
   RATE BAR
   ========================================================= */
.cex-rate-bar {
    padding: 10px 16px;
    background: var(--cex-card);
    border-bottom: 1px solid var(--cex-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cex-rate-current {
    font-size: 18px;
    font-weight: 700;
    color: var(--cex-text);
}

.cex-rate-current span {
    font-size: 12px;
    font-weight: 500;
    color: var(--cex-text-muted);
    margin-left: 4px;
}

.cex-rate-change {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}

.cex-rate-change.up   { color: var(--cex-green); background: rgba(63,185,80,0.12); }
.cex-rate-change.down { color: var(--cex-red);   background: rgba(248,81,73,0.12); }

.cex-rate-update {
    font-size: 11px;
    color: var(--cex-text-dim);
}

/* =========================================================
   CHART CONTAINER
   ========================================================= */
.cex-chart-container {
    background: var(--cex-card);
    border-bottom: 1px solid var(--cex-border);
    padding: 12px 16px 8px;
    position: relative;
}

.cex-chart-timeframes {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.cex-tf-btn {
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    background: transparent;
    border: 1px solid var(--cex-border);
    color: var(--cex-text-muted);
    cursor: pointer;
    transition: all var(--cex-transition);
    font-family: inherit;
}

.cex-tf-btn:hover { color: var(--cex-text); border-color: var(--cex-text-muted); }
.cex-tf-btn.active { background: var(--cex-accent); border-color: var(--cex-accent); color: #000; }

.cex-chart-canvas-wrap {
    height: 90px;
    position: relative;
}

.cex-chart-canvas-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* =========================================================
   WIDGET TABS (bottom nav)
   ========================================================= */
.cex-widget-tabs {
    display: flex;
    background: var(--cex-card);
    border-bottom: 1px solid var(--cex-border);
    overflow-x: auto;
    scrollbar-width: none;
}

.cex-widget-tabs::-webkit-scrollbar { display: none; }

.cex-tab-btn {
    flex: 1;
    min-width: 60px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 500;
    color: var(--cex-text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color var(--cex-transition), border-color var(--cex-transition), background var(--cex-transition);
    font-family: inherit;
    white-space: nowrap;
    margin-bottom: -1px;
}

.cex-tab-btn .tab-icon {
    font-size: 16px;
    line-height: 1;
}

.cex-tab-btn:hover { color: var(--cex-text); background: rgba(255,255,255,0.03); }

.cex-tab-btn.active {
    color: var(--cex-accent);
    border-bottom-color: var(--cex-accent);
}

.cex-tab-panel {
    display: none;
}

.cex-tab-panel.active {
    display: block;
    animation: cexFadeIn 0.18s ease both;
}

@keyframes cexFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* =========================================================
   COIN SELECTOR (BTC / LTC toggle)
   ========================================================= */
.cex-coin-selector {
    display: flex;
    gap: 6px;
    padding: 14px 16px 0;
}

.cex-coin-btn {
    flex: 1;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--cex-radius);
    border: 1px solid var(--cex-border);
    background: var(--cex-card2);
    color: var(--cex-text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--cex-transition);
    font-family: inherit;
}

.cex-coin-btn:hover { border-color: var(--cex-accent); color: var(--cex-text); }

.cex-coin-btn.active {
    background: rgba(247,147,26,0.12);
    border-color: var(--cex-accent);
    color: var(--cex-accent);
}

.cex-coin-btn .coin-icon {
    font-size: 16px;
}

/* =========================================================
   FORM FIELDS
   ========================================================= */
.cex-exchange-form {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cex-form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cex-form-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--cex-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cex-widget-input,
.cex-widget-select {
    width: 100%;
    background: var(--cex-card2);
    border: 1px solid var(--cex-border);
    border-radius: var(--cex-radius);
    color: var(--cex-text);
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--cex-transition), box-shadow var(--cex-transition);
    appearance: none;
    -webkit-appearance: none;
}

.cex-widget-input:focus,
.cex-widget-select:focus {
    outline: none;
    border-color: var(--cex-accent);
    box-shadow: 0 0 0 3px rgba(247,147,26,0.12);
}

.cex-widget-input::placeholder { color: var(--cex-text-muted); }

.cex-widget-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%238b949e' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 30px;
    cursor: pointer;
}

.cex-field-suffix {
    position: relative;
}

.cex-field-suffix .cex-widget-input {
    padding-right: 56px;
}

.cex-field-suffix-label {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 600;
    color: var(--cex-accent);
    pointer-events: none;
}

/* =========================================================
   ORDER SUMMARY
   ========================================================= */
.cex-order-summary {
    margin: 0 16px 14px;
    background: var(--cex-card2);
    border: 1px solid var(--cex-border);
    border-radius: var(--cex-radius);
    overflow: hidden;
}

.cex-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--cex-border);
}

.cex-summary-row:last-child { border-bottom: none; }

.cex-summary-row .s-label { color: var(--cex-text-muted); }
.cex-summary-row .s-value { font-weight: 600; color: var(--cex-text); }

.cex-summary-row.total {
    background: rgba(247,147,26,0.07);
    border-top: 1px solid rgba(247,147,26,0.2);
}

.cex-summary-row.total .s-label { color: var(--cex-text); font-weight: 600; }
.cex-summary-row.total .s-value { color: var(--cex-accent); font-size: 15px; font-weight: 700; }

.cex-summary-row.discount .s-value { color: var(--cex-green); }

/* =========================================================
   MAIN ACTION BUTTON
   ========================================================= */
.cex-widget-btn {
    display: block;
    width: calc(100% - 32px);
    margin: 0 16px 16px;
    padding: 13px 20px;
    background: linear-gradient(135deg, var(--cex-accent), var(--cex-accent-dark));
    border: none;
    border-radius: var(--cex-radius);
    color: #000;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s ease, box-shadow var(--cex-transition), opacity var(--cex-transition);
    font-family: inherit;
    letter-spacing: 0.2px;
}

.cex-widget-btn:hover {
    box-shadow: 0 6px 20px rgba(247,147,26,0.35);
}

.cex-widget-btn:active {
    transform: scale(0.98);
}

.cex-widget-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cex-widget-btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

/* =========================================================
   PAYMENT PANEL
   ========================================================= */
.cex-payment-panel {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: cexFadeIn 0.2s ease;
}

.cex-payment-status {
    text-align: center;
    padding: 12px;
    border-radius: var(--cex-radius);
    font-size: 13px;
    font-weight: 600;
}

.cex-payment-status.waiting {
    background: rgba(247,147,26,0.1);
    color: var(--cex-accent);
    border: 1px solid rgba(247,147,26,0.25);
}

.cex-payment-status.confirmed {
    background: rgba(63,185,80,0.1);
    color: var(--cex-green);
    border: 1px solid rgba(63,185,80,0.25);
}

.cex-payment-instructions {
    font-size: 13px;
    color: var(--cex-text-muted);
    text-align: center;
    line-height: 1.5;
}

/* Card number display */
.cex-card-number {
    background: var(--cex-card2);
    border: 1px solid var(--cex-border);
    border-radius: var(--cex-radius);
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.cex-card-number .card-num-value {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--cex-text);
    font-family: "SF Mono", "Fira Code", monospace;
    flex: 1;
    word-break: break-all;
}

.cex-copy-btn {
    background: rgba(247,147,26,0.1);
    border: 1px solid rgba(247,147,26,0.25);
    border-radius: 6px;
    color: var(--cex-accent);
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--cex-transition);
    flex-shrink: 0;
    font-family: inherit;
}

.cex-copy-btn:hover {
    background: var(--cex-accent);
    color: #000;
}

.cex-copy-btn.copied {
    background: rgba(63,185,80,0.15);
    border-color: rgba(63,185,80,0.3);
    color: var(--cex-green);
}

/* =========================================================
   TIMER BAR
   ========================================================= */
.cex-timer-bar {
    background: var(--cex-card2);
    border: 1px solid var(--cex-border);
    border-radius: var(--cex-radius);
    padding: 12px 14px;
}

.cex-timer-bar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
}

.cex-timer-bar-label { color: var(--cex-text-muted); }
.cex-timer-bar-value { font-weight: 700; color: var(--cex-accent); font-size: 15px; }
.cex-timer-bar-value.urgent { color: var(--cex-red); }

.cex-timer-progress-track {
    height: 5px;
    background: var(--cex-border);
    border-radius: 3px;
    overflow: hidden;
}

.cex-timer-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cex-accent), var(--cex-accent-light));
    border-radius: 3px;
    transition: width 1s linear, background var(--cex-transition);
}

.cex-timer-progress-fill.urgent {
    background: linear-gradient(90deg, var(--cex-red), #ff6b6b);
}

/* Circular timer */
.cex-timer-circular {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid var(--cex-accent);
    font-size: 18px;
    font-weight: 700;
    color: var(--cex-accent);
    position: relative;
    flex-shrink: 0;
}

.cex-timer-circular.urgent {
    border-color: var(--cex-red);
    color: var(--cex-red);
    animation: cexUrgentPulse 1s ease-in-out infinite;
}

.cex-timer-circular .timer-sub { font-size: 9px; font-weight: 500; color: var(--cex-text-muted); }

@keyframes cexUrgentPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(248,81,73,0.4); }
    50%       { box-shadow: 0 0 0 8px rgba(248,81,73,0); }
}

/* =========================================================
   HISTORY LIST
   ========================================================= */
.cex-history-tab {
    padding: 14px 16px;
}

.cex-history-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.cex-history-filter-btn {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--cex-border);
    background: transparent;
    color: var(--cex-text-muted);
    cursor: pointer;
    transition: all var(--cex-transition);
    font-family: inherit;
}

.cex-history-filter-btn:hover { color: var(--cex-text); border-color: var(--cex-text-muted); }
.cex-history-filter-btn.active { background: var(--cex-accent); border-color: var(--cex-accent); color: #000; }

.cex-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cex-history-item {
    background: var(--cex-card2);
    border: 1px solid var(--cex-border);
    border-radius: var(--cex-radius);
    padding: 12px;
    transition: border-color var(--cex-transition);
    cursor: pointer;
}

.cex-history-item:hover { border-color: var(--cex-text-muted); }

.cex-history-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.cex-history-item-id { font-size: 11px; color: var(--cex-text-muted); font-family: monospace; }

.cex-history-item-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cex-history-item-amounts {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cex-history-amount-send { font-size: 13px; color: var(--cex-text-muted); }
.cex-history-amount-recv { font-size: 14px; font-weight: 700; color: var(--cex-text); }

.cex-history-item-date { font-size: 11px; color: var(--cex-text-muted); text-align: right; }

/* Badges */
.cex-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.cex-status-badge.new        { background: rgba(88,166,255,0.15); color: var(--cex-blue); }
.cex-status-badge.waiting    { background: rgba(247,147,26,0.15); color: var(--cex-accent); }
.cex-status-badge.confirmed  { background: rgba(139,92,246,0.15); color: #a78bfa; }
.cex-status-badge.completed  { background: rgba(63,185,80,0.15);  color: var(--cex-green); }
.cex-status-badge.cancelled  { background: rgba(100,116,139,0.15); color: #94a3b8; }
.cex-status-badge.expired    { background: rgba(107,114,128,0.15); color: #9ca3af; }
.cex-status-badge.dispute    { background: rgba(248,81,73,0.15);   color: var(--cex-red); }

/* =========================================================
   DISPUTE BUTTON
   ========================================================= */
.cex-dispute-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--cex-radius);
    background: rgba(248,81,73,0.1);
    border: 1px solid rgba(248,81,73,0.25);
    color: var(--cex-red);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--cex-transition);
    font-family: inherit;
}

.cex-dispute-btn:hover {
    background: var(--cex-red);
    color: #fff;
}

.cex-dispute-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.cex-dispute-timer {
    font-size: 11px;
    color: var(--cex-red);
    font-variant-numeric: tabular-nums;
    min-width: 24px;
}

/* =========================================================
   PROFILE PANEL
   ========================================================= */
.cex-profile-panel {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cex-profile-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--cex-border);
}

.cex-profile-avatar-large {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--cex-border);
    border: 2px solid var(--cex-border);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: border-color var(--cex-transition);
}

.cex-profile-avatar-large:hover { border-color: var(--cex-accent); }
.cex-profile-avatar-large img { width: 100%; height: 100%; object-fit: cover; }

.cex-avatar-upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--cex-transition);
    font-size: 18px;
    color: #fff;
}

.cex-profile-avatar-large:hover .cex-avatar-upload-overlay { opacity: 1; }

/* =========================================================
   USER STATUS BADGE
   ========================================================= */
.cex-user-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.cex-user-status-badge.newcomer { background: rgba(88,166,255,0.15); color: var(--cex-blue); }
.cex-user-status-badge.pro      { background: rgba(247,147,26,0.15); color: var(--cex-accent); }
.cex-user-status-badge.vip      { background: rgba(139,92,246,0.15); color: #c084fc; }

/* =========================================================
   LEVEL PROGRESS
   ========================================================= */
.cex-level-progress {
    padding: 12px 14px;
    background: var(--cex-card2);
    border: 1px solid var(--cex-border);
    border-radius: var(--cex-radius);
}

.cex-level-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
}

.cex-level-label  { color: var(--cex-text-muted); }
.cex-level-value  { font-weight: 600; color: var(--cex-accent); }

.cex-level-track {
    height: 5px;
    background: var(--cex-border);
    border-radius: 3px;
    overflow: hidden;
}

.cex-level-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cex-accent), var(--cex-accent-light));
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.34,1.56,0.64,1);
}

.cex-level-hint {
    font-size: 11px;
    color: var(--cex-text-muted);
    margin-top: 5px;
}

/* =========================================================
   TOGGLE BUTTONS (theme / sound)
   ========================================================= */
.cex-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--cex-card2);
    border: 1px solid var(--cex-border);
    border-radius: var(--cex-radius);
}

.cex-toggle-label {
    font-size: 13px;
    color: var(--cex-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cex-toggle-label .icon { font-size: 16px; }

.cex-toggle-switch {
    width: 40px;
    height: 22px;
    background: var(--cex-border);
    border-radius: 11px;
    position: relative;
    cursor: pointer;
    transition: background var(--cex-transition);
    flex-shrink: 0;
    border: none;
}

.cex-toggle-switch.active { background: var(--cex-accent); }

.cex-toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--cex-transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.cex-toggle-switch.active::after { transform: translateX(18px); }

/* Aliases */
.cex-theme-toggle { /* uses .cex-toggle-row + .cex-toggle-switch */ }
.cex-sound-toggle { /* uses .cex-toggle-row + .cex-toggle-switch */ }

/* =========================================================
   SUPPORT CHAT (slide-in from right)
   ========================================================= */
.cex-support-chat {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    background: var(--cex-bg);
    z-index: 50;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    border-radius: var(--cex-radius-xl);
    overflow: hidden;
}

.cex-support-chat.open {
    transform: translateX(0);
}

.cex-support-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--cex-card);
    border-bottom: 1px solid var(--cex-border);
    flex-shrink: 0;
}

.cex-support-chat-header .title {
    font-size: 14px;
    font-weight: 600;
    color: var(--cex-text);
}

.cex-support-close-btn {
    background: transparent;
    border: none;
    color: var(--cex-text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    line-height: 1;
    transition: color var(--cex-transition);
}

.cex-support-close-btn:hover { color: var(--cex-text); }

.cex-support-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cex-support-input-row {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--cex-border);
    background: var(--cex-card);
    flex-shrink: 0;
}

.cex-support-input {
    flex: 1;
    background: var(--cex-card2);
    border: 1px solid var(--cex-border);
    border-radius: var(--cex-radius);
    color: var(--cex-text);
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    height: 36px;
    transition: border-color var(--cex-transition);
}

.cex-support-input:focus { outline: none; border-color: var(--cex-accent); }

.cex-support-send-btn {
    width: 36px;
    height: 36px;
    background: var(--cex-accent);
    border: none;
    border-radius: var(--cex-radius);
    color: #000;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--cex-transition);
    flex-shrink: 0;
}

.cex-support-send-btn:hover { background: var(--cex-accent-dark); }

/* =========================================================
   AUTH PANEL
   ========================================================= */
.cex-auth-panel {
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: cexFadeIn 0.2s ease;
}

.cex-auth-logo {
    text-align: center;
    margin-bottom: 8px;
}

.cex-auth-logo .logo-icon { font-size: 40px; }
.cex-auth-logo .logo-name { font-size: 18px; font-weight: 700; color: var(--cex-text); margin-top: 4px; }
.cex-auth-logo .logo-sub  { font-size: 12px; color: var(--cex-text-muted); }

.cex-auth-tabs {
    display: flex;
    background: var(--cex-card2);
    border: 1px solid var(--cex-border);
    border-radius: var(--cex-radius);
    padding: 3px;
    gap: 3px;
}

.cex-auth-tab {
    flex: 1;
    padding: 7px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    border-radius: calc(var(--cex-radius) - 2px);
    cursor: pointer;
    color: var(--cex-text-muted);
    background: transparent;
    border: none;
    transition: all var(--cex-transition);
    font-family: inherit;
}

.cex-auth-tab.active {
    background: var(--cex-accent);
    color: #000;
}

.cex-auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cex-auth-divider {
    text-align: center;
    font-size: 12px;
    color: var(--cex-text-muted);
    position: relative;
}

.cex-auth-divider::before,
.cex-auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 20px);
    height: 1px;
    background: var(--cex-border);
}

.cex-auth-divider::before { left: 0; }
.cex-auth-divider::after  { right: 0; }

/* Captcha */
.cex-captcha-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cex-captcha-img {
    border-radius: 6px;
    border: 1px solid var(--cex-border);
    cursor: pointer;
    height: 40px;
}

.cex-captcha-wrap .cex-widget-input {
    flex: 1;
}

/* =========================================================
   SHIMMER LOADING SKELETON
   ========================================================= */
.cex-skeleton {
    background: linear-gradient(
        90deg,
        var(--cex-card2) 25%,
        var(--cex-border) 50%,
        var(--cex-card2) 75%
    );
    background-size: 200% 100%;
    animation: cexShimmer 1.4s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes cexShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.cex-skeleton-line {
    height: 12px;
    margin-bottom: 8px;
}

.cex-skeleton-line.sm { height: 10px; width: 60%; }
.cex-skeleton-line.lg { height: 20px; }

/* =========================================================
   RESPONSIVE — 480px (full width)
   ========================================================= */
@media (max-width: 480px) {
    .cex-buyer-widget {
        max-width: 100%;
        border-radius: 0;
        border-left: none;
        border-right: none;
        min-height: 100vh;
    }
}

/* =========================================================
   RESPONSIVE — 360px (compact mode)
   ========================================================= */
@media (max-width: 360px) {
    .cex-widget-header { padding: 10px 12px; }
    .cex-exchange-form { padding: 12px; gap: 10px; }
    .cex-widget-btn { width: calc(100% - 24px); margin: 0 12px 12px; }
    .cex-order-summary { margin: 0 12px 12px; }
    .cex-payment-panel { padding: 12px; }
    .cex-profile-panel { padding: 12px; }
    .cex-history-tab   { padding: 12px; }
    .cex-coin-selector { padding: 12px 12px 0; }

    .cex-rate-current { font-size: 15px; }
    .cex-card-number .card-num-value { font-size: 14px; letter-spacing: 2px; }

    .cex-tab-btn { font-size: 9px; padding: 8px 4px; }
    .cex-tab-btn .tab-icon { font-size: 14px; }
}
