/* =========================
   Professional UX Polish
   ========================= */

/* ---- SVG Theme Toggle Icons ----
   Sun shown in dark mode; moon shown in light mode.
   CSS-controlled via data-theme on :root (no JS innerHTML needed). */
.icon-theme-sun,
.icon-theme-moon {
  display: block;
  pointer-events: none;
}:root:not([data-theme="light"]) .icon-theme-moon { display: none; }

/* Ensure icon-only buttons don't render extra line-height from font-size: 28px !important */
#themeToggle,
#footerMainOptionsToggle {
  line-height: 0;
}

/* ---- Entry Switcher (Score / Games) icon + label layout ---- */
.entry-switcher-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: calc(13px + var(--font-size-step)) !important;
}

.entry-tab-label {
  font-size: calc(12px + var(--font-size-step));
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
}

.entry-switcher-btn svg {
  flex-shrink: 0;
}
/* Dark theme: active tab (already exists but match new layout) */
:root:not([data-theme="light"]) .entry-switcher-btn.active {
  color: #d8ecff;
  background: rgba(74, 158, 255, 0.22);
  border-color: #4a9eff;
}
.scorecard-controls-shell:has(#gameTotalsCard:not([hidden])) {
  border-top-color: transparent !important;
}

/* =========================
   SVG Icon + Layout Modernization
   ========================= */

/* ---- Game Toggle: icon + label chip layout ---- */
/* Replace emoji-optimized 19px with tight icon+text layout */
.game-toggle {
  gap: 7px;
  font-size: calc(13px + var(--font-size-step));
  padding: 10px 14px;       /* was 10px 2px */
  letter-spacing: 0.01em;
}

/* ---- Gamesbar: ensure last tab is fully visible when scrolled to end ---- */
.games-controls-shell .gamesbar {
  padding-right: 12px;
}

/* ---- Responsive: compact game toggles on narrow phones (<= 480px) ---- */
@media (max-width: 480px) {
  .games-controls-shell .game-toggle-item {
    min-width: 96px;
  }
  .game-toggle {
    padding: 8px 10px;
    gap: 5px;
  }
  .game-toggle-label {
    font-size: calc(11px + var(--font-size-step));
  }
}
.game-toggle-label {
  font-size: calc(12px + var(--font-size-step));
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

/* Prevent SVGs inside game toggles from shrinking when the button is narrow */
.game-toggle svg {
  flex-shrink: 0;
}

/* ---- Icon-only option buttons: fix line-height with SVG content ---- */
/* font-size: 28px was there for emoji; now SVGs are explicit-sized so reset */
.game-options-icon-btn,
.banker-options-icon-btn {
  line-height: 0 !important;
  font-size: 0 !important;
}

/* ---- Utilities accordion toggle: list-row treatment ---- */
.utilities-toggle-btn {
  font-size: calc(14px + var(--font-size-step));
  font-weight: 600;
  letter-spacing: 0.015em;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: var(--radius-lg);
}

/* Chevron indicator on utilities toggles */
.utilities-toggle-btn::after {
  content: '›';
  margin-left: auto;
  font-size: calc(18px + var(--font-size-step));
  line-height: 1;
  opacity: 0.5;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.utilities-toggle-btn.is-open::after {
  transform: rotate(90deg);
  opacity: 0.85;
}#headerOptionsPanel #utilitiesToggle {
  width: 100%;
  justify-content: flex-start;
  gap: 8px;
  min-height: 56px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid var(--line-cool);
  background: linear-gradient(180deg, var(--hi-bright), rgba(242, 248, 255, 0.9));
  color: #1e3348;
  box-shadow: inset 0 1px 0 var(--hi-strong), 0 12px 20px -18px rgba(36, 71, 102, 0.3);
}#headerOptionsPanel #utilitiesToggle:hover {
  border-color: rgba(116, 149, 176, 0.4);
  background: linear-gradient(180deg, rgba(248, 252, 255, 0.98), rgba(236, 244, 252, 0.92));
}#headerOptionsPanel #utilitiesToggle.is-open {
  border-color: rgba(20, 93, 171, 0.62);
  background: linear-gradient(180deg, rgba(35, 132, 220, 0.2), rgba(23, 109, 198, 0.16));
  color: #133f62;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58), 0 0 0 2px rgba(35, 132, 220, 0.16);
}:root:not([data-theme="light"]) #headerOptionsPanel #utilitiesToggle {
  border-color: var(--line-medium);
  background: linear-gradient(180deg, var(--surface-d1), var(--surface-d2));
  color: #e5f1fb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 20px -18px var(--shadow-deep);
}:root:not([data-theme="light"]) #headerOptionsPanel #utilitiesToggle.is-open {
  border-color: rgba(82, 169, 255, 0.65);
  background: linear-gradient(180deg, rgba(30, 101, 176, 0.36), rgba(24, 72, 130, 0.3));
  color: #f2f8ff;
}

/* ---- SVG buttons in regular .btn rows: vertical alignment ---- */
.btn svg {
  flex-shrink: 0;
  vertical-align: middle;
}

/* ---- Game section h2: remove extra space from removed emoji ---- */
.game-section-header h2 {
  font-size: calc(17px + var(--font-size-step));
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* ---- Warning banner: SVG vertical alignment ---- */
.warning-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.vegas-warning-banner,
.game-warning-banner {
  display: flex;
  align-items: center;
  gap: 7px;
}

/* =========================
   Games Native Polish (final overrides)
   ========================= */

/* Cleaner game surface hierarchy: less border noise, more depth by layer. */
.game-section {
  border-top-color: rgba(128, 153, 178, 0.22);
  border-bottom-color: var(--line-base);
}

.game-section-header {
  padding-top: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-base);
}
.game-options-icon-btn,
.banker-options-icon-btn {
  border-width: 1px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 8px 16px -14px rgba(36, 71, 102, 0.34);
}

.game-options-panel {
  border-color: var(--line-base);
  box-shadow: 0 14px 28px -24px rgba(36, 71, 102, 0.28);
}
.results-card-wrap {
  border-color: rgba(128, 153, 178, 0.24);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 16px 28px -24px rgba(36, 71, 102, 0.22);
}

.results-card-wrap .live-results-card,
.results-card-wrap .banker-header-totals {
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.99), rgba(239, 246, 253, 0.99));
}

.results-collapse-bar {
  min-height: 42px;
  letter-spacing: 0.02em;
  font-weight: 700;
}

.results-collapse-label {
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.gamesbar-scroll-indicator {
  height: 4px;
  border-radius: 999px;
  opacity: 0.85;
}

.gamesbar-scroll-indicator__thumb {
  border-radius: 999px;
}

.vegas-table th,
.vegas-table td,
.banker-table th,
.banker-table td,
.skins-table th,
.skins-table td,
.junk-table th,
.junk-table td {
  border-color: var(--line-base);
}

.vegas-table thead th,
.banker-table thead th,
.skins-table thead th,
.junk-table thead th {
  font-size: clamp(1.05rem, 2.35vw, 1.28rem);
  letter-spacing: 0.01em;
}

:root:not([data-theme="light"]) .game-section {
  border-top-color: rgba(112, 148, 178, 0.28);
  border-bottom-color: rgba(112, 148, 178, 0.24);
}

:root:not([data-theme="light"]) .game-section-header {
  border-bottom-color: rgba(112, 148, 178, 0.26);
}

:root:not([data-theme="light"]) .game-options-icon-btn,
:root:not([data-theme="light"]) .banker-options-icon-btn {
  border-color: rgba(112, 148, 178, 0.36);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 10px 18px -14px rgba(0, 0, 0, 0.56);
}

:root:not([data-theme="light"]) .game-options-panel {
  border-color: rgba(112, 148, 178, 0.26);
  box-shadow: 0 18px 30px -24px rgba(0, 0, 0, 0.62);
}
:root:not([data-theme="light"]) .results-card-wrap {
  border-color: rgba(112, 148, 178, 0.28);
  box-shadow: 0 16px 28px -20px rgba(0, 0, 0, 0.68);
}

:root:not([data-theme="light"]) .results-card-wrap .live-results-card,
:root:not([data-theme="light"]) .results-card-wrap .banker-header-totals {
  background: linear-gradient(180deg, rgba(16, 34, 52, 0.99), rgba(12, 27, 42, 0.99));
}
:root:not([data-theme="light"]) .vegas-table th,
:root:not([data-theme="light"]) .vegas-table td,
:root:not([data-theme="light"]) .banker-table th,
:root:not([data-theme="light"]) .banker-table td,
:root:not([data-theme="light"]) .skins-table th,
:root:not([data-theme="light"]) .skins-table td,
:root:not([data-theme="light"]) .junk-table th,
:root:not([data-theme="light"]) .junk-table td {
  border-color: rgba(112, 148, 178, 0.24);
}

@media (max-width: 480px) {
  .game-section-header {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .game-section-header h2 {
    font-size: calc(16px + var(--font-size-step));
  }

  .results-card-wrap {
    border-radius: 20px;
  }

  .results-collapse-bar {
    min-height: 40px;
    padding-left: 12px;
    padding-right: 12px;
  }}

/* =========================
   Error & Success Toast Notifications
   Appended from main.css
   ========================= */

/* =========================
   Error & Success Toast Notifications
   ========================= */

.error-toast,
.success-toast {
  position: fixed;
  top: var(--space-xl);
  right: var(--space-xl);
  max-width: 400px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 32px var(--shadow);
  padding: var(--space-lg);
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s ease;
  z-index: 10000;
  pointer-events: all;
}

.error-toast {
  border-left: 4px solid var(--danger);
}

.success-toast {
  border-left: 4px solid var(--accent);
}

.error-content,
.success-content {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.error-icon,
.success-icon {
  font-size: var(--text-2xl);
  flex-shrink: 0;
  line-height: 1;
}

.error-icon {
  color: var(--danger);
}

.success-icon {
  color: var(--accent);
  font-weight: bold;
}

.error-body {
  flex: 1;
}

.error-message,
.success-message {
  font-size: var(--text-lg);
  color: var(--ink);
  font-weight: 500;
  margin-bottom: var(--space-xs);
}

.error-details {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: var(--space-xs);
}

.error-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: calc(24px + var(--font-size-step));
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin-left: var(--space-sm);
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.error-close:hover {
  color: var(--ink);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .error-toast,
  .success-toast {
    left: var(--space-md);
    right: var(--space-md);
    top: var(--space-md);
    max-width: none;
  }
}
/* ==========================================================
   Touch press feedback — touch screens only (pointer: coarse)
   Immediate visual response on tap for a native-app feel.
   No impact on mouse/desktop interactions.
   ========================================================== */
@media (pointer: coarse) {
  .btn:active,
  .theme-toggle:active {
    transform: scale(0.95);
    filter: brightness(0.80);
    transition: transform 0ms, filter 0ms;
  }

  .game-toggle:active {
    transform: scale(0.92);
    filter: brightness(0.75);
    transition: transform 0ms, filter 0ms;
  }

  .entry-switcher-btn:active {
    transform: scale(0.96);
    filter: brightness(0.82);
    transition: transform 0ms, filter 0ms;
  }}

/* =========================
   Swipe-to-delete + Professional UX Polish
   Appended from main.css
   ========================= */

/* ---- Swipe-to-delete: touch devices only ---- */

/* Hide the regular delete button on touch; show on pointer:fine (mouse) */
@media (pointer: fine) {
  .swipe-delete-btn { display: none; }
}

@media (pointer: coarse) {
  .player-delete-btn { display: none !important; }

  .player-row > td:first-child {
    position: relative;
    overflow: hidden;
  }

  .player-row > td:first-child > .name-cell-container {
    transition: transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
  }

  .player-row.swipe-open > td:first-child > .name-cell-container {
    transform: translateX(-72px);
  }

  .swipe-delete-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 72px;
    background: #ff3b30;
    color: #fff;
    border: none;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 2;
    touch-action: manipulation;
  }

  .player-row.swipe-open .swipe-delete-btn {
    transform: translateX(0);
  }

  .swipe-delete-btn:active {
    background: #c0392b;
  }
}
/* ---- Responsive: compact game toggles on narrow phones (≤ 480px) ---- */
@media (max-width: 480px) {  .game-toggle-label {
    font-size: 11px;
  }
}
/* ---- Utilities accordion toggle: list-row treatment ---- */
.utilities-toggle-btn {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.015em;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: var(--radius-lg);
}

/* Chevron indicator on utilities toggles */
.utilities-toggle-btn::after {
  content: '›';
  margin-left: auto;
  font-size: 18px;
  line-height: 1;
  opacity: 0.5;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* =========================================================================
   Light theme overrides — moved from light-theme-overrides.css. Re-defines
   --bg/--panel-alt/--line (this file loads after main.css), so these win
   over the values set in main.css's light-theme block.
   ========================================================================= */

:root[data-theme="light"] .icon-theme-sun { display: none; }

/* Light theme: refined color palette */
:root[data-theme="light"] {
  --bg: #f0f4f8;         /* was #dbe3ea - cleaner, lighter */
  --panel-alt: #e2eaf3;  /* was #e8eef4 */
  --line: #c5d1de;       /* was #b7c2cd - slightly lighter */
}

/* Light theme: card elevation via subtle shadows */
:root[data-theme="light"] .scorecard-container {
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.05);
}

:root[data-theme="light"] .control {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

:root[data-theme="light"] .scorecard-card-footer {
  box-shadow: 0 -1px 0 rgba(15, 23, 42, 0.06);
}

/* Light theme: inactive tab (the .active variants live in game-shell.css
   alongside the rest of the .entry-switcher-btn light rules). */
:root[data-theme="light"] .entry-switcher-btn:not(.active) {
  color: #64748b;
}

/* Light theme: btn default improvement */
:root[data-theme="light"] .btn:not(.accent):not(.active):not(.is-open) {
  background: #ffffff;
  border-color: #c5d1de;
  color: #1e293b;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

:root[data-theme="light"] .btn:not(.accent):not(.active):not(.is-open):hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* Light theme: header area polish */
:root[data-theme="light"] .top-pinned-shell {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
}

/* Light theme: footer shells polish */
:root[data-theme="light"] .scorecard-controls-shell,
:root[data-theme="light"] .games-controls-shell {
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.06);
}

/* Light theme: error/success toast surfaces */
:root[data-theme="light"] .error-toast,
:root[data-theme="light"] .success-toast {
  background: #ffffff;
  border-color: #d3d7dc;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

:root[data-theme="light"] .error-message,
:root[data-theme="light"] .success-message {
  color: #1a1c1f;
}

:root[data-theme="light"] .error-details {
  color: #6c757d;
}

:root[data-theme="light"] .error-close {
  color: #6c757d;
}

:root[data-theme="light"] .error-close:hover {
  color: #1a1c1f;
}