/* ═══════════════════════════════════════════════════════════
   CHESS OX — Play Page Premium Styles
   Glassmorphism cards, scale hover effects, glow states,
   consistent spacing, and full light/dark theme support.
   ═══════════════════════════════════════════════════════════ */

/* ─── Layout Override ──────────────────────────────────────── */
.main-content > * { position: relative; z-index: 1; }

/* Dashboard container on play page — tighter top padding */
.dashboard-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 120px 28px 80px 28px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  z-index: 10;
}

/* Play layout grid: wider board, narrower right panel */
.settings-wrapper {
  display: grid;
  grid-template-columns: 1.35fr 1fr !important;
  gap: 36px !important;
  align-items: start;
  width: 100%;
}

/* ─── Preview Board Panel ──────────────────────────────────── */
.preview-panel {
  position: sticky !important;
  top: 110px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: flex-start !important;
  padding-top: 0 !important;
  width: 100% !important;
}

.ps-preview-board-outer {
  width: 100% !important;
  max-width: 620px !important;
  aspect-ratio: 1 / 1 !important;
  padding: 10px !important;
  border-radius: 12px !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 4px 16px rgba(0, 0, 0, 0.5) !important;
  background: rgba(30, 40, 55, 0.6) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
}

.ps-preview-board-wrap {
  width: 100% !important;
  height: 100% !important;
}

.ps-preview-board {
  display: grid !important;
  grid-template-columns: repeat(8, 1fr) !important;
  grid-template-rows: repeat(8, 1fr) !important;
  width: 100% !important;
  height: 100% !important;
  border: 1px solid rgba(0, 0, 0, 0.7) !important;
  border-radius: 4px !important;
  overflow: hidden !important;
}

/* ─── Right Column Cards ────────────────────────────────────── */
.card {
  background: var(--bg-glass) !important;
  backdrop-filter: blur(24px) saturate(1.4) !important;
  -webkit-backdrop-filter: blur(24px) saturate(1.4) !important;
  border: 1px solid var(--border-medium) !important;
  border-radius: 14px !important;
  padding: 20px 20px 18px 20px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255,255,255,0.05) inset !important;
  transition: border-color 0.25s ease, box-shadow 0.25s ease !important;
  margin-bottom: 16px !important;
}

.card:hover {
  border-color: rgba(212, 168, 67, 0.22) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255,255,255,0.07) inset !important;
}

/* Light theme card override */
[data-theme="light"] .card {
  background: rgba(255, 255, 255, 0.88) !important;
  border-color: rgba(0, 0, 0, 0.10) !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 0 rgba(255,255,255,0.9) inset !important;
}

[data-theme="light"] .card:hover {
  border-color: rgba(163, 118, 26, 0.30) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 1px 0 rgba(255,255,255,0.9) inset !important;
}

/* ─── Card Title ────────────────────────────────────────────── */
.card-title {
  font-family: var(--font-display) !important;
  font-size: 11px !important;
  letter-spacing: 1.6px !important;
  color: var(--text-muted) !important;
  text-transform: uppercase !important;
  margin-bottom: 14px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-weight: 700 !important;
}

.card-title::before {
  content: '' !important;
  width: 3px !important;
  height: 13px !important;
  background: var(--gold) !important;
  border-radius: 2px !important;
  box-shadow: 0 0 8px rgba(212, 168, 67, 0.50) !important;
  flex-shrink: 0 !important;
}

/* ─── Mode Cards (Game Mode row) ─────────────────────────────── */
.mode-tabs-container {
  display: flex !important;
  gap: 6px !important;
  padding: 5px !important;
  border-radius: 12px !important;
  border: 1px solid var(--border-subtle) !important;
  background: var(--bg-sunken) !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
}

.mode-tabs-container::-webkit-scrollbar { display: none !important; }

/* Light mode tabs bg */
[data-theme="light"] .mode-tabs-container {
  background: rgba(0,0,0,0.04) !important;
  border-color: rgba(0,0,0,0.08) !important;
}

.mode-card {
  flex: 1 !important;
  padding: 12px 8px !important;
  min-height: auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  border: 1.5px solid transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 9px !important;
  cursor: pointer !important;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1) !important;
  color: var(--text-muted) !important;
  min-width: 60px !important;
}

.mode-card i {
  font-size: 20px !important;
  transition: color 0.22s ease, transform 0.22s ease !important;
}

.mode-card div {
  font-size: 11px !important;
  font-weight: 600 !important;
  transition: color 0.22s ease !important;
}

/* Hover state */
.mode-card:hover {
  background: rgba(212, 168, 67, 0.08) !important;
  border-color: rgba(212, 168, 67, 0.25) !important;
  color: var(--gold) !important;
  transform: scale(1.03) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.20) !important;
}

.mode-card:hover i { color: var(--gold) !important; transform: scale(1.08) !important; }
.mode-card:hover div { color: var(--gold) !important; }

/* Active / selected state */
.mode-card.selected {
  background: rgba(212, 168, 67, 0.14) !important;
  border-color: rgba(212, 168, 67, 0.50) !important;
  color: var(--gold) !important;
  box-shadow: 0 0 0 1px rgba(212, 168, 67, 0.20), 0 4px 18px rgba(212, 168, 67, 0.15) !important;
}

.mode-card.selected i { color: var(--gold) !important; }
.mode-card.selected div { color: var(--gold) !important; }

/* Active (click) state */
.mode-card:active {
  transform: scale(0.97) !important;
  transition: transform 0.10s ease !important;
}

/* Light mode mode-card */
[data-theme="light"] .mode-card:hover {
  background: rgba(163, 118, 26, 0.10) !important;
  border-color: rgba(163, 118, 26, 0.35) !important;
}

[data-theme="light"] .mode-card.selected {
  background: rgba(163, 118, 26, 0.12) !important;
  border-color: rgba(163, 118, 26, 0.55) !important;
  box-shadow: 0 0 0 1px rgba(163, 118, 26, 0.20), 0 4px 18px rgba(163, 118, 26, 0.15) !important;
}

/* ─── Timer Grid ────────────────────────────────────────────── */
.timer-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 8px !important;
  margin: 8px 0 16px 0 !important;
}

.timer-btn {
  flex: 1 !important;
  padding: 14px 8px 10px 8px !important;
  background: var(--bg-card) !important;
  border: 1.5px solid var(--border-subtle) !important;
  border-radius: 11px !important;
  cursor: pointer !important;
  text-align: center !important;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1) !important;
  font-family: var(--font-display) !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  color: var(--text-muted) !important;
  position: relative !important;
  overflow: hidden !important;
}

.timer-btn:focus-visible {
  outline: 2px solid var(--gold) !important;
  outline-offset: 2px !important;
}

/* Light mode timer btn base */
[data-theme="light"] .timer-btn {
  background: rgba(255,255,255,0.7) !important;
  border-color: rgba(0,0,0,0.10) !important;
}

.timer-btn:hover {
  border-color: rgba(212, 168, 67, 0.45) !important;
  color: var(--gold) !important;
  background: rgba(212, 168, 67, 0.08) !important;
  transform: scale(1.03) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.22), 0 0 0 1px rgba(212,168,67,0.12) !important;
}

.timer-btn:active {
  transform: scale(0.97) !important;
  transition: transform 0.10s ease !important;
}

.timer-btn.selected {
  border-color: var(--gold) !important;
  color: var(--gold) !important;
  background: rgba(212, 168, 67, 0.12) !important;
  box-shadow: 0 0 0 1px rgba(212,168,67,0.25), 0 6px 22px rgba(212,168,67,0.20) !important;
}

.timer-btn.selected .timer-sub { color: var(--gold) !important; opacity: 0.85 !important; }

/* Light mode selected timer */
[data-theme="light"] .timer-btn.selected {
  background: rgba(163, 118, 26, 0.12) !important;
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 1px rgba(163, 118, 26, 0.25), 0 6px 22px rgba(163, 118, 26, 0.18) !important;
}

[data-theme="light"] .timer-btn:hover {
  background: rgba(163, 118, 26, 0.08) !important;
  border-color: rgba(163, 118, 26, 0.45) !important;
}

.timer-btn .timer-sub {
  font-family: var(--font-body) !important;
  font-size: 10px !important;
  color: var(--text-muted) !important;
  font-weight: 500 !important;
  margin-top: 3px !important;
  display: block !important;
  transition: color 0.22s ease !important;
}

/* ─── Find Match Button ─────────────────────────────────────── */
.btn.btn-primary.btn-full.btn-lg {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  padding: 16px 24px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  letter-spacing: 0.6px !important;
  border-radius: 12px !important;
  background: var(--gold) !important;
  color: #0d0d0d !important;
  border: none !important;
  cursor: pointer !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 4px 18px rgba(212, 168, 67, 0.35), 0 1px 4px rgba(0,0,0,0.2) !important;
  position: relative !important;
  z-index: 10 !important;
  overflow: hidden !important;
  margin-top: 4px !important;
}

.btn.btn-primary.btn-full.btn-lg::before {
  content: '' !important;
  position: absolute !important;
  inset: 0 !important;
  background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 60%) !important;
  pointer-events: none !important;
}

.btn.btn-primary.btn-full.btn-lg:hover {
  background: var(--gold-light) !important;
  transform: scale(1.03) translateY(-2px) !important;
  box-shadow: 0 8px 30px rgba(212, 168, 67, 0.50), 0 2px 8px rgba(0,0,0,0.25) !important;
}

.btn.btn-primary.btn-full.btn-lg:active {
  transform: scale(0.98) translateY(0) !important;
  box-shadow: 0 2px 10px rgba(212, 168, 67, 0.30) !important;
  transition: all 0.10s ease !important;
}

.btn.btn-primary.btn-full.btn-lg:focus-visible {
  outline: 2px solid rgba(212,168,67,0.70) !important;
  outline-offset: 3px !important;
}

.match-status-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 0 4px 0;
  color: var(--text-muted);
  pointer-events: none;
  text-align: center;
}

.match-status-area .status-icon {
  font-size: 22px;
  opacity: 0.65;
}

.match-status-area .status-text {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
  max-width: 200px;
}

/* ─── Bot Grid ──────────────────────────────────────────────── */
.bot-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 10px !important;
}

.bot-btn {
  padding: 18px 12px !important;
  background: var(--bg-card) !important;
  border: 1.5px solid var(--border-subtle) !important;
  border-radius: 12px !important;
  cursor: pointer !important;
  text-align: center !important;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.bot-btn:hover {
  border-color: rgba(123, 111, 196, 0.50) !important;
  background: rgba(123, 111, 196, 0.08) !important;
  transform: scale(1.03) !important;
  box-shadow: 0 6px 22px rgba(0,0,0,0.22), 0 0 0 1px rgba(123,111,196,0.18) !important;
}

.bot-btn:active {
  transform: scale(0.97) !important;
  transition: transform 0.10s ease !important;
}

.bot-btn.selected {
  border-color: var(--accent) !important;
  background: rgba(123, 111, 196, 0.12) !important;
  box-shadow: 0 0 0 1px rgba(123,111,196,0.25), 0 6px 22px rgba(123,111,196,0.20) !important;
}

.bot-btn .bot-iq {
  font-family: var(--font-display) !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  color: var(--accent) !important;
  margin-bottom: 4px !important;
}

.bot-btn .bot-name {
  font-size: 10px !important;
  color: var(--text-muted) !important;
  margin-top: 2px !important;
}

/* ─── Panels ────────────────────────────────────────────────── */
.panel { display: none; }
.panel.active { display: block; }

/* ─── Searching Overlay ─────────────────────────────────────── */
.searching-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
}

.searching-overlay.active { display: flex; }

.search-spinner {
  width: 76px;
  height: 76px;
  border: 3px solid rgba(212, 168, 67, 0.12);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Border classes for board preview ─────────────────────── */
.border-wood  { border: 14px solid #5c3a21 !important; box-shadow: inset 0 0 10px #000 !important; }
.border-metal { border: 14px solid #717c80 !important; box-shadow: inset 0 0 10px #000 !important; }
.border-gold  { border: 14px solid #d4af37 !important; box-shadow: inset 0 0 15px #000 !important; }
.border-neon  { border: 14px solid #00ffcc !important; box-shadow: 0 0 20px #00ffcc !important; }
.border-marble{ border: 14px solid #e0e0e0 !important; box-shadow: inset 0 0 10px #000 !important; }

/* ─── Square pieces on board preview ───────────────────────── */
.sq {
  display: flex;
  justify-content: center;
  align-items: center;
}

.sq img {
  width: 82%;
  height: 82%;
  object-fit: contain;
  filter: drop-shadow(2px 3px 5px rgba(0, 0, 0, 0.45));
}

/* ─── Light Mode Adjustments ────────────────────────────────── */
[data-theme="light"] .searching-overlay {
  background: rgba(230, 242, 248, 0.94);
}

[data-theme="light"] .ps-preview-board-outer {
  background: rgba(255,255,255,0.75) !important;
  border-color: rgba(0,0,0,0.10) !important;
}

[data-theme="light"] .bot-btn {
  background: rgba(255,255,255,0.70) !important;
  border-color: rgba(0,0,0,0.10) !important;
}

[data-theme="light"] .bot-btn:hover {
  background: rgba(99,85,178,0.08) !important;
  border-color: rgba(99,85,178,0.45) !important;
}

/* ─── Mobile: Navigation overrides ─────────────────────────── */
@media (max-width: 1024px) {
  .nav-links { display: none !important; }
  #mobile-toggle-btn { display: flex !important; align-items: center; justify-content: center; }
  .nav-right > a.nav-icon { display: none !important; }
  .nav-right > div > .notif-btn { display: none !important; }
  .nav-right > div:has(.notif-btn) { display: none !important; }
  #header-avatar-link { display: none !important; }
  .top-header { padding: 0 16px !important; }
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .settings-wrapper {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  .preview-panel {
    position: static !important;
    top: auto !important;
  }

  .ps-preview-board-outer {
    max-width: 480px !important;
    margin: 0 auto !important;
  }
}

@media (max-width: 768px) {
  .dashboard-container {
    padding: 100px 16px 40px 16px !important;
    gap: 0 !important;
  }

  .top-header {
    padding: 0 16px !important;
    height: 70px !important;
  }

  .logo-block { margin-left: 0 !important; }
  .logo-text { font-size: 22px !important; }

  .timer-grid { grid-template-columns: repeat(4, 1fr) !important; }

  .timer-btn {
    min-width: 0 !important;
    font-size: 16px !important;
  }

  .mode-tabs-container { overflow-x: auto !important; }
}

@media (max-width: 480px) {
  .bot-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .timer-grid { grid-template-columns: repeat(4, 1fr) !important; }
  .timer-btn { min-width: 0 !important; font-size: 14px !important; padding: 11px 4px 8px 4px !important; }
}