/* ==========================================
   Luxury Glassmorphism Game Lobby Stylesheet
   ========================================== */

:root {
  --bg-dark: #070714;
  --panel-glass: rgba(13, 13, 33, 0.45);
  --border-glass: rgba(255, 255, 255, 0.08);
  --accent-purple: #c54bfd;
  --accent-cyan: #00f0ff;
  --accent-green: #39ff14;
  --accent-red: #ff0055;
  --text-primary: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.7);
  --font-family: 'Vazirmatn', 'Outfit', sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* --- Ambient Glowing Orbs --- */
.ambient-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.2;
  mix-blend-mode: screen;
  animation: pulse 15s infinite alternate ease-in-out;
}

.orb-1 {
  top: -10%;
  left: 20%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, var(--accent-purple), transparent 70%);
}

.orb-2 {
  bottom: -10%;
  right: 15%;
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, var(--accent-cyan), transparent 70%);
  animation-delay: -5s;
}

.orb-3 {
  top: 35%;
  left: -10%;
  width: 35vw;
  height: 35vw;
  background: radial-gradient(circle, var(--accent-green), transparent 70%);
  animation-delay: -10s;
}

@keyframes pulse {
  0% { transform: scale(1) translate(0, 0); opacity: 0.18; }
  100% { transform: scale(1.15) translate(3%, 4%); opacity: 0.25; }
}

/* --- Layout Wrapper --- */
.lobby-wrapper {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  z-index: 2;
}

/* --- Glassmorphic Header --- */
.glass-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background: var(--panel-glass);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  margin-bottom: 30px;
}

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

.game-logo-icon {
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: float 4s infinite ease-in-out;
}

.brand h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 2px;
  font-family: 'Outfit', 'Vazirmatn', sans-serif;
}

.brand h1 .highlight {
  color: var(--accent-cyan);
  text-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
}

.user-status {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-capsule {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: 50px;
  font-size: 0.9rem;
}

.user-capsule i {
  color: var(--accent-green);
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.6);
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.3s;
  padding: 5px;
}

.btn-logout:hover {
  color: var(--accent-red);
  transform: scale(1.1);
}

/* --- Common UI Components --- */
.glass-card {
  background: var(--panel-glass);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.badge {
  display: inline-block;
  padding: 5px 14px;
  background: rgba(197, 75, 253, 0.15);
  border: 1px solid rgba(197, 75, 253, 0.3);
  border-radius: 50px;
  color: var(--accent-purple);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 15px;
  text-transform: uppercase;
  font-family: 'Outfit', sans-serif;
}

/* --- Form Fields & Buttons --- */
.input-group {
  margin-bottom: 25px;
  width: 100%;
}

.input-group label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 10px;
  text-align: right;
  font-weight: 500;
}

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

.input-wrapper i {
  position: absolute;
  right: 18px;
  color: var(--accent-cyan);
  font-size: 1.1rem;
}

.input-wrapper input {
  width: 100%;
  padding: 16px 50px 16px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  color: #fff;
  font-size: 1rem;
  font-family: var(--font-family);
  transition: all 0.3s ease;
  text-align: right;
}

.input-wrapper input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.25);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 15px 35px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  color: #fff;
  width: 100%;
}

.btn-glow {
  box-shadow: 0 0 20px rgba(197, 75, 253, 0.35);
}

.btn-glow:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.6);
}

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

/* --- Welcome/Nickname selection Card --- */
.nickname-card {
  max-width: 550px;
  width: 100%;
  margin: 60px auto;
  padding: 40px;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.nickname-card h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.nickname-card p {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 30px;
}

/* --- Games section and Grid --- */
.games-section {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.section-title {
  text-align: center;
  margin-bottom: 10px;
}

.section-title h2 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.section-title p {
  color: var(--text-dim);
  font-size: 1.1rem;
}

.user-accent {
  color: var(--accent-green);
  text-shadow: 0 0 10px rgba(57, 255, 20, 0.4);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

/* --- Game Card design --- */
.game-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.game-card:hover {
  transform: translateY(-8px);
}

.hover-glow:hover {
  box-shadow: 0 20px 40px rgba(0, 240, 255, 0.15);
  border-color: rgba(0, 240, 255, 0.3);
}

.game-card[data-game="kitchen"]:hover {
  box-shadow: 0 20px 40px rgba(255, 200, 0, 0.15);
  border-color: rgba(255, 200, 0, 0.3);
}

.game-card[data-game="pixel"]:hover {
  box-shadow: 0 20px 40px rgba(255, 0, 85, 0.15);
  border-color: rgba(255, 0, 85, 0.3);
}

.game-card[data-game="airhockey"]:hover {
  box-shadow: 0 20px 40px rgba(0, 229, 255, 0.15);
  border-color: rgba(0, 229, 255, 0.3);
}

.game-card[data-game="destiny"]:hover {
  box-shadow: 0 20px 40px rgba(255, 140, 0, 0.2);
  border-color: rgba(255, 140, 0, 0.4);
}

.card-banner {
  height: 160px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.font-kitchen {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
}

.font-runner {
  background: linear-gradient(135deg, #00f0ff, #002233);
}

.font-pixel {
  background: linear-gradient(135deg, #ff0055, #3c0022);
}

.font-airhockey {
  background: linear-gradient(135deg, #ff3c6f, #00e5ff);
}

.font-destiny {
  background: linear-gradient(135deg, #ff8c00, #4b0082);
}

.game-icon {
  font-size: 4.5rem;
  transition: transform 0.4s ease;
}

.game-card:hover .game-icon {
  transform: scale(1.18) rotate(5deg);
}

.card-badge {
  position: absolute;
  top: 15px;
  left: 15px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.5px;
  color: #000;
}

.bg-yellow { background-color: #ffd700; }
.bg-cyan { background-color: #00f0ff; }
.bg-pink { background-color: #ff0055; color: #fff; }
.bg-orange { background-color: #ff8c00; color: #fff; }

.card-body {
  padding: 25px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-body h3 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.card-body p {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 25px;
  flex-grow: 1;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 15px;
}

.game-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-card {
  padding: 10px 20px;
  font-size: 0.9rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: #fff;
}

.game-card[data-game="kitchen"] .btn-card:hover {
  background: #ff8c00;
  border-color: #ffd700;
  box-shadow: 0 0 15px rgba(255, 140, 0, 0.5);
  color: #000;
}

.game-card[data-game="runner"] .btn-card:hover {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
  color: #000;
}

.game-card[data-game="pixel"] .btn-card:hover {
  background: var(--accent-red);
  border-color: var(--accent-red);
  box-shadow: 0 0 15px rgba(255, 0, 85, 0.5);
  color: #fff;
}

.game-card[data-game="airhockey"] .btn-card:hover {
  background: #00e5ff;
  border-color: #00e5ff;
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.5);
  color: #000;
}

/* --- Animated States --- */
.hidden {
  display: none !important;
}

.animate-zoom {
  animation: zoomIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.15) forwards;
}

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

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

/* --- Full Screen Game Viewport --- */
.viewport-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background-color: #000;
  z-index: 9999;
  display: flex;
  flex-direction: column;
}

#game-iframe {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

/* --- Floating Exit Capsule --- */
.exit-capsule {
  position: fixed;
  top: 15px;
  left: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 8px 15px 8px 8px;
  background: rgba(10, 10, 25, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  z-index: 10000;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
  transition: opacity 0.3s;
}

.exit-capsule:hover {
  opacity: 1;
}

.exit-info {
  display: flex;
  align-items: center;
}

.active-game-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: 'Outfit', sans-serif;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-red), #aa0033);
  color: #fff;
  padding: 8px 18px;
  font-size: 0.85rem;
  border-radius: 50px;
}

.btn-glow-red {
  box-shadow: 0 0 15px rgba(255, 0, 85, 0.4);
}

.btn-glow-red:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 25px rgba(255, 0, 85, 0.75);
}

.animate-fade-in {
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(-10px); }
  100% { opacity: 0.85; transform: translateY(0); }
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
  .glass-header {
    padding: 12px 20px;
  }
  .brand h1 {
    font-size: 1.3rem;
  }
  .nickname-card {
    padding: 25px;
    margin: 30px auto;
  }
  .games-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .exit-capsule {
    top: 10px;
    left: 10px;
    padding: 6px 12px 6px 6px;
  }
  .active-game-title {
    font-size: 0.7rem;
  }
  .btn-danger {
    padding: 6px 12px;
    font-size: 0.75rem;
  }
}
