/* ============================================================
   TopChess.org – Puzzles page styles
   ============================================================ */

/* Page layout */
.puzzles-page .main {
  min-height: 100vh;
}

/* ---- Header ------------------------------------------------ */
.puzzles-header {
  text-align: center;
  padding: 2rem 1.5rem 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.puzzles-title {
  font-size: 2rem;
  font-weight: 900;
  color: var(--text-white);
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 0 rgba(0,0,0,.5);
}

.puzzles-subtitle {
  font-size: 1.05rem;
  color: rgba(255,255,255,.75);
  margin-bottom: 1.5rem;
}

/* ---- Filters ----------------------------------------------- */
.puzzle-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
  padding: 0 1.5rem 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.filter-label {
  color: rgba(255,255,255,.8);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.diff-btn {
  padding: 0.45rem 1rem;
  border: 2px solid rgba(255,255,255,.25);
  border-radius: var(--radius-full);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.85);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.diff-btn:hover {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.5);
}

.diff-btn.active {
  background: var(--primary);
  border-color: var(--primary-light);
  color: #fff;
}

.diff-btn.active.easy   { background: #22c55e; border-color: #16a34a; }
.diff-btn.active.normal { background: #3b82f6; border-color: #2563eb; }
.diff-btn.active.medium { background: #f59e0b; border-color: #d97706; }
.diff-btn.active.hard   { background: #ef4444; border-color: #dc2626; }
.diff-btn.active.expert { background: #8b5cf6; border-color: #7c3aed; }
.diff-btn.active.all    { background: var(--primary); border-color: var(--primary-light); }

.theme-select {
  padding: 0.45rem 0.9rem;
  border: 2px solid rgba(255,255,255,.25);
  border-radius: var(--radius-full);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: var(--transition-fast);
  min-width: 160px;
}

.theme-select:focus,
.theme-select:hover {
  border-color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.15);
}

.theme-select option {
  background: #1e293b;
  color: #fff;
}

/* ---- Main puzzle layout ------------------------------------ */
.puzzle-main {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  align-items: start;
}

@media (max-width: 768px) {
  .puzzle-main {
    grid-template-columns: 1fr;
  }
}

/* ---- Board wrapper ---------------------------------------- */
.puzzle-board-wrap {
  position: relative;
}

#puzzleBoard {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-2xl), 0 0 60px rgba(0,76,153,.3);
}

/* ---- Info panel ------------------------------------------- */
.puzzle-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255,255,255,.12);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.puzzle-id {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: monospace;
}

.puzzle-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
}

.meta-badge.rating {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #86efac;
}

.meta-badge.theme {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.puzzle-status {
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  text-align: center;
  min-height: 2.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.puzzle-status.info     { background: #eff6ff; color: #1d4ed8; }
.puzzle-status.correct  { background: #f0fdf4; color: #15803d; }
.puzzle-status.wrong    { background: #fef2f2; color: #dc2626; }
.puzzle-status.loading  { background: #f8fafc; color: var(--text-light); }

/* ---- Buttons ---------------------------------------------- */
.puzzle-controls {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.puzzle-btn {
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.puzzle-btn.primary {
  background: var(--primary);
  color: #fff;
}
.puzzle-btn.primary:hover { background: var(--primary-light); }

.puzzle-btn.secondary {
  background: #f1f5f9;
  color: var(--text-dark);
  border: 1px solid #e2e8f0;
}
.puzzle-btn.secondary:hover { background: #e2e8f0; }

.puzzle-btn.success {
  background: #22c55e;
  color: #fff;
}
.puzzle-btn.success:hover { background: #16a34a; }

.puzzle-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ---- Stats bar -------------------------------------------- */
.puzzle-stats-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
}

/* ---- Login hint banner ------------------------------------ */
.puzzle-login-hint {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fcd34d;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
}

.login-hint-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.login-hint-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
  color: #92400e;
}

.login-hint-body strong {
  font-size: 0.9rem;
  font-weight: 700;
  color: #78350f;
}

.login-hint-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  background: #fff;
  border: 1.5px solid #fbbf24;
  border-radius: var(--radius-full);
  color: #92400e;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.login-hint-btn:hover {
  background: #fef3c7;
  border-color: #f59e0b;
}

/* ---- XP Toast --------------------------------------------- */
.xp-toast {
  position: fixed;
  top: 80px;
  right: 20px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2xl);
  z-index: 9999;
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transform: translateX(120%);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 180px;
}

.xp-toast.show {
  transform: translateX(0);
}

.xp-toast-title { font-size: 1.3rem; }
.xp-toast-sub   { font-size: 0.85rem; opacity: .85; font-weight: 600; }

/* ---- All-solved message ----------------------------------- */
.all-solved-msg {
  text-align: center;
  padding: 2rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  color: var(--text-dark);
  display: none;
}

.all-solved-msg.show { display: block; }

/* ---- Streak indicator ------------------------------------- */
.streak-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: rgba(255,255,255,.9);
}

.streak-count {
  font-size: 1.1rem;
  color: #fbbf24;
}

/* ---- Loading skeleton ------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
