/* Palette, sidebar, cards, tables and modals taken from the mat-alsaed dashboard */
:root {
  --primary: #2563eb; --primary-dark: #1d4ed8; --bg: #f1f5f9; --card: #fff;
  --border: #e2e8f0; --text: #1e293b; --muted: #94a3b8;
  --sb-w: 250px; --sb-bg: #0f172a;
}
*, *::before, *::after { box-sizing: border-box; }
body, input, select, textarea, button, table, .modal, .dropdown-menu { font-family: 'Tajawal', sans-serif; }
.fa, .fas, .far, .fa-solid, .fa-regular, .fa::before, .fas::before, .far::before, .fa-solid::before, .fa-regular::before { font-family: 'Font Awesome 6 Free' !important; }
.fas, .fa-solid, .fas::before, .fa-solid::before { font-weight: 900; }
.far, .fa-regular, .far::before, .fa-regular::before { font-weight: 400; }
body { background: var(--bg); color: var(--text); min-height: 100vh; }
.num { direction: ltr; unicode-bidi: plaintext; }

/* sidebar */
body.has-sb { padding-right: var(--sb-w); transition: padding-right .25s ease; }
body.has-sb.sb-collapsed { --sb-w: 72px; }
.sb { position: fixed; top: 0; right: 0; height: 100vh; width: var(--sb-w); background: var(--sb-bg); color: #cbd5e1;
  z-index: 1040; display: flex; flex-direction: column; transition: width .25s ease, transform .25s ease; overflow: hidden; }
.sb-brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.25rem; color: #fff; font-weight: 800; font-size: 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,.08); white-space: nowrap; min-height: 68px; text-decoration: none; }
.sb-brand i { font-size: 1.3rem; color: #38bdf8; flex-shrink: 0; width: 28px; text-align: center; }
.sb-nav { flex: 1; padding: .75rem .6rem; display: flex; flex-direction: column; gap: .25rem; overflow-y: auto; }
.sb-link { display: flex; align-items: center; gap: .85rem; padding: .7rem .85rem; border-radius: 10px; color: #cbd5e1;
  text-decoration: none; white-space: nowrap; font-weight: 600; font-size: .95rem; border: 0; background: none; width: 100%; text-align: right; cursor: pointer; }
.sb-link i { width: 28px; text-align: center; font-size: 1.1rem; flex-shrink: 0; }
.sb-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sb-link.active { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,.4); }
.sb-foot { padding: .6rem; border-top: 1px solid rgba(255,255,255,.08); }
.sb-user { padding: .4rem .85rem .6rem; font-size: .8rem; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-toggle { width: 38px; height: 38px; border-radius: 10px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.sb-toggle:hover { background: rgba(255,255,255,.25); }
.sb-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 1039; opacity: 0; pointer-events: none; transition: opacity .25s; }
body.has-sb.sb-collapsed .sb-label, body.has-sb.sb-collapsed .sb-user { display: none; }
body.has-sb.sb-collapsed .sb-link, body.has-sb.sb-collapsed .sb-brand { justify-content: center; padding-left: 0; padding-right: 0; }
@media (max-width: 991.98px) {
  body.has-sb, body.has-sb.sb-collapsed { padding-right: 0; }
  .sb { transform: translateX(100%); width: 270px; }
  body.sb-open .sb { transform: translateX(0); box-shadow: -8px 0 30px rgba(0,0,0,.35); }
  body.sb-open .sb-backdrop { opacity: 1; pointer-events: all; }
  body.sb-open { overflow: hidden; }
  body.has-sb.sb-collapsed .sb-label { display: inline; }
  body.has-sb.sb-collapsed .sb-user { display: block; }
  body.has-sb.sb-collapsed .sb-link, body.has-sb.sb-collapsed .sb-brand { justify-content: flex-start; padding: .7rem .85rem; }
}

/* header */
.app-header { background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #0ea5e9 100%); padding: 1.1rem 1.5rem; color: #fff;
  box-shadow: 0 4px 24px rgba(37,99,235,.35); display: flex; align-items: center; gap: .9rem; }
.app-header h1 { font-size: 1.35rem; font-weight: 800; margin: 0; }
.app-body { padding: 1.25rem 1.5rem 2rem; }
@media (max-width: 575.98px) { .app-header { padding: .9rem 1rem; } .app-body { padding: 1rem .75rem 2rem; } }

/* cards */
.stat-card { background: var(--card); border-radius: 14px; padding: 1rem 1.2rem; border: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem; box-shadow: 0 2px 10px rgba(0,0,0,.05); height: 100%; }
.stat-icon { width: 46px; height: 46px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; flex-shrink: 0; }
.stat-value { font-size: 1.45rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .76rem; color: var(--muted); font-weight: 500; margin-top: 2px; }
.filter-card, .table-card { background: var(--card); border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 2px 12px rgba(0,0,0,.05); }
.filter-card { padding: 1.2rem 1.4rem; }
.table-card { overflow: hidden; }
.card-title-sm { font-size: .78rem; font-weight: 700; color: var(--muted); letter-spacing: .6px; margin-bottom: .8rem; }
.table-card-header { padding: .95rem 1.4rem; border-bottom: 1px solid var(--border); font-weight: 700; }

/* forms and buttons */
.form-label { font-size: .82rem; font-weight: 600; margin-bottom: .3rem; color: #475569; }
.form-control, .form-select { border-radius: 10px; border: 1.5px solid var(--border); font-size: .88rem; padding: .5rem .85rem; transition: border-color .2s, box-shadow .2s; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.btn { font-weight: 700; border-radius: 10px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-right: 2.5rem; }
.input-icon-wrap .fi { position: absolute; right: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

/* tables */
.tbl thead th { background: #f8fafc; color: #64748b; font-weight: 700; font-size: .78rem; letter-spacing: .5px; border-bottom: 2px solid var(--border);
  padding: .85rem 1rem; white-space: nowrap; text-align: right; }
.tbl tbody td { padding: .7rem 1rem; vertical-align: middle; font-size: .88rem; border-bottom: 1px solid #f1f5f9; text-align: right; }
.tbl tbody tr:hover td { background: #eff6ff; }
#tbl tbody tr { cursor: pointer; }
.code-badge { font-family: 'Courier New', monospace; background: #f1f5f9; color: #475569; padding: .18rem .55rem; border-radius: 6px; font-size: .78rem; }
.qty-pill { background: #f1f5f9; border-radius: 20px; padding: .18rem .75rem; font-weight: 700; font-size: .82rem; display: inline-block; }
.qty-pill.qty-zero { background: #fee2e2; color: #b91c1c; }
.qty-pill.qty-ok { background: #dcfce7; color: #15803d; }
.price-cell { font-weight: 800; color: #15803d; }
.badge-store { padding: .28rem .65rem; border-radius: 20px; font-size: .75rem; font-weight: 600; display: inline-block; }
.store-0 { background:#dbeafe; color:#1d4ed8; } .store-1 { background:#dcfce7; color:#15803d; }
.store-2 { background:#fef3c7; color:#b45309; } .store-3 { background:#fce7f3; color:#be185d; } .store-4 { background:#ede9fe; color:#6d28d9; }
.thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 10px; background: #e2e8f0; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }

/* DataTables */
.dataTables_wrapper { padding: 0 1rem 1rem; }
.dataTables_wrapper .dataTables_filter input, .dataTables_wrapper .dataTables_length select { border-radius: 8px !important; border: 1.5px solid var(--border) !important; padding: .28rem .6rem !important; }
.dataTables_wrapper .dataTables_length select { min-width: 80px !important; }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }
.dataTables_wrapper > .row:first-child { padding-top: 1rem; }

/* modals */
.modal-content { border-radius: 14px; border: none; box-shadow: 0 24px 60px rgba(0,0,0,.2); }
.modal-header { background: linear-gradient(135deg, #1e3a8a, #2563eb); color: #fff; border-radius: 14px 14px 0 0; padding: 1rem 1.4rem; }
.modal-header .btn-close { filter: invert(1); margin: 0 auto 0 0; }

/* product result */
.pc-hero { display: flex; gap: 1rem; align-items: center; }
.pc-img { width: 110px; height: 110px; border-radius: 14px; object-fit: cover; background: #e2e8f0; flex-shrink: 0; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 2.4rem; }
.pc-name { font-size: 1.2rem; font-weight: 800; }
.pc-price { font-size: 2.3rem; font-weight: 800; color: #15803d; line-height: 1.1; }
.pc-price small { font-size: .9rem; color: var(--muted); font-weight: 600; }
.pc-section { font-size: .78rem; font-weight: 700; color: var(--muted); margin: 1.1rem 0 .5rem; letter-spacing: .5px; }
.chip { display: inline-flex; flex-direction: column; align-items: center; padding: .45rem .9rem; border-radius: 12px; background: #f8fafc; border: 1px solid var(--border); min-width: 86px; }
.chip b { font-size: 1rem; } .chip span { font-size: .72rem; color: var(--muted); }
.chip.on { background: #eff6ff; border-color: var(--primary); }
.chip.on b { color: var(--primary); }
@media (max-width: 575.98px) { .pc-img { width: 80px; height: 80px; } .pc-price { font-size: 1.9rem; } }

/* login */
.login-wrap { width: 100%; max-width: 400px; }
.login-card { background: #fff; border-radius: 20px; border: 1px solid var(--border); box-shadow: 0 8px 40px rgba(37,99,235,.12); overflow: hidden; }
.login-header { background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #0ea5e9 100%); color: #fff; text-align: center; padding: 2.2rem 1.5rem 1.8rem; }
.login-header .icon-ring { width: 66px; height: 66px; background: rgba(255,255,255,.18); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem; font-size: 1.6rem; }
.login-header h4 { font-size: 1.3rem; font-weight: 800; margin: 0 0 .2rem; }
.login-header p { font-size: .82rem; opacity: .8; margin: 0; }
.login-body { padding: 2rem; }
@media (max-width: 420px) { .login-body { padding: 1.4rem; } }

/* brand logo */
.sb-logo { width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: 50%; padding: 2px; flex-shrink: 0; }
.login-logo { width: 120px; height: 120px; object-fit: contain; background: #fff; border-radius: 50%; padding: 6px; box-shadow: 0 6px 18px rgba(15,23,42,.15); margin: 0 auto 12px; display: block; }
