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

/* ============================================
   ARISAN PREMIUM CLIENT VIEW - STYLING
   ============================================ */

:root {
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.5);
  --secondary: #ec4899;
  --secondary-glow: rgba(236, 72, 153, 0.5);
  --accent: #8b5cf6;
  --background: #0f172a;
  --surface: rgba(30, 41, 59, 0.7);
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --winner: #fbbf24;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--background);
  background-image:
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
  color: var(--text);
  min-height: 100vh;
  padding: 20px;
  overflow-x: hidden;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

/* Header */
.header {
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 20px 40px;
  margin-bottom: 30px;
  position: relative;
}

.header h1 {
  text-align: center;
  font-weight: 800;
  font-size: 2.5rem;
  background: linear-gradient(to right, #818cf8, #f472b6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
}

.status-bar {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.status-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  text-align: center;
}

.status-item .label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.status-item .value {
  font-size: 1.5rem;
  font-weight: 700;
  display: block;
}

.status-badge {
  color: #818cf8;
}

/* Grid Dynamic Layout */
.participants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
  transition: all 0.5s ease;
}

/* ZOOM OUT MODE (When many participants) */
.participants-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

/* Participant Card */
.participant-card {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 20px 10px;
  text-align: center;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 120px;
}

.participants-grid.compact .participant-card {
  min-height: 80px;
  padding: 10px 5px;
  border-radius: 12px;
}

.participants-grid.compact .participant-name {
  font-size: 0.9rem;
}

.participant-name {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
}

.participant-city {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 400;
  text-transform: capitalize;
}

.winner-highlight .participant-city {
  color: #334155 !important;
  font-weight: 600;
}

/* Elimination Animation (Shatter/Burn) */
.participant-card.hiding {
  animation: shatter 0.8s ease-out forwards;
  pointer-events: none;
}

@keyframes shatter {
  0% {
    transform: scale(1) rotate(0);
    filter: brightness(1) contrast(1);
  }

  20% {
    transform: scale(1.1) rotate(5deg);
    filter: brightness(2);
  }

  100% {
    transform: scale(0) rotate(-20deg);
    opacity: 0;
    filter: brightness(5) blur(20px);
  }
}

/* Shake Effect for elimination */
.shake {
  animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

  10%,
  90% {
    transform: translate3d(-1px, 0, 0);
  }

  20%,
  80% {
    transform: translate3d(2px, 0, 0);
  }

  30%,
  50%,
  70% {
    transform: translate3d(-4px, 0, 0);
  }

  40%,
  60% {
    transform: translate3d(4px, 0, 0);
  }
}

/* Screen Shake */
.screen-shake {
  animation: screen-shake 0.5s ease-in-out;
}

@keyframes screen-shake {
  0% {
    transform: translate(0, 0);
  }

  10% {
    transform: translate(-5px, -5px);
  }

  20% {
    transform: translate(5px, 5px);
  }

  30% {
    transform: translate(-5px, 5px);
  }

  40% {
    transform: translate(5px, -5px);
  }

  100% {
    transform: translate(0, 0);
  }
}

/* Spotlight Roulette Highlight */
.spotlight {
  border-color: #fff !important;
  box-shadow: 0 0 30px #fff, inset 0 0 15px #fff !important;
  transform: scale(1.1);
  z-index: 5;
  background: rgba(255, 255, 255, 0.2) !important;
}

.participant-card.unpaid {
  opacity: 0.5;
  filter: grayscale(0.8);
  background: rgba(239, 68, 68, 0.1);
}

.participant-card.already-won {
  background: #f1f5f9;
  color: #64748b;
  border: 1px dashed var(--glass-border);
  opacity: 0.9;
}

.badge-won {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-muted);
  color: white;
  font-size: 0.6rem;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 800;
  width: max-content;
}

/* Winner Effect */
.winner-highlight {
  animation: float-win 2s infinite alternate;
  border: 4px solid #facc15 !important;
  background: linear-gradient(135deg, #eab308, #fbbf24) !important;
  z-index: 10;
  color: #000;
}

@keyframes float-win {
  from {
    transform: translateY(0) scale(1.1);
    box-shadow: 0 0 30px #facc15;
  }

  to {
    transform: translateY(-10px) scale(1.15);
    box-shadow: 0 0 50px #facc15;
  }
}

/* Laser Effect */
.laser-active::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to right, transparent, rgba(239, 68, 68, 0.3), transparent);
  animation: laser-sweep 1.5s ease-in-out;
  pointer-events: none;
  z-index: 99;
}

@keyframes laser-sweep {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* Glitch */
.glitch-active {
  animation: glitch 0.2s infinite;
  border-color: #f472b6 !important;
}

@keyframes glitch {
  0% {
    transform: translate(0);
  }

  25% {
    transform: translate(-2px, 2px);
  }

  50% {
    transform: translate(2px, -2px);
  }

  75% {
    transform: translate(-2px, -2px);
  }

  100% {
    transform: translate(0);
  }
}

/* Winner Modal */
.winner-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.9);
  backdrop-filter: blur(20px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

@keyframes fall {
  0% {
    transform: translateY(-100px) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

.winner-modal.show {
  display: flex;
}

.winner-content {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: 40px;
  padding: 60px;
  text-align: center;
  width: 90%;
  max-width: 600px;
  position: relative;
  z-index: 20;
  animation: modal-enter 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modal-enter {
  from {
    transform: scale(0.8) translateY(50px);
    opacity: 0;
  }

  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.winner-item {
  font-size: 3rem;
  font-weight: 900;
  margin: 10px 0;
  background: linear-gradient(to bottom, #facc15, #ca8a04);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn-close {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  padding: 15px 40px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 30px;
}

/* Admin floating control */
.admin-game-control {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  padding: 0;
  border-radius: 12px;
  width: 260px;
  z-index: 1000;
  overflow: hidden;
  transition: all 0.3s ease;
}

.control-header {
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-minimize {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0 5px;
  line-height: 1;
}

#panelBody {
  padding: 15px;
}

/* Lobby Overlay */
.lobby-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  z-index: 50;
  /* Di atas grid, di bawah admin panel */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}

.lobby-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.lobby-content {
  text-align: center;
  animation: float-win 3s ease-in-out infinite;
}

.pulse-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  display: inline-block;
  animation: pulse 2s infinite;
}

.hidden {
  display: none !important;
}

.pulse {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

/* RESPONSIVE */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .header {
    padding: 15px;
    margin-bottom: 20px;
  }

  .header h1 {
    font-size: 1.5rem;
    margin-bottom: 15px;
  }

  .status-bar {
    gap: 10px;
    flex-wrap: wrap;
  }

  .status-item {
    padding: 8px 15px;
    flex: 1 1 calc(50% - 10px);
    min-width: 120px;
  }

  .status-item .value {
    font-size: 1.2rem;
  }

  .participants-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }

  .participants-grid.compact {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
  }

  .admin-game-control {
    width: calc(100% - 20px);
    left: 10px;
    bottom: 10px;
    padding: 10px;
  }

  .winner-content {
    padding: 30px 20px;
    border-radius: 24px;
  }

  .winner-item {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .participants-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .participants-grid.compact {
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
  }

  .participant-name {
    font-size: 0.9rem;
  }

  .participants-grid.compact .participant-name {
    font-size: 0.75rem;
  }

  .status-item {
    flex: 1 1 100%;
  }

  .header h1 {
    font-size: 1.25rem;
  }
}