/* ─── Alors en fait! — Common Styles ─────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Inter:wght@300;400;500;600;700;800&family=Fira+Code:wght@400;500&display=swap');

:root {
  /* Core palette - Um Actually inspired: dark backgrounds with vibrant pops */
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: #0f3460;
  --bg-elevated: #533483;

  /* Accent colors - Bold, saturated comic book style */
  --accent-primary: #ff4757;
  --accent-secondary: #ffa502;
  --accent-tertiary: #2ed573;
  --accent-gold: #ffeb3b;
  --accent-orange: #ff6348;

  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #e0e0e0;
  --text-muted: #b0b0c0;

  /* States */
  --success: #2ed573;
  --error: #ff3838;
  --warning: #ffa502;
  --info: #00d2d3;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Fonts */
  --font-display: 'Bangers', cursive;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Fira Code', monospace;

  /* Shadows - Bold, vibrant glows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.8);
  --shadow-glow-accent: 0 0 30px rgba(255, 71, 87, 0.5), 0 0 60px rgba(255, 71, 87, 0.2);
  --shadow-glow-success: 0 0 30px rgba(46, 213, 115, 0.5), 0 0 60px rgba(46, 213, 115, 0.2);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background:
    repeating-linear-gradient(
      45deg,
      #1a1a2e,
      #1a1a2e 10px,
      #16213e 10px,
      #16213e 20px
    );
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Typography ────────────────────────────────────── */

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: 1px;
}

.title-xl {
  font-size: 3rem;
  background: linear-gradient(135deg, #ff4757 0%, #ffa502 50%, #2ed573 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(255, 71, 87, 0.3);
  filter: drop-shadow(0 0 20px rgba(255, 165, 2, 0.2));
}

.title-lg { font-size: 2rem; }
.title-md { font-size: 1.5rem; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 0.875rem; }

/* ─── Buttons ───────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border: 3px solid;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  position: relative;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.5);
}
.btn:active {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #ff4757, #ff6348);
  color: white;
  border-color: #ff2e42;
  box-shadow: var(--shadow-glow-accent), 0 4px 0 #ff2e42;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #ff6348, #ff8c7b);
  box-shadow: var(--shadow-glow-accent), 0 6px 0 #ff2e42;
}

.btn-secondary {
  background: linear-gradient(135deg, #ffa502, #ffc107);
  color: #1a1a2e;
  border-color: #ff8c00;
  box-shadow: 0 0 20px rgba(255, 165, 2, 0.4), 0 4px 0 #ff8c00;
}
.btn-secondary:hover {
  background: linear-gradient(135deg, #ffc107, #ffd54f);
  box-shadow: 0 0 30px rgba(255, 165, 2, 0.6), 0 6px 0 #ff8c00;
}

.btn-success {
  background: linear-gradient(135deg, #2ed573, #1dd1a1);
  color: #1a1a2e;
  border-color: #10ac84;
  box-shadow: 0 0 20px rgba(46, 213, 115, 0.4), 0 4px 0 #10ac84;
}
.btn-success:hover {
  background: linear-gradient(135deg, #1dd1a1, #00d2d3);
  box-shadow: 0 0 30px rgba(46, 213, 115, 0.6), 0 6px 0 #10ac84;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(255, 71, 87, 0.3);
}
.btn-ghost:hover {
  background: rgba(255, 71, 87, 0.2);
  border-color: var(--accent-secondary);
  box-shadow: 0 0 25px rgba(255, 165, 2, 0.4);
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: 1.125rem;
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: 0.875rem;
}

/* ─── Input Fields ──────────────────────────────────── */

.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.input-group label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
textarea,
select {
  padding: var(--space-sm) var(--space-md);
  background: rgba(15, 52, 96, 0.8);
  border: 2px solid #ffa502;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #ff4757;
  background: rgba(15, 52, 96, 0.95);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 71, 87, 0.3);
}

/* ─── Cards ─────────────────────────────────────────── */

.card {
  background: linear-gradient(135deg, #0f3460, #16213e);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 165, 2, 0.3);
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #ff4757, #ffa502, #2ed573);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.card-elevated {
  background: linear-gradient(135deg, #533483, #6c4b7a);
  border-color: rgba(255, 165, 2, 0.4);
}

/* ─── Room Code Display ─────────────────────────────── */

.room-code {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 12px;
  color: #ffeb3b;
  text-shadow:
    0 0 20px rgba(255, 235, 59, 0.6),
    0 0 40px rgba(255, 165, 2, 0.4),
    2px 2px 0 rgba(0, 0, 0, 0.8),
    4px 4px 0 rgba(255, 71, 87, 0.3);
  font-style: italic;
}

/* ─── Scoreboard ────────────────────────────────────── */

.scoreboard {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.score-entry {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: linear-gradient(135deg, rgba(15, 52, 96, 0.8), rgba(22, 33, 62, 0.8));
  border: 2px solid #ffa502;
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.score-entry:hover {
  transform: translateY(-3px);
  border-color: #ff4757;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 71, 87, 0.3);
}

.score-entry .rank {
  font-family: var(--font-display);
  font-size: 1.8rem;
  min-width: 3rem;
  text-align: center;
  font-weight: 900;
}

.score-entry .rank.gold {
  color: #ffeb3b;
  text-shadow: 0 0 10px rgba(255, 235, 59, 0.6);
}
.score-entry .rank.silver {
  color: #e0e0e0;
  text-shadow: 0 0 10px rgba(224, 224, 224, 0.4);
}
.score-entry .rank.bronze {
  color: #ff8c42;
  text-shadow: 0 0 10px rgba(255, 140, 66, 0.5);
}

.score-entry .player-name {
  flex: 1;
  font-weight: 500;
}

.score-entry .player-score {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--accent-tertiary);
}

.score-entry .avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--bg-elevated);
}

/* ─── Animations ────────────────────────────────────── */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 10px #ff4757, 0 4px 0 rgba(0, 0, 0, 0.3); }
  50% { box-shadow: 0 0 30px #ff4757, 0 0 60px rgba(255, 71, 87, 0.3), 0 4px 0 rgba(0, 0, 0, 0.3); }
}

@keyframes popIn {
  0% { transform: scale(0.7) rotate(-5deg); opacity: 0; }
  50% { transform: scale(1.1) rotate(2deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes comicBounce {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(-8px) scaleY(0.95); }
}

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

.animate-fadeIn { animation: fadeIn 0.4s ease-out; }
.animate-slideInLeft { animation: slideInLeft 0.4s ease-out; }
.animate-slideInRight { animation: slideInRight 0.4s ease-out; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-glow { animation: glow 2s ease-in-out infinite; }
.animate-shake { animation: shakeX 0.5s ease-in-out; }
.animate-popIn { animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
.animate-comicBounce { animation: comicBounce 0.6s ease-in-out infinite; }

/* ─── Utility ───────────────────────────────────────── */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.text-center { text-align: center; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-md { margin-bottom: var(--space-md); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

/* ─── Toasts / Notifications ────────────────────────── */

.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-weight: 500;
  animation: slideInRight 0.3s ease-out;
  box-shadow: var(--shadow-lg);
}

.toast-success { background: var(--success); color: var(--bg-primary); }
.toast-error { background: var(--error); color: white; }
.toast-info { background: var(--info); color: var(--bg-primary); }
.toast-warning { background: var(--warning); color: var(--bg-primary); }

/* ─── Responsive ────────────────────────────────────── */

@media (max-width: 768px) {
  :root {
    --space-lg: 16px;
    --space-xl: 24px;
  }
  .title-xl { font-size: 2rem; }
  .room-code { font-size: 2rem; letter-spacing: 6px; }
}
