/* =========================================================
   UNIVERS JEUX — admin panel
   ========================================================= */
:root {
  --red: #d10a0a; --red-700: #a30000; --red-50: #fff1f1;
  --ink: #0e0e0e; --muted: #6b6b6b; --line: #e7e7e7; --bg: #f5f5f4; --paper: #fff;
  --green: #148a3e; --ease: cubic-bezier(.2,.8,.2,1); --ease-io: cubic-bezier(.77,0,.18,1);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 400 15px/1.5 Inter, system-ui, sans-serif; color: var(--ink); background: var(--bg); }
h1, h2, h3, h4 { font-family: Archivo, sans-serif; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.ar input, .ar textarea, input[dir="rtl"], textarea[dir="rtl"] { font-family: Cairo, Inter, sans-serif; }

/* ---------- buttons ---------- */
.btn {
  position: relative; overflow: hidden; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px; background: var(--red); color: #fff; font-weight: 700; font-size: .9rem; white-space: nowrap;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), color .2s;
}
.btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--ink); transform: translateX(-101%); transition: transform .35s var(--ease-io); }
.btn:hover { transform: translateY(-2px); box-shadow: 4px 4px 0 var(--ink); }
.btn:hover::before { transform: none; }
.btn:active { transform: none; box-shadow: none; }
.btn:disabled { opacity: .6; pointer-events: none; }
.btn i { font-size: 1.05rem; }
.btn-block { width: 100%; height: 54px; font-size: 1rem; }
.btn-block i { transition: transform .3s var(--ease); }
.btn-block:hover i { transform: translateX(4px); }
.btn-dark { background: var(--ink); }
.btn-dark::before { background: var(--red); }
.btn-dark:hover { box-shadow: 4px 4px 0 var(--red); }
.btn-ghost { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost::before { background: var(--bg); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink); transform: none; }
.btn.danger { color: var(--red); }
.btn.danger:hover { box-shadow: inset 0 0 0 1.5px var(--red); }
.danger-fill { background: var(--red); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; font-size: 1.2rem; border-radius: 50%; transition: background .2s, color .2s, transform .2s; }
.icon-btn:hover { background: var(--red-50); color: var(--red); }
.link { display: inline-flex; align-items: center; gap: 6px; color: var(--red); font-weight: 600; font-size: .85rem; margin-top: -4px; }
.link:hover { text-decoration: underline; }

/* ---------- fields ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: .8rem; font-weight: 600; color: #333; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); margin-inline-start: 4px; }
.field input, .field select, .field textarea {
  width: 100%; height: 44px; padding: 0 13px; background: #fff; border: 1.5px solid var(--line); outline: 0; transition: border-color .2s, box-shadow .2s;
}
.field textarea { height: auto; padding: 10px 13px; resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: #cfcfcf; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(209,10,10,.12); }
.field input:invalid.touched { border-color: var(--red); }
.input-ic { position: relative; }
.input-ic > i { position: absolute; top: 50%; left: 14px; transform: translateY(-50%); color: var(--muted); font-size: 1.15rem; pointer-events: none; transition: color .2s; }
.input-ic input { height: 52px; padding-left: 44px; }
.input-ic:focus-within > i { color: var(--red); }
.peek { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; display: grid; place-items: center; color: var(--muted); font-size: 1.15rem; }
.peek:hover { color: var(--ink); }
.form-error { min-height: 1.3em; margin: 0 0 8px; color: var(--red); font-size: .85rem; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.grid2.tight { gap: 0 10px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.login-art { position: relative; overflow: hidden; background: var(--red); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 36px; }
.login-art::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(-11deg, transparent 0 46px, rgba(0,0,0,.06) 46px 48px); }
.login-logo { position: relative; height: 46px; width: auto; align-self: flex-start; background: #fff; padding: 4px; }
.login-art-text { position: relative; }
.login-art h1 { font-size: clamp(3rem, 6vw, 5.6rem); line-height: .88; text-transform: uppercase; font-weight: 900; letter-spacing: -.02em; }
.login-art p { max-width: 380px; opacity: .85; margin: 20px 0 0; font-size: 1.05rem; }
.login-shapes { position: absolute; right: -30px; top: 50%; width: 300px; transform: translateY(-60%) rotate(8deg); fill: none; stroke: rgba(255,255,255,.22); stroke-width: 5; stroke-linejoin: round; stroke-linecap: round; animation: float 8s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-56%) rotate(2deg); } }
.login-side { display: grid; place-items: center; padding: 40px 24px; }
.login-form { width: min(400px, 100%); animation: rise .6s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--red); }
.login-form h2 { font-size: 2.6rem; text-transform: uppercase; font-weight: 900; margin: 6px 0 28px; }
.login-form.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; color: var(--muted); text-decoration: none; font-size: .88rem; transition: color .2s, gap .2s; }
.back-link:hover { color: var(--ink); gap: 10px; }
.mode-note { margin: 26px 0 0; padding: 12px 14px; background: var(--bg); font-size: .8rem; color: var(--muted); border-left: 3px solid var(--red); }
.mode-note:empty { display: none; }
.mode-note code { background: #fff; padding: 1px 5px; color: var(--ink); font-weight: 600; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--ink); color: #cfcfcf; display: flex; flex-direction: column; padding: 22px 14px; }
.side-logo { display: block; background: #fff; padding: 6px; margin: 0 6px 30px; transition: transform .3s var(--ease); }
.side-logo:hover { transform: scale(1.03); }
.side-nav { display: grid; gap: 4px; }
.side-nav button { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: #bdbdbd; font-weight: 600; text-align: left; transition: background .2s, color .2s, padding .3s var(--ease); }
.side-nav button i { font-size: 1.25rem; }
.side-nav button::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: var(--red); transform: scaleY(0); transition: transform .3s var(--ease); }
.side-nav button:hover { background: #1b1b1b; color: #fff; padding-left: 18px; }
.side-nav button.on { background: #1f1f1f; color: #fff; }
.side-nav button.on::before { transform: none; }
.side-nav b { margin-left: auto; font-size: .72rem; background: var(--red); color: #fff; padding: 2px 8px; border-radius: 10px; }
.side-foot { margin-top: auto; display: grid; gap: 12px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 12px 14px; color: #fff; text-decoration: none; font-weight: 600; box-shadow: inset 0 0 0 1.5px #333; transition: background .2s, box-shadow .2s; }
.side-link i:last-child { margin-left: auto; transition: transform .3s var(--ease); }
.side-link:hover { background: var(--red); box-shadow: none; }
.side-link:hover i:last-child { transform: translate(3px, -3px); }
.me { display: flex; align-items: center; gap: 10px; padding: 10px 6px 0; border-top: 1px solid #262626; }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; background: var(--red); color: #fff; font-weight: 800; text-transform: uppercase; }
.me b { display: block; color: #fff; font-size: .9rem; }
.me small { font-size: .72rem; color: #8a8a8a; }
.me .icon-btn { margin-left: auto; color: #bdbdbd; }
.me .icon-btn:hover { background: #262626; color: #fff; }

.main { padding: 30px clamp(18px, 3vw, 44px) 60px; min-width: 0; }
.demo-banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; margin-bottom: 24px; background: #fff8e1; border-left: 4px solid #f0a500; font-size: .88rem; }
.demo-banner i { color: #c98700; font-size: 1.25rem; }
.view { animation: rise .45s var(--ease); }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.view-head small { font-size: .74rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--red); }
.view-head h1 { font-size: 2.4rem; text-transform: uppercase; font-weight: 900; line-height: 1; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { position: relative; overflow: hidden; background: #fff; padding: 18px 20px; border: 1.5px solid transparent; text-align: left; transition: transform .3s var(--ease), border-color .2s, box-shadow .3s; }
.stat:hover { transform: translateY(-3px); border-color: var(--ink); box-shadow: 4px 4px 0 var(--red); }
.stat.on { border-color: var(--red); }
.stat i { position: absolute; right: 14px; top: 14px; font-size: 1.5rem; color: var(--red); transition: transform .4s var(--ease); }
.stat:hover i { transform: rotate(-12deg) scale(1.15); }
.stat b { display: block; font: 900 2rem Archivo, sans-serif; line-height: 1.1; }
.stat span { font-size: .82rem; color: var(--muted); font-weight: 600; }

/* table */
.table-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.search, .select { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; background: #fff; border: 1.5px solid var(--line); transition: border-color .2s; }
.search { flex: 1; min-width: 220px; }
.search:focus-within, .select:focus-within { border-color: var(--red); }
.search input, .select select { border: 0; outline: 0; background: none; width: 100%; }
.select select { cursor: pointer; font-weight: 600; font-size: .88rem; }
.search i, .select i { color: var(--muted); font-size: 1.1rem; }
.table-wrap { background: #fff; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 820px; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; padding: 13px 14px; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.table th.c, .table td.c { text-align: center; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .2s; }
.table tbody tr:hover { background: #fafafa; }
.table tbody tr.flash { animation: flash 1.2s ease; }
@keyframes flash { 0% { background: #e9f9ef; } }
.prod { display: flex; align-items: center; gap: 12px; min-width: 240px; cursor: pointer; }
.prod img { width: 54px; height: 54px; object-fit: cover; background: var(--bg); flex: none; transition: transform .3s var(--ease); }
.prod:hover img { transform: scale(1.08); }
.prod b { display: block; font-size: .9rem; line-height: 1.3; transition: color .2s; }
.prod:hover b { color: var(--red); }
.prod small { color: var(--muted); font-size: .76rem; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; font-size: .78rem; font-weight: 600; background: var(--bg); white-space: nowrap; }
.pill i { color: var(--red); }
.money { width: 100px; height: 38px; padding: 0 10px; border: 1.5px solid transparent; background: var(--bg); font-weight: 700; outline: 0; transition: border-color .2s, background .2s; }
.money:hover { border-color: var(--line); background: #fff; }
.money:focus { border-color: var(--red); background: #fff; }
.money.saving { border-color: #f0a500; }
.money.saved { border-color: var(--green); }
.money.old { font-weight: 500; color: var(--muted); }
.promo-tag { display: block; font-size: .7rem; font-weight: 700; color: var(--red); margin-top: 3px; }
.row-acts { display: flex; gap: 4px; justify-content: flex-end; }
.row-acts .icon-btn { border-radius: 0; }
.row-acts .del:hover { background: var(--red); color: #fff; }
.table-empty { text-align: center; color: var(--muted); padding: 40px; margin: 0; }
.table-empty i { display: block; font-size: 2rem; color: var(--red); }
.hint { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .82rem; margin-top: 14px; }

/* mini switch */
.mini { position: relative; display: inline-block; width: 40px; height: 22px; }
.mini input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.mini span { position: absolute; inset: 0; background: #d6d6d6; border-radius: 11px; transition: background .25s; }
.mini span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .25s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.mini input:checked + span { background: var(--red); }
.mini.green input:checked + span { background: var(--green); }
.mini input:checked + span::after { transform: translateX(18px); }
.mini input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }

/* panels */
.panel { background: #fff; padding: 28px; }
.panel h3 { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; text-transform: uppercase; margin: 26px 0 14px; padding-top: 22px; border-top: 1px solid var(--line); }
.panel h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.panel h3 i { color: var(--red); font-size: 1.3rem; }
#settingsForm { max-width: 900px; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 10px; padding-top: 20px; border-top: 1px solid var(--line); }
.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; transition: transform .3s var(--ease), box-shadow .3s; }
.tile:hover { transform: translateY(-4px); box-shadow: 6px 6px 0 var(--ink); }
.tile .big { font-size: 2.2rem; color: var(--red); }
.tile h3 { margin: 0; padding: 0; border: 0; }
.tile p { color: var(--muted); margin: 0 0 10px; font-size: .9rem; flex: 1; }

/* ---------- product editor sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(2px); opacity: 0; transition: opacity .3s; }
.sheet-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: #fff; display: flex; flex-direction: column; transform: translateX(104%); transition: transform .45s var(--ease); box-shadow: -30px 0 60px -20px rgba(0,0,0,.3); }
.sheet.open { pointer-events: auto; }
.sheet.open .sheet-scrim { opacity: 1; }
.sheet.open .sheet-panel { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 3px solid var(--red); }
.sheet-head h2 { font-size: 1.4rem; text-transform: uppercase; font-weight: 900; }
.sheet-body { flex: 1; overflow-y: auto; padding: 22px 24px 10px; }
.sheet-foot { display: flex; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); background: #fff; }
.grow { flex: 1; }
.photo { display: grid; gap: 10px; margin-bottom: 18px; }
.drop { position: relative; height: 230px; display: grid; place-items: center; background: var(--bg); border: 2px dashed #cfcfcf; cursor: pointer; overflow: hidden; transition: border-color .2s, background .2s; }
.drop:hover, .drop.over { border-color: var(--red); background: var(--red-50); }
.drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.drop.has-img .drop-hint { position: absolute; inset: 0; background: rgba(0,0,0,.55); color: #fff; opacity: 0; transition: opacity .25s; }
.drop.has-img:hover .drop-hint { opacity: 1; }
.drop-hint { display: grid; place-items: center; align-content: center; gap: 4px; text-align: center; color: var(--muted); }
.drop-hint i { font-size: 2.4rem; color: var(--red); transition: transform .3s var(--ease); }
.drop:hover .drop-hint i { transform: translateY(-4px); }
.drop-hint b { color: inherit; }
.drop.has-img .drop-hint b { color: #fff; }
.drop-hint span { font-size: .82rem; }
.drop-busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.75); font-size: 2rem; color: var(--red); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fgroup { margin-bottom: 8px; }
.fgroup h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px; }
.fgroup h4 em { font-style: normal; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); font-family: Inter; }
.lang-field { grid-template-columns: 44px 1fr; gap: 0; margin-bottom: 8px; }
.lang-field .lang-tag { display: grid; place-items: center; background: var(--ink); color: #fff; font-size: .72rem; font-weight: 800; letter-spacing: .06em; }
.lang-field.ar .lang-tag { font-family: Cairo; font-size: .95rem; }
.lang-field input, .lang-field textarea { border-left: 0; }
.small-hint { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: .8rem; margin: -4px 0 16px; }
.small-hint i { color: var(--red); }
.toggles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.toggle { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1.5px solid var(--line); cursor: pointer; transition: border-color .2s, background .2s; }
.toggle:hover { border-color: #cfcfcf; }
.toggle:has(input:checked) { border-color: var(--red); background: var(--red-50); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .sw { position: relative; flex: none; width: 34px; height: 20px; background: #d6d6d6; border-radius: 10px; margin-top: 1px; transition: background .25s; }
.toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; background: #fff; border-radius: 50%; transition: transform .25s var(--ease); }
.toggle input:checked + .sw { background: var(--red); }
.toggle input:checked + .sw::after { transform: translateX(14px); }
.toggle input:focus-visible + .sw { outline: 2px solid var(--red); outline-offset: 2px; }
.toggle b { display: block; font-size: .86rem; }
.toggle small { color: var(--muted); font-size: .74rem; line-height: 1.3; display: block; }

/* confirm */
.confirm { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .25s; }
.confirm.open { opacity: 1; pointer-events: auto; }
.confirm-box { width: min(400px, 100%); background: #fff; padding: 30px; text-align: center; transform: scale(.94); transition: transform .3s var(--ease); }
.confirm.open .confirm-box { transform: none; }
.confirm-box > i { font-size: 2.8rem; color: var(--red); }
.confirm-box h3 { font-size: 1.3rem; margin: 6px 0; text-transform: uppercase; }
.confirm-box p { color: var(--muted); margin: 0 0 22px; }
.confirm-box div { display: flex; gap: 10px; justify-content: center; }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 380px; padding: 12px 16px; background: var(--ink); color: #fff; font-weight: 600; font-size: .88rem; border-left: 4px solid var(--green); animation: tin .35s var(--ease); }
.toast.err { border-left-color: var(--red); }
.toast i { font-size: 1.2rem; color: #3ddc84; }
.toast.err i { color: #ff6b6b; }
.toast.out { animation: tout .3s ease forwards; }
@keyframes tin { from { opacity: 0; transform: translateX(30px); } }
@keyframes tout { to { opacity: 0; transform: translateX(30px); } }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: 260px; padding: 28px; }
  .login-art h1 { font-size: 3rem; }
  .login-shapes { width: 200px; }
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 50; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; overflow-x: auto; }
  .side-logo { margin: 0; width: 120px; flex: none; }
  .side-nav { display: flex; }
  .side-nav button { padding: 10px 12px; }
  .side-nav button span { display: none; }
  .side-nav b { margin-left: 4px; }
  .side-foot { margin: 0 0 0 auto; display: flex; align-items: center; }
  .side-link span, .side-link i:last-child, .me div { display: none; }
  .side-link { padding: 10px; }
  .me { border: 0; padding: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cards3, .grid3 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .grid2 { grid-template-columns: 1fr; }
  .toggles { grid-template-columns: 1fr; }
  .view-head h1 { font-size: 1.9rem; }
  .view-head .btn span { display: none; }
  .sheet-foot .btn span { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
