/*!
 * GameVault CMS v2.0.0 — Frontend Enhancements
 * --------------------------------------------------
 * Adds:
 *   • Advanced game player overlay UI
 *   • Pre-game ad screen (countdown, progress bar, skip)
 *   • Focus mode, fullscreen helpers
 *   • Skeleton loading cards
 *   • Sticky mobile bottom navigation
 *   • Responsive helpers for ≥320 / 768 / 1024 / 1366 / 1920
 *   • Report-game modal
 *
 * @author  Mr Arslan CEO
 * @url     https://codester.com/mrdigitalceo
 * @version 2.0.0
 */

/* =========================
   1. CSS custom properties
   ========================= */
:root{
  --gv2-z-overlay: 90;
  --gv2-z-ad: 95;
  --gv2-z-modal: 1050;
  --gv2-z-toast: 1100;
  --gv2-radius-lg: 16px;
  --gv2-radius-md: 12px;
  --gv2-radius-sm: 8px;
  --gv2-shadow-lg: 0 20px 50px rgba(0,0,0,.35);
}

/* =========================
   2. Game Player Wrap
   ========================= */
.gv2-player-wrap{
  position: relative;
  width: 100%;
  background:#000;
  border-radius: var(--gv2-radius-lg);
  overflow: hidden;
  aspect-ratio: 16/9;
  max-height: 78vh;
  box-shadow: var(--gv2-shadow-lg);
}
.gv2-player-wrap iframe{
  position:absolute; inset:0;
  width:100%; height:100%;
  border:0; background:#000;
}

/* Game preview overlay (before play) */
.gv2-preview-overlay{
  position:absolute; inset:0;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,.85) 100%);
  z-index: var(--gv2-z-overlay);
  gap: 16px; padding: 18px;
  text-align:center;
  color:#fff;
}
.gv2-preview-overlay::before{
  content:""; position:absolute; inset:0;
  background-size: cover; background-position: center;
  background-image: var(--bg-thumb, none);
  filter: blur(10px) brightness(.45);
  z-index:-1;
}
.gv2-preview-thumb{
  width: clamp(140px, 22vw, 240px);
  aspect-ratio: 1;
  border-radius: var(--gv2-radius-md);
  object-fit: cover;
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
  border:2px solid rgba(255,255,255,.15);
}
.gv2-preview-title{ font-size: clamp(18px,3vw,28px); margin:0; font-weight:800; letter-spacing:.2px;}
.gv2-preview-meta{ font-size:13px; color:#cbd5e1; display:flex; gap:14px; flex-wrap:wrap; justify-content:center;}
.gv2-preview-meta span{ display:inline-flex; align-items:center; gap:6px;}
.gv2-play-btn{
  background: linear-gradient(135deg, var(--theme-primary,#6366f1), var(--theme-accent,#06b6d4));
  color:#fff; border:0; cursor:pointer;
  padding: 12px 30px; font-size:17px; font-weight:700;
  border-radius: 999px;
  display:inline-flex; align-items:center; gap:10px;
  box-shadow: 0 8px 24px rgba(99,102,241,.5);
  transition: transform .15s ease, box-shadow .15s ease;
}
.gv2-play-btn:hover{ transform: translateY(-2px); box-shadow: 0 14px 32px rgba(99,102,241,.6);}
.gv2-play-btn i{ font-size:20px;}

/* Game spinner */
.gv2-game-spinner{
  position:absolute; inset:0;
  display:none;
  align-items:center; justify-content:center;
  flex-direction:column; gap:14px;
  background: rgba(0,0,0,.7);
  color:#fff; z-index: 92;
}
.gv2-game-spinner.show{ display:flex;}
.gv2-game-spinner .spinner{
  width:54px; height:54px; border:4px solid rgba(255,255,255,.15);
  border-top-color: var(--theme-accent,#06b6d4);
  border-radius:50%; animation: gv2spin 1s linear infinite;
}
@keyframes gv2spin { to { transform: rotate(360deg);} }

/* =========================
   3. Pre-Game Ad UI
   ========================= */
.gv2-ad-overlay{
  position:absolute; inset:0;
  background:#0b1220;
  display:none;
  flex-direction:column;
  z-index: var(--gv2-z-ad);
  border-radius: var(--gv2-radius-lg);
  overflow:hidden;
}
.gv2-ad-overlay.show{ display:flex;}
.gv2-ad-topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding: 8px 14px;
  background: rgba(0,0,0,.55);
  color:#cbd5e1;
  font-size:12px;
  flex: 0 0 auto;
}
.gv2-ad-label{
  display:inline-flex; align-items:center; gap:6px;
  background: rgba(255,255,255,.08);
  padding: 4px 10px; border-radius: 999px;
  letter-spacing:.5px; text-transform:uppercase; font-weight:700;
  font-size:11px;
}
.gv2-ad-label::before{
  content:""; width:6px; height:6px; border-radius:50%;
  background: var(--theme-accent,#06b6d4);
  box-shadow: 0 0 6px var(--theme-accent,#06b6d4);
}
.gv2-ad-countdown{ font-weight:700; color:#fff;}
.gv2-ad-body{
  position:relative; flex:1 1 auto;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
  background:#000;
}
.gv2-ad-body img, .gv2-ad-body video{
  max-width:100%; max-height:100%; object-fit:contain;
}
.pga-image-ad{ display:flex; width:100%; height:100%; align-items:center; justify-content:center;}
.pga-image-ad img{ width:100%; height:100%; object-fit:cover;}
.pga-text-ad{
  color:#fff; text-align:center; padding: 30px;
  max-width: 640px;
}
.pga-text-ad h3{ font-size: clamp(22px,3vw,32px); margin:0 0 14px; color:#fff;}
.pga-text-ad p{ color:#cbd5e1; font-size:15px; margin:0 0 22px; line-height:1.6;}
.pga-cta{
  display:inline-flex; align-items:center; gap:8px;
  padding: 12px 28px; border-radius: 999px;
  background: linear-gradient(135deg, var(--theme-primary,#6366f1), var(--theme-accent,#06b6d4));
  color:#fff; text-decoration:none; font-weight:700;
}
.pga-html-ad{ width:100%; height:100%; display:flex; align-items:center; justify-content:center; overflow:auto;}

/* Progress bar + bottom controls */
.gv2-ad-progress{
  height: 4px; background: rgba(255,255,255,.08); overflow:hidden;
  flex: 0 0 auto;
}
.gv2-ad-progress-bar{
  height:100%; width:0%;
  background: linear-gradient(90deg, var(--theme-primary,#6366f1), var(--theme-accent,#06b6d4));
  transition: width .4s linear;
}
.gv2-ad-bottombar{
  display:flex; align-items:center; justify-content:flex-end;
  gap:10px; padding: 10px 14px;
  background: rgba(0,0,0,.55);
  flex: 0 0 auto;
}
.gv2-ad-skip, .gv2-ad-continue{
  background: rgba(255,255,255,.08);
  color:#fff;
  border:1px solid rgba(255,255,255,.15);
  padding: 9px 18px; border-radius: 8px; cursor:pointer; font-weight:600;
  font-size:14px;
  display:inline-flex; align-items:center; gap:6px;
}
.gv2-ad-skip[disabled]{ opacity:.5; cursor:not-allowed;}
.gv2-ad-continue{
  background: var(--theme-accent,#06b6d4);
  border-color: transparent;
}
.gv2-ad-continue:hover{ filter: brightness(1.1);}

/* =========================
   4. Toolbar & extra controls
   ========================= */
.gv2-toolbar{
  display:flex; flex-wrap:wrap; gap:8px; padding:10px 0;
  border-top: 1px solid rgba(148,163,184,.1);
  margin-top:14px;
}
.gv2-tool-btn{
  display:inline-flex; align-items:center; gap:6px;
  background: rgba(148,163,184,.08);
  color: inherit;
  padding: 8px 14px; border-radius: 999px;
  font-size: 13px; font-weight:600;
  border:0; cursor:pointer; text-decoration:none;
  transition: background .2s ease, transform .2s ease;
}
.gv2-tool-btn:hover{ background: rgba(99,102,241,.15); transform: translateY(-1px);}
.gv2-tool-btn.is-active{ background: rgba(239,68,68,.15); color:#ef4444;}

/* Focus mode */
body.gv2-focus-mode .site-header,
body.gv2-focus-mode .site-footer,
body.gv2-focus-mode .game-sidebar,
body.gv2-focus-mode .gv2-sidebar,
body.gv2-focus-mode aside{ display:none !important;}
body.gv2-focus-mode .gv2-player-wrap{ max-height: 92vh;}

/* Landscape hint on mobile */
.gv2-landscape-hint{
  display:none;
  position:fixed; inset:0;
  background: rgba(0,0,0,.85); color:#fff;
  z-index: 200; align-items:center; justify-content:center;
  flex-direction:column; gap:16px; padding:30px; text-align:center;
}
.gv2-landscape-hint i{ font-size:60px; color:var(--theme-accent,#06b6d4); animation: gv2rotate 2s ease-in-out infinite;}
@keyframes gv2rotate { 0%,100%{transform: rotate(0);} 50%{transform: rotate(90deg);} }

@media (max-width: 768px) and (orientation: portrait){
  body.gv2-show-landscape-hint .gv2-landscape-hint{ display:flex;}
}

/* =========================
   5. Skeleton loading cards
   ========================= */
.gv2-skel{
  background: linear-gradient(90deg, rgba(148,163,184,.07) 25%, rgba(148,163,184,.18) 50%, rgba(148,163,184,.07) 75%);
  background-size: 200% 100%;
  animation: gv2shimmer 1.4s linear infinite;
  border-radius: var(--gv2-radius-sm);
}
@keyframes gv2shimmer { 0%{ background-position: 200% 0;} 100%{ background-position: -200% 0;} }
.gv2-skel-card{ aspect-ratio: 1; border-radius: var(--gv2-radius-md); }

/* =========================
   6. Report Modal
   ========================= */
.gv2-modal{
  position: fixed; inset:0;
  background: rgba(0,0,0,.7);
  display:none;
  align-items:center; justify-content:center;
  z-index: var(--gv2-z-modal);
  padding:20px;
}
.gv2-modal.show{ display:flex;}
.gv2-modal-dialog{
  width: 100%;
  max-width: 460px;
  background: var(--tv-card, #1e293b);
  color: var(--tv-text, #e2e8f0);
  border-radius: var(--gv2-radius-lg);
  padding: 24px;
  box-shadow: var(--gv2-shadow-lg);
}
.gv2-modal-dialog h3{ margin: 0 0 14px; font-size:18px;}
.gv2-modal-dialog label{ display:block; margin-bottom:10px; font-size:13px;}
.gv2-modal-dialog select, .gv2-modal-dialog textarea, .gv2-modal-dialog input{
  width:100%;
  background: rgba(15,23,42,.6);
  color: inherit;
  border: 1px solid rgba(148,163,184,.25);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font: inherit;
}
.gv2-modal-actions{ display:flex; gap:8px; justify-content:flex-end; margin-top:8px;}
.gv2-modal-actions button{
  background: rgba(148,163,184,.15); color: inherit; border:0; padding:9px 18px; border-radius:8px; cursor:pointer;
}
.gv2-modal-actions .btn-primary{
  background: linear-gradient(135deg, var(--theme-primary,#6366f1), var(--theme-accent,#06b6d4));
  color:#fff;
}

/* =========================
   7. Toast notifications
   ========================= */
.gv2-toast-stack{
  position: fixed; top:20px; right:20px;
  display:flex; flex-direction:column; gap:8px;
  z-index: var(--gv2-z-toast);
  max-width: 320px;
}
.gv2-toast{
  background: #1e293b; color:#fff;
  border-left: 4px solid var(--theme-accent,#06b6d4);
  padding: 12px 14px; border-radius:8px; font-size:14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  animation: gv2toastin .3s ease;
}
.gv2-toast.success{ border-left-color:#22c55e;}
.gv2-toast.error  { border-left-color:#ef4444;}
.gv2-toast.warn   { border-left-color:#f59e0b;}
@keyframes gv2toastin { from{opacity:0; transform:translateY(-6px);} to{opacity:1; transform:translateY(0);} }

/* =========================
   8. Sticky mobile bottom nav
   ========================= */
.gv2-mob-bottomnav{
  position: fixed; bottom:0; left:0; right:0;
  display: none;
  background: var(--tv-card-2, #273549);
  border-top:1px solid rgba(148,163,184,.2);
  padding: 6px 8px env(safe-area-inset-bottom);
  z-index: 70;
  justify-content: space-around;
}
.gv2-mob-bottomnav a{
  flex:1; text-align:center;
  color: var(--tv-muted,#94a3b8); text-decoration:none;
  font-size: 11px;
  display:flex; flex-direction:column; align-items:center; gap:2px;
  padding: 6px 0;
  transition: color .2s ease;
}
.gv2-mob-bottomnav a i{ font-size:18px;}
.gv2-mob-bottomnav a.active{ color: var(--theme-accent,#06b6d4);}

@media (max-width: 768px){
  .gv2-mob-bottomnav{ display:flex;}
  body{ padding-bottom: 60px; }
}

/* =========================
   9. Mobile responsiveness
   ========================= */
@media (max-width: 1024px){
  .gv2-player-wrap{ max-height: 70vh;}
}
@media (max-width: 768px){
  .gv2-player-wrap{
    border-radius: var(--gv2-radius-md);
    max-height: 56vh;
  }
  .gv2-toolbar{ gap:6px;}
  .gv2-tool-btn{ padding:7px 11px; font-size:12px;}
  .gv2-preview-meta{ font-size:12px;}
}
@media (max-width: 480px){
  .gv2-player-wrap{
    border-radius: var(--gv2-radius-sm);
    max-height: 48vh;
  }
  .pga-text-ad h3{ font-size:18px;}
  .pga-text-ad p{ font-size:13px;}
  .gv2-ad-bottombar{ padding:8px 10px;}
  .gv2-ad-skip, .gv2-ad-continue{ padding:8px 14px; font-size:13px;}
}

/* =========================
   10. Game badges (NEW / TRENDING / FEATURED)
   ========================= */
.gv2-game-badges{
  position:absolute; top:8px; left:8px;
  display:flex; flex-direction:column; gap:4px;
}
.gv2-badge{
  font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.5px;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(0,0,0,.6);
  color:#fff; backdrop-filter: blur(4px);
}
.gv2-badge.new      { background:#22c55e;}
.gv2-badge.trending { background:#f97316;}
.gv2-badge.featured { background:#f59e0b;}
.gv2-badge.editor   { background:#a855f7;}

/* =========================
   11. Admin responsive helpers (loaded on admin pages too)
   ========================= */
@media (max-width: 768px){
  .admin-sidebar{ transform: translateX(-100%); transition: transform .25s ease;}
  .admin-sidebar.open{ transform: translateX(0);}
  .admin-content{ padding: 14px;}
  .admin-card-grid{ grid-template-columns: 1fr 1fr !important;}
}
@media (max-width: 480px){
  .admin-card-grid{ grid-template-columns: 1fr !important;}
}
