/*
 * Panel styles — admin dashboard components.
 * Requires: tokens.css loaded first.
 */

/* ---- app sidebar ---- */
.sidebar { width: var(--sidebar-w); background: var(--surface2); border-right: 1px solid var(--border); position: fixed; top: 0; left: 0; bottom: 0; display: flex; flex-direction: column; z-index: 100; overflow-y: auto; }
.sidebar-brand { padding: 24px 20px 20px; display: flex; align-items: baseline; gap: 8px; }
.sidebar-brand-link { font-size: 0.875rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); text-decoration: none; }
.sidebar-version { font-size: 0.6875rem; color: var(--muted); font-weight: 700; letter-spacing: 0.04em; opacity: 0.6; }
.sidebar-nav { flex: 1; padding: 4px 0; }
.sidebar-link { display: block; color: var(--muted); text-decoration: none; font-size: 0.8125rem; font-weight: 700; padding: 10px 20px; border-left: 3px solid transparent; transition: var(--transition); }
.sidebar-link:hover { color: var(--text); background: var(--surface3); }
.sidebar-link.active { color: #fff; background: rgba(255,74,0,0.08); border-left-color: var(--accent); }
.sidebar-sep { height: 1px; background: var(--border); margin: 8px 20px; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-user { font-size: 0.8125rem; font-weight: 700; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-link-sm { font-size: 0.75rem; color: var(--muted); text-decoration: none; font-weight: 700; padding: 4px 8px; border-radius: 4px; transition: var(--transition); border-left: none; }
.sidebar-link-sm:hover { color: var(--text); background: var(--surface3); }

/* ---- app layout ---- */
.app-main { margin-left: var(--sidebar-w); min-height: 100vh; }
.auth-layout { min-height: 100vh; }

/* ---- layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 32px; }
.page-header { margin-bottom: 32px; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.page-header p { color: var(--muted); font-size: 0.875rem; margin-top: 4px; }

/* ---- stats row ---- */
.stats-row { display: flex; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; }
.stat-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 20px; flex: 1; min-width: 120px; }
.stat-val { font-size: 1.5rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; margin-top: 2px; }
.stat-green .stat-val { color: var(--green); }
.stat-red .stat-val { color: var(--red); }
.stat-yellow .stat-val { color: var(--yellow); }

/* ---- table ---- */
.table-wrap { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 16px; min-height: 48px; font-size: 0.75rem; line-height: 1rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; background: var(--surface3); border-bottom: 1px solid var(--border); }
td { padding: 12px 16px; min-height: 48px; font-size: 0.875rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }
.table-link { color: var(--text); text-decoration: none; font-weight: 700; }
.table-link:hover { color: var(--accent); }

/* ---- panel badges ---- */
.badge-ok { background: var(--green-bg); color: var(--green); }
.badge-failed { background: var(--red-bg); color: var(--red); }
.badge-stale { background: var(--yellow-bg); color: var(--yellow); }
.badge-old { background: var(--red-bg); color: var(--red); }
.badge-fresh { background: var(--green-bg); color: var(--green); }
.badge-no-data { background: var(--surface3); color: var(--muted); }
.badge-blocked { background: var(--surface3); color: var(--muted); }
.badge-manual { background: var(--info-bg); color: var(--info); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 3rem; padding: 0 24px; border-radius: 4px; font-family: inherit; font-size: 0.875rem; line-height: 1.1875rem; font-weight: 700; cursor: pointer; transition: var(--transition); text-decoration: none; border: 1px solid var(--border); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { filter: brightness(0.85); }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--hover-reversed); }

/* ---- forms ---- */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }
.form-input { width: 100%; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; color: var(--text); font-family: inherit; font-size: 0.875rem; transition: var(--transition); }
.form-input:focus { outline: none; border-color: var(--accent); }
.form-input::placeholder { color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-check { display: flex; align-items: center; gap: 16px; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---- store detail ---- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 28px; }
.detail-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 20px; }
.detail-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.detail-val { font-size: 0.875rem; margin-top: 4px; word-break: break-all; }
.detail-val a { color: var(--accent); text-decoration: none; }

/* ---- screenshot grid ---- */
.run-section { margin-bottom: 28px; }
.run-header { font-size: 0.875rem; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.run-date { color: var(--accent); }
.run-count { color: var(--muted); font-weight: 400; }
.screenshot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.screenshot-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; padding: 12px; display: flex; flex-direction: column; gap: 16px; }
.sc-img-wrap { position: relative; }
.screenshot-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; object-position: top; border-radius: 4px; display: block; }
.sc-labels { display: flex; gap: 4px; flex-wrap: wrap; }
.sc-label { display: inline-flex; align-items: center; justify-content: center; padding: 2px 4px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; line-height: 1rem; letter-spacing: 0; }
.sc-label-main { background: var(--accent-pressed); color: var(--accent); }
.sc-label-overlay { background: var(--accent-pressed); color: var(--accent); }
.sc-label-mobile { background: var(--info-bg); color: var(--info); }
.sc-label-desktop { background: var(--info-bg); color: var(--info); }
.sc-method { position: absolute; top: 8px; left: 8px; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 4px; background: var(--surface2); border: 1px solid var(--border); }
.sc-method svg { width: 24px; height: 24px; }
.sc-method-crawler { color: var(--text); }
.sc-method-manual { color: var(--yellow); }
.sc-method-custom_page { color: var(--info); }
.sc-info { display: flex; flex-direction: column; gap: 4px; }
.sc-title { display: flex; gap: 4px; align-items: baseline; font-size: 1rem; font-weight: 700; line-height: 1.375; }
.sc-title-num { color: var(--muted); white-space: nowrap; }
.sc-title-name { color: var(--text); }
.sc-desc { font-size: 0.875rem; color: var(--muted); line-height: 1.43; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sc-verdict { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 0; font-size: 0.75rem; font-weight: 500; color: var(--text); background: var(--bg); }

/* ---- search ---- */
.search-wrap { margin-bottom: 20px; }
.search-input { width: 100%; max-width: 400px; padding: 10px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; color: var(--text); font-family: inherit; font-size: 0.875rem; }
.search-input:focus { outline: none; border-color: var(--accent); }

/* ---- feature badges ---- */
.badge-feat { font-size: 0.6875rem; padding: 2px 7px; margin: 1px 2px; border-radius: var(--radius-xs); }
/* e-commerce features — accent tint */
.badge-feat-discount_code,
.badge-feat-promotion,
.badge-feat-free_shipping,
.badge-feat-countdown,
.badge-feat-installments { background: var(--accent-pressed); color: var(--accent); }
/* content features — info tint */
.badge-feat-reviews,
.badge-feat-cross_sell,
.badge-feat-trust_signals { background: var(--info-bg); color: var(--info); }
/* common features — muted */
.badge-feat-newsletter,
.badge-feat-loyalty_program { background: var(--surface3); color: var(--muted); }

/* ---- run features in store detail ---- */
.run-features { margin-bottom: 10px; font-size: 0.8125rem; }
.run-feat-line { margin-bottom: 3px; display: flex; align-items: center; flex-wrap: wrap; gap: 3px; }
.run-feat-page { color: var(--muted); font-weight: 700; font-size: 0.75rem; text-transform: capitalize; margin-right: 4px; min-width: 80px; }

/* ---- drawers ---- */
.drawer-overlay { position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); z-index:190; display:none; }
.drawer { position:fixed; top:0; right:0; width:480px; height:100%; background:var(--surface); border-left:1px solid var(--border); z-index:200; transform:translateX(100%); transition:transform 0.25s ease; display:flex; flex-direction:column; overflow:hidden; }
.drawer.open { transform:translateX(0); }
.drawer.drawer-wide { width:600px; }
.drawer.drawer-xl { width:800px; }
.drawer-header { display:flex; align-items:center; justify-content:space-between; padding:20px 24px; border-bottom:1px solid var(--border); flex-shrink:0; }
.drawer-header h2 { font-size:1rem; font-weight:700; margin:0; }
.drawer-close { background:none; border:none; color:var(--muted); font-size:1.5rem; cursor:pointer; padding:4px 8px; line-height:1; }
.drawer-close:hover { color:var(--text); }
.drawer-body { flex:1; overflow-y:auto; padding:24px; }
.drawer-footer { padding:16px 24px; border-top:1px solid var(--border); flex-shrink:0; display:flex; gap:12px; }

/* ---- form sections ---- */
.form-section { border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 28px; background: var(--surface2); }
.form-section legend { font-size: 0.8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); padding: 0 8px; }
.form-section-desc { font-size: 0.8125rem; color: var(--muted); margin-bottom: 16px; }

/* ---- journey page rows ---- */
.journey-pages { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.journey-page-row { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); transition: var(--transition); }
.journey-page-row.is-manual { opacity: 0.65; }
.journey-page-row.is-manual .journey-page-url input { border-style: dashed; }
.journey-page-header { display: flex; align-items: center; gap: 10px; }
.journey-page-name { font-weight: 700; font-size: 0.875rem; flex: 1; }
.journey-page-mode { width: auto; padding: 5px 10px; font-size: 0.8125rem; }
.journey-page-url { margin-top: 8px; }
.journey-page-note { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.form-hint { font-size: 0.75rem; color: var(--muted); display: block; margin-top: 4px; }

/* ---- responsive ---- */
@media (max-width: 768px) {
  :root { --sidebar-w: 200px; }
  .container { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stats-row { flex-direction: column; }
  .drawer, .drawer-wide, .drawer-xl { width: 100%; }
  .journey-page-header { flex-wrap: wrap; }
}
