/* =========================================================
   THEBAN GAMES — "بيننا مجرم"
   FINAL PROFESSIONAL THEME
   الجزء 1/3 — Base & Layout & Topbar & Footer
   الهوية البصرية: #272416 / #241F08
   مستوحى من Hard Situation framework
   ========================================================= */
html, body { background: #272416; }
.no-scroll { overflow: hidden; }
.cr-empty { text-align: center; margin: 40px 0; }

/* بدل background-image صار img */
.cover { position: relative; overflow: hidden; }
.cover-img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Variables ---------- */
:root {
  --cr-base: #272416;
  --cr-base-700: #241F08;
  --cr-base-800: #1d1a07;
  --cr-accent: #ebce8f;
  --cr-accent-400: #d4b772;
  --cr-accent-200: #fff3ca;
  --cr-text: #f5f5f5;
  --cr-muted: #bdb6a0;
  --cr-border: rgba(255,255,255,0.08);
  --cr-shadow: 0 4px 18px rgba(0,0,0,0.35);
  --radius: 14px;
  font-family: 'Tajawal','Segoe UI','Tahoma',Arial,sans-serif;
}

/* ---------- Base Reset ---------- */
* { box-sizing:border-box; margin:0; padding:0; }
html, body { height:100%; }
body {
  background-color: #272416; /* fallback فوري */
  background-image: url(/assets/img/Criminal_Background.webp);
  background-size: cover;
  background-repeat: repeat;
  background-attachment: fixed;
  background-position: center;
  color: var(--cr-text);
  overflow-x: hidden;
  line-height: 1.5;
}
body.layout { display:flex; flex-direction:column; min-height:100vh; }
.wrap { width:100%; max-width:1200px; margin:0 auto; padding:24px 18px; }

/* =========================================================
   🧭 Topbar
   ========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--cr-border);
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
}
.brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  color: var(--cr-accent);
}
.brand-title .badge {
  background: rgba(235,206,143,0.12);
  color: var(--cr-accent-200);
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(235,206,143,0.25);
}
.brand-title span {
  font-size: 1rem;
  color: var(--cr-accent-400);
  opacity: .9;
}
.auth-links {
  display: flex;
  align-items: center;
  gap: 10px;
}
.auth-links .welcome {
  font-weight: 600;
  color: var(--cr-accent-200);
}
.btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease;
}
.btn.primary {
  background: linear-gradient(180deg, var(--cr-accent) 0%, var(--cr-accent-400) 100%);
  color: #241F08;
  border: 1px solid rgba(235,206,143,0.5);
}
.btn.primary:hover {
  background: linear-gradient(180deg, var(--cr-accent-400) 0%, var(--cr-accent) 100%);
  transform: translateY(-1px);
}
.btn.secondary {
  background: rgba(255,255,255,0.08);
  color: var(--cr-text);
  border: 1px solid rgba(255,255,255,0.15);
}
.btn.secondary:hover {
  background: rgba(255,255,255,0.15);
}

/* =========================================================
   🎬 Hero Section (عنوان اللعبة)
   ========================================================= */
.hero {
  max-width: 1200px;
  margin: 40px auto 30px;
  padding: 32px 18px;
  text-align: center;
}
.page-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 1.9rem;
  color: var(--cr-accent);
  font-weight: 800;
  text-shadow: 0 2px 6px rgba(0,0,0,0.45);
}
.page-title .title-logo {
  margin-left: 12px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #3a3620, #1f1c0b);
  display: flex;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(235,206,143,0.35);
  border: 2px solid rgba(235,206,143,0.45);
}




.page-title .title-logo img {
  width: 90%; height: 90%;
  object-fit: cover;
  filter: drop-shadow(0 0 4px rgba(235,206,143,0.4));
}
.subtitle {
  margin-top: 12px;
  color: var(--cr-muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* =========================================================
   ⚖️ Footer
   ========================================================= */
.footer {
  margin-top: auto;
  padding: 18px 0;
  background: rgba(0,0,0,0.45);
  border-top: 1px solid var(--cr-border);
  color: var(--cr-text);
}
.footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.copy {
  color: var(--cr-muted);
  font-size: .9rem;
}
.social {
  display: flex;
  gap: 12px;
}
.social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 10px;
  background: rgba(255,255,255,0.1);
  transition: all .18s ease;
}
.social a:hover {
  transform: translateY(-3px);
  background: rgba(255,255,255,0.18);
}
.social svg {
  width: 24px; height: 24px;
}
/* =========================================================
   THEBAN GAMES — "بيننا مجرم"
   الجزء 2/3 — Cards + Grid + Mobile Carousel + Confirm Modal + Alerts
   ========================================================= */

/* ===========================
   📦 Scenario Grid & Cards
   =========================== */
.grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:22px;
  justify-items:center;
  margin:18px 0 34px;
}
@media (max-width: 1024px){
  .grid{ grid-template-columns:repeat(2, 1fr); }
}
@media (max-width: 640px){
  .grid{ grid-template-columns:1fr; }
}

.cr-card{
  background: linear-gradient(180deg, var(--cr-base-700) 0%, var(--cr-base) 100%);
  border:1px solid var(--cr-border);
  border-radius:16px;
  overflow:hidden;
  box-shadow: var(--cr-shadow);
  display:flex;
  flex-direction:column;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  width:100%;
  max-width: 360px;
}
.cr-card:hover{
  transform: translateY(-4px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.45);
  border-color: rgba(235,206,143,0.18);
}

/* صورة الغلاف مع طبقات ضبابية أنيقة */
.cr-card .cover{
  position:relative;
  width:100%;
  aspect-ratio: 4/3;
  background: #1b170b center/cover no-repeat;
  border-bottom: 2px solid rgba(255,255,255,0.06);
  animation: fadeIn .6s ease both;
}
/* ✅ بعد التحويل إلى <img>، أوقف طبقات الخلفية القديمة لأنها تغطي الصور */
.cr-card .cover::before,
.cr-card .cover::after{
  content: none !important;
  display: none !important;
}
.cr-card .cover.placeholder{
  background: linear-gradient(135deg, #3a3625, #2a2415);
  display:flex; align-items:center; justify-content:center;
  color: var(--cr-muted); font-size: .9rem;
}

/* معلومات البطاقة */
.cr-card .info{
  padding: 16px 18px 20px;
  display:flex; flex-direction:column; gap:8px;
  color: var(--cr-text);
}
.cr-card .info .title{
  color: var(--cr-accent);
  font-size: 1.1rem; font-weight: 800;
  letter-spacing: .2px;
}
.cr-card .info .desc{
  color: var(--cr-muted);
  font-size: .92rem; line-height: 1.55;
  min-height: 46px;
}

/* زر البدء */
.btn-start{
  margin-top:auto;
  padding: 12px;
  border-radius: 10px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 18px rgba(0,0,0,.22);
}
.btn-start:active{
  transform: translateY(0);
  opacity: .95;
}

/* ===========================
   📱 Mobile: Carousel Mode
   =========================== */
@media (max-width: 768px){
  .grid{
    display:flex;
    overflow-x:auto;
    gap:16px;
    scroll-snap-type: x mandatory;
    padding: 8px 10px 16px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-padding: 0 10px;
  }
  .grid::-webkit-scrollbar{ height: 6px; }
  .grid::-webkit-scrollbar-thumb{
    background: rgba(255,255,255,.15);
    border-radius: 4px;
  }
  .cr-card{
    flex: 0 0 88vw;
    scroll-snap-align: center;
    border-radius: 14px;
    margin: 0 auto;
    max-width: none;
  }
  .cr-card .cover{ aspect-ratio: 16/10; }
}

/* احترام مناطق الـ safe-area على الأجهزة الكاملة الشاشة */
@supports (padding: env(safe-area-inset-top)){
  @media (max-width:768px){
    .grid{
      padding-right: max(10px, env(safe-area-inset-right, 0px));
      padding-left:  max(10px, env(safe-area-inset-left, 0px));
    }
  }
}

/* ===========================
   ✅ Confirm Modal
   =========================== */
.confirm-overlay{
  position: fixed; inset:0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  display:flex; align-items:center; justify-content:center;
  z-index: 2000;
  animation: modalFade .2s ease both;
}
.confirm-box{
  width: min(92%, 420px);
  background: linear-gradient(180deg, var(--cr-base-700) 0%, var(--cr-base) 100%);
  border: 1px solid rgba(235,206,143,.25);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  padding: 22px 20px;
  color: var(--cr-text);
  text-align: center;
  animation: modalPop .22s ease-out both;
}
.confirm-box h2{
  margin-bottom: 8px;
  font-size: 1.25rem;
  color: var(--cr-accent);
}
.confirm-box p{
  color: var(--cr-muted);
  line-height: 1.65;
}
.confirm-btns{
  display:flex; gap:10px; justify-content:center; margin-top:16px;
}
.confirm-btns .btn{
  min-width: 120px;
}

/* ===========================
   🔔 Alerts
   =========================== */
.alert{
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--cr-border);
  background: rgba(255,255,255,.06);
  color: var(--cr-text);
  margin: 10px 0 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.alert-error{
  border-color: rgba(220, 84, 84, .35);
  background: rgba(220, 84, 84, .12);
}

/* ===========================
   🧭 Accessibility / Motion
   =========================== */
.btn:focus-visible,
a:focus-visible,
button:focus-visible{
  outline: 3px solid rgba(235,206,143,.6);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(235,206,143,.2);
  border-radius: 8px;
}
@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; animation: none !important; }
}

/* ===========================
   ✨ Animations
   =========================== */
@keyframes fadeIn{
  from{ opacity:0; transform: scale(1.05); }
  to  { opacity:1; transform: scale(1); }
}
@keyframes modalFade{
  from{ opacity:0; } to{ opacity:1; }
}
@keyframes modalPop{
  from{ transform: scale(.95); opacity:0; }
  to  { transform: scale(1);   opacity:1; }
}
/* =========================================================
   THEBAN GAMES — "بيننا مجرم"
   الجزء 3/3 — POLISH + MOBILE IMPROVEMENTS + EFFECTS
   ========================================================= */

/* =========================================================
   📱 تحسينات عامة — هوامش ومسافات مرنة
   ========================================================= */
@media (max-width: 900px) {
  .wrap { padding: 16px 10px; }

  .page-title {
    flex-direction: column;
    gap: 8px;
    font-size: 1.6rem;
    text-align: center;
  }

  .title-logo {
    width: 56px; height: 56px;
  }

  .subtitle { font-size: 0.95rem; }
}

/* =========================================================
   🔝 تحسين الشكل العام للتوب بار والفوتر في الجوال
   ========================================================= */
@media (max-width: 768px) {
  .topbar {
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
    background: rgba(0,0,0,.45);
    padding-bottom: 4px;
  }

  .topbar .wrap {
    flex-wrap: wrap;
    row-gap: 8px;
    column-gap: 6px;
    padding: 10px 12px;
  }

  .auth-links {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  .auth-links .btn {
    padding: 8px 12px;
    font-size: .95rem;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .auth-links .welcome {
    flex: 1 1 100%;
    text-align: center;
    order: -1;
    font-size: .9rem;
    opacity: .9;
  }

  .footer {
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    background: rgba(0,0,0,.45);
  }

  .social a {
    width: 40px; height: 40px;
  }
}

/* =========================================================
   🧩 Safe-Area (iPhone & fullscreen devices)
   ========================================================= */
@supports (padding: env(safe-area-inset-top)) {
  .topbar {
    padding-top: calc(12px + env(safe-area-inset-top));
  }
  .footer {
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
  body.layout {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* =========================================================
   ⚙️ STRUCTURAL SAFETY — إزالة أي scroll وهمي
   ========================================================= */
html, body {
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: hidden !important;
  max-width: 100%;
  height: auto;
}
@media (min-width: 1025px) {
  body.layout {
    padding: 0 !important;
    margin: 0 !important;
  }
}

/* =========================================================
   🌗 Hover & Active & Focus polish
   ========================================================= */
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}
.btn:active {
  transform: scale(0.98);
  opacity: 0.95;
}
.btn:focus-visible {
  outline: 3px solid rgba(235,206,143,0.7);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(235,206,143,0.25);
  border-radius: 8px;
}

/* =========================================================
   💫 Animation Enhancements
   ========================================================= */
.cr-card:hover .cover {
  filter: brightness(1.08);
  transition: filter .3s ease;
}
.cr-card:hover .info .title {
  color: var(--cr-accent-200);
  transition: color .3s ease;
}

/* =========================================================
   🎬 Fade-in transitions for Hero & Cards
   ========================================================= */
.hero, .cr-card {
  animation: sectionFade .4s ease both;
}
@keyframes sectionFade {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   🧱 Shadows & depth consistency
   ========================================================= */
@media (max-width: 768px) {
  .cr-card {
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  }
  .cr-card:hover {
    box-shadow: 0 5px 12px rgba(0,0,0,0.35);
  }
}

/* =========================================================
   🎯 Reduced motion accessibility
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* =========================================================
   ✅ Summary
   - تصميم متجاوب بالكامل على كل المقاسات.
   - انتقالات خفيفة محسّنة الأداء.
   - دعم Safe Area على الأجهزة الحديثة.
   - ثيم فخم بلون ترابي ذهبي مطابق لهوية اللعبة.
   ========================================================= */
/* ===== 🎟️ CRIMINAL — Redeem Modal ===== */
.cr-modal { position:fixed; inset:0; display:flex; align-items:center; justify-content:center;
  z-index:3000; background:rgba(0,0,0,.65); backdrop-filter:blur(6px); }
.cr-modal.is-hidden { display:none; }

.cr-modal-dialog {
  position:relative; width:min(92%, 420px);
  background: linear-gradient(180deg, var(--cr-base-700) 0%, var(--cr-base) 100%);
  border-radius: 16px; border: 2px solid var(--cr-accent);
  box-shadow: 0 8px 28px rgba(0,0,0,.55);
  padding: 28px 24px; text-align:center; color: var(--cr-text);
  animation: modalPop .25s ease-out;
}
.cr-modal-close { position:absolute; top:10px; left:14px; background:transparent; border:none;
  color:#bbb; font-size:22px; cursor:pointer; transition:color .2s; }
.cr-modal-close:hover { color:#fff; }
.cr-modal-header h3 { font-size:1.25rem; margin-bottom:6px; color: var(--cr-accent-200); }
.cr-modal-sub { font-size:.95rem; color: var(--cr-muted); line-height:1.6; }

.cr-redeem-field { margin:18px 0; text-align:right; direction:rtl; }
.cr-redeem-field label { display:block; font-size:.9rem; color:#e8e0c5; margin-bottom:6px; }
.cr-redeem-field input {
  width:100%; padding:10px 12px; border-radius:8px;
  border:1px solid rgba(255,255,255,.15);
  background:#1f1b0c; color: var(--cr-text); font-size:.95rem;
}
.cr-redeem-field input::placeholder { color:#9a9070; }
.cr-modal-actions { display:flex; justify-content:center; gap:10px; margin-top:14px; }
.cr-modal-footer-hint { margin-top:14px; font-size:.9rem; color: var(--cr-muted); }
.cr-modal-footer-hint a { color: var(--cr-accent-200); text-decoration:none; }
.cr-modal-footer-hint a:hover { text-decoration:underline; }
.cr-redeem-feedback { margin-top:10px; font-size:.95rem; min-height:22px; color:#81FFBA; }
.cr-modal-footer-hint a:hover { color: var(--cr-accent); text-decoration: underline; }
.cr-redeem-feedback a {
   color: var(--cr-accent);
  text-decoration: none;
  font-weight: 600;
}

.cr-redeem-feedback a:hover {
  text-decoration: underline;
  color: #f3e5b1; /* درجة أفتح عند الـ hover */
}
.cover { position: relative; overflow: hidden; }
.cover-blur{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit: cover;
  filter: blur(14px) brightness(.65);
  transform: scale(1.08);
}
.cover-img{
  position:relative; z-index:1;
  width:100%; height:100%;
  object-fit: cover;
  display:block;
}
.cr-modal{ position: fixed; inset: 0; }
.cr-modal-backdrop{ position: absolute; inset: 0; }
.cr-modal-dialog{ position: relative; z-index: 1; }

/* Phase 4: CSRF-safe logout form */
.logout-form-inline { display: inline-flex; margin: 0; padding: 0; }
