/*
 * Cogg Game Platform
 * Copyright (c) 2026 Greg Strelzoff / Cogg. All rights reserved.
 * Proprietary and confidential.
 *
 * game-chrome.css
 *   Shared chrome for all game pages (solo + multiplayer).
 *   Universal states only. Game specific status variants live inline
 *   in each game's page. Examples that stay inline:
 *     .status-bar.check       (chess, xiangqi)
 *     .status-bar.must-take   (checkers)
 *     .status-bar.placement   (battleship, foxandhounds)
 *     .status-bar.phase-prod  (beyondthesun)
 *     .status-bar.game-over-win / .game-over-lose (cor)
 *
 *   Inline overrides are also fine. Xiangqi for example overrides
 *   .status-bar.your-turn to red for its themed palette; that override
 *   in xiangqi's <style> block wins via source order (this file is
 *   loaded via <link> before any inline <style>).
 */

/* ---------- Topbar ---------- */
.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid var(--outline);
  border-radius: 14px;
  padding: 10px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--outline);
  background: var(--panel2);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none !important;
}
.home-btn:hover { filter: brightness(.95); text-decoration: none !important; }

.room-badge {
  font-family: monospace;
  font-size: 13px;
  font-weight: 700;
  background: var(--panel2);
  border: 1px solid var(--outline);
  border-radius: 8px;
  padding: 4px 10px;
  color: var(--text);
  letter-spacing: .08em;
  white-space: nowrap;
  flex-shrink: 0;
}

.dark-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--outline);
  background: var(--panel2);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.dark-toggle:hover { filter: brightness(.95); }

/* ---------- Status bar (base + universal states) ---------- */
.status-bar {
  text-align: center;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  border: 1px solid var(--outline);
  background: var(--panel2);
  color: var(--text);
  transition: background .2s, border-color .2s, color .2s;
  position: relative;
  overflow: hidden;
}

.status-bar.your-turn   { background: #EFF6FF; border-color: #93C5FD; color: #1E40AF; }
.status-bar.their-turn  { background: var(--panel2); color: var(--sub); }
.status-bar.ai-turn     { background: var(--panel2); color: var(--sub); }
.status-bar.waiting     { background: var(--panel2); color: var(--sub); }
.status-bar.win         { background: #DCFCE7; border-color: #86EFAC; color: #166534; }
.status-bar.lose        { background: #FEF2F2; border-color: #FCA5A5; color: #991B1B; }
.status-bar.draw        { background: #EFF6FF; border-color: #93C5FD; color: #1E40AF; }

body.dark .status-bar.your-turn { background: #172340; border-color: #1E40AF; color: #93C5FD; }
body.dark .status-bar.win       { background: #0F2218; border-color: #166534; color: #86EFAC; }
body.dark .status-bar.lose      { background: #2D1010; border-color: #991B1B; color: #FCA5A5; }
body.dark .status-bar.draw      { background: #0F1F38; border-color: #1E40AF; color: #93C5FD; }

/* ---------- Toast (ephemeral pre game settings confirmation) ---------- */
.cogg-toast-host {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.cogg-toast {
  background: rgba(17, 24, 39, .92);
  color: #F1F5F9;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .01em;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .25);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  max-width: 320px;
  text-align: center;
  pointer-events: none;
}
.cogg-toast.cogg-toast-in  { opacity: 1; transform: translateY(0); }
.cogg-toast.cogg-toast-out { opacity: 0; transform: translateY(-4px); transition: opacity .25s ease, transform .25s ease; }

body.dark .cogg-toast {
  background: rgba(241, 245, 249, .94);
  color: #0F172A;
  border-color: rgba(0, 0, 0, .08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .45);
}

@media (max-width: 600px) {
  .cogg-toast-host { bottom: 16px; }
  .cogg-toast { font-size: 12px; padding: 7px 12px; }
}

/* ---------- Confirm dialog (mid game settings change protection) ---------- */
.cogg-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: coggConfirmFadeIn .15s ease;
}
@keyframes coggConfirmFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cogg-confirm-box {
  background: var(--panel);
  border: 1px solid var(--outline);
  border-radius: 14px;
  padding: 22px 26px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .35);
  max-width: 420px;
  width: calc(100% - 32px);
  color: var(--text);
}
.cogg-confirm-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
  line-height: 1.3;
}
.cogg-confirm-sub {
  font-size: 13px;
  color: var(--sub);
  margin-bottom: 18px;
  line-height: 1.4;
}
.cogg-confirm-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.cogg-confirm-btn {
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--outline);
  transition: filter .15s, transform .05s;
  font-family: inherit;
}
.cogg-confirm-btn:hover  { filter: brightness(1.05); }
.cogg-confirm-btn:active { transform: translateY(1px); }
.cogg-confirm-secondary {
  background: var(--panel2);
  color: var(--text);
}
.cogg-confirm-primary {
  background: #2563EB;
  color: #FFFFFF;
  border-color: #1D4ED8;
}
body.dark .cogg-confirm-primary {
  background: #3B82F6;
  border-color: #2563EB;
}
.cogg-confirm-btn:focus-visible {
  outline: 2px solid #60A5FA;
  outline-offset: 2px;
}
