/* public/css/main.css - Castcade Dark Arcade Theme */
:root {
  --bg-primary: #0a0c16;
  --bg-secondary: #131728;
  --bg-card: #1c223a;
  --bg-glass: rgba(28, 34, 58, 0.85);
  
  --accent-cyan: #00f3ff;
  --accent-pink: #ff007f;
  --accent-gold: #ffd700;
  --accent-green: #00ff88;
  --accent-purple: #9d4edd;
  
  --text-primary: #f0f4fc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --border-glow: 0 0 15px rgba(0, 243, 255, 0.3);
  --border-color: rgba(255, 255, 255, 0.1);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-main: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(0, 243, 255, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(255, 0, 127, 0.08) 0%, transparent 40%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Header & Top Bar */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  flex-shrink: 0;
}

.brand .logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-cyan));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
  font-size: 1rem;
}

.brand-text span:first-child { color: var(--accent-cyan); }
.brand-text span:last-child { color: var(--accent-pink); }

/* Version badge in header */
.version-badge {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-family: var(--font-main);
  letter-spacing: 0.3px;
  vertical-align: middle;
  white-space: nowrap;
}

.user-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.gold-badge {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 140, 0, 0.2));
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  padding: 5px 10px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.avatar-preview {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--accent-cyan);
  object-fit: cover;
  cursor: pointer;
  background: #252b48;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Mobile Header Optimizations */
@media (max-width: 600px) {
  header {
    padding: 6px 10px;
    gap: 6px;
  }
  .brand {
    font-size: 1.1rem;
    gap: 6px;
  }
  .brand .logo-icon {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }
  .header-btn-text {
    display: none;
  }
  .user-status-bar {
    gap: 6px;
  }
  .gold-badge {
    padding: 4px 8px;
    font-size: 0.8rem;
  }
  .avatar-preview {
    width: 30px;
    height: 30px;
    font-size: 1rem;
  }
  #appVersionBadge {
    font-size: 0.5rem;
    padding: 1px 4px;
    margin-left: 4px;
  }
}

/* Equipped Frames */
.avatar-frame-default { border: 2px solid var(--accent-cyan); }
.avatar-frame-frame_gold { border: 3px solid #ffd700; box-shadow: 0 0 12px rgba(255, 215, 0, 0.8); }
.avatar-frame-frame_neon_cyan { border: 3px solid #00f3ff; box-shadow: 0 0 12px rgba(0, 243, 255, 0.9); }
.avatar-frame-frame_flame { border: 3px solid #ff3b00; box-shadow: 0 0 15px rgba(255, 59, 0, 0.9); }
.avatar-frame-frame_rainbow { border: 3px solid transparent; background: linear-gradient(#1c223a, #1c223a) padding-box, linear-gradient(45deg, #ff007f, #00f3ff, #ffe600) border-box; }

/* Main Container */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

/* Sliding Game Details Drawer / Bottom Sheet */
.game-drawer-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(5, 7, 15, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.game-drawer-backdrop.active {
  display: block;
  opacity: 1;
}

.game-drawer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-height: 88vh;
  background: #141829;
  border-top: 2px solid var(--accent-cyan);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
  z-index: 1001;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 768px) {
  .game-drawer {
    top: 0; bottom: 0; right: 0; left: auto;
    width: 480px;
    max-height: 100vh;
    border-top: none;
    border-left: 2px solid var(--accent-cyan);
    border-radius: 0;
    transform: translateX(100%);
  }
}

.game-drawer.active {
  transform: translateY(0);
}

@media (min-width: 768px) {
  .game-drawer.active {
    transform: translateX(0);
  }
}

.game-drawer-header {
  padding: 18px 20px;
  background: rgba(28, 34, 58, 0.9);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.game-drawer-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.game-drawer-footer {
  padding: 16px 20px;
  background: rgba(20, 24, 41, 0.95);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
}

/* Category Filter Tabs Bar */
.category-tabs-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 2px 12px 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.category-tabs-bar::-webkit-scrollbar {
  display: none;
}

.category-tab-btn {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.category-tab-btn.active {
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.2), rgba(255, 0, 127, 0.2));
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.3);
}

/* Horizontal Solo Games Shelf */
.solo-games-shelf {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 8px 2px 14px 2px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.solo-game-card {
  min-width: 200px;
  max-width: 200px;
  background: var(--bg-card);
  border: 1px solid rgba(0, 243, 255, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

.solo-game-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-cyan);
  box-shadow: 0 6px 20px rgba(0, 243, 255, 0.25);
}

/* Compact Catalog Game Card */
.compact-game-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.compact-game-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 243, 255, 0.5);
  box-shadow: 0 6px 18px rgba(0, 243, 255, 0.15);
}

.view-section {
  display: none;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.25s ease-in-out;
}

.view-section.active {
  display: flex;
}

#view-player-game.active {
  display: flex;
  height: calc(100dvh - 65px);
  max-height: calc(100dvh - 65px);
  gap: 0;
  overflow: hidden;
  padding: 0;
}

#playerGameContainer {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

/* Arcade Cards */
.arcade-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.arcade-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-pink));
}

.card-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, #00f3ff, #0088ff);
  color: #050811;
  border: none;
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
}

.btn-pink {
  background: linear-gradient(135deg, #ff007f, #b5179e);
  color: #fff;
  border: none;
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.4);
}

.btn-gold {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #1a0f00;
  border: none;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #00ff88, #00b359);
  color: #031c0c;
  border: none;
}

.btn-danger {
  background: linear-gradient(135deg, #ff4757, #c0392b);
  color: #fff;
  border: none;
}

.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-lg { padding: 16px 28px; font-size: 1.15rem; }
.btn-full { width: 100%; }

/* Form Controls */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.input-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.input-field, select.input-field {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-field:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(0, 243, 255, 0.3);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(5, 7, 15, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 15px;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 550px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Grid Layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 15px; }
.grid-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

@media (max-width: 600px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-games { grid-template-columns: 1fr; }
  main { padding: 12px; }
}

/* Tags & Badges */
.tag-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-right: 4px;
  margin-bottom: 4px;
}

.tag-badge.active {
  background: rgba(0, 243, 255, 0.2);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* Floating Share Bar */
.action-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, rgba(0, 243, 255, 0.1), rgba(255, 0, 127, 0.1));
  border: 1px solid rgba(0, 243, 255, 0.3);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

/* Toast Notification System */
.toast-container {
  position: fixed;
  top: 60px;
  right: 15px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 30px);
}

.toast-item {
  background: rgba(28, 34, 58, 0.95);
  border: 1px solid var(--accent-cyan);
  border-left: 5px solid var(--accent-cyan);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 243, 255, 0.3);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  animation: toastSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-item.toast-success {
  border-color: var(--accent-green);
  border-left-color: var(--accent-green);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 255, 136, 0.3);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Player Roster Chips */
.player-roster {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
  justify-content: center;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 30px;
  padding: 5px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  transition: transform 0.2s ease;
}

.player-chip.is-host {
  border-color: var(--accent-gold);
  background: rgba(255, 215, 0, 0.12);
  color: var(--accent-gold);
}

.player-chip.is-me {
  border-color: var(--accent-cyan);
  background: rgba(0, 243, 255, 0.12);
  color: var(--accent-cyan);
}
