/* RR_WebProfile — стили специфичные для модуля.
   Базовый стиль (layout, sidebar, кнопки, формы, темы) приходит из хаба:
   <link href="https://ads.rust-ru.com/css/style.css">. */

/* === Layout: app-grid (хаб его не задаёт явно — нужно повторить) === */
#app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.nav-sidebar { background: var(--bg-sidebar); border-right: 0.5px solid var(--border); display: flex; flex-direction: column; padding: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }

/* === Секции (показ через класс .active) === */
.section { display: none; }
.section.active { display: block; }

/* === Stats cards === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--bg-card); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-hint); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); }
.stat-sub { font-size: 11px; color: var(--text-hint); margin-top: 2px; }

/* === Page actions === */
.page-actions { display: flex; gap: 8px; align-items: center; }

/* === Bulk select bar === */
.bulk-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; user-select: none; }
.bulk-check input { cursor: pointer; }
#market-bulk-bar { align-items: center; gap: 12px; }

/* === Danger button === */
.btn-danger { padding: 8px 16px; background: #dc2626; color: #fff; border: none; border-radius: var(--radius, 8px); cursor: pointer; font-size: 13px; font-weight: 500; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger:disabled { opacity: .6; cursor: default; }

/* === Table === */
.table-wrap { background: var(--bg-card); border: 0.5px solid var(--border); border-radius: var(--radius-lg); overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; padding: 10px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-hint); font-weight: 600; border-bottom: 0.5px solid var(--border); background: var(--overlay-subtle); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 0.5px solid var(--border); vertical-align: middle; color: var(--text); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--overlay-subtle); }
.table .cell-name { font-weight: 500; }
.table .cell-mono { font-family: 'SF Mono', SFMono-Regular, Consolas, monospace; font-size: 12px; color: var(--text-muted); }
.table .cell-right { text-align: right; }
.table .cell-center { text-align: center; }
.table .cell-actions { display: flex; gap: 4px; }
.table code { font-size: 11px; background: var(--overlay-subtle); padding: 1px 5px; border-radius: 3px; }

/* === Badges === */
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 500; white-space: nowrap; }
.badge-green { background: #d1fae5; color: #059669; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-gray { background: #f1f0eb; color: #666; }
.badge-rarity { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
[data-theme="dark"] .badge-green { background: #0f3a2c; color: #6ee7b7; }
[data-theme="dark"] .badge-yellow { background: #3a2e10; color: #fcd34d; }
[data-theme="dark"] .badge-red { background: #3a1212; color: #fca5a5; }
[data-theme="dark"] .badge-blue { background: #1f2256; color: #a5b4fc; }
[data-theme="dark"] .badge-gray { background: #2a2c30; color: #c4c4c4; }

/* === Item card (market grid) === */
.items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.item-card { background: var(--bg-card); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 12px; transition: border-color .15s; position: relative; }
.item-card:hover { border-color: var(--border-med); }
.item-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.item-card-check { position: absolute; top: 8px; left: 8px; width: 18px; height: 18px; cursor: pointer; accent-color: var(--accent); z-index: 2; }
.item-post-badge { position: absolute; top: 8px; right: 8px; z-index: 2; font-size: 10px; font-weight: 600; line-height: 1; padding: 4px 7px; border-radius: 10px; white-space: nowrap; border: 0.5px solid var(--border); }
.item-post-badge.posted { background: rgba(46, 160, 67, .18); color: #3fb950; border-color: rgba(46, 160, 67, .4); }
.item-post-badge.queued { background: rgba(210, 153, 34, .18); color: #d29922; border-color: rgba(210, 153, 34, .4); }
.item-post-badge.none { background: var(--overlay-subtle); color: var(--text-hint); }
.item-post-badge.sold { background: rgba(110, 118, 129, .18); color: #8b949e; border-color: rgba(110, 118, 129, .4); }
.item-card-img { width: 100%; height: 140px; object-fit: contain; border-radius: 6px; background: var(--overlay-subtle); margin-bottom: 8px; display: block; }
.item-card-name { font-size: 13px; font-weight: 500; margin-bottom: 4px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--text); }
.item-card-meta { font-size: 11px; color: var(--text-hint); display: flex; justify-content: space-between; align-items: center; }
.item-card-price { font-weight: 600; color: var(--text); font-size: 13px; }
.item-card-price.no-price { color: var(--text-hint); font-weight: 400; }
/* Цена есть, но товар ещё не опубликован — приглушаем (статус виден по плашке). */
.item-card-price.unpublished { color: var(--text-hint); font-weight: 500; }
.item-card-actions { display: flex; gap: 4px; margin-top: 8px; }
.item-card-actions button { flex: 1; justify-content: center; padding: 5px 8px; font-size: 12px; }

/* === Modal — расширения над хабовскими стилями === */
.modal-overlay.open { display: flex !important; }

/* === Loading / empty === */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }
.spinner { display: inline-block; width: 24px; height: 24px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: .3; }
.empty-state-text { font-size: 14px; }

/* === Toast === */
#toast { position: fixed; bottom: 24px; right: 24px; padding: 10px 18px; border-radius: var(--radius); background: #1a1a1a; color: #fff; font-size: 13px; z-index: 9999; opacity: 0; transform: translateY(8px); transition: all .25s; pointer-events: none; }
#toast.show { opacity: 1; transform: translateY(0); }
#toast.toast-success { background: #065f46; }
#toast.toast-error { background: #991b1b; }

/* === Кнопки-иконки в строках таблицы === */
.btn-icon { padding: 5px 8px; background: transparent; border: 0.5px solid var(--border); border-radius: 5px; cursor: pointer; color: var(--text-muted); font-size: 13px; }
.btn-icon:hover { background: var(--overlay-subtle); color: var(--text); }

/* === Прогресс парсинга цен во вкладке Цены === */
.tab-progress {
    display: none;
    margin-left: 4px;
    padding: 1px 5px;
    background: var(--accent);
    color: #fff;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    vertical-align: middle;
}
.tab-progress.active { display: inline-block; }

/* === Последний результат парсинга цен Steam === */
.price-last-result {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 5px 10px;
    background: var(--bg-card);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    line-height: 1.4;
}
.price-last-result-label {
    color: var(--text-hint);
    font-weight: 500;
}
.price-last-result-value {
    color: var(--text);
}
.price-last-result-time {
    color: var(--text-muted);
    font-size: 11px;
}
.price-last-result-warning {
    color: #b45309;
}
[data-theme="dark"] .price-last-result-warning {
    color: #fbbf24;
}

/* === Адаптив === */
@media (max-width: 768px) {
    #app { grid-template-columns: 1fr; }
    .nav-sidebar { display: none; }
    .main-content { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .items-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
