/* =========================================================
   Retail SaaS - Wujha-inspired Premium UI Theme (RTL)
   Colors inspired by the uploaded identity guide.
========================================================= */

:root{
  --bg: #edf4f5;
  --bg-soft: #f7fbfb;
  --card: rgba(255,255,255,.94);
  --card-solid: #ffffff;
  --text: #153F58;
  --text-2: #1E1E1E;
  --muted: #5f7280;
  --border: rgba(21, 63, 88, .10);
  --primary: #153F58;
  --primary-2: #102f42;
  --primary-3: #0c2432;
  --accent: #67C39C;
  --accent-2: #49b489;
  --accent-soft: rgba(103, 195, 156, .16);
  --danger: #d9534f;
  --warning: #c28a21;
  --success: #198754;
  --shadow: 0 14px 36px rgba(21, 63, 88, .10);
  --shadow-sm: 0 8px 24px rgba(21, 63, 88, .08);
  --radius: 18px;
  --radius-sm: 14px;
}

*{ box-sizing:border-box; }
html, body { min-height: 100%; }
body.app-body{
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(103,195,156,.18), transparent 28%),
    radial-gradient(circle at top right, rgba(21,63,88,.10), transparent 24%),
    linear-gradient(180deg, #f9fcfc 0%, var(--bg) 100%);
  color: var(--text-2);
  font-family: "Cairo", "Inter", system-ui, -apple-system, Segoe UI, Tahoma, Arial, sans-serif;
}

a{ color: var(--primary); text-decoration:none; }
a:hover{ color: var(--primary-2); }

/* Generic buttons */
.btn{
  border-radius: 14px;
  font-weight: 700;
  box-shadow: none;
}
.btn-primary,
button.btn.primary,
a.btn.primary{
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 22px rgba(103,195,156,.24);
}
.btn-primary:hover,
button.btn.primary:hover,
a.btn.primary:hover{
  background: linear-gradient(135deg, var(--accent-2) 0%, #32a77a 100%);
  color:#fff;
}
.btn-outline-primary{
  border-color: rgba(21,63,88,.16);
  color: var(--primary);
}
.btn-outline-primary:hover{
  background: var(--primary);
  border-color: var(--primary);
}
.btn-light{
  background: rgba(255,255,255,.8);
  border-color: rgba(21,63,88,.08);
}

/* Brand mark */
.logo-dot{
  width: 46px;
  height: 46px;
  border-radius: 16px 16px 16px 4px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background: linear-gradient(145deg, var(--accent) 0%, #33b688 100%);
  position: relative;
  box-shadow: 0 12px 26px rgba(103,195,156,.25);
}
.logo-dot::before{
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50% 50% 50% 10%;
  background: #fff;
  transform: rotate(45deg);
  position: absolute;
}
.logo-dot::after{
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  position: relative;
  z-index: 1;
}

/* Shell */
.app-shell{
  display:grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}
@media (max-width: 991px){
  .app-shell{ grid-template-columns: 1fr; }
  .app-sidebar{
    position: fixed;
    top: 0; bottom: 0;
    right: -320px;
    width: 300px;
    z-index: 1050;
    transition: right .28s ease;
  }
  .app-sidebar.open{ right: 0; }
}

/* Sidebar */
.app-sidebar{
  background:
    radial-gradient(circle at top right, rgba(103,195,156,.14), transparent 22%),
    linear-gradient(180deg, var(--primary) 0%, var(--primary-2) 58%, var(--primary-3) 100%);
  color: #ecf6f7;
  padding: 20px 16px;
  border-left: 1px solid rgba(255,255,255,.06);
  position: relative;
  overflow: hidden;
}
.app-sidebar::before,
.app-sidebar::after{
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events:none;
}
.app-sidebar::before{
  width: 280px; height: 280px;
  left: -110px; top: -90px;
  background: radial-gradient(circle, rgba(255,255,255,.06), transparent 70%);
}
.app-sidebar::after{
  width: 220px; height: 220px;
  right: -80px; bottom: 60px;
  background: radial-gradient(circle, rgba(103,195,156,.10), transparent 70%);
}
.sidebar-brand{
  display:flex; align-items:center; gap:14px;
  padding: 8px 12px 18px;
  position: relative; z-index: 1;
}
.brand-title{
  font-weight: 900;
  letter-spacing: .2px;
  color: #fff;
  font-size: 1.05rem;
}
.brand-sub{
  font-size: 12px;
  color: rgba(255,255,255,.72);
  margin-top: 2px;
}
.sidebar-user{
  display:flex; gap:12px; align-items:center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px;
  padding: 14px;
  margin: 4px 10px 16px;
  position: relative; z-index: 1;
  backdrop-filter: blur(10px);
}
.sidebar-user .avatar{
  width: 48px; height: 48px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(103,195,156,.30), rgba(103,195,156,.14));
  display:flex; align-items:center; justify-content:center;
  font-weight: 900; font-size: 1.1rem; color: #fff;
  border: 1px solid rgba(255,255,255,.08);
}
.sidebar-user .name{ font-weight: 800; color: #fff; }
.sidebar-user .email{ font-size: 12px; color: rgba(255,255,255,.72); }
.sidebar-nav{ display:flex; flex-direction:column; gap:6px; padding: 0 10px; position: relative; z-index: 1; }
.nav-item{
  display:flex; align-items:center; gap:12px;
  padding: 11px 13px;
  border-radius: 15px;
  color: rgba(255,255,255,.90);
  border: 1px solid transparent;
  transition: .2s ease;
}
.nav-item i{ width: 18px; text-align:center; }
.nav-item:hover{
  transform: translateX(-2px);
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.08);
  color:#fff;
}
.nav-item.active{
  background: linear-gradient(135deg, rgba(103,195,156,.18), rgba(103,195,156,.10));
  border-color: rgba(103,195,156,.24);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(103,195,156,.06);
}
.nav-sep{ height: 1px; background: rgba(255,255,255,.08); margin: 10px 4px; }
.sidebar-footer{ padding: 14px 14px 0; color: rgba(255,255,255,.58); position: relative; z-index: 1; }

/* Main */
.app-main{
  display:flex; flex-direction:column; min-height:100vh;
}
.app-topbar{
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  padding: 16px 18px;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  position: sticky; top:0; z-index:1020;
}
.topbar-title .title{ font-weight: 900; color: var(--primary); }
.topbar-title .subtitle{ font-size: 12px; color: var(--muted); margin-top: -2px; }
.topbar-actions .btn{ padding-inline: 16px; }
.app-content{ padding: 20px 18px 26px; }
.app-footer{ margin-top:auto; padding: 8px 18px 22px; }
.public-main{ padding-top: 28px; padding-bottom: 28px; }

/* Cards / layout */
.cardx,
.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card{ padding: 18px; }
.cardx + .cardx,
.card + .card,
.cardx + .card,
.card + .cardx{ margin-top: 16px; }
.card h2{
  margin: 0 0 10px;
  color: var(--primary);
  font-weight: 900;
  font-size: 1.35rem;
}
.card p{ color: var(--muted); }
.cardx .cardx-head{
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  background: linear-gradient(180deg, rgba(247,251,251,.95), rgba(255,255,255,.92));
}
.cardx .cardx-title{ font-weight: 900; color: var(--primary); }
.cardx .cardx-body{ padding: 18px; }
.badge-soft{
  background: var(--accent-soft);
  color: var(--primary);
  border: 1px solid rgba(103,195,156,.18);
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 800;
}
.badge.text-bg-success{ background: rgba(25,135,84,.12) !important; color:#146c43 !important; border:1px solid rgba(25,135,84,.18); }
.badge.text-bg-secondary{ background: rgba(108,117,125,.12) !important; color:#495057 !important; border:1px solid rgba(108,117,125,.16); }

/* Dashboard legacy grid */
.grid{
  display:grid;
  gap: 14px;
  margin: 14px 0;
}
.grid.cols-2{ grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.cols-3{ grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.cols-4{ grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 991px){
  .grid.cols-4, .grid.cols-3{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 640px){
  .grid.cols-4, .grid.cols-3, .grid.cols-2{ grid-template-columns: 1fr; }
}
.mini-card,
.kpi{
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(247,251,251,.92));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}
.mini-card{
  padding: 16px;
  font-weight: 700;
  color: var(--primary);
  position: relative;
  overflow: hidden;
}
.mini-card::after{
  content:"";
  position:absolute;
  width:90px; height:90px;
  left:-28px; top:-26px;
  border-radius:50%;
  background: radial-gradient(circle, rgba(103,195,156,.14), transparent 68%);
}
.mini-card .kpi{
  display:block;
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin: 0 0 6px;
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--text-2);
}
.kpi{
  display:flex; gap:12px; align-items:center;
  padding: 15px;
}
.kpi .kpi-icon{
  width: 46px; height: 46px; border-radius: 16px;
  display:flex; align-items:center; justify-content:center;
  background: var(--accent-soft);
  color: var(--primary);
}
.kpi .kpi-title{ color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.kpi .kpi-value{ font-weight: 900; font-size: 20px; color: var(--primary); }
.actions{
  display:flex; flex-wrap:wrap; gap:10px; margin-top: 14px;
}
.actions .btn{
  border: 1px solid rgba(21,63,88,.10);
  background: #fff;
  color: var(--primary);
  padding: 10px 14px;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.actions .btn:hover{
  background: var(--primary);
  color:#fff;
  border-color: var(--primary);
}
.full{ grid-column: 1 / -1; }

/* Tables */
.table,
.card table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}
.table thead th,
.card table thead th{
  color: var(--muted);
  font-weight: 800;
  border-bottom: 1px solid var(--border) !important;
  background: rgba(247,251,251,.8);
}
.card table th,
.card table td{
  padding: 12px 14px;
  border-bottom: 1px solid rgba(21,63,88,.07);
}
.table td, .table th{ vertical-align: middle; border-color: var(--border) !important; }
.card table tbody tr:hover,
.table tbody tr:hover{ background: rgba(103,195,156,.06); }
.table-responsive{ border-radius: 14px; }

/* Forms */
label{ display:block; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
label input,
label select,
label textarea{
  display:block;
  width:100%;
  margin-top: 6px;
}
.form-control,
.form-select,
textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select{
  width:100%;
  border-radius: 14px;
  border: 1px solid rgba(21,63,88,.12);
  padding: .72rem .9rem;
  background: #fff;
  color: var(--text-2);
  outline:none;
  transition: .18s ease;
}
textarea{ min-height: 120px; resize: vertical; }
.form-control:focus,
.form-select:focus,
textarea:focus,
input:focus,
select:focus{
  border-color: rgba(103,195,156,.65);
  box-shadow: 0 0 0 .22rem rgba(103,195,156,.14);
}
.form-label{ color: var(--primary); font-weight: 800; }

/* Auth / public */
.auth-wrap{
  max-width: 1120px;
  margin: 26px auto;
  display:grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 18px;
}
@media (max-width: 991px){ .auth-wrap{ grid-template-columns: 1fr; } }
.auth-hero{
  min-height: 430px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,.16), transparent 26%),
    linear-gradient(135deg, var(--primary) 0%, #1b5473 55%, #236a73 100%);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 26px;
  box-shadow: 0 18px 44px rgba(21,63,88,.18);
  padding: 30px;
  color:#fff;
}
.auth-hero::before,
.auth-hero::after{
  content:"";
  position:absolute;
  border-radius:50%;
}
.auth-hero::before{
  width: 260px; height: 260px;
  left: -80px; bottom: -70px;
  background: radial-gradient(circle, rgba(103,195,156,.22), transparent 70%);
}
.auth-hero::after{
  width: 160px; height: 160px;
  right: 30px; top: 30px;
  background: radial-gradient(circle, rgba(255,255,255,.10), transparent 70%);
}
.auth-hero h1{ font-weight: 900; font-size: 2.2rem; position:relative; z-index:1; }
.auth-hero p{ color: rgba(255,255,255,.82); margin:0; position:relative; z-index:1; }
.auth-hero .hero-badges{ position:relative; z-index:1; display:flex; flex-wrap:wrap; gap:10px; margin-top:22px; }
.auth-hero .hero-badges span{
  display:inline-flex; align-items:center; gap:8px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  padding: 9px 12px;
  font-size: .92rem;
}
.auth-card{
  background: var(--card-solid);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.public-hero{
  background: linear-gradient(135deg, var(--primary) 0%, #1b5473 55%, var(--accent-2) 100%);
  color:#fff;
  border-radius: 28px;
  padding: 28px;
  box-shadow: 0 22px 48px rgba(21,63,88,.16);
}
.public-hero .lead{ color: rgba(255,255,255,.86); }

/* Alerts */
.alert{
  border: 0;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.alert-success{ background: rgba(103,195,156,.16); color: #145f40; }
.alert-danger{ background: rgba(217,83,79,.12); color: #8a2624; }

/* Small helpers */
.text-muted{ color: var(--muted) !important; }
.fw-bold{ font-weight: 800 !important; }
.shadow-sm{ box-shadow: var(--shadow-sm) !important; }
.container, .container-fluid{ max-width: 100%; }
