/* ==================== CSS Variables & Theme ==================== */
:root {
  /* Colors - Dark Theme */
  --bg-primary: #0b0c10;
  --bg-secondary: #11151f;
  --bg-card: #1a1d2e;
  --bg-hover: rgba(53, 160, 255, 0.05);

  --text-primary: #e8edf7;
  --text-secondary: #c8d2e3;
  --text-muted: #7c8698;

  --accent-primary: #35a0ff;
  --accent-hover: #5ab3ff;
  --accent-glow: rgba(53, 160, 255, 0.35);

  --border-color: #1f2633;
  --border-hover: #35a0ff;

  --danger: #e5484d;
  --success: #3ac569;
  --warning: #ffb224;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.3);

  /* Animation Durations */
  --duration-instant: 100ms;
  --duration-fast: 200ms;
  --duration-normal: 300ms;
  --duration-slow: 400ms;

  /* Easing */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: ease-in;
  --ease-out: ease-out;

  /* Layout */
  --header-height: 64px;
  --max-width: 1400px;
  --sidebar-width: 400px;
}

/* ==================== Reset & Base ==================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
  background: linear-gradient(180deg, #0d1117 0%, #0b0c10 100%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-default);
}

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ==================== Layout Utilities ==================== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-narrow {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section {
  padding: var(--space-2xl) 0;
}

.section-sm {
  padding: var(--space-lg) 0;
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

/* Responsive grid for game cards (3x5 layout on desktop) */
.grid-games {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.grid-featured {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

/* Flex Utilities */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* ==================== Typography ==================== */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 700;
  color: var(--text-primary);
}

h1 {
  font-size: 2.5rem;
  margin-bottom: var(--space-lg);
}

h2 {
  font-size: 2rem;
  margin-bottom: var(--space-md);
}

h3 {
  font-size: 1.5rem;
  margin-bottom: var(--space-md);
}

p {
  margin-bottom: var(--space-md);
}

.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-small {
  font-size: 0.875rem;
}

.text-large {
  font-size: 1.125rem;
}

/* ==================== Buttons ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all var(--duration-fast) var(--ease-default);
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: #0b0c10;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--accent-glow);
}

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

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--accent-primary);
  background: var(--bg-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #d93e43;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-full);
}

.btn-pill {
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 0.875rem;
}

/* ==================== Cards ==================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
}

.card-hover {
  transition: all var(--duration-normal) var(--ease-default);
}

.card-hover:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: var(--accent-primary);
}

/* ==================== Badges & Tags ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-hot {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  color: white;
}

.badge-new {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
}

.badge-status {
  background: rgba(53, 160, 255, 0.15);
  color: #7ec3ff;
}

/* ==================== Forms ==================== */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all var(--duration-fast) var(--ease-default);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(53, 160, 255, 0.1);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-error {
  border-color: var(--danger);
}

.form-error-text {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: var(--space-xs);
}

/* Game Detail Grid Layout */
.game-detail-grid {
  display: grid;
  grid-template-columns: 70% 30%;
  gap: 24px;
}

/* ==================== Responsive Breakpoints ==================== */
/* Tablet: 768px - 1024px (2 columns) */
@media (max-width: 1024px) {
  .game-detail-grid {
    grid-template-columns: 65% 35%;
    gap: 16px;
  }
  .grid-games {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-featured {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }
}

/* Hide fullscreen button by default (PC) */
#fullscreen-btn {
  display: none !important;
}

/* Mobile Only Controls */
.mobile-only {
  display: none !important;
}

/* Desktop Only Controls */
.desktop-only {
  display: inline-flex !important;
}

/* Mobile: < 768px */
@media (max-width: 768px) {
  .mobile-only {
    display: inline-flex !important;
  }
  .desktop-only {
    display: none !important;
  }
  /* Switch to single column layout for game details */
  .game-detail-grid {
    grid-template-columns: 100% !important;
    display: flex;
    flex-direction: column;
  }
}

/* ==================== Pseudo-Fullscreen Mode (Dynamic Sizing) ==================== */

/* Exit Button for Pseudo-Fullscreen */
.pseudo-fullscreen-exit {
  position: fixed !important;
  top: 16px;
  left: 16px;
  right: auto;
  z-index: 2147483648 !important; /* Above everything */
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 600;
  font-size: 18px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.pseudo-fullscreen-exit:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.05);
}

.pseudo-fullscreen-exit:active {
  transform: scale(0.98);
}

/* ==================== Utility Classes ==================== */


.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.pointer {
  cursor: pointer;
}

.no-scroll {
  overflow: hidden;
}
