/* ==========================================================
   Rasan Construction - Modern Theme (Light + Dark)
   ضعه بعد app.css مباشرة. للحذف: احذف سطر الربط فقط.
   ========================================================== */

:root{
  --gold:#D4A800;
  --gold-600:#B88F00;
  --gold-100:#FBF3D1;
  --charcoal:#231F20;
  --charcoal-2:#2E2A2B;

  --bg:#F6F4EE;
  --surface:#FFFFFF;
  --surface-2:#FAF8F2;
  --text:#231F20;
  --muted:#7A7472;
  --border:#E8E3D6;
  --shadow:0 1px 2px rgba(35,31,32,.05),0 8px 24px rgba(35,31,32,.06);
  --shadow-hover:0 2px 4px rgba(35,31,32,.08),0 14px 32px rgba(35,31,32,.12);
  --radius:16px;
  --radius-sm:10px;

  --side-bg:linear-gradient(180deg,#2B2728 0%,#1A1718 100%);
  --side-text:#CFC9C4;
  --side-hover:rgba(212,168,0,.12);
}

html[data-theme="dark"]{
  --bg:#121011;
  --surface:#1C1919;
  --surface-2:#231F20;
  --text:#F3EFE6;
  --muted:#A49E99;
  --border:#34302F;
  --shadow:0 1px 2px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.35);
  --shadow-hover:0 2px 4px rgba(0,0,0,.5),0 14px 32px rgba(0,0,0,.5);
  --gold-100:rgba(212,168,0,.14);
  --side-bg:linear-gradient(180deg,#171415 0%,#0D0B0C 100%);
  color-scheme:dark;
}

/* ---------- Base ---------- */
html,body{
  background:var(--bg)!important;
  color:var(--text)!important;
  font-family:'Cairo','Segoe UI',Tahoma,sans-serif!important;
  transition:background .25s,color .25s;
}
a{color:var(--gold-600)}
html[data-theme="dark"] a{color:var(--gold)}
::selection{background:var(--gold);color:var(--charcoal)}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:var(--border);border-radius:10px}
::-webkit-scrollbar-thumb:hover{background:var(--gold)}

/* ---------- Sidebar ---------- */
aside,.sidebar,.side,#sidebar,nav.side{
  background:var(--side-bg)!important;
  color:var(--side-text)!important;
  border:0!important;
  box-shadow:0 0 40px rgba(0,0,0,.15);
}
aside a,.sidebar a,.side a,#sidebar a{
  color:var(--side-text)!important;
  border-radius:12px;
  margin:2px 8px;
  transition:all .2s;
}
aside a:hover,.sidebar a:hover,.side a:hover,#sidebar a:hover{
  background:var(--side-hover)!important;
  color:#fff!important;
  transform:translateX(-3px);
}
aside a.active,.sidebar a.active,.side a.active,#sidebar a.active,
aside .active,.sidebar .active,.side .active,#sidebar .active{
  background:linear-gradient(135deg,var(--gold),#E8BE1C)!important;
  color:var(--charcoal)!important;
  font-weight:700;
  box-shadow:0 6px 16px rgba(212,168,0,.35);
}

/* ---------- Topbar ---------- */
header,.topbar,.top,#topbar{
  background:var(--surface)!important;
  color:var(--text)!important;
  border-bottom:1px solid var(--border)!important;
  box-shadow:none!important;
}

/* ---------- Cards / KPI ---------- */
.card,.panel,.box,.kpi,.stat,.widget,section.card{
  background:var(--surface)!important;
  color:var(--text)!important;
  border:1px solid var(--border)!important;
  border-radius:var(--radius)!important;
  box-shadow:var(--shadow)!important;
  transition:transform .2s,box-shadow .2s,border-color .2s;
}
.kpi:hover,.stat:hover,.card:hover{
  transform:translateY(-3px);
  box-shadow:var(--shadow-hover)!important;
  border-color:var(--gold)!important;
}
/* شريط جانبي بدل الألوان المتعددة: كله بهوية الذهبي */
.kpi,.stat{border-top-width:1px!important;position:relative;overflow:hidden}
.kpi::before,.stat::before{
  content:"";position:absolute;inset:0 0 auto 0;height:4px;
  background:linear-gradient(90deg,var(--gold),#F0CF55);
}
.kpi b,.stat b,.kpi .num{color:var(--text)!important;font-weight:800}
.muted,small,.sub,.kpi small,.kpi span{color:var(--muted)!important}
h1,h2,h3,h4{color:var(--text)!important;font-weight:700}

/* ---------- Buttons ---------- */
button,.btn,input[type=submit],a.btn{
  font-family:inherit!important;
  border-radius:12px!important;
  transition:all .2s;
}
.btn-primary,.btn.primary,button.primary,input[type=submit],a.btn.primary{
  background:linear-gradient(135deg,var(--gold),#E8BE1C)!important;
  color:var(--charcoal)!important;
  border:0!important;
  font-weight:700;
  box-shadow:0 6px 16px rgba(212,168,0,.3);
}
.btn-primary:hover,.btn.primary:hover,button.primary:hover,input[type=submit]:hover{
  transform:translateY(-2px);
  box-shadow:0 10px 22px rgba(212,168,0,.45);
}
.btn-secondary,.btn.secondary,.btn-light,.btn.ghost{
  background:var(--surface)!important;
  color:var(--text)!important;
  border:1px solid var(--border)!important;
}

/* ---------- Forms ---------- */
input,select,textarea{
  background:var(--surface-2)!important;
  color:var(--text)!important;
  border:1px solid var(--border)!important;
  border-radius:var(--radius-sm)!important;
  font-family:inherit!important;
  transition:border-color .2s,box-shadow .2s;
}
input:focus,select:focus,textarea:focus{
  outline:0!important;
  border-color:var(--gold)!important;
  box-shadow:0 0 0 4px rgba(212,168,0,.2)!important;
}
::placeholder{color:var(--muted)!important}

/* ---------- Tables ---------- */
table{
  background:var(--surface)!important;
  color:var(--text)!important;
  border-collapse:separate!important;
  border-spacing:0;
  border-radius:var(--radius-sm);
  overflow:hidden;
}
thead th,th{
  background:var(--charcoal)!important;
  color:var(--gold)!important;
  font-weight:700;
  border:0!important;
}
td{border-bottom:1px solid var(--border)!important;color:var(--text)!important}
tbody tr:hover td{background:var(--gold-100)!important}

/* ---------- Badges ---------- */
.badge,.tag,.chip,.pill{
  background:var(--gold-100)!important;
  color:var(--gold-600)!important;
  border-radius:999px!important;
  font-weight:600;
}
html[data-theme="dark"] .badge,html[data-theme="dark"] .tag{color:var(--gold)!important}

/* ---------- Login page ---------- */
.login,.auth,.login-box,.login-card{
  background:var(--surface)!important;
  border-radius:20px!important;
  box-shadow:var(--shadow-hover)!important;
  border:1px solid var(--border)!important;
}
body.login-page,body.auth-page{
  background:
    radial-gradient(circle at 20% 10%,rgba(212,168,0,.18),transparent 40%),
    var(--charcoal)!important;
}

/* ---------- Charts (SVG/Canvas text) ---------- */
html[data-theme="dark"] canvas{filter:brightness(1.05)}
html[data-theme="dark"] svg text{fill:var(--muted)}

/* ---------- Theme toggle button ---------- */
#theme-toggle{
  position:fixed;bottom:20px;left:20px;z-index:9999;
  width:46px;height:46px;border-radius:50%;
  border:1px solid var(--border);
  background:var(--surface);color:var(--text);
  font-size:20px;cursor:pointer;
  box-shadow:var(--shadow-hover);
  display:flex;align-items:center;justify-content:center;
  transition:transform .25s;
}
#theme-toggle:hover{transform:rotate(20deg) scale(1.08);border-color:var(--gold)}

/* ---------- Print: ارجع للأبيض ---------- */
@media print{
  html,body{background:#fff!important;color:#000!important}
  #theme-toggle{display:none}
  .card,.kpi{box-shadow:none!important}
}
