/* ═══════════════════════════════════════════════════════
   FastGamez — History Panel  (history-panel.css)
   Tabs: Recent | Favorites | Liked
   ═══════════════════════════════════════════════════════ */

/* ── Overlay ───────────────────────────────────────────── */
#fg-history-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1199;
  opacity: 0;
  transition: opacity .28s ease;
}
#fg-history-overlay.open { display: block; opacity: 1; }

/* ── Panel ─────────────────────────────────────────────── */
#fg-history-panel {
  position: fixed;
  top: 0; 
  bottom: 0; 
  left: 0;
  width: 340px;
  max-width: 92vw;
  height: 100% !important; 
  background: var(--sidebar-bg-solid);
  border-right: 1px solid var(--border2);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 4px 0 32px rgba(0,0,0,.25);
}
#fg-history-panel.open { transform: translateX(0) !important; }
/* ── Header ────────────────────────────────────────────── */
.fg-hp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.fg-hp-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.fg-hp-title svg { color: var(--accent); width: 18px; height: 18px; flex-shrink: 0; }
.fg-hp-close {
  background: none; border: none; color: var(--text2); cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.fg-hp-close:hover { background: var(--bg4); color: var(--text); }

/* ── Tabs ──────────────────────────────────────────────── */
.fg-hp-tabs {
  display: flex;
  padding: 10px 12px 0;
  gap: 2px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.fg-hp-tab {
  flex: 1;
  background: none; border: none;
  cursor: pointer;
  font-size: 12px; font-weight: 600;
  color: var(--text3);
  padding: 7px 4px 10px;
  border-bottom: 2px solid transparent;
  transition: color .18s, border-color .18s;
  display: flex; align-items: center; justify-content: center;
  gap: 5px; white-space: nowrap;
}
.fg-hp-tab svg { width: 13px; height: 13px; flex-shrink: 0; }
.fg-hp-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.fg-hp-tab:hover:not(.active) { color: var(--text); }

.fg-hp-count {
  background: var(--bg4); color: var(--text2);
  border-radius: 20px; font-size: 10px; font-weight: 700;
  padding: 1px 6px; min-width: 18px; text-align: center; line-height: 16px;
}
.fg-hp-tab.active .fg-hp-count { background: var(--accent); color: #fff; }

/* ── Body ──────────────────────────────────────────────── */
.fg-hp-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--bg4) transparent;
}
.fg-hp-body::-webkit-scrollbar { width: 4px; }
.fg-hp-body::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 4px; }

.fg-hp-pane { display: none; padding: 10px 10px 16px; animation: hpFadeIn .22s ease; }
.fg-hp-pane.active { display: block; }
@keyframes hpFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Empty state ───────────────────────────────────────── */
.fg-hp-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 48px 16px; gap: 10px;
  color: var(--text3); text-align: center;
}
.fg-hp-empty-icon { font-size: 40px; line-height: 1; opacity: .5; }
.fg-hp-empty p { font-size: 13px; line-height: 1.5; margin: 0; }

/* ── Game card ─────────────────────────────────────────── */
.fg-hp-card {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text);
  transition: background .15s; position: relative;
  animation: hpCardIn .25s ease both;
}
@keyframes hpCardIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}
.fg-hp-card:hover { background: var(--bg4); }

.fg-hp-card-thumb {
  width: 56px; height: 38px; border-radius: 6px;
  object-fit: cover; background: var(--bg4);
  flex-shrink: 0; display: block;
}
.fg-hp-card-info { flex: 1; min-width: 0; }
.fg-hp-card-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text); line-height: 1.3;
}
.fg-hp-card-sub {
  font-size: 11px; color: var(--text3);
  margin-top: 2px; display: flex; align-items: center; gap: 4px;
}

/* Delete btn — hover only */
.fg-hp-card-del {
  opacity: 0; background: none; border: none; cursor: pointer;
  width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); flex-shrink: 0;
  transition: opacity .15s, background .15s, color .15s;
  pointer-events: none;
}
.fg-hp-card:hover .fg-hp-card-del { opacity: 1; pointer-events: auto; }
.fg-hp-card-del:hover { background: rgba(239,68,68,.15); color: #ef4444; }
.fg-hp-card-del svg { width: 13px; height: 13px; }
@media (hover: none) {
  .fg-hp-card-del { opacity: 1; pointer-events: auto; }
}

/* ── Footer ────────────────────────────────────────────── */
.fg-hp-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.fg-hp-clear-btn {
  width: 100%; background: none;
  border: 1px solid var(--border2);
  color: var(--text2); cursor: pointer;
  font-size: 12px; font-weight: 600;
  padding: 8px 12px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  gap: 6px; transition: background .15s, color .15s, border-color .15s;
}
.fg-hp-clear-btn:hover {
  background: rgba(239,68,68,.1);
  border-color: rgba(239,68,68,.35);
  color: #ef4444;
}
.fg-hp-clear-btn svg { width: 13px; height: 13px; }

/* ── Confirm Modal — ألوان ثابتة عشان يبان واضح ────────── */
#fg-hp-confirm {
  display: none; position: fixed; inset: 0; z-index: 1300;
  align-items: center; justify-content: center; padding: 20px;
}
#fg-hp-confirm.open { display: flex; }
.fg-hp-confirm-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.fg-hp-confirm-box {
  position: relative;
  background: #1e2535;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-lg);
  padding: 24px 20px 20px;
  width: 100%; max-width: 300px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: hpModalIn .22s ease;
}
@keyframes hpModalIn {
  from { opacity: 0; transform: scale(.93); }
  to   { opacity: 1; transform: scale(1); }
}
.fg-hp-confirm-icon { font-size: 32px; margin-bottom: 10px; }
.fg-hp-confirm-box h3 { font-size: 15px; font-weight: 700; color: #e2e8f0; margin: 0 0 6px; }
.fg-hp-confirm-box p  { font-size: 13px; color: #94a3b8; margin: 0 0 18px; line-height: 1.5; }
.fg-hp-confirm-btns   { display: flex; gap: 8px; }
.fg-hp-confirm-btns button {
  flex: 1; padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer; border: none;
  transition: opacity .15s;
}
.fg-hp-confirm-btns button:hover { opacity: .85; }
#fg-hp-confirm-cancel { background: rgba(255,255,255,.1); color: #e2e8f0; }
#fg-hp-confirm-ok     { background: #ef4444; color: #fff; }

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 480px) {
  #fg-history-panel { width: 100vw; max-width: 100vw; border-right: none; }
}