/* ═══════════════════════════════════════════════════════════════
   MOBILE FEATURES — Content styles for overlays + sheets
   Only active on mobile (< 768px). Desktop untouched.
   ═══════════════════════════════════════════════════════════════ */

/* ── Shared ────────────────────────────────────────────────────── */

.cm-features-watchlist,
.cm-features-alerts,
.cm-features-datawindow,
.cm-features-objects,
.cm-features-settings {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.cm-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.cm-empty-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.3;
}

.cm-empty-text {
    font-size: 14px;
    color: var(--ui-muted, rgba(255, 255, 255, 0.45));
    line-height: 1.5;
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════════
   WATCHLIST
   ═══════════════════════════════════════════════════════════════ */

/* ── Watchlist search ─────────────────────────────────────────── */

.cm-wl-search-wrap {
    padding: 0 4px 8px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--ui-bg, #1a1a2e);
}

.cm-wl-search {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.08));
    background: rgba(255, 255, 255, 0.05);
    color: var(--ui-fg, #e0e0e0);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

.cm-wl-search::placeholder {
    color: var(--ui-muted, rgba(255, 255, 255, 0.3));
}

.cm-wl-search:focus {
    border-color: rgba(38, 166, 154, 0.5);
}

.cm-wl-list {
    overflow-y: auto;
    flex: 1;
}

.cm-wl-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   WATCHLIST GROUP HEADERS
   ═══════════════════════════════════════════════════════════════ */

.cm-wl-group-hdr {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ui-muted, rgba(255, 255, 255, 0.4));
    padding: 12px 0 6px;
    border-bottom: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.06));
    margin-bottom: 4px;
}

.cm-wl-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s ease;
}

.cm-wl-row:hover,
.cm-wl-row:active {
    background: rgba(255, 255, 255, 0.04);
}

.cm-wl-active {
    background: rgba(38, 166, 154, 0.08);
}

.cm-wl-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.3px;
    flex-shrink: 0;
}

.cm-wl-info {
    flex: 1;
    min-width: 0;
}

.cm-wl-sym {
    font-size: 14px;
    font-weight: 600;
    color: var(--ui-fg, #e0e0e0);
}

.cm-wl-desc {
    font-size: 11px;
    color: var(--ui-muted, rgba(255, 255, 255, 0.35));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cm-wl-price {
    font-size: 13px;
    font-weight: 500;
    color: var(--ui-fg, #e0e0e0);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.cm-wl-chg {
    font-size: 11px;
    font-weight: 500;
    text-align: right;
    min-width: 60px;
    font-variant-numeric: tabular-nums;
}

.cm-wl-chg.up   { color: #26a69a; }
.cm-wl-chg.down { color: #ef5350; }
.cm-wl-chg.flat { color: var(--ui-muted, rgba(255, 255, 255, 0.4)); }

/* ═══════════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════════ */

/* ── Alert toolbar + create button ────────────────────────────── */

.cm-alert-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 12px;
    border-bottom: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.06));
    margin-bottom: 4px;
}

.cm-alert-count {
    font-size: 13px;
    color: var(--ui-muted, rgba(255, 255, 255, 0.45));
    font-weight: 500;
}

.cm-alert-create-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: rgba(38, 166, 154, 0.15);
    color: #26a69a;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.cm-alert-create-btn:hover,
.cm-alert-create-btn:active {
    background: rgba(38, 166, 154, 0.25);
}

.cm-alert-list {
    overflow-y: auto;
    flex: 1;
}

/* ── Alert toggle button ─────────────────────────────────────── */

.cm-alert-toggle {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--ui-muted, rgba(255, 255, 255, 0.4));
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

.cm-alert-toggle:hover,
.cm-alert-toggle:active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--ui-fg, #e0e0e0);
}

/* ── Create alert form ───────────────────────────────────────── */

.cm-alert-form {
    padding: 8px 0;
}

.cm-alert-form-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ui-fg, #e0e0e0);
    margin-bottom: 20px;
}

.cm-alert-form-field {
    margin-bottom: 16px;
}

.cm-alert-form-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ui-muted, rgba(255, 255, 255, 0.5));
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.cm-alert-form-sym {
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ui-fg, #e0e0e0);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
}

.cm-alert-form-input,
.cm-alert-form-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.08));
    background: rgba(255, 255, 255, 0.05);
    color: var(--ui-fg, #e0e0e0);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    -webkit-appearance: none;
}

.cm-alert-form-input:focus,
.cm-alert-form-select:focus {
    border-color: rgba(38, 166, 154, 0.5);
}

.cm-alert-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.cm-alert-form-cancel,
.cm-alert-form-submit {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.cm-alert-form-cancel {
    background: rgba(255, 255, 255, 0.06);
    color: var(--ui-muted, rgba(255, 255, 255, 0.5));
}

.cm-alert-form-cancel:hover,
.cm-alert-form-cancel:active {
    background: rgba(255, 255, 255, 0.1);
}

.cm-alert-form-submit {
    background: rgba(38, 166, 154, 0.2);
    color: #26a69a;
}

.cm-alert-form-submit:hover,
.cm-alert-form-submit:active {
    background: rgba(38, 166, 154, 0.3);
}

/* ── Alert rows ──────────────────────────────────────────────── */

.cm-alert-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 4px;
    border-radius: 6px;
    transition: background 0.12s ease;
}

.cm-alert-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.cm-alert-inactive {
    opacity: 0.5;
}

.cm-alert-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--ui-muted, rgba(255, 255, 255, 0.12));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--ui-fg, #e0e0e0);
    flex-shrink: 0;
}

.cm-alert-info {
    flex: 1;
    min-width: 0;
}

.cm-alert-sym {
    font-size: 14px;
    font-weight: 600;
    color: var(--ui-fg, #e0e0e0);
}

.cm-alert-cond {
    font-size: 12px;
    color: var(--ui-muted, rgba(255, 255, 255, 0.45));
}

.cm-alert-del {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--ui-muted, rgba(255, 255, 255, 0.4));
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.cm-alert-del:hover,
.cm-alert-del:active {
    background: rgba(239, 83, 80, 0.12);
    color: #ef5350;
}

/* ═══════════════════════════════════════════════════════════════
   DATA WINDOW
   ═══════════════════════════════════════════════════════════════ */

.cm-dw-sym {
    font-size: 15px;
    font-weight: 700;
    color: var(--ui-fg, #e0e0e0);
    padding: 8px 0 12px;
    border-bottom: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.06));
    margin-bottom: 8px;
}

.cm-dw-table {
    display: flex;
    flex-direction: column;
}

.cm-dw-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.04));
}

.cm-dw-label {
    font-size: 13px;
    color: var(--ui-muted, rgba(255, 255, 255, 0.45));
}

.cm-dw-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--ui-fg, #e0e0e0);
    font-variant-numeric: tabular-nums;
}

.cm-dw-up   { color: #26a69a !important; }
.cm-dw-down { color: #ef5350 !important; }
.cm-dw-high { color: #26a69a !important; }
.cm-dw-low  { color: #ef5350 !important; }

.cm-dw-section-hdr {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ui-muted, rgba(255, 255, 255, 0.4));
    padding: 16px 0 6px;
}

/* ═══════════════════════════════════════════════════════════════
   OBJECT TREE
   ═══════════════════════════════════════════════════════════════ */

.cm-obj-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    border-radius: 6px;
    transition: background 0.12s ease;
}

.cm-obj-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.cm-obj-hidden {
    opacity: 0.4;
}

.cm-obj-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cm-obj-label {
    flex: 1;
    font-size: 14px;
    color: var(--ui-fg, #e0e0e0);
}

.cm-obj-actions {
    display: flex;
    gap: 4px;
}

.cm-obj-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--ui-muted, rgba(255, 255, 255, 0.4));
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
}

.cm-obj-btn:hover,
.cm-obj-btn:active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--ui-fg, #e0e0e0);
}

/* ═══════════════════════════════════════════════════════════════
   SETTINGS
   ═══════════════════════════════════════════════════════════════ */

.cm-settings-list {
    display: flex;
    flex-direction: column;
}

.cm-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s ease;
}

.cm-settings-row:hover,
.cm-settings-row:active {
    background: rgba(255, 255, 255, 0.04);
}

.cm-settings-info {
    flex: 1;
}

.cm-settings-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ui-fg, #e0e0e0);
}

.cm-settings-desc {
    font-size: 12px;
    color: var(--ui-muted, rgba(255, 255, 255, 0.35));
    margin-top: 2px;
}

.cm-settings-arrow {
    font-size: 18px;
    color: var(--ui-muted, rgba(255, 255, 255, 0.3));
    flex-shrink: 0;
    margin-left: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   TIMEFRAME SHEET
   ═══════════════════════════════════════════════════════════════ */

.cm-tf-sheet {
    padding: 8px 0;
}

.cm-tf-cat-hdr {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--ui-muted, rgba(255, 255, 255, 0.35));
    padding: 12px 0 6px;
}

.cm-tf-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 8px;
}

.cm-tf-btn {
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.08));
    background: rgba(255, 255, 255, 0.04);
    color: var(--ui-fg, #e0e0e0);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
    flex: 0 0 auto;
    min-width: 56px;
    text-align: center;
}

.cm-tf-btn:hover,
.cm-tf-btn:active {
    background: rgba(255, 255, 255, 0.08);
}

.cm-tf-btn--active {
    background: rgba(38, 166, 154, 0.15);
    border-color: rgba(38, 166, 154, 0.4);
    color: #26a69a;
}

/* ═══════════════════════════════════════════════════════════════
   BUY / SELL SHEET
   ═══════════════════════════════════════════════════════════════ */

.cm-bs-sheet {
    padding: 8px 0;
}

.cm-bs-sym {
    font-size: 16px;
    font-weight: 700;
    color: var(--ui-fg, #e0e0e0);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.06));
    margin-bottom: 16px;
}

.cm-bs-prices {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.cm-bs-col {
    flex: 1;
    text-align: center;
    padding: 14px 8px;
    border-radius: 10px;
}

.cm-bs-col-sell {
    background: rgba(239, 83, 80, 0.08);
}

.cm-bs-col-buy {
    background: rgba(38, 166, 154, 0.08);
}

.cm-bs-price-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 4px;
}

.cm-bs-col-sell .cm-bs-price-label { color: #ef5350; }
.cm-bs-col-buy .cm-bs-price-label  { color: #26a69a; }

.cm-bs-price-val {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ui-fg, #e0e0e0);
}

.cm-bs-lot-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 0;
    margin-bottom: 16px;
}

.cm-bs-lot-label {
    font-size: 13px;
    color: var(--ui-muted, rgba(255, 255, 255, 0.45));
    margin-right: 4px;
}

.cm-bs-lot-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--ui-panel-border, rgba(255, 255, 255, 0.1));
    background: rgba(255, 255, 255, 0.04);
    color: var(--ui-fg, #e0e0e0);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s ease;
}

.cm-bs-lot-btn:hover,
.cm-bs-lot-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

.cm-bs-lot-val {
    font-size: 15px;
    font-weight: 600;
    color: var(--ui-fg, #e0e0e0);
    min-width: 40px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.cm-bs-btn-row {
    display: flex;
    gap: 10px;
}

.cm-bs-action {
    flex: 1;
    padding: 14px;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
    letter-spacing: 0.3px;
}

.cm-bs-sell {
    background: rgba(239, 83, 80, 0.15);
    color: #ef5350;
}

.cm-bs-sell:hover,
.cm-bs-sell:active {
    background: rgba(239, 83, 80, 0.25);
}

.cm-bs-buy {
    background: rgba(38, 166, 154, 0.15);
    color: #26a69a;
}

.cm-bs-buy:hover,
.cm-bs-buy:active {
    background: rgba(38, 166, 154, 0.25);
}

/* ═══════════════════════════════════════════════════════════════
   LIGHT MODE OVERRIDES
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: light) {
    .cm-wl-search-wrap {
        background: #F3F4F6;
    }
    .cm-wl-search {
        border-color: rgba(0, 0, 0, 0.1);
        background: rgba(0, 0, 0, 0.03);
        color: #1a1a2e;
    }
    .cm-wl-search::placeholder { color: rgba(0, 0, 0, 0.3); }
    .cm-wl-search:focus { border-color: rgba(38, 166, 154, 0.6); }

    .cm-wl-row:hover,
    .cm-wl-row:active { background: rgba(0, 0, 0, 0.04); }
    .cm-wl-active { background: rgba(38, 166, 154, 0.08); }
    .cm-wl-search-wrap { background: var(--ui-bg, #F3F4F6); }

    .cm-alert-toolbar { border-bottom-color: rgba(0, 0, 0, 0.06); }
    .cm-alert-row:hover { background: rgba(0, 0, 0, 0.04); }
    .cm-alert-toggle:hover,
    .cm-alert-toggle:active { background: rgba(0, 0, 0, 0.06); }

    .cm-alert-form-input,
    .cm-alert-form-select {
        border-color: rgba(0, 0, 0, 0.1);
        background: rgba(0, 0, 0, 0.03);
        color: #1a1a2e;
    }
    .cm-alert-form-input:focus,
    .cm-alert-form-select:focus { border-color: rgba(38, 166, 154, 0.6); }
    .cm-alert-form-cancel { background: rgba(0, 0, 0, 0.04); color: #6b7280; }
    .cm-alert-form-submit { background: rgba(38, 166, 154, 0.12); color: #26a69a; }

    .cm-obj-row:hover { background: rgba(0, 0, 0, 0.04); }
    .cm-obj-btn:hover,
    .cm-obj-btn:active { background: rgba(0, 0, 0, 0.06); }

    .cm-settings-row:hover,
    .cm-settings-row:active { background: rgba(0, 0, 0, 0.04); }

    .cm-tf-btn {
        border-color: rgba(0, 0, 0, 0.1);
        background: rgba(0, 0, 0, 0.03);
        color: #1a1a2e;
    }
    .cm-tf-btn:hover,
    .cm-tf-btn:active { background: rgba(0, 0, 0, 0.05); }
    .cm-tf-btn--active { background: rgba(38, 166, 154, 0.1); color: #26a69a; }

    .cm-bs-col-sell { background: rgba(239, 83, 80, 0.06); }
    .cm-bs-col-buy { background: rgba(38, 166, 154, 0.06); }
    .cm-bs-price-val { color: #1a1a2e; }
    .cm-bs-lot-btn {
        border-color: rgba(0, 0, 0, 0.1);
        background: rgba(0, 0, 0, 0.03);
        color: #1a1a2e;
    }
    .cm-bs-lot-btn:hover,
    .cm-bs-lot-btn:active { background: rgba(0, 0, 0, 0.06); }
    .cm-bs-lot-val { color: #1a1a2e; }
    .cm-bs-sell { background: rgba(239, 83, 80, 0.1); }
    .cm-bs-sell:hover,
    .cm-bs-sell:active { background: rgba(239, 83, 80, 0.18); }
    .cm-bs-buy { background: rgba(38, 166, 154, 0.1); }
    .cm-bs-buy:hover,
    .cm-bs-buy:active { background: rgba(38, 166, 154, 0.18); }
}

/* ── Touch targets ── */
@media (hover: none) and (pointer: coarse) {
    .cm-wl-row { padding: 12px 4px; }
    .cm-alert-row { padding: 14px 4px; }
    .cm-alert-toggle { width: 36px; height: 36px; }
    .cm-alert-del { width: 36px; height: 36px; }
    .cm-obj-row { padding: 12px 4px; }
    .cm-settings-row { padding: 16px 4px; }
    .cm-tf-btn { padding: 12px 18px; min-width: 60px; }
    .cm-bs-action { padding: 16px; }
    .cm-bs-lot-btn { width: 40px; height: 40px; }
}
