@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
  --bg-primary: #09090b;
  --bg-card: rgba(20, 20, 25, 0.6);
  --border-color: rgba(255, 255, 255, 0.08);
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --glow-purple: 0 0 20px rgba(139, 92, 246, 0.4);
  --glow-cyan: 0 0 20px rgba(6, 182, 212, 0.4);
  --glow-pink: 0 0 20px rgba(236, 72, 153, 0.4);
}

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

body {
  font-family: 'Outfit', sans-serif;
  background: radial-gradient(circle at 50% 50%, #181028 0%, #09090b 100%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header */
header {
  padding: 2rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  background: rgba(9, 9, 11, 0.5);
  backdrop-filter: blur(12px);
}

h1 {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  background: linear-gradient(to right, #ffffff, #a1a1aa, var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 300;
}

/* Main Content Wrapper */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

/* Responsive Grid for Tiles */
.lobby-grid {
  display: grid;
  gap: 2rem;
  width: 100%;
  padding: 1rem 0;
}

/* Desktop layout (3 tiles per row) */
@media (min-width: 1024px) {
  .lobby-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Mobile layout & Medium screens (2 tiles per row) */
@media (max-width: 1023px) {
  .lobby-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tile/Card Styling */
.game-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2.5rem;
  text-decoration: none;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 250px;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
}

.game-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 20px;
  padding: 2px;
  background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  transition: all 0.4s ease;
}

/* Colors & Glows on Hover */
.tile-mafia {
  --tile-accent: var(--accent-purple);
  --tile-glow: var(--glow-purple);
}

.tile-trivia {
  --tile-accent: var(--accent-cyan);
  --tile-glow: var(--glow-cyan);
}

.tile-pong {
  --tile-accent: var(--accent-pink);
  --tile-glow: var(--glow-pink);
}

.game-tile:hover {
  transform: translateY(-8px);
  border-color: var(--tile-accent);
  box-shadow: var(--tile-glow), 0 20px 40px rgba(0, 0, 0, 0.6);
  background: rgba(20, 20, 25, 0.85);
}

.game-tile:hover::before {
  background: linear-gradient(135deg, var(--tile-accent), transparent, var(--tile-accent));
}

.tile-icon {
  width: 54px;
  height: 54px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.game-tile:hover .tile-icon {
  background: var(--tile-accent);
  color: #fff;
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 0 15px var(--tile-accent);
}

.tile-details {
  width: 100%;
}

.tile-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  letter-spacing: -0.02em;
}

.tile-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  font-weight: 300;
}

.tile-action {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--tile-accent);
  transition: transform 0.3s ease;
}

.tile-action svg {
  margin-left: 0.5rem;
  transition: transform 0.3s ease;
}

.game-tile:hover .tile-action svg {
  transform: translateX(5px);
}

/* Glassmorphic Container & forms */
.glass-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 3rem;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
}

.glass-container.wide {
  max-width: 1000px;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.input-glow {
  background: rgba(9, 9, 11, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
}

.input-glow:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3), inset 0 0 5px rgba(0, 0, 0, 0.5);
}

/* Buttons */
.btn-premium {
  background: linear-gradient(135deg, var(--accent-purple) 0%, #6d28d9 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  padding: 1rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
  text-align: center;
  text-decoration: none;
}

.btn-premium:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.btn-premium:active {
  transform: translateY(0);
}

.btn-cyan {
  background: linear-gradient(135deg, var(--accent-cyan) 0%, #0891b2 100%);
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn-cyan:hover {
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
}

.error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  color: #f87171;
  padding: 0.8rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  text-align: center;
}

/* Access Denied Page */
.denied-container {
  text-align: center;
}

.denied-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}

/* Admin Dashboard Layout */
.admin-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.admin-title-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-title-badge {
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
}

.logout-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.logout-link:hover {
  color: #f87171;
}

/* Token Manager Grid */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  width: 100%;
}

@media (min-width: 768px) {
  .admin-grid {
    grid-template-columns: 1fr 2fr;
  }
}

.token-form-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  height: fit-content;
}

.token-list-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
}

.panel-header {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.token-table-container {
  overflow-x: auto;
}

.token-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.token-table th, .token-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.token-table th {
  color: var(--text-secondary);
  font-weight: 600;
}

.token-cell-desc {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-link-btn {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--accent-purple);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.token-link-btn:hover {
  background: var(--accent-purple);
  color: #fff;
}

.btn-delete {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-delete:hover {
  background: #ef4444;
  color: #fff;
}

.no-tokens {
  text-align: center;
  color: var(--text-secondary);
  padding: 3rem 1rem;
}

/* Mafia Game / Webcams Interface */
.mafia-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100vh - 120px);
  max-width: 1400px;
  margin: 0 auto;
  gap: 1.5rem;
}

.mafia-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 1.2rem 2rem;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.mafia-game-info {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.game-status-badge {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid var(--accent-purple);
  color: var(--accent-purple);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-purple);
  border-radius: 50%;
  animation: live-pulse 1.5s infinite;
}

@keyframes live-pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

.mafia-controls {
  display: flex;
  gap: 0.8rem;
}

.btn-control {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.6rem 1rem;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  transition: all 0.3s ease;
}

.btn-control:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-control.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

/* Webcam Grid */
.webcam-grid {
  flex: 1;
  display: grid;
  gap: 1.2rem;
  padding: 0.5rem;
  align-items: center;
  justify-items: center;
  overflow: hidden;
}

/* Camera Card */
.webcam-card {
  background: #121217;
  border: 2px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  width: 100%;
  max-height: 100%;
}

.webcam-card.speaking {
  border-color: var(--accent-purple);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.webcam-video-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  background: radial-gradient(circle at center, #2e283a 0%, #0d0d11 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Abstract placeholder avatar */
.webcam-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--accent-purple);
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  z-index: 1;
  transition: all 0.3s ease;
}

.webcam-card.speaking .webcam-avatar {
  transform: scale(1.08);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
}

/* Camera labels */
.webcam-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.8rem 1rem;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 2;
}

.webcam-name {
  font-weight: 600;
  font-size: 0.9rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.webcam-indicators {
  display: flex;
  gap: 0.5rem;
}

.indicator-badge {
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-primary);
}

.indicator-badge.muted {
  color: #ef4444;
}

/* Speaking waves simulation */
.speaking-wave {
  position: absolute;
  border: 2px solid var(--accent-purple);
  border-radius: 50%;
  width: 70px;
  height: 70px;
  animation: pulse-wave 1.8s infinite linear;
  opacity: 0;
  z-index: 0;
}

@keyframes pulse-wave {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: rgba(18, 18, 23, 0.95);
  border: 1px solid var(--accent-purple);
  box-shadow: var(--glow-purple), 0 10px 30px rgba(0,0,0,0.5);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success-icon {
  color: var(--accent-cyan);
  font-size: 1.2rem;
}

/* Stiluri noi: Utilitare și Selector Joc Admin */
.hidden {
  display: none !important;
}

.game-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  width: 100%;
  max-width: 900px;
  margin: 2rem auto;
}

.game-select-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.game-select-card .game-icon {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  transition: transform 0.3s ease;
}

.game-select-card h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.game-select-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 300;
}

.game-select-card.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.game-select-card:not(.disabled):hover {
  transform: translateY(-6px);
  border-color: var(--accent-purple);
  box-shadow: var(--glow-purple);
}

.game-select-card:not(.disabled):hover .game-icon {
  transform: scale(1.15);
}

/* Admin Tabs */
.admin-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  width: 100%;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.admin-tab-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.7rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.admin-tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.admin-tab-btn.active {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--accent-purple);
  color: var(--accent-purple);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

/* Dropdown Roluri */
.role-select {
  background: rgba(9, 9, 11, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.role-select:focus {
  border-color: var(--accent-purple);
}

/* Status Pills */
.status-pill {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pill.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-pill.success {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-pill.warning {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

/* WebRTC Video Element */
.webcam-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  background: #000;
}

/* Overlay-uri Mafia Game */
.overlay-dead {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #0f0202;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.overlay-illustration {
  font-size: 4.5rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 15px rgba(239, 68, 68, 0.6));
  animation: floatIllustration 3s ease-in-out infinite;
}

@keyframes floatIllustration {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0px); }
}

.overlay-dead-text {
  color: #f87171;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
  margin-bottom: 0.3rem;
}

.overlay-dead-sub {
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.overlay-expelled {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #140a02;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.overlay-expelled-text {
  color: #fb923c;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-shadow: 0 0 10px rgba(249, 115, 22, 0.8);
  margin-bottom: 0.3rem;
}

.overlay-speaking-turn {
  position: absolute;
  bottom: 42px;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.95) 0%, rgba(8, 145, 178, 0.95) 100%);
  color: #fff;
  text-align: center;
  padding: 0.35rem 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  z-index: 8;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
  animation: speakingPulse 1.5s infinite ease-in-out;
}

@keyframes speakingPulse {
  0% { opacity: 0.9; }
  50% { opacity: 1; filter: brightness(1.15); }
  100% { opacity: 0.9; }
}

