/* SellerCopilot — Мои карточки (admin UI Phase D) */

:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #111827;
  --muted: #5b6472;
  /* Aligned to main app (styles.css) — same accent blue, not the old #005bff. */
  --accent: #005bff;
  --accent-pressed: #003bbf;
  --accent-grad: linear-gradient(180deg, #2e79ff 0%, #005bff 52%, #003bbf 100%);
  --brand-grad: linear-gradient(140deg, #005bff 0%, #005bff 52%, #003bbf 100%);
  --border: #dde3ea;
  --ok: #15803d;
  --ok-bg: #e7f6ec;
  --warn: #b45309;
  --warn-bg: #fff4e3;
  --err: #b42318;
  --err-bg: #fdecec;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-blur: saturate(180%) blur(14px);
  --ring: 0 0 0 3px rgba(30, 91, 255, 0.30);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 1px 2px rgba(17, 24, 39, 0.05), 0 12px 32px -14px rgba(17, 24, 39, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  /* Manrope to match the main app; system stack as fallback. */
  font: 15px/1.55 "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 620px at 50% -8%, #ffffff 0%, var(--bg) 58%) no-repeat,
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ HEADER ============ */
.cards-header {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid rgba(221, 227, 234, 0.7);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 6px 22px -14px rgba(17, 24, 39, 0.22);
  position: sticky;
  top: 0;
  z-index: 10;
}
.cards-header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.cards-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
}
.cards-brand-mark {
  width: 34px;
  height: 34px;
  background: var(--brand-grad);
  color: #fff;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 12px -3px rgba(24, 71, 199, 0.5);
}
.cards-nav { display: flex; gap: 6px; }
.cards-nav-link {
  color: var(--muted);
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  text-decoration: none;
  transition: background var(--ease) 180ms, color var(--ease) 180ms;
}
.cards-nav-link:hover { background: rgba(17, 24, 39, 0.05); color: var(--text); text-decoration: none; }
.cards-nav-link.is-active { background: var(--accent-soft, #eaf1ff); color: var(--accent-pressed); font-weight: 700; }

/* ============ MAIN ============ */
.cards-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 60px;
}
.cards-hero h1 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: -0.02em;
}
.cards-lead {
  color: var(--muted);
  margin: 0 0 24px;
  max-width: 720px;
  font-size: 15px;
}

/* ============ STATS ============ */
.cards-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}
.cards-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cards-stat-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.cards-stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
@media (max-width: 720px) {
  .cards-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ============ FILTERS ============ */
.cards-filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.cards-filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.cards-filter-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 100px;
}
.cards-filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cards-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.cards-chip:hover { border-color: var(--accent); }
.cards-chip.is-selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.cards-chip-count {
  margin-left: 4px;
  opacity: 0.7;
  font-size: 11px;
}

/* ============ BULK BAR ============ */
.cards-bulk-bar {
  background: linear-gradient(135deg, #ebf3ff 0%, #d6e6ff 100%);
  border: 1px solid #b6cdf0;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.cards-bulk-btn {
  background: var(--accent-grad);
  color: #fff;
  border: 0;
  border-radius: var(--radius-md);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 2px 6px rgba(24, 71, 199, 0.26), 0 10px 24px -8px rgba(24, 71, 199, 0.42);
  transition: box-shadow var(--ease) 180ms, transform var(--ease) 120ms, opacity 0.15s;
}
.cards-bulk-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 10px rgba(24, 71, 199, 0.3), 0 16px 34px -10px rgba(24, 71, 199, 0.5); }
.cards-bulk-btn:disabled { opacity: 0.5; cursor: wait; }
.cards-bulk-status { font-size: 13px; color: var(--muted); min-height: 18px; }

/* ============ LIST ============ */
.cards-list-wrap { position: relative; min-height: 200px; }
.cards-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.cards-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  transition: box-shadow var(--ease) 180ms, transform var(--ease) 120ms;
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 14px;
  align-items: center;
}
.cards-item-photo {
  width: 80px;
  height: 80px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--muted);
}
.cards-item-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cards-item:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 1px 2px rgba(17, 24, 39, 0.05), 0 20px 44px -18px rgba(17, 24, 39, 0.22);
}
.cards-item-body { min-width: 0; }
.cards-item-title {
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}
.cards-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 13px;
  color: var(--muted);
}
.cards-item-meta strong { color: var(--text); }
.cards-item-aside {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.cards-item-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
}
.cards-item-status.is-success { background: var(--ok-bg); color: var(--ok); }
.cards-item-status.is-partial { background: var(--warn-bg); color: var(--warn); }
.cards-item-status.is-failed { background: var(--err-bg); color: var(--err); }
.cards-item-status.is-blocked { background: var(--err-bg); color: var(--err); }
.cards-item-link {
  font-size: 13px;
}
.cards-item-analyze {
  background: var(--accent-grad);
  color: #fff;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 2px 6px rgba(24, 71, 199, 0.24);
  transition: box-shadow var(--ease) 180ms, transform var(--ease) 120ms, opacity 0.15s;
}
.cards-item-analyze:hover:not(:disabled) { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 4px 12px rgba(24, 71, 199, 0.32); }
.cards-item-analyze:disabled { opacity: 0.5; cursor: wait; }

/* ============ ANALYZE MODAL ============ */
.cards-modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 23, 28, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 20px;
  z-index: 100;
  overflow-y: auto;
  animation: cards-modal-fade 0.15s ease;
}
@keyframes cards-modal-fade { from { opacity: 0; } to { opacity: 1; } }
.cards-modal-card {
  background: var(--surface);
  border-radius: 12px;
  max-width: 720px;
  width: 100%;
  padding: 24px 26px 28px;
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.15);
  position: relative;
}
.cards-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: 0;
  font-size: 28px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
}
.cards-modal-close:hover { background: var(--bg); color: var(--text); }
.cards-modal-header h2 { margin: 0 0 6px; font-size: 20px; }
.cards-modal-score { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.cards-modal-score strong { color: var(--text); font-size: 18px; }
.cards-modal-section { margin-top: 18px; }
.cards-modal-section h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--text);
}
.cards-modal-list { padding-left: 18px; margin: 0; }
.cards-modal-list li {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.45;
}
.cards-modal-list li strong { color: var(--text); }
@media (max-width: 560px) {
  .cards-item { grid-template-columns: 60px 1fr; }
  .cards-item-photo { width: 60px; height: 60px; }
  .cards-item-aside { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ============ EMPTY/LOADING/ERROR ============ */
.cards-empty,
.cards-loading,
.cards-error {
  text-align: center;
  padding: 36px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
}
.cards-empty h2 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--text);
}
.cards-empty p { margin: 6px 0; max-width: 520px; margin-left: auto; margin-right: auto; }
.cards-cta {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  margin-top: 10px;
}
.cards-cta:hover { background: var(--accent-pressed); text-decoration: none; }
.cards-error {
  border-color: var(--err);
  color: var(--err);
  background: var(--err-bg);
}
.is-hidden { display: none !important; }

/* ============ PAGINATION ============ */
.cards-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
}
.cards-page-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.cards-page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.cards-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cards-page-info { font-size: 13px; color: var(--muted); min-width: 100px; text-align: center; }

/* ============ FOOTER ============ */
.cards-footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
}
