/* ============================================================
   Manassate 2026 — Shared Styles (new light design)
   [AR] نظام التصميم الجديد لمنصّتي: فاتح + سايدبار داكن + تدرّج وردي/برتقالي
   ============================================================ */

:root {
  --bg:          #f4efe9;
  --card:        #ffffff;
  --ink:         #241f2e;
  --muted:       #8b8694;
  --side:        #16141c;
  --pink:        #f5418f;
  --orange:      #ff9d5c;
  --grad:        linear-gradient(120deg,#f5418f,#ff9d5c);
  --line:        #ece4db;
  --soft:        #efe7df;
  /* legacy mappings */
  --primary:     #f5418f;
  --primary-600: #e0307e;
  --accent:      #ff9d5c;
  --success:     #047857;
  --danger:      #be185d;
  --surface:     #ffffff;
  --surface-2:   #f0eae3;
  --text:        #241f2e;
  --text-muted:  #8b8694;
  --border:      #ece4db;
  --shadow:      0 12px 30px rgba(120,90,90,.07);
  --radius:      16px;
  --navy:        #f4efe9;
  --navy-2:      #ece4db;
}

/* ---------- Reset ---------- */
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0 }
html,body { height:100% }
body {
  font-family:'Readex Pro',system-ui,sans-serif;
  background:var(--bg); color:var(--ink); direction:rtl;
  min-height:100vh; -webkit-font-smoothing:antialiased;
}

/* ---------- Auth background ---------- */
.auth-bg {
  position:fixed; inset:0; z-index:-1;
  background: radial-gradient(circle at 18% 18%, rgba(245,65,143,.12) 0%, transparent 50%),
              radial-gradient(circle at 82% 82%, rgba(255,157,92,.10) 0%, transparent 50%),
              var(--bg);
}

/* ---------- Layout ---------- */
.center-screen { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px }
.container { max-width:1180px; margin:0 auto; padding:24px 20px }
.grid { display:grid; gap:18px }
.grid-2 { grid-template-columns:repeat(2,1fr) }
.grid-3 { grid-template-columns:repeat(3,1fr) }
.grid-4 { grid-template-columns:repeat(4,1fr) }
@media(max-width:900px){ .grid-3,.grid-4 { grid-template-columns:repeat(2,1fr) } }
@media(max-width:600px){ .grid-2,.grid-3,.grid-4 { grid-template-columns:1fr } }

/* ---------- Card ---------- */
.card {
  background:var(--card); border:1px solid var(--line);
  border-radius:var(--radius); box-shadow:var(--shadow); padding:22px;
}
.card-title { font-weight:800; font-size:1.05rem; margin-bottom:14px }

/* ---------- Auth card ---------- */
.auth-card {
  width:100%; max-width:420px; background:var(--card); border-radius:24px;
  box-shadow:0 24px 60px rgba(120,90,90,.14); padding:34px 30px;
}
.brand { text-align:center; margin-bottom:22px }
.brand-logo {
  width:70px; height:70px; margin:0 auto 12px; background:var(--grad); color:#fff;
  border-radius:18px; display:grid; place-items:center; font-size:30px; font-weight:900;
  box-shadow:0 10px 24px rgba(245,65,143,.3); overflow:hidden;
}
.brand h1 { font-size:1.3rem; font-weight:800 }
.brand p  { color:var(--muted); font-size:.9rem; margin-top:4px }

/* ---------- Forms ---------- */
.field { margin-bottom:16px }
.field label { display:block; font-weight:700; font-size:.88rem; margin-bottom:6px }
.input,select,textarea {
  width:100%; padding:12px 14px; border:1.5px solid var(--line);
  border-radius:12px; background:#faf7f3; color:var(--ink);
  font-family:inherit; font-size:.95rem; transition:border-color .15s;
}
.input:focus,select:focus,textarea:focus { outline:none; border-color:var(--pink); background:#fff }
select option { color:var(--ink) }

/* ---------- Buttons ---------- */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:12px 18px; border:none; border-radius:12px;
  font-family:inherit; font-weight:700; font-size:.95rem;
  cursor:pointer; transition:transform .08s, box-shadow .15s;
  background:var(--soft); color:var(--ink);
}
.btn:active { transform:translateY(1px) }
.btn:disabled { opacity:.55; cursor:not-allowed }
.btn-block { width:100% }
.btn-primary { background:var(--grad); color:#fff; box-shadow:0 8px 20px rgba(245,65,143,.26) }
.btn-primary:hover { box-shadow:0 12px 26px rgba(245,65,143,.36) }
.btn-accent  { background:var(--grad); color:#fff }
.btn-danger  { background:#fff1f1; color:#e11d48; border:1px solid #ffd9dd }
.btn-ghost   { background:var(--card); border:1.5px solid var(--line); color:var(--ink) }
.btn-sm { padding:7px 12px; font-size:.85rem; border-radius:10px }

/* ---------- Helpers ---------- */
.link { color:var(--pink); cursor:pointer; font-weight:700 }
.text-muted { color:var(--muted) }
.text-center { text-align:center }
.mt-2 { margin-top:12px } .mt-3 { margin-top:18px } .mt-4 { margin-top:24px }
.row-between { display:flex; align-items:center; justify-content:space-between; gap:12px }
.hidden { display:none !important }

/* ---------- Badges ---------- */
.badge { display:inline-block; padding:3px 10px; border-radius:999px; font-size:.78rem; font-weight:700 }
.badge-trial   { background:#fef3c7; color:#92400e }
.badge-active  { background:#d1fae5; color:#065f46 }
.badge-expired { background:#fee2e2; color:#991b1b }
.badge-on      { background:#d1fae5; color:#065f46 }
.badge-off     { background:#fee2e2; color:#991b1b }

/* ---------- Stats ---------- */
.stat { text-align:center }
.stat .num { font-size:2rem; font-weight:900; background:var(--grad); -webkit-background-clip:text; background-clip:text; color:transparent }
.stat .label { color:var(--muted); font-size:.9rem; margin-top:4px }

/* ---------- Table ---------- */
.table-wrap { overflow-x:auto }
table { width:100%; border-collapse:collapse; font-size:.92rem }
th,td { padding:12px 14px; text-align:right; border-bottom:1px solid var(--line) }
th { color:var(--muted); font-weight:700; white-space:nowrap }
tbody tr:hover { background:var(--soft) }

/* ---------- Toast ---------- */
.toast {
  position:fixed; bottom:24px; left:50%; transform:translateX(-50%);
  background:var(--side); color:#fff; padding:12px 22px;
  border-radius:12px; box-shadow:0 10px 30px rgba(0,0,0,.3);
  z-index:999; opacity:0; transition:opacity .2s,transform .2s; pointer-events:none;
}
.toast.show { opacity:1; transform:translateX(-50%) translateY(-4px) }
.toast.error   { background:#e11d48 }
.toast.success { background:var(--success) }

/* ---------- Spinner ---------- */
.spinner { width:18px; height:18px; border:2.5px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; animation:spin .7s linear infinite }
@keyframes spin { to { transform:rotate(360deg) } }

/* ---------- Theme toggle (hidden in new design) ---------- */
.theme-toggle { display:none }

/* ---------- QR preview ---------- */
.qr-preview { display:grid; place-items:center; padding:18px; background:var(--soft); border-radius:var(--radius); min-height:240px }

/* ============================================================
   App layout — dark sidebar (right) + light content
   ============================================================ */
body { display:flex; flex-direction:column; min-height:100vh }

/* App header — becomes light topbar */
.app-header {
  background:var(--card); border-bottom:1px solid var(--line);
  padding:12px 22px; display:flex; align-items:center; justify-content:space-between; gap:14px;
  position:sticky; top:0; z-index:80; box-shadow:0 4px 16px rgba(120,90,90,.06);
}
.hbrand { display:flex; align-items:center; gap:12px }
.hlogo {
  width:46px; height:46px; border-radius:14px; background:var(--grad); color:#fff;
  display:grid; place-items:center; font-weight:900; font-size:22px; overflow:hidden; flex-shrink:0;
  box-shadow:0 6px 16px rgba(245,65,143,.3);
}
.hlogo img { max-width:100%; max-height:100%; object-fit:contain }
.htitle { font-size:1.02rem; font-weight:800; color:var(--ink) }
.hsub   { font-size:.72rem; color:var(--muted) }
.hactions { display:flex; gap:10px; align-items:center }
.btn-logout {
  background:var(--soft); color:var(--ink); border:1px solid var(--line);
  padding:8px 16px; border-radius:10px; font-family:inherit; font-weight:700; cursor:pointer;
}
.btn-logout:hover { background:#fff1f1; color:#e11d48; border-color:#ffd9dd }

/* Sidebar — dark icon/label hybrid */
.layout { display:flex; flex:1; gap:0; align-items:stretch; min-height:0 }

.sidebar {
  width:220px; flex-shrink:0; background:var(--side); color:#fff;
  display:flex; flex-direction:column; gap:0; padding:18px 10px;
  position:sticky; top:69px; height:calc(100vh - 69px); overflow-y:auto;
}
.sidebar .brand-row {
  display:flex; align-items:center; gap:9px; font-weight:900; font-size:.95rem;
  color:#fff; padding:4px 8px 14px; border-bottom:1px solid rgba(255,255,255,.08); margin-bottom:10px;
}
.sidebar .brand-row .mark {
  width:36px; height:36px; border-radius:54% 46% 57% 43% / 46% 57% 43% 54%;
  background:conic-gradient(from 210deg,#a855f7,#ec4899,#ff9d5c,#f5418f,#7c3aed,#a855f7);
  box-shadow:0 6px 16px rgba(245,65,143,.4); display:grid; place-items:center; overflow:hidden; flex-shrink:0;
  animation:morph 8s ease-in-out infinite;
  color:transparent; font-size:0;
}
@keyframes morph{ 50%{border-radius:43% 57% 46% 54% / 57% 43% 54% 46%} }

.side-nav { display:flex; flex-direction:column; gap:3px }
.nav-item {
  text-align:right; padding:11px 13px; border:none; border-radius:12px; width:100%;
  background:transparent; color:rgba(255,255,255,.65); font-family:inherit; font-weight:600; font-size:.9rem;
  cursor:pointer; transition:all .15s; display:flex; align-items:center; gap:10px; border-right:3px solid transparent;
}
.nav-item .nav-ic { font-size:1rem; width:22px; text-align:center; flex-shrink:0 }
.nav-item:hover { background:rgba(255,255,255,.07); color:#fff }
.nav-item.active { background:rgba(255,255,255,.12); color:#fff; border-right-color:var(--pink) }
.nav-item.hidden { display:none }

.profile {
  display:flex; align-items:center; gap:10px; padding:10px; border-radius:14px; margin-bottom:10px;
  background:var(--grad); color:#fff; box-shadow:0 6px 16px rgba(245,65,143,.3);
}
.avatar {
  width:44px; height:44px; border-radius:50%; flex-shrink:0; display:grid; place-items:center;
  font-size:1.2rem; font-weight:900; background:rgba(255,255,255,.22); overflow:hidden;
}
.profile .pinfo { min-width:0 }
.profile .pname { font-weight:800; font-size:.9rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.profile .prole { font-size:.74rem; opacity:.85 }

.nav-group-label {
  font-size:.7rem; font-weight:800; color:rgba(255,255,255,.4);
  letter-spacing:.4px; padding:10px 12px 4px;
}
.side-bottom {
  margin-top:auto; display:flex; gap:8px; align-items:center;
  padding-top:12px; border-top:1px solid rgba(255,255,255,.08);
}

.content { flex:1; min-width:0; padding:18px; background:var(--bg) }
.content .container { padding:0; max-width:none }
.panel:not(.active) { display:none }

@media(max-width:820px){
  body { flex-direction:column }
  .app-header { position:sticky; top:0 }
  .layout { flex-direction:column; padding:12px; gap:12px }
  .sidebar {
    position:static; width:100%; height:auto; flex-direction:row; flex-wrap:nowrap; overflow-x:auto; padding:8px 10px;
  }
  .sidebar .brand-row { display:none }
  .profile { flex:0 0 auto; margin-bottom:0; padding:8px 12px }
  .profile .pinfo { display:none }
  .nav-group-label { display:none }
  .side-nav { flex-direction:row; flex-wrap:nowrap }
  .nav-item { flex:0 0 auto; border-right:none; border-bottom:3px solid transparent; padding:8px 12px; font-size:.82rem }
  .side-bottom { margin-top:0; border-top:none; padding-top:0 }
  .content { padding:12px }
}

/* ---------- Topbar search ---------- */
.gsearch {
  width:200px; max-width:38vw; padding:9px 14px; border-radius:11px;
  background:var(--soft); border:1px solid var(--line); color:var(--ink);
  font-family:inherit; font-size:.9rem;
}
.gsearch:focus { outline:none; border-color:var(--pink); background:#fff }
.h-icon-btn {
  width:38px; height:38px; border-radius:10px; background:var(--soft); border:1px solid var(--line);
  color:var(--ink); cursor:pointer; display:grid; place-items:center; font-size:1rem;
}
.live-ind { font-size:.72rem; color:var(--muted); display:flex; align-items:center; gap:6px; white-space:nowrap }
.live-dot { width:8px; height:8px; border-radius:50%; background:#22c55e; animation:pulse 2s infinite }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
@media(max-width:720px){ .hsub{display:none} .gsearch{width:130px} }

/* ---------- Overview / clients ---------- */
.overview-head { display:flex; align-items:center; gap:8px; margin:4px 0 14px }
.overview-head h2 { font-size:1.18rem; font-weight:800 }

.client-card {
  background:var(--card); border:1px solid var(--line); border-radius:18px;
  padding:14px 16px; margin-bottom:12px; box-shadow:var(--shadow);
}
.cc-head { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap }
.cc-name { font-weight:800; font-size:1.02rem }
.cc-url  { font-size:.76rem; color:var(--muted) }
.cc-actions { display:flex; gap:6px; flex-wrap:wrap }
.cc-detail { margin-top:12px; padding-top:12px; border-top:1px dashed var(--line) }
.copy-row { display:flex; align-items:center; gap:8px; margin:6px 0; flex-wrap:wrap }
.copy-row code { background:var(--soft); padding:4px 8px; border-radius:8px; font-size:.8rem; word-break:break-all }

.ann-card { border:1px solid var(--line); border-radius:12px; padding:12px; margin-bottom:10px; background:var(--card) }

/* ---------- Sidebar title ---------- */
.sidebar-title {
  font-weight:800; font-size:.8rem; color:rgba(255,255,255,.4);
  padding:4px 10px 9px; margin-bottom:4px; border-bottom:1px solid rgba(255,255,255,.08);
  display:flex; gap:6px; align-items:center;
}

/* ---------- Footer ---------- */
.app-footer {
  text-align:center; padding:22px 16px; margin-top:28px; border-top:1px solid var(--line);
  font-size:.78rem; color:var(--muted);
}
.app-footer .fcredit { margin-top:6px; display:inline-flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:center }
.app-footer .fdev { font-weight:800; color:var(--ink) }
.app-footer a { color:var(--pink) }

/* ---------- Ticker ---------- */
.ticker { overflow:hidden; border:1px solid var(--line); border-radius:14px; background:var(--card); padding:10px 0 }
.ticker-track { display:inline-flex; white-space:nowrap; gap:10px; animation:ticker 32s linear infinite }
.ticker:hover .ticker-track { animation-play-state:paused }
@keyframes ticker { from{transform:translateX(0)} to{transform:translateX(-50%)} }
.ticker-item { display:inline-flex; align-items:center; gap:8px; padding:6px 14px; border-radius:999px; background:var(--soft); font-weight:700; font-size:.9rem }
.tk-badge { background:#fef3c7; color:#92400e; padding:2px 9px; border-radius:999px; font-size:.76rem }

/* ---------- Type hint ---------- */
.type-hint { font-size:.8rem; color:var(--muted); background:var(--soft); border-radius:10px; padding:8px 12px; margin-bottom:12px; line-height:1.7 }
