/* Geçmiş sekmesi (index.html #gecmis, client/js/gecmis.js).
   main.css ve ui.css'ten sonra yüklenir; renkler ui.css'teki --sk-* değişkenleri (açık / koyu tema).
   Eski main.css .container kuralları !important kullandığı için burada da yer yer var. */

#tab-calculation-history [hidden] { display: none !important; }

#tab-calculation-history .container.gc {
  max-width: 1120px;
  margin: 0 auto 18px;
  padding: 22px 24px !important;
  background: var(--sk-surface) !important;
  border: 1px solid var(--sk-line);
  border-radius: var(--sk-r) !important;
  box-shadow: var(--sk-shadow);
  color: var(--sk-fg);
  font-family: var(--sk-font);
}

/* ---------- Başlık ---------- */
.gc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 14px; }
.gc-head-text { min-width: 0; }
.gc-title { margin: 0; font: 800 22px/1.25 var(--sk-font); color: var(--sk-fg); }
.gc-sub { margin: 4px 0 0; color: var(--sk-muted); font-size: 14px; }
.gc-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.gc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--sk-line);
  background: var(--sk-surface-2);
  color: var(--sk-fg);
  font: 700 14px/1.2 var(--sk-font);
  cursor: pointer;
  white-space: nowrap;
}
.gc-btn:hover { border-color: var(--sk-accent); }
.gc-btn:focus-visible, .gc-chip:focus-visible, .gc-icon:focus-visible, .gc-link:focus-visible, .gc-tag:focus-visible { outline: 3px solid var(--sk-focus); outline-offset: 1px; }
.gc-btn.is-primary { background: var(--sk-accent); border-color: var(--sk-accent); color: var(--sk-on-accent); }
.gc-btn.is-primary:hover { filter: brightness(1.05); }
.gc-btn.is-soft { background: var(--sk-accent-soft); border-color: transparent; color: var(--sk-accent); }
.gc-btn.is-soft:hover { border-color: var(--sk-accent); }
.gc-btn.is-quiet { background: none; border-color: transparent; color: var(--sk-muted); }
.gc-btn.is-quiet:hover { color: var(--sk-bad); border-color: var(--sk-line); }

/* ---------- Süzgeç, arama ---------- */
.gc-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 6px; }
.gc-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.gc-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--sk-line);
  background: var(--sk-surface);
  color: var(--sk-muted);
  font: 600 14px/1.2 var(--sk-font);
  cursor: pointer;
}
.gc-chip b { font-weight: 800; color: var(--sk-fg); font-variant-numeric: tabular-nums; }
.gc-chip:hover { border-color: var(--sk-accent); }
.gc-chip.is-on { background: var(--sk-accent-soft); border-color: var(--sk-accent); color: var(--sk-accent); }
.gc-chip.is-on b { color: var(--sk-accent); }
.gc-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.gc-chip.is-good .gc-dot { color: var(--sk-good); }
.gc-chip.is-flat .gc-dot { color: var(--sk-warn); }
.gc-chip.is-bad .gc-dot { color: var(--sk-bad); }
.gc-find { display: flex; gap: 8px; flex: 1 1 320px; justify-content: flex-end; min-width: 0; }
#tab-calculation-history .gc-search, #tab-calculation-history .gc-mpsel {
  height: 40px;
  border: 1px solid var(--sk-line);
  border-radius: 10px;
  background: var(--sk-surface-2);
  color: var(--sk-fg);
  font: 500 14px var(--sk-font);
  padding: 0 12px;
  margin: 0;
}
#tab-calculation-history .gc-search { flex: 1 1 240px; min-width: 0; max-width: 340px; }
#tab-calculation-history .gc-mpsel { flex: 0 1 auto; max-width: 200px; }
#tab-calculation-history .gc-search:focus, #tab-calculation-history .gc-mpsel:focus { outline: 3px solid var(--sk-focus); border-color: var(--sk-accent); }

/* ---------- Gün başlıkları ---------- */
.gc-day {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 18px 0 8px;
  font: 800 13px/1.2 var(--sk-font);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--sk-muted);
}
.gc-day small { font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 12px; }
.gc-group { border: 1px solid var(--sk-line); border-radius: 12px; overflow: hidden; background: var(--sk-surface); }

/* ---------- Kart ---------- */
.gc-card { border-bottom: 1px solid var(--sk-line); box-shadow: inset 3px 0 0 var(--gc-state, var(--sk-line)); }
.gc-card:last-child { border-bottom: 0; }
.gc-card.is-good { --gc-state: var(--sk-good); --gc-soft: var(--sk-good-soft); }
.gc-card.is-flat { --gc-state: var(--sk-warn); --gc-soft: var(--sk-warn-soft); }
.gc-card.is-bad { --gc-state: var(--sk-bad); --gc-soft: var(--sk-bad-soft); }
.gc-card:hover, .gc-card.is-open { background: var(--sk-surface-2); }

.gc-main {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto 150px auto;
  grid-template-areas: "mp what prices net acts";
  align-items: center;
  gap: 8px 16px;
  padding: 12px 14px 12px 16px;
}
/* Pazaryeri renkleri main.css'teki body[data-market] renkleriyle aynı */
.gc-mp { grid-area: mp; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font: 800 11px/1 var(--sk-font); letter-spacing: .02em; color: #fff; background: var(--gc-mp, var(--sk-muted)); box-shadow: inset 0 0 0 1px #ffffff1f; }
.gc-mp.is-trendyol { --gc-mp: #f27a1a; }
.gc-mp.is-hepsiburada { --gc-mp: #1f4bff; }
.gc-mp.is-amazon { --gc-mp: #232f3e; }
.gc-mp.is-n11 { --gc-mp: #6f2dbd; }
.gc-what { grid-area: what; min-width: 0; }
.gc-name { font-weight: 700; line-height: 1.35; color: var(--sk-fg); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gc-name.is-manual { color: var(--sk-muted); font-weight: 600; font-style: italic; }
.gc-meta { margin-top: 2px; color: var(--sk-muted); font-size: 12px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.gc-tag {
  border: 1px solid var(--sk-line);
  background: var(--sk-surface);
  border-radius: 999px;
  padding: 1px 8px;
  font: 700 11px/1.5 var(--sk-font);
  color: var(--sk-accent);
  cursor: pointer;
}
.gc-tag:hover { border-color: var(--sk-accent); }

.gc-prices { grid-area: prices; display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.gc-price { display: grid; gap: 1px; text-align: right; }
.gc-price small { color: var(--sk-muted); font-size: 11px; font-weight: 600; }
.gc-price b { font-size: 14px; font-weight: 700; color: var(--sk-fg); white-space: nowrap; }
.gc-arrow { color: var(--sk-muted); padding-top: 12px; }

.gc-net { grid-area: net; display: grid; justify-items: end; gap: 3px; font-variant-numeric: tabular-nums; }
.gc-net b { font-size: 17px; font-weight: 800; color: var(--gc-state); white-space: nowrap; }
.gc-card.is-flat .gc-net b { color: var(--sk-fg); }
.gc-pill { background: var(--gc-soft); color: var(--gc-state); border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 700; white-space: nowrap; }

.gc-acts { grid-area: acts; display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.gc-acts .gc-btn { padding: 7px 11px; font-size: 13px; }
.gc-toggle::after { content: "▾"; font-size: 11px; transition: transform .15s; }
.gc-toggle[aria-expanded="true"]::after { transform: rotate(180deg); }
.gc-icon { border: 1px solid transparent; background: none; color: var(--sk-muted); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 15px; }
.gc-icon:hover { border-color: var(--sk-line); background: var(--sk-surface); color: var(--sk-fg); }
.gc-icon.is-danger:hover { color: var(--sk-bad); }
.gc-icon.is-small { width: 28px; height: 28px; font-size: 16px; line-height: 1; }

/* ---------- Ayrıntı ---------- */
.gc-panel { padding: 0 16px 16px 64px; display: grid; gap: 12px; }
.gc-inputs { display: flex; flex-wrap: wrap; gap: 6px; }
.gc-inputs span { background: var(--sk-surface); border: 1px solid var(--sk-line); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--sk-muted); font-weight: 600; }
.gc-cols { display: grid; grid-template-columns: minmax(0, 420px); gap: 16px; }
.gc-cols.has-tries { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); }
.gc-cols h4 { margin: 0 0 6px; font: 800 12px/1.2 var(--sk-font); text-transform: uppercase; letter-spacing: .05em; color: var(--sk-muted); }
.gc-breakdown, .gc-tries { background: var(--sk-surface); border: 1px solid var(--sk-line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.gc-rows { display: grid; }
.gc-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--sk-line); font-size: 14px; font-variant-numeric: tabular-nums; }
.gc-row:last-of-type { border-bottom: 0; }
.gc-k { color: var(--sk-muted); }
.gc-k[title] { cursor: help; text-decoration: underline dotted var(--sk-line); text-underline-offset: 3px; }
.gc-v { font-weight: 600; white-space: nowrap; }
.gc-row.is-top .gc-k, .gc-row.is-top .gc-v { color: var(--sk-fg); font-weight: 700; }
.gc-row.is-info .gc-v { color: var(--sk-muted); font-weight: 500; }
.gc-row.is-total { border-top: 1px solid var(--sk-fg); border-bottom: 0; margin-top: 4px; padding-top: 8px; }
.gc-row.is-total .gc-k { color: var(--sk-fg); font-weight: 800; }
.gc-row.is-total .gc-v { color: var(--gc-state); font-weight: 800; font-size: 16px; }
.gc-card.is-flat .gc-row.is-total .gc-v { color: var(--sk-fg); }
.gc-rule { margin: 8px 0 0; font-size: 12px; color: var(--sk-muted); }
.gc-muted { margin: 0; color: var(--sk-muted); font-size: 14px; }

.gc-tries-wrap { overflow-x: auto; }
.gc-tries-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.gc-tries-table th { text-align: left; color: var(--sk-muted); font: 700 11px/1.2 var(--sk-font); text-transform: uppercase; letter-spacing: .04em; padding: 4px 8px 6px 0; border-bottom: 1px solid var(--sk-line); }
.gc-tries-table td { padding: 6px 8px 6px 0; border-bottom: 1px dashed var(--sk-line); white-space: nowrap; }
.gc-tries-table tr:last-child td { border-bottom: 0; }
.gc-tries-table tr.is-head td { font-weight: 700; }
.gc-tries-table .gc-num { text-align: right; }
.gc-tries-table th:nth-child(3), .gc-tries-table th:nth-child(4), .gc-tries-table th:nth-child(5) { text-align: right; }
.gc-tries-table tr.is-good .gc-tries-net { color: var(--sk-good); }
.gc-tries-table tr.is-bad .gc-tries-net { color: var(--sk-bad); }
.gc-tries-act { text-align: right; padding-right: 0 !important; }
.gc-link { border: 0; background: none; color: var(--sk-accent); font: 700 13px var(--sk-font); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.gc-link:hover { background: var(--sk-accent-soft); }

/* ---------- Boş durum, alt satır ---------- */
.gc-empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 40px 16px; color: var(--sk-muted); border: 1px dashed var(--sk-line); border-radius: 12px; margin-top: 12px; }
.gc-empty b { color: var(--sk-fg); font-size: 17px; }
.gc-empty span { max-width: 460px; font-size: 14px; line-height: 1.5; }
.gc-empty .gc-btn { margin-top: 6px; }
.gc-empty-icon { font-size: 34px; line-height: 1; }
.gc-empty.is-small { padding: 24px 16px; }
.gc-foot { display: flex; align-items: center; gap: 10px 14px; margin-top: 12px; flex-wrap: wrap; }
.gc-foot:has(.gc-count:empty):has(#gcMore[hidden]):has(#gcClear[hidden]) { display: none; }
.gc-count { color: var(--sk-muted); font-size: 13px; }
.gc-clear { margin-left: auto; padding: 6px 8px; font-size: 13px; font-weight: 600; }

/* ---------- Orta genişlik: düğmeler alta iner ---------- */
@media (max-width: 980px) {
  .gc-main {
    grid-template-columns: 32px minmax(0, 1fr) auto 140px;
    grid-template-areas: "mp what prices net" ". acts acts acts";
  }
  .gc-acts { justify-content: flex-start; }
}

/* ---------- Telefon ---------- */
@media (max-width: 720px) {
  #tab-calculation-history .container.gc { padding: 16px !important; border-radius: 0 !important; border-left: 0; border-right: 0; }
  .gc-head-actions { width: 100%; }
  .gc-head-actions .gc-btn { flex: 1; }
  .gc-find { flex-basis: 100%; flex-wrap: wrap; justify-content: stretch; }
  #tab-calculation-history .gc-search, #tab-calculation-history .gc-mpsel { flex: 1 1 100%; max-width: none; font-size: 16px; }
  /* Fiyatlar ve sonuç ayrı satırlarda: rozet ("%3,3 · Başabaşa yakın") satış rakamının üstüne binmesin */
  .gc-main {
    grid-template-columns: 32px minmax(0, 1fr);
    grid-template-areas: "mp what" ". prices" ". net" ". acts";
    gap: 8px 10px;
    padding: 12px;
  }
  .gc-prices { gap: 6px; }
  .gc-price { text-align: left; }
  .gc-net { grid-auto-flow: column; justify-content: start; justify-items: start; align-items: center; gap: 8px; }
  .gc-acts { justify-content: flex-start; }
  .gc-acts .gc-btn { flex: 1; }
  .gc-panel { padding: 0 12px 12px; }
  .gc-cols.has-tries, .gc-cols { grid-template-columns: minmax(0, 1fr); }
}
