/* ═══ CMC Watchlist — Toast + Add Modal + Action Buttons ═══ */

/* ── Watchlist page header ── */
.cmc-watchlist-page .cmc-wl-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}
.cmc-watchlist-page .cmc-wl-page-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: var(--cmc-text, #0d1320);
}
.cmc-wl-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s, transform .18s, box-shadow .18s;
    white-space: nowrap;
}
.cmc-wl-add-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
}
.cmc-wl-add-btn i { font-size: 16px; }

/* ── Action buttons in table column ── */
.cmc-wl-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.cmc-wl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 7px;
    border: 1px solid #e8edf4;
    background: #fff;
    color: #536070;
    cursor: pointer;
    transition: background .16s, color .16s, border-color .16s, transform .16s;
    font-size: 18px;
}
.cmc-wl-btn:hover {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
    transform: translateY(-1px);
}
.cmc-wl-portfolio-btn:hover { color: #059669; background: #ecfdf5; border-color: #a7f3d0; }
.cmc-wl-alert-btn:hover     { color: #d97706; background: #fffbeb; border-color: #fde68a; }

/* ── Toast notification ── */
#cmc-wl-toast {
    position: fixed;
    z-index: 99999;
    background: #1e293b;
    color: #f1f5f9;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.22);
    padding: 12px 16px;
    min-width: 220px;
    max-width: 300px;
    font-size: 13px;
    line-height: 1.4;
    transition: opacity .22s, transform .22s;
    pointer-events: auto;
}
#cmc-wl-toast.cmc-wl-toast-hide {
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
}
.cmc-wl-toast-icon {
    font-size: 18px;
    vertical-align: -3px;
    margin-right: 5px;
}
.cmc-wl-toast-icon.added   { color: #f59e0b; }
.cmc-wl-toast-icon.removed { color: #94a3b8; }
.cmc-wl-toast-msg {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}
.cmc-wl-toast-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}
.cmc-wl-toast-close,
.cmc-wl-toast-goto {
    flex: 1;
    text-align: center;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
    border: none;
}
.cmc-wl-toast-close {
    background: rgba(255,255,255,.1);
    color: #cbd5e1;
}
.cmc-wl-toast-close:hover { background: rgba(255,255,255,.18); color: #fff; }
.cmc-wl-toast-goto {
    background: #f59e0b;
    color: #1c1917;
    display: inline-block;
}
.cmc-wl-toast-goto:hover { background: #d97706; color: #fff; text-decoration: none; }

/* ── Add-to-watchlist Modal ── */
.cmc-wl-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: cmc-wl-fade-in .18s ease;
}
.cmc-wl-modal-overlay[hidden] { display: none !important; }
@keyframes cmc-wl-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.cmc-wl-modal {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: cmc-wl-slide-up .2s ease;
}
@keyframes cmc-wl-slide-up {
    from { transform: translateY(16px); opacity: .5; }
    to   { transform: none; opacity: 1; }
}
.cmc-wl-modal-h {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e8edf4;
    flex-shrink: 0;
}
.cmc-wl-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #0d1320;
    display: flex;
    align-items: center;
    gap: 7px;
}
.cmc-wl-modal-title i { color: #f59e0b; font-size: 18px; }
.cmc-wl-modal-close {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    border: none;
    background: #f1f5f9;
    color: #536070;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.cmc-wl-modal-close:hover { background: #fee2e2; color: #dc2626; }
.cmc-wl-modal-b {
    padding: 16px 20px 20px;
    overflow-y: auto;
    flex: 1;
}

/* Search input */
.cmc-wl-fg { margin-bottom: 12px; }
.cmc-wl-fi {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e8edf4;
    border-radius: 9px;
    font-size: 14px;
    color: #0d1320;
    background: #f8fafd;
    outline: none;
    transition: border-color .18s, box-shadow .18s;
    box-sizing: border-box;
}
.cmc-wl-fi:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
    background: #fff;
}

/* Results */
.cmc-wl-results { }
.cmc-wl-results-loading {
    text-align: center;
    padding: 24px;
    color: #9aa5b4;
}
.cmc-wl-results-loading i { font-size: 24px; }
.cmc-wl-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #9aa5b4;
    padding: 8px 0 5px;
}
.cmc-wl-coin-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 9px;
    cursor: pointer;
    transition: background .15s;
}
.cmc-wl-coin-item:hover { background: #eff6ff; }
.cmc-wl-coin-item.in-watchlist { opacity: .55; pointer-events: none; }
.cmc-wl-coin-item.in-watchlist::after {
    content: '✓';
    margin-left: auto;
    color: #059669;
    font-weight: 700;
    font-size: 14px;
}
.cmc-wl-coin-logo {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.cmc-wl-coin-logo-placeholder {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #e8edf4;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #536070;
}
.cmc-wl-coin-info { flex: 1; min-width: 0; }
.cmc-wl-coin-name {
    font-size: 14px;
    font-weight: 600;
    color: #0d1320;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cmc-wl-coin-symbol { font-size: 12px; color: #9aa5b4; }
.cmc-wl-coin-rank {
    font-size: 12px;
    color: #9aa5b4;
    background: #f1f5f9;
    padding: 2px 7px;
    border-radius: 20px;
    white-space: nowrap;
}
.cmc-wl-empty-results {
    text-align: center;
    padding: 24px;
    color: #9aa5b4;
    font-size: 14px;
}

/* Watchlist count badge */
.cmc-wl-count {
    background: #eff6ff;
    color: #2563eb;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 6px;
}

/* ── Hide DataTables pagination + top info bar ── */
#cmc_watchlist_table_wrapper .top,
#cmc_watchlist_table_wrapper .bottom {
    display: none !important;
}
.cmc-watchlist-page .cmc-pagination-wrap {
    display: none !important;
}

/* ── DataTables wrapper — neutralize overflow ── */
#cmc_watchlist_table_wrapper.dataTables_wrapper {
    position: relative !important;
    box-shadow: none !important;
    overflow: visible !important;
    padding: 0 !important;
}

/* ── Table base (mirror #cmc_coinslist) ── */
#cryptocurency-market-cap-wrapper table#cmc_watchlist_table {
    width: 100% !important;
    min-width: 900px;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    border: 0 !important;
    background: var(--card);
    table-layout: auto !important;
    margin: 0 !important;
    padding: 0;
    box-shadow: none !important;
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

/* ── TH: override cmc-custom.css (15px/700/white) with design-system values ── */
#cryptocurency-market-cap-wrapper table#cmc_watchlist_table thead th {
    text-align: center !important;
    padding: 9px 5px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    letter-spacing: .5px;
    color: var(--t3, #9aa5b4) !important;
    background: var(--bg, #f4f6f9) !important;
    border-bottom: 1px solid var(--border, #e8edf4) !important;
    border-top: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: color .18s;
    vertical-align: middle;
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif !important;
}
#cryptocurency-market-cap-wrapper table#cmc_watchlist_table thead th:hover {
    color: var(--t1, #0d1320) !important;
}
/* Badge in header — reset */
#cryptocurency-market-cap-wrapper table#cmc_watchlist_table thead th .badge {
    background: none;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    padding: 0;
    margin: 0;
    border-radius: 0;
    display: inline;
}

/* ── TD: override cmc-custom.css (font-size 16px) ── */
#cryptocurency-market-cap-wrapper table#cmc_watchlist_table > tbody > tr > td {
    padding: 16px 0 !important;
    border-bottom: 1px solid var(--border, #e8edf4) !important;
    border-top: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    font-size: 14px !important;
    vertical-align: middle;
    color: var(--t1, #0d1320);
    text-align: center;
    background: var(--card, #fff);
    transition: background .18s;
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif !important;
}
#cryptocurency-market-cap-wrapper table#cmc_watchlist_table > tbody > tr {
    cursor: pointer;
    transition: background .18s;
}
#cryptocurency-market-cap-wrapper table#cmc_watchlist_table > tbody > tr:hover > td {
    background: var(--hover, #f4f6f9) !important;
}
#cryptocurency-market-cap-wrapper table#cmc_watchlist_table > tbody > tr:last-child > td {
    border-bottom: none !important;
}

/* ── Sticky "Актив" column (2nd) ── */
#cryptocurency-market-cap-wrapper table#cmc_watchlist_table > thead > tr > th:nth-child(2),
#cryptocurency-market-cap-wrapper table#cmc_watchlist_table > tbody > tr > td:nth-child(2) {
    position: sticky !important;
    left: 0 !important;
    z-index: 1;
    background: var(--card, #fff);
    max-width: 130px !important;
}
#cryptocurency-market-cap-wrapper table#cmc_watchlist_table > thead > tr > th:nth-child(2) {
    background: var(--bg, #f4f6f9) !important;
    z-index: 3 !important;
}
#cryptocurency-market-cap-wrapper table#cmc_watchlist_table > tbody > tr:hover > td:nth-child(2) {
    background: var(--hover, #f4f6f9) !important;
}

/* ── Overflow: prevent phantom page-level scrollbar ── */
#cmc-watchlist-page-wrap {
    overflow-x: hidden;
}

/* ── Watchlist table: overflow-x scroll inside table area ── */
.cmc-watchlist-page .cmc-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* ── DT search box moved into .cmc-head-controls ── */
#cryptocurency-market-cap-wrapper .cmc-head-controls .dataTables_filter {
    display: block !important;
    position: static;
    float: none;
}
#cryptocurency-market-cap-wrapper .cmc-head-controls .dataTables_filter label {
    display: flex;
    align-items: center;
    margin: 0;
    font-size: 0;
}
#cryptocurency-market-cap-wrapper .cmc-head-controls .dataTables_filter input {
    padding: 7px 11px !important;
    border: 1px solid var(--border, #e8edf4) !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    color: var(--t1, #0d1320) !important;
    background: var(--card, #fff) !important;
    outline: none !important;
    width: 160px !important;
    transition: border-color .18s, box-shadow .18s;
    box-shadow: none !important;
    margin: 0 !important;
    font-family: 'Manrope', sans-serif !important;
}
#cryptocurency-market-cap-wrapper .cmc-head-controls .dataTables_filter input:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1) !important;
}

@media (max-width: 600px) {
    .cmc-watchlist-page .cmc-wl-page-header { flex-direction: column; align-items: flex-start; }
    .cmc-wl-add-btn { width: 100%; justify-content: center; }
    .cmc-wl-modal { max-height: 90vh; }
}
