/* ============ THEME & COLORS ============ */
:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: #0f1217;
  color: #eef2f7;
  font-size: 16px;
  line-height: 1.5;
  
  --surface: #161b24;
  --surface-strong: #1f2837;
  --surface-soft: #0d2444;
  --accent: #8dd7ff;
  --accent-strong: #57b0ff;
  --success: #4ade80;
  --error: #ff6b6b;
  --warning: #fbbf24;
  --text-muted: #99a5b6;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100vh;
}

body {
  background: radial-gradient(circle at top, rgba(84, 145, 255, 0.12), transparent 32%),
              linear-gradient(180deg, #0d1117 0%, #0b1017 100%);
}

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

a {
  color: inherit;
  text-decoration: none;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
}

/* ============ GLOBAL MESSAGE ============ */
.global-message {
  padding: 1rem 1.5rem;
  margin: 0;
  border-radius: 8px;
  font-weight: 500;
  text-align: center;
  transition: all 0.3s ease;
  opacity: 1;
  transform: translateY(0);
}

.global-message.success {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: var(--success);
}

.global-message.error {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  color: var(--error);
}

.global-message.info {
  background: rgba(141, 215, 255, 0.1);
  border: 1px solid rgba(141, 215, 255, 0.3);
  color: var(--accent);
}

.global-message.hidden {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
}

/* ============ APP LAYOUT ============ */
.app-shell {
  width: min(1200px, calc(100% - 1rem));
  margin: 0 auto;
  padding: 1rem 0 2rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  margin-bottom: 2rem;
}

main {
  flex: 1;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(18, 24, 33, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #57b0ff, #8dd7ff);
  color: #07101a;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand h1 {
  margin: 0;
  font-size: 1rem;
}

.brand p {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: 1rem;
}

.nav-link {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.nav-link:active,
.nav-link.active {
  background: var(--primary);
  color: var(--primary-text);
}

.user-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.token-display {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-strong);
  border-radius: 8px;
  font-weight: 600;
}

.token-icon {
  font-size: 1.1rem;
}

/* ============ VIEWS & SECTIONS ============ */
.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 2rem;
}

.section-heading h2 {
  margin: 0 0 0.5rem;
}

.section-heading p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

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

.hero h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}

.hero p {
  margin: 0;
  color: var(--text-muted);
}

/* ============ CARDS & GRID ============ */
.card {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(22, 27, 36, 0.5);
  backdrop-filter: blur(12px);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.game-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-strong);
}

.game-card-image-wrapper {
  width: 100%;
  height: 200px;
  border-radius: 12px 12px 0 0;
  margin: -1.5rem -1.5rem 1rem;
  overflow: hidden;
  background: var(--surface-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-placeholder {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--surface-strong);
}

.game-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.game-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.game-card-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.game-card-button {
  margin-top: auto;
  margin-top: 1rem;
}

/* ============ FORMS ============ */
.form-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0;
}

label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 500;
  font-size: 0.95rem;
}

input, textarea, select {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent-strong);
}

textarea {
  resize: vertical;
  font-family: inherit;
}

.form-hint {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-error {
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(255, 107, 107, 0.15);
  color: #ff6b6b;
  font-size: 0.9rem;
  display: none;
}

.form-error.visible {
  display: block;
}

/* ============ BUTTONS ============ */
.button {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.button.primary {
  background: linear-gradient(135deg, #57b0ff, #8dd7ff);
  color: #07101a;
}

.button.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(87, 176, 255, 0.3);
}

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

.button.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}

.button.ghost:hover {
  background: var(--surface-strong);
  border-color: var(--accent);
}

.button.small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============ TABS ============ */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.tab-button {
  padding: 1rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.tab-button.active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent-strong);
}

.tab-button:hover {
  color: var(--accent);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: flex;
}

/* ============ ALERTS & MESSAGES ============ */
.alert {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.alert.success {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}

.alert.error {
  background: rgba(255, 107, 107, 0.15);
  color: #ff6b6b;
}

.alert.warning {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.alert.info {
  background: rgba(141, 215, 255, 0.15);
  color: #8dd7ff;
}

/* ============ GAME DETAIL ============ */
.game-detail-card {
  max-width: 900px;
  margin: 0 auto;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 1rem;
}

.game-header h2 {
  margin: 0 0 0.5rem;
}

.game-header p {
  margin: 0;
  color: var(--text-muted);
}

.badge {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--surface-strong);
}

.badge.active {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

.badge.inactive {
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
}

.media-gallery {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 2rem 0;
}

.gallery-main-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-main-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-placeholder {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.gallery-thumbnails {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.5rem 0;
}

.gallery-thumbnail {
  width: 100px;
  height: 100px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.gallery-thumbnail:hover {
  border-color: var(--accent-strong);
}

.media-item {
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.section-text {
  margin: 1.5rem 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background: var(--surface-strong);
  border-radius: 12px;
  margin: 1.5rem 0;
}

.detail-row h3 {
  margin: 0 0 0.25rem;
}

.detail-row p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.token-chip {
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, #8dd7ff15, #57b0ff15);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.box {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  margin: 2rem 0;
}

.box h3 {
  margin: 0 0 1rem;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.list-item {
  padding: 0.75rem;
  background: var(--surface);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.list-item-value {
  font-weight: 600;
}

.list-item-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.list-item.exact {
  background: rgba(74, 222, 128, 0.1);
  border-left: 3px solid #4ade80;
}

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

/* ============ ADMIN ============ */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1.5rem;
}

.admin-card {
  display: flex;
  flex-direction: column;
}

.admin-card h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-list-item {
  padding: 1rem;
  background: var(--surface);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.admin-list-item-info h4 {
  margin: 0 0 0.25rem;
  font-weight: 600;
}

.admin-list-item-info p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.admin-actions {
  display: flex;
  gap: 0.5rem;
}

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state p {
  margin: 0;
  font-size: 0.95rem;
}

/* ============ CHECKBOXES ============ */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.4;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.checkbox-label a {
  color: var(--accent);
  text-decoration: underline;
}

.checkbox-label a:hover {
  color: var(--accent-strong);
}

/* ============ ADMIN USER LIST ============ */
.admin-list-item-user {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--surface);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.admin-list-item-user-info h4 {
  margin: 0 0 0.25rem;
  font-weight: 600;
}

.admin-list-item-user-info p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.admin-user-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.token-input {
  width: 80px;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: inherit;
  font-size: 0.85rem;
  text-align: center;
}

/* ============ FOOTER LINKS ============ */
.footer-links {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.5rem;
  justify-content: center;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

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

.footer p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

/* ============ PROFILE STATUS ============ */
.profile-status {
  margin-bottom: 1.5rem;
}

.success-message {
  padding: 1rem;
  border-radius: 8px;
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  font-size: 0.9rem;
}

.warning-message {
  padding: 1rem;
  border-radius: 8px;
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
  font-size: 0.9rem;
}

/* ============ FORM ROW ============ */
.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-row > div {
  flex: 1;
  min-width: 120px;
}

.form-row label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .app-shell {
    width: calc(100% - 1rem);
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .brand {
    justify-content: center;
    margin-bottom: 0.5rem;
  }

  .topbar-actions {
    justify-content: center;
  }

  .section-heading {
    flex-direction: column;
    gap: 1rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .detail-row {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .media-gallery {
    grid-template-columns: 1fr;
  }

  .tabs {
    gap: 0.5rem;
  }

  .tab-button {
    padding: 0.75rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .app-shell {
    padding: 0.5rem 0 1rem;
  }

  .topbar {
    padding: 0.75rem;
    border-radius: 12px;
  }

  .brand-mark {
    width: 2rem;
    height: 2rem;
    font-size: 0.9rem;
  }

  .brand h1 {
    font-size: 0.9rem;
  }

  .brand p {
    font-size: 0.75rem;
  }

  .hero h2 {
    font-size: 1.25rem;
  }

  .card {
    padding: 1rem;
    border-radius: 12px;
  }

  .button {
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
  }

  .form-card {
    gap: 0.75rem;
  }

  .box {
    padding: 1rem;
  }

  .detail-row {
    padding: 1rem;
  }
}

/* Countdown Styles */
.game-countdown {
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0.25rem 0 0;
}

.game-countdown.upcoming {
  color: var(--warning);
}

.game-countdown.active {
  color: var(--success);
}

.game-countdown.ended {
  color: var(--error);
}
