/* =============================================
   GameHub PHP — CSS 100% fiel ao original React
   ============================================= */

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

:root {
  --background:        40 20% 98%;
  --foreground:        240 10% 10%;
  --card:              0 0% 100%;
  --card-foreground:   240 10% 10%;
  --card-hover:        0 0% 98%;
  --primary:           267 84% 58%;
  --primary-foreground:0 0% 100%;
  --primary-glow:      267 84% 68%;
  --secondary:         240 5% 96%;
  --secondary-foreground: 240 10% 30%;
  --muted:             240 5% 94%;
  --muted-foreground:  240 5% 50%;
  --accent:            267 60% 95%;
  --accent-foreground: 267 84% 45%;
  --destructive:       0 84% 60%;
  --destructive-foreground: 0 0% 100%;
  --border:            240 6% 90%;
  --input:             240 6% 90%;
  --ring:              267 84% 58%;
  --radius:            1rem;
  --shadow-card:       0 4px 24px -4px hsl(240 10% 10% / 0.08);
  --shadow-card-hover: 0 12px 32px -8px hsl(240 10% 10% / 0.15);
  --gradient-primary: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-glow)));
  --gradient-accent:   linear-gradient(135deg, hsl(180 70% 50%), hsl(200 80% 55%));
  --category-crash:    15 90% 55%;
  --category-roulette: 340 80% 55%;
  --category-scratch:  45 90% 55%;
  --category-slots:    267 84% 58%;
  --badge-popular:     340 80% 55%;
  --badge-new:         160 70% 45%;
  --badge-recommended: 45 90% 50%;
}

.dark {
  --background:        270 50% 6%;
  --foreground:        270 10% 95%;
  --card:              270 40% 10%;
  --card-foreground:   270 10% 95%;
  --card-hover:        270 40% 12%;
  --primary:           267 90% 65%;
  --primary-foreground:270 50% 6%;
  --primary-glow:      267 100% 70%;
  --secondary:         270 30% 15%;
  --secondary-foreground: 270 10% 85%;
  --muted:             270 30% 12%;
  --muted-foreground:  270 10% 55%;
  --accent:            267 50% 20%;
  --accent-foreground: 267 90% 75%;
  --destructive:       0 70% 50%;
  --destructive-foreground: 0 0% 100%;
  --border:            270 30% 18%;
  --input:             270 30% 18%;
  --ring:              267 90% 65%;
  --shadow-card:       0 4px 24px -4px hsl(267 100% 60% / 0.15);
  --shadow-card-hover: 0 12px 40px -8px hsl(267 100% 60% / 0.3);
  --gradient-primary: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-glow)));
  --gradient-accent:   linear-gradient(135deg, hsl(180 80% 55%), hsl(200 90% 60%));
  --category-crash:    20 100% 60%;
  --category-roulette: 340 90% 60%;
  --category-scratch:  50 100% 60%;
  --category-slots:    267 100% 70%;
  --badge-popular:     340 90% 60%;
  --badge-new:         160 80% 50%;
  --badge-recommended: 50 100% 55%;
}

/* ── Base ── */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(
    180deg,
    hsl(var(--primary) / 0.08) 0%,
    hsl(var(--background)) 40%
  );
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
img { display: block; max-width: 100%; }

.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 1rem; }

/* ── Theme toggle ── */
.theme-toggle {
  position: relative; padding: .5rem; border-radius: .75rem;
  background: hsl(var(--secondary)); border: none;
  color: hsl(var(--foreground));
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.theme-toggle:hover { background: hsl(var(--accent)); }
.ic-sun, .ic-moon { display: flex; }
.dark .ic-sun  { display: none; }
html:not(.dark) .ic-moon { display: none; }

/* ── Header ── sticky top-0 z-50 w-full bg-background/80 backdrop-blur-xl border-b border-border ── */
.site-header {
  position: sticky; top: 0; z-index: 50; width: 100%;
  background: hsl(var(--background) / .8);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid hsl(var(--border));
}
/* container flex items-center justify-between h-16 */
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 4rem; }

/* flex items-center gap-3 hover:opacity-80 transition-opacity */
.logo-link { display: flex; align-items: center; gap: .75rem; transition: opacity .2s; }
.logo-link:hover { opacity: .8; }

/* p-2 rounded-xl bg-primary/10 */
.logo-icon {
  display: flex; align-items: center; justify-content: center;
  padding: .5rem; border-radius: .75rem;
  background: hsl(var(--primary) / .1); color: hsl(var(--primary)); flex-shrink: 0;
}
/* w-6 h-6 object-contain */
.logo-img { width: 1.5rem; height: 1.5rem; object-fit: contain; }

/* font-bold text-xl text-foreground */
.site-name { font-weight: 700; font-size: 1.25rem; color: hsl(var(--foreground)); }
.header-actions { display: flex; align-items: center; gap: .75rem; }

/* Favoritos button: flex items-center gap-2 px-4 py-2 rounded-xl */
.btn-favorites {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem 1rem; border-radius: .75rem;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground)); font-size: .875rem; font-weight: 500;
  transition: all .2s;
}
.btn-favorites:hover { background: hsl(var(--muted)); }
.btn-favorites.active { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-color: hsl(var(--primary)); }
.btn-favorites .fav-label { display: none; }
@media (min-width: 640px) { .btn-favorites .fav-label { display: inline; } }

/* Admin icon button: w-10 h-10 rounded-xl bg-card border border-border */
.btn-admin {
  display: flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border-radius: .75rem;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground)); transition: all .2s;
}
.btn-admin:hover { background: hsl(var(--muted)); }

/* ── Main ── container py-6 */
.main-content { padding: 1.5rem 1rem; }

/* Hero: mb-8 */
.hero-section { margin-bottom: 2rem; }
/* text-3xl md:text-4xl font-bold mb-2 */
.hero-title { font-size: clamp(1.75rem, 4vw, 2.25rem); font-weight: 700; margin-bottom: .5rem; color: hsl(var(--foreground)); }
/* text-muted-foreground text-lg */
.hero-sub { font-size: 1.125rem; color: hsl(var(--muted-foreground)); }

/* ── Search: mb-6, max-w-md, rounded-xl, focus ring ── */
.search-section { margin-bottom: 1.5rem; }
.search-wrap { position: relative; width: 100%; max-width: 28rem; }
.search-icon {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  color: hsl(var(--muted-foreground)); pointer-events: none; display: flex;
}
/* h-12 pl-12 pr-12 rounded-xl bg-card border border-border focus:ring-2 focus:ring-primary/50 */
.search-input {
  width: 100%; height: 3rem; padding: 0 3rem 0 3rem;
  border-radius: .75rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  font-size: .9375rem;
  transition: all .2s;
  outline: none; -webkit-appearance: none; display: block;
}
.search-input:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(var(--primary) / .5);
}
.search-input::placeholder { color: hsl(var(--muted-foreground)); }

/* ── Categories: mb-8, w-full overflow-x-auto, gap-2, min-w-max px-1 ── */
.categories-section { margin-bottom: 2rem; }
.category-bar-wrap { width: 100%; overflow-x: auto; padding: .5rem 0; scrollbar-width: none; }
.category-bar-wrap::-webkit-scrollbar { display: none; }
.category-bar { display: flex; gap: .5rem; min-width: max-content; padding: 0 .25rem; }

/* category-chip — px-4 py-2.5 rounded-xl font-medium text-sm */
.category-chip {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .625rem 1rem; border-radius: .75rem;
  font-weight: 500; font-size: .875rem; white-space: nowrap;
  background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground));
  transition: all .2s; border: none;
}
.category-chip:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.category-chip.active {
  background: var(--gradient-primary); color: hsl(var(--primary-foreground));
  box-shadow: 0 4px 16px -4px hsl(var(--primary) / .4);
}

/* ── Games Grid: grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 md:gap-6 ── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (min-width: 768px)  { .games-grid { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; } }
@media (min-width: 1024px) { .games-grid { grid-template-columns: repeat(4, 1fr); gap: 1.5rem; } }

/* card-game: relative overflow-hidden rounded-2xl bg-card transition-all */
.card-game {
  position: relative; overflow: hidden;
  border-radius: 1rem; /* rounded-2xl = 1rem */
  background: hsl(var(--card));
  transition: all .3s ease-out;
  box-shadow: var(--shadow-card);
  cursor: pointer;
}
.card-game:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-4px); }

/* card-game-image: w-full aspect-[3/4] object-cover will-change-transform group-hover:scale-110 */
.card-img-wrap { position: relative; overflow: hidden; }
.card-img {
  width: 100%; aspect-ratio: 3/4; object-fit: cover;
  transition: transform .3s ease-out;
  will-change: transform;
}
.card-game:hover .card-img { transform: scale(1.1); } /* scale-110 */

/* absolute inset-0 bg-gradient-to-t from-black/70 via-black/20 opacity-60 group-hover:opacity-80 */
.card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.7), rgba(0,0,0,.2) 50%, transparent);
  opacity: .6; transition: opacity .3s;
}
.card-game:hover .card-overlay { opacity: .8; }

/* badge-game: absolute top-3 left-3 px-2.5 py-1 rounded-lg text-xs font-bold uppercase tracking-wide backdrop-blur-md */
.badge-game {
  position: absolute; top: .75rem; left: .75rem;
  padding: .25rem .625rem; border-radius: .5rem;
  font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  backdrop-filter: blur(12px);
}
.badge-popular     { background: hsl(var(--badge-popular) / 0.9);     color: white; }
.badge-new         { background: hsl(var(--badge-new) / 0.9);         color: white; }
.badge-recommended { background: hsl(var(--badge-recommended) / 0.9); color: hsl(270 50% 10%); }

/* Bottom row: absolute bottom-3 left-3 right-3 flex items-center justify-between z-10 */
.card-bottom-row {
  position: absolute; bottom: .75rem; left: .75rem; right: .75rem;
  display: flex; align-items: center; justify-content: space-between; z-index: 10;
}

/* Category icon: p-2 rounded-lg bg-background/80 backdrop-blur-md */
.card-cat-icon {
  display: flex; align-items: center; justify-content: center;
  padding: .5rem; border-radius: .5rem;
  background: hsl(var(--background) / .8); backdrop-filter: blur(12px);
  color: hsl(var(--foreground));
}

/* Favorite button */
.card-fav-btn {
  display: flex; align-items: center; justify-content: center;
  padding: .5rem; border-radius: .5rem; border: none;
  background: hsl(var(--background) / .8); backdrop-filter: blur(12px);
  color: hsl(var(--foreground));
  transition: all .2s;
}
.card-fav-btn:hover { background: hsl(var(--destructive) / .9); color: white; }
.card-fav-btn.active { background: hsl(var(--destructive) / .9); color: white; }
.card-fav-btn.active svg { fill: currentColor; transform: scale(1.1); }

/* Play overlay: absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 */
.play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .3s; z-index: 3;
}
.card-game:hover .play-overlay { opacity: 1; }

/* btn-play: px-6 py-3 rounded-xl font-semibold text-sm — scale-90 group-hover:scale-100 */
.btn-play {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .75rem 1.5rem; border-radius: .75rem;
  font-weight: 600; font-size: .875rem; border: none;
  background: var(--gradient-primary); color: hsl(var(--primary-foreground));
  transform: scale(.9); transition: all .2s;
}
.card-game:hover .btn-play { transform: scale(1); }
.btn-play:hover { transform: scale(1.05); box-shadow: 0 8px 24px -4px hsl(var(--primary) / .4); }
.btn-play:active { transform: scale(.98); }

/* p-4 */
.card-body { padding: 1rem; }
/* font-semibold text-card-foreground group-hover:text-primary line-clamp-1 */
.card-title {
  font-weight: 600; font-size: .9375rem; color: hsl(var(--card-foreground));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .2s;
}
.card-game:hover .card-title { color: hsl(var(--primary)); }

/* text-gradient — fiel ao original */
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* col-span-full text-center py-16 */
.empty-state {
  grid-column: 1 / -1;
  text-align: center; padding: 4rem 1rem;
  color: hsl(var(--muted-foreground)); font-size: 1.125rem;
}

/* ── Footer: border-t border-border mt-12 / container py-8 text-center ── */
.site-footer { border-top: 1px solid hsl(var(--border)); margin-top: 3rem; }
.footer-inner { padding: 2rem 0; text-align: center; }
.footer-inner p { color: hsl(var(--muted-foreground)); font-size: .875rem; }

/* ═══════════════ ADMIN ═══════════════ */
.admin-layout { min-height: 100vh; background: hsl(var(--background)); }
.admin-header { position: sticky; top: 0; z-index: 50; background: hsl(var(--background) / .9); backdrop-filter: blur(20px); border-bottom: 1px solid hsl(var(--border)); }
.admin-header-inner { display: flex; align-items: center; justify-content: space-between; height: 4rem; padding: 0 1.5rem; }
.admin-nav { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; }
.admin-nav::-webkit-scrollbar { display: none; }
.admin-tab { padding: .625rem 1.5rem; border-radius: .75rem; border: none; background: transparent; color: hsl(var(--muted-foreground)); font-size: .875rem; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .2s, color .2s; }
.admin-tab:hover { background: hsl(var(--secondary)); color: hsl(var(--foreground)); }
.admin-tab.active { background: hsl(var(--card)); color: hsl(var(--foreground)); box-shadow: 0 1px 4px hsl(0 0% 0% / .1); }
.admin-main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.panel-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; }
.panel-header p { color: hsl(var(--muted-foreground)); font-size: .9rem; }

.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .5rem; }
.form-input, .form-select { width: 100%; height: 2.75rem; padding: 0 .875rem; border-radius: .75rem; border: 1px solid hsl(var(--border)); background: hsl(var(--secondary) / .5); color: hsl(var(--foreground)); font-size: .9375rem; outline: none; transition: border-color .2s, box-shadow .2s; font-family: inherit; }
.form-input:focus, .form-select:focus { border-color: hsl(var(--primary)); box-shadow: 0 0 0 2px hsl(var(--primary) / .5); }
.form-select { appearance: none; cursor: pointer; }
.form-hint { font-size: .8rem; color: hsl(var(--muted-foreground)); margin-top: .35rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 580px) { .form-row { grid-template-columns: 1fr; } }

.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .625rem 1.25rem; border-radius: .75rem; border: none; font-size: .875rem; font-weight: 600; cursor: pointer; transition: all .15s; font-family: inherit; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--gradient-primary); color: hsl(var(--primary-foreground)); }
.btn-primary:hover { opacity: .9; box-shadow: 0 4px 16px hsl(var(--primary) / .35); }
.btn-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.btn-secondary:hover { opacity: .85; }
.btn-danger { background: hsl(var(--destructive) / .15); color: hsl(var(--destructive)); }
.btn-danger:hover { background: hsl(var(--destructive) / .25); }
.btn-ghost { background: transparent; color: hsl(var(--muted-foreground)); border: 1px solid hsl(var(--border)); }
.btn-ghost:hover { background: hsl(var(--secondary)); color: hsl(var(--foreground)); }
.btn-icon { width: 2.25rem; height: 2.25rem; padding: 0; justify-content: center; }

.card { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) * 1.25); padding: 1.5rem; }
.games-table { width: 100%; border-collapse: collapse; }
.games-table th, .games-table td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid hsl(var(--border)); font-size: .875rem; }
.games-table th { color: hsl(var(--muted-foreground)); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.games-table tr:last-child td { border-bottom: none; }
.game-thumb { width: 2.5rem; height: 3.25rem; border-radius: .5rem; object-fit: cover; }

.order-list { display: flex; flex-direction: column; gap: .5rem; }
.order-item { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-radius: .75rem; background: hsl(var(--secondary) / .5); border: 1px solid hsl(var(--border)); cursor: grab; user-select: none; transition: background .2s; }
.order-item.dragging { opacity: .5; }
.order-item.drag-over { background: hsl(var(--accent)); border-color: hsl(var(--primary) / .5); }
.order-thumb { width: 2rem; height: 2.5rem; border-radius: .375rem; object-fit: cover; flex-shrink: 0; }
.order-title { flex: 1; font-size: .9rem; font-weight: 500; }

.color-preset { width: 2.25rem; height: 2.25rem; border-radius: .5rem; border: 2px solid transparent; cursor: pointer; transition: transform .15s, border-color .15s; }
.color-preset:hover { transform: scale(1.12); border-color: hsl(var(--foreground) / .4); }
input[type="color"] { width: 3rem; height: 3rem; border-radius: .75rem; border: 1px solid hsl(var(--border)); cursor: pointer; padding: .25rem; background: hsl(var(--card)); }

.upload-area { border: 2px dashed hsl(var(--border)); border-radius: var(--radius); padding: 1.25rem; text-align: center; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .5rem; color: hsl(var(--muted-foreground)); font-size: .875rem; transition: border-color .2s, background .2s; }
.upload-area:hover { border-color: hsl(var(--primary)); background: hsl(var(--primary) / .05); }
.upload-preview { margin-top: .75rem; }
.upload-preview img { max-height: 8rem; border-radius: .5rem; margin: 0 auto; }

.modal-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.hidden { display: none !important; }
.modal { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) * 1.5); width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; padding: 1.75rem; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-header h2 { font-size: 1.2rem; font-weight: 700; }
.modal-footer { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid hsl(var(--border)); }

.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-box { width: 100%; max-width: 420px; }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo-icon { display: inline-flex; align-items: center; justify-content: center; width: 4rem; height: 4rem; border-radius: 1rem; background: hsl(var(--primary) / .1); color: hsl(var(--primary)); margin-bottom: 1rem; }
.login-card { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) * 1.5); padding: 2rem; box-shadow: 0 4px 32px hsl(0 0% 0% / .1); }
.login-input-wrap { position: relative; }
.login-input-icon { position: absolute; left: .875rem; top: 50%; transform: translateY(-50%); color: hsl(var(--muted-foreground)); pointer-events: none; display: flex; }
.login-input { width: 100%; height: 3rem; padding: 0 3rem; border-radius: .875rem; border: 1px solid hsl(var(--border)); background: hsl(var(--secondary) / .5); color: hsl(var(--foreground)); font-size: 1rem; outline: none; transition: border-color .2s, box-shadow .2s; }
.login-input:focus { border-color: hsl(var(--primary)); box-shadow: 0 0 0 2px hsl(var(--primary) / .5); }
.login-input::placeholder { color: hsl(var(--muted-foreground)); }
.pw-toggle { position: absolute; right: .875rem; top: 50%; transform: translateY(-50%); background: none; border: none; color: hsl(var(--muted-foreground)); cursor: pointer; display: flex; transition: color .2s; }
.pw-toggle:hover { color: hsl(var(--foreground)); }
.login-error { display: flex; align-items: center; gap: .5rem; padding: .75rem 1rem; border-radius: .75rem; background: hsl(var(--destructive) / .12); color: hsl(var(--destructive)); font-size: .875rem; border: 1px solid hsl(var(--destructive) / .25); }
.btn-login { width: 100%; height: 3rem; font-size: 1rem; font-weight: 600; border: none; border-radius: .875rem; cursor: pointer; background: var(--gradient-primary); color: hsl(var(--primary-foreground)); display: flex; align-items: center; justify-content: center; gap: .5rem; transition: box-shadow .2s, transform .15s; }
.btn-login:hover { box-shadow: 0 4px 20px hsl(var(--primary) / .4); }
.btn-login:active { transform: scale(.98); }
.back-link { display: block; text-align: center; margin-top: 1.5rem; font-size: .875rem; color: hsl(var(--muted-foreground)); transition: color .2s; }
.back-link:hover { color: hsl(var(--foreground)); }

@keyframes slideIn  { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { to   { transform: translateX(110%); opacity: 0; } }
