/* ============================================================
   Draft Arena - Draft History UI (Phase 4C.2B)
   Scoped: .draft-history-* / .dh-*  (gameplay selektorlerine dokunmaz).
   Mevcut Floodlight tokenlarini kullanir. Global [hidden] korunur.
   ============================================================ */

/* Topbar "Draftlarım" (account-btn stilini paylasir, index.php'de account.css'ten) */
.draft-history-control { display: inline-flex; align-items: center; }
.draft-history-btn { white-space: nowrap; }

/* ---- Overlay ---- */
.draft-history-overlay {
  position: fixed; inset: 0; z-index: 9997;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4, 16px);
  font-family: var(--font-body, "Barlow", system-ui, sans-serif);
  color: var(--text-primary, #EAF6F0);
}
.draft-history-backdrop { position: absolute; inset: 0; background: rgba(3, 10, 8, .72); }

.draft-history-panel {
  position: relative; z-index: 1;
  width: 100%; max-width: 640px; max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--surface, #12251E);
  border: 1px solid var(--border, #204338);
  border-radius: var(--r-lg, 20px);
  box-shadow: var(--e-modal, 0 16px 40px rgba(0,0,0,.6));
  overflow: hidden;
}
.draft-history-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3, 12px);
  padding: var(--space-5, 24px) var(--space-5, 24px) var(--space-4, 16px);
  border-bottom: 1px solid var(--border, #204338);
}
.draft-history-title {
  margin: 0; font-family: var(--font-display, "Saira Condensed", sans-serif);
  font-weight: 800; font-size: var(--fs-h1, 28px);
}
.draft-history-sub { margin: 4px 0 0; color: var(--text-secondary, #9CC0B2); font-size: var(--fs-small, 13px); }
.draft-history-close {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: var(--r-pill, 999px);
  background: var(--surface-elevated, #17332A); border: 1px solid var(--border-strong, #2C5A49);
  color: var(--text-primary, #EAF6F0); cursor: pointer; font-size: 15px; line-height: 1;
}
.draft-history-close:hover { border-color: var(--accent, #1ED08A); }

.draft-history-body { padding: var(--space-4, 16px) var(--space-5, 24px) var(--space-5, 24px); overflow-y: auto; }

/* ---- List ---- */
.draft-history-cards { display: flex; flex-direction: column; gap: var(--space-3, 12px); }
.draft-history-card {
  width: 100%; text-align: left; cursor: pointer;
  background: var(--bg-secondary, #0B1A15);
  border: 1px solid var(--border, #204338);
  border-radius: var(--r-md, 14px);
  padding: var(--space-3, 12px) var(--space-4, 16px);
  color: var(--text-primary, #EAF6F0);
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color var(--dur-fast, 120ms);
}
.draft-history-card:hover { border-color: var(--accent, #1ED08A); }
.draft-history-card:focus-visible { outline: 2px solid var(--accent, #1ED08A); outline-offset: 2px; }
.dh-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2, 8px); }
.dh-card-mode { font-family: var(--font-display, "Saira Condensed", sans-serif); font-weight: 700; font-size: 16px; letter-spacing: .01em; }
.dh-card-score { font-family: var(--font-stat, "Saira Condensed", sans-serif); font-weight: 800; color: var(--accent, #1ED08A); font-size: 18px; white-space: nowrap; }
.dh-card-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--text-secondary, #9CC0B2); font-size: var(--fs-small, 13px); }
.dh-card-formation { font-weight: 600; }
.dh-card-date { color: var(--text-secondary, #9CC0B2); font-size: var(--fs-label, 12px); }

.draft-history-more {
  margin-top: var(--space-4, 16px); width: 100%; min-height: 44px;
  background: var(--surface-elevated, #17332A); border: 1px solid var(--border-strong, #2C5A49);
  border-radius: var(--r-md, 14px); color: var(--text-primary, #EAF6F0);
  font: 600 var(--fs-body, 16px) var(--font-body, "Barlow", sans-serif); cursor: pointer;
}
.draft-history-more:hover:not(:disabled) { border-color: var(--accent, #1ED08A); }
.draft-history-more:disabled { opacity: .6; cursor: default; }

/* ---- Detail ---- */
.draft-history-back { background: none; border: none; color: var(--text-secondary, #9CC0B2); font: inherit; cursor: pointer; padding: 0; margin-bottom: var(--space-3, 12px); }
.draft-history-back:hover { color: var(--text-primary, #EAF6F0); }
.dh-detail-head { display: flex; align-items: baseline; gap: var(--space-3, 12px); }
.dh-detail-mode { font-family: var(--font-display, "Saira Condensed", sans-serif); font-weight: 800; font-size: var(--fs-h2, 20px); }
.dh-detail-score { font-family: var(--font-stat, "Saira Condensed", sans-serif); font-weight: 800; color: var(--accent, #1ED08A); font-size: 22px; }
.dh-detail-sub { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-secondary, #9CC0B2); font-size: var(--fs-small, 13px); margin: 6px 0 var(--space-4, 16px); }
.dh-detail-h { font-family: var(--font-display, "Saira Condensed", sans-serif); font-weight: 700; font-size: 15px; margin: var(--space-4, 16px) 0 var(--space-2, 8px); color: var(--text-secondary, #9CC0B2); }
.dh-detail-note { color: var(--text-secondary, #9CC0B2); font-size: var(--fs-small, 13px); margin: var(--space-3, 12px) 0 0; }

.dh-player-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: var(--space-2, 8px); }
.dh-player { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--space-2, 8px) 6px; background: var(--bg-secondary, #0B1A15); border: 1px solid var(--border, #204338); border-radius: var(--r-sm, 10px); min-width: 0; }
.dh-player-slot { align-self: flex-start; font-size: 11px; font-weight: 800; color: var(--gold, #FFCB5C); font-family: var(--font-display, "Saira Condensed", sans-serif); letter-spacing: .5px; }
.dh-player-av { position: relative; width: 100%; max-width: 76px; aspect-ratio: 24 / 34; border-radius: 8px; overflow: hidden; background: var(--surface-elevated, #17332A); display: flex; align-items: center; justify-content: center; }
.dh-player-av img { width: 100%; height: 100%; object-fit: contain; display: block; }
.dh-player.dh-noimg .dh-player-av::after { content: "👤"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.dh-player-ovr { position: absolute; bottom: 3px; right: 3px; background: var(--accent-strong, #0E9C62); color: #04140D; font-family: var(--font-stat, "Saira Condensed", sans-serif); font-weight: 800; font-size: 12px; padding: 1px 5px; border-radius: var(--r-pill, 999px); line-height: 1.15; }
.dh-player-name { font-size: var(--fs-label, 12px); font-weight: 600; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.dh-player-team { font-size: 10.5px; color: var(--text-secondary, #9CC0B2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- States ---- */
.draft-history-status, .draft-history-empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-3, 12px); padding: var(--space-7, 48px) var(--space-4, 16px); text-align: center; color: var(--text-secondary, #9CC0B2); }
.draft-history-empty-emoji { font-size: 34px; }
.draft-history-empty-title { margin: 0; color: var(--text-primary, #EAF6F0); font-weight: 600; }
.draft-history-empty-sub { margin: 0; font-size: var(--fs-small, 13px); }
.draft-history-error { color: var(--danger, #FF5C6C); margin: 0; }
.draft-history-btn2 { min-height: 40px; padding: 8px 16px; background: var(--surface-elevated, #17332A); border: 1px solid var(--border-strong, #2C5A49); border-radius: var(--r-md, 14px); color: var(--text-primary, #EAF6F0); font: 600 var(--fs-small, 13px) var(--font-body, sans-serif); cursor: pointer; }
.draft-history-btn2:hover { border-color: var(--accent, #1ED08A); }
.draft-history-spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--border, #204338); border-top-color: var(--accent, #1ED08A); animation: dhspin .8s linear infinite; }
@keyframes dhspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .draft-history-spinner { animation-duration: 2s; } }

/* ---- Transfer toast ---- */
.draft-history-toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  z-index: 10000; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: var(--space-3, 12px);
  padding: 10px 16px; border-radius: var(--r-pill, 999px);
  background: var(--surface-elevated, #17332A); border: 1px solid var(--border-strong, #2C5A49);
  box-shadow: var(--e-card, 0 6px 18px rgba(0,0,0,.35));
  color: var(--text-primary, #EAF6F0); font-size: var(--fs-small, 13px);
}
.draft-history-toast.dh-toast-ok { border-color: var(--accent, #1ED08A); }
.draft-history-toast.dh-toast-warn { border-color: var(--warning, #FFCB5C); }
.dh-toast-retry { background: var(--accent, #1ED08A); color: #04140D; border: none; border-radius: var(--r-pill, 999px); padding: 5px 12px; font: 700 var(--fs-small, 13px) var(--font-body, sans-serif); cursor: pointer; white-space: nowrap; }

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .draft-history-overlay { padding: 0; align-items: stretch; }
  .draft-history-panel { max-width: 100%; max-height: 100vh; border-radius: 0; border: none; }
  .draft-history-title { font-size: 22px; }
  .dh-player-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
}

/* Overlay giriş-çıkış hareketi (Phase 8: ortak motion) */
.draft-history-backdrop { animation: ovScrimIn var(--dur-mid, 220ms) var(--ease-enter) both; }
.draft-history-panel    { animation: ovPanelIn var(--dur-mid, 220ms) var(--ease-enter) both; }
.draft-history-overlay.closing .draft-history-backdrop { animation: ovScrimOut var(--dur-fast, 120ms) var(--ease-exit) both; }
.draft-history-overlay.closing .draft-history-panel    { animation: ovPanelOut var(--dur-fast, 120ms) var(--ease-exit) both; }
@media (prefers-reduced-motion: reduce) {
  .draft-history-backdrop, .draft-history-panel,
  .draft-history-overlay.closing .draft-history-backdrop,
  .draft-history-overlay.closing .draft-history-panel { animation: none; }
}

/* Mikro-etkileşim tutarlılığı (Phase 8): kart hover kalkış + press; kapat butonu press. */
.draft-history-card { transition: border-color var(--dur-fast, 120ms) var(--ease-standard), transform var(--dur-fast, 120ms) var(--ease-standard), box-shadow var(--dur-mid, 220ms) var(--ease-standard); }
.draft-history-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0, 0, 0, .35); }
.draft-history-card:active { transform: translateY(0) scale(.99); box-shadow: 0 4px 12px rgba(0, 0, 0, .3); }
.draft-history-close { transition: border-color var(--dur-fast, 120ms) var(--ease-standard), transform var(--dur-fast, 120ms) var(--ease-standard); }
.draft-history-close:active { transform: scale(.92); }
@media (prefers-reduced-motion: reduce) {
  .draft-history-card, .draft-history-card:hover, .draft-history-card:active,
  .draft-history-close, .draft-history-close:active { transition: none; transform: none; }
}
