/*
 * Copyright 2026 Antigravity IDE
 * Premium styles for Othello XOT Trainer
 */

:root {
  --bg-gradient: linear-gradient(135deg, #090d16 0%, #0f172a 60%, #1e1b4b 100%);
  --panel-bg: rgba(15, 23, 42, 0.45);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  
  --board-bg: #14532d;
  --board-grid: #166534;
  --board-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.6), 0 10px 30px rgba(0, 0, 0, 0.5);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  
  --color-primary: #3b82f6; /* Modern Blue */
  --color-primary-hover: #60a5fa;
  --color-secondary: rgba(255, 255, 255, 0.08);
  --color-secondary-hover: rgba(255, 255, 255, 0.15);
  
  --color-success: #10b981; /* Green */
  --color-warning: #f59e0b; /* Gold/Amber */
  --color-danger: #ef4444;  /* Red */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.3);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.app-container {
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 16px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 40px;
  color: var(--color-primary);
  text-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.logo-text h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(120deg, #f8fafc, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Streak Badge */
.streak-badge {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 16px;
  padding: 8px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.05);
}

.streak-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--color-warning);
}

.streak-value {
  font-size: 26px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: #fff;
  line-height: 1;
  margin-top: 2px;
}

/* Main Layout */
.main-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
}

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

/* Board Section */
.board-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.board-wrapper {
  background: rgba(15, 23, 42, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 12px 18px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.board-middle {
  display: flex;
  align-items: center;
}

.board-labels {
  display: flex;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  user-select: none;
}

.board-labels.cols {
  width: 400px;
  justify-content: space-around;
  padding: 6px 0;
}

.board-labels.rows {
  flex-direction: column;
  height: 400px;
  justify-content: space-around;
  width: 24px;
}

.board-labels.rows.right-labels {
  text-align: right;
}

/* The Board Grid */
.board {
  display: grid;
  grid-template-columns: repeat(8, 50px);
  grid-template-rows: repeat(8, 50px);
  width: 400px;
  height: 400px;
  background-color: var(--board-bg);
  box-shadow: var(--board-shadow);
  border-radius: 12px;
  overflow: hidden;
  border: 4px solid #0f3d21;
}

/* Individual Squares */
.square {
  width: 100%;
  height: 100%;
  border: 1px solid var(--board-grid);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: background-color 0.2s;
}

.square:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Visual cue for clickable valid moves (during player's turn) */
.square.playable::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  pointer-events: none;
  transition: transform 0.2s, background-color 0.2s;
}

.square.playable:hover::after {
  transform: scale(1.8);
  background-color: rgba(255, 255, 255, 0.4);
}

/* Disks */
.disk {
  width: 86%;
  height: 86%;
  border-radius: 50%;
  display: none;
  position: relative;
  z-index: 2;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.disk.black {
  display: block;
  background: radial-gradient(circle at 30% 30%, #3d4a5c 0%, #0f172a 70%, #020617 100%);
  animation: diskPlace 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.disk.white {
  display: block;
  background: radial-gradient(circle at 30% 30%, #ffffff 0%, #e2e8f0 60%, #94a3b8 100%);
  animation: diskPlace 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Turn indicators (small dot on top of disks if needed) */
.disk::after {
  content: '';
  position: absolute;
  top: 6%;
  left: 6%;
  right: 6%;
  bottom: 6%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

/* Animation for placing a disk */
@keyframes diskPlace {
  0% { transform: scale(0.3) rotateY(90deg); opacity: 0; }
  100% { transform: scale(1) rotateY(0deg); opacity: 1; }
}

/* Wrong Move highlight */
.square.wrong-play {
  background-color: rgba(239, 68, 68, 0.2) !important;
}

.square.wrong-play::after {
  content: 'close';
  font-family: 'Material Symbols Rounded';
  font-size: 24px;
  color: var(--color-danger);
  position: absolute;
  z-index: 10;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* Evaluation Annotation (revealed overlay) */
.annotation {
  position: absolute;
  z-index: 10;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.85);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* Optimal move highlighting on solution reveal */
.square.optimal-move {
  box-shadow: inset 0 0 0 3px var(--color-warning);
}

.square.optimal-move .annotation {
  color: var(--color-warning);
  border-color: var(--color-warning);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

/* Cards (Right hand layout) */
.card {
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card:last-child {
  margin-bottom: 0;
}

.glass {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* Status Card styling */
.status-card {
  gap: 12px;
  background: rgba(15, 23, 42, 0.6);
}

.status-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--text-secondary);
}

.status-dot.pulsing {
  background-color: var(--color-primary);
  box-shadow: 0 0 10px var(--color-primary);
  animation: pulse 1.8s infinite alternate;
}

.status-dot.success {
  background-color: var(--color-success);
  box-shadow: 0 0 10px var(--color-success);
}

.status-dot.warning {
  background-color: var(--color-warning);
  box-shadow: 0 0 10px var(--color-warning);
}

.status-dot.danger {
  background-color: var(--color-danger);
  box-shadow: 0 0 10px var(--color-danger);
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.2); opacity: 1; }
}

.message-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  border-left: 3px solid rgba(255, 255, 255, 0.1);
}

.message-box.correct {
  color: #fff;
  border-left-color: var(--color-success);
  background: rgba(16, 185, 129, 0.05);
}

.message-box.incorrect {
  color: #fff;
  border-left-color: var(--color-danger);
  background: rgba(239, 68, 68, 0.05);
}

/* Configuration dropdown styling */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
}

.select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

select {
  width: 100%;
  appearance: none;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  color: #fff;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.select-arrow {
  position: absolute;
  right: 14px;
  color: var(--text-secondary);
  pointer-events: none;
}

/* Buttons */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  padding: 14px 20px;
  cursor: pointer;
  border: none;
  outline: none;
  transition: transform 0.15s, background-color 0.2s, box-shadow 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-hover);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background-color: var(--color-secondary);
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-secondary-hover);
}

.btn-tertiary {
  background-color: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 8px;
  align-self: center;
}

.btn-tertiary:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.05);
}

.btn .material-symbols-rounded {
  font-size: 20px;
}

/* Stats Dashboard */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.stat-item {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.stat-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-val {
  font-size: 16px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: #fff;
}
