/* assets/css/main.css */
:root {
  --bg-primary: #0f1523;
  --bg-header: #151b29;
  --bg-card: #182136;
  --bg-card-secondary: #222b40;
  --accent-gold: #ffcb36;
  --accent-gold-dark: #e5b630;
  --accent-green: #2ecc71;
  --accent-red: #ff4d4f;
  --text-white: #ffffff;
  --text-muted: #8e95ae;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body.light-theme {
  --bg-primary: #f0f2f5;
  --bg-header: #ffffff;
  --bg-card: #ffffff;
  --bg-card-secondary: #e4e6eb;
  --text-white: #1c1e21;
  --text-muted: #65676b;
}

@media (min-width: 768px) {
  .bottom-nav { display: none !important; }
  body { padding-bottom: 0 !important; }
  .floating-support { right: 20px !important; bottom: 20px !important; }
}

.card-grad-1 { background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%) !important; }
.card-grad-2 { background: linear-gradient(135deg, #512788 0%, #a242c7 100%) !important; }
.card-grad-3 { background: linear-gradient(135deg, #a80a82 0%, #d83bb3 100%) !important; }
.card-grad-4 { background: linear-gradient(135deg, #0e823f 0%, #17c762 100%) !important; }
.card-grad-5 { background: linear-gradient(135deg, #995c00 0%, #db8c00 100%) !important; }
.card-grad-6 { background: linear-gradient(135deg, #161e38 0%, #2b3b6b 100%) !important; }

/* Winning pop animation */
@keyframes winPop {
  0% { transform: translateY(20px) scale(0.9); opacity: 0; }
  20% { transform: translateY(0) scale(1.1); opacity: 1; }
  80% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-20px) scale(0.9); opacity: 0; }
}
.win-pop-item {
  animation: winPop 4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  position: absolute;
  width: 100%;
}

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

html,
body {
  min-height: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--bg-primary);
}

body {
  background-color: var(--bg-primary);
  color: var(--text-white);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 70px;
  position: relative;
  overflow-x: hidden;
}

/* Sidebar Menu */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1040;
}
.sidebar-menu {
  position: fixed;
  top: 0; left: -280px; width: 280px; height: 100%;
  background-color: var(--bg-header);
  z-index: 1050;
  transition: left 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar-menu.active {
  left: 0;
}
.sidebar-menu a {
  padding: 15px 20px;
  color: var(--text-white);
  text-decoration: none;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sidebar-menu a:hover {
  background: var(--bg-card);
}
.sidebar-menu a i {
  color: var(--text-muted);
  width: 20px;
  text-align: center;
}

/* Header */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  width: 100%;
  background-color: var(--bg-header);
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Use general sibling so padding applies even when elements (e.g. canvas) appear between header and container */
.top-header ~ .container {
  padding-top: calc(60px + env(safe-area-inset-top, 0px));
}

/* Make the particles canvas non-layout and fixed behind the UI so it doesn't create vertical gap */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-left img {
  height: 24px;
}
.header-left .brand-name {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.5px;
}

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

.wallet-card {
  background-color: rgba(216, 184, 76, 0.1);
  border: 1px solid rgba(216, 184, 76, 0.3);
  padding: 6px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--accent-gold);
  cursor: pointer;
}

.icon-btn {
  background: var(--bg-card-secondary);
  border: none;
  color: var(--text-white);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  cursor: pointer;
}

.notification-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-red);
}

.avatar-btn {
  background: var(--accent-gold);
  color: var(--bg-primary);
  font-weight: 700;
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(16, 21, 34, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  z-index: 100;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
}

.nav-item.active {
  color: var(--accent-gold);
}

.nav-item i {
  font-size: 20px;
}

/* Container */
.container {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.game-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (min-width: 768px) {
  .game-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .game-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.game-card {
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,0.06);
  background: var(--bg-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  min-height: 100%;
}

.game-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.15);
  box-shadow: 0 18px 40px rgba(0,0,0,0.18);
}

.game-card-media {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: rgba(255,255,255,0.03);
}

.game-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
}

.game-card-title,
.game-card-provider,
.card-footer,
.game-name {
  display: none !important;
}

/* Ensure game image fills the card and no text is shown by default */
.game-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: transparent;
  aspect-ratio: 3 / 4;
}

.game-card-media {
  padding: 0;
}

.game-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
}

.game-card-badge,
.game-card-live {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  background: rgba(0,0,0,0.45);
  color: #fff;
}

.game-card-badge { top: 10px; left: 10px; }
.game-card-live { top: 10px; right: 10px; }

.banner-slider {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
}

.banner-slide {
  display: none;
  width: 100%;
  transition: opacity 0.5s ease;
}

.banner-slide.active {
  display: block;
}

.banner-slider .slider-dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.banner-slider .slider-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.banner-slider .slider-dot.active {
  background: var(--accent-gold);
  transform: scale(1.15);
}

.live-wins-container {
  position: relative;
  min-height: 26px;
  overflow: hidden;
}

.live-wins-item {
  position: absolute;
  white-space: nowrap;
  left: 100%;
  top: 0;
  opacity: 0;
  animation: liveWinScroll 8s linear forwards;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

@keyframes liveWinScroll {
  0% { left: 100%; opacity: 0; }
  10% { left: 0%; opacity: 1; }
  80% { left: 0%; opacity: 1; }
  100% { left: -100%; opacity: 0; }
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}
.form-control {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-white);
  padding: 14px;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent-gold);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.2s;
  width: 100%;
}
.btn-primary {
  background: var(--accent-gold);
  color: var(--bg-primary);
}
.btn-primary:active {
  background: var(--accent-gold-dark);
}

.text-center { text-align: center; }
.mt-3 { margin-top: 16px; }
.mb-3 { margin-bottom: 16px; }
.text-gold { color: var(--accent-gold); }

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card-secondary);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  font-size: 14px;
  animation: slideUp 0.3s ease forwards;
  opacity: 0;
  border-left: 4px solid var(--accent-gold);
}
.toast.success { border-color: var(--accent-green); }
.toast.error { border-color: var(--accent-red); }

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

/* Auth Screens */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 30px;
}
.auth-logo img {
  height: 40px;
}
