/* ============================================================
   ShamsShop - السمة الرئيسية | Main theme
   تصميم عصري متجاوب يدعم RTL/LTR | Modern responsive RTL/LTR
   ============================================================ */

:root {
    --brand:        #0d6e6e;   /* فيروزي احترافي | professional teal */
    --brand-dark:   #0a5757;
    --brand-light:  #e6f4f4;
    --accent:       #f59e0b;   /* كهرماني | amber accent */
    --accent-dark:  #d97706;
    --ink:          #1f2937;
    --muted:        #6b7280;
    --line:         #e5e7eb;
    --bg-soft:      #f7f9fa;
    --ok:           #198754;
    --danger:       #dc3545;
}

body {
    font-family: "Segoe UI", "Tahoma", "Cairo", system-ui, sans-serif;
    color: var(--ink);
    background: var(--bg-soft);
}

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

/* ---------- شريط التنقّل | Navbar ---------- */
.navbar-brand { font-weight: 800; letter-spacing: .3px; }
.navbar-brand .logo-badge {
    background: var(--accent);
    color: #fff; border-radius: 8px;
    padding: 2px 10px; margin-inline-end: 6px;
}
.shop-navbar { background: var(--brand) !important; }
.shop-navbar .nav-link,
.shop-navbar .navbar-brand { color: #fff !important; }
.shop-navbar .nav-link:hover { color: var(--accent) !important; }

.cart-badge {
    position: relative; top: -10px; inset-inline-start: -6px;
    font-size: .7rem;
}

/* ---------- البطل / البانر | Hero banner ---------- */
.hero {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff; border-radius: 18px;
    padding: 56px 40px; margin-bottom: 36px;
    box-shadow: 0 10px 30px rgba(13,110,110,.25);
}
.hero h1 { font-weight: 800; font-size: 2.4rem; }
.hero .btn-accent { background: var(--accent); border: none; color: #fff; }
.hero .btn-accent:hover { background: var(--accent-dark); color:#fff; }

/* ---------- بطاقة المنتج | Product card ---------- */
.product-card {
    background: #fff; border: 1px solid var(--line);
    border-radius: 14px; overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
    height: 100%;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,.10);
}
.product-card .img-wrap {
    aspect-ratio: 1/1; background: #fff;
    display:flex; align-items:center; justify-content:center; overflow:hidden;
}
.product-card .img-wrap img { width:100%; height:100%; object-fit: cover; }
.product-card .p-name {
    font-weight: 600; color: var(--ink);
    display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
    overflow:hidden; min-height: 2.6em;
}
.price { color: var(--brand-dark); font-weight: 800; font-size: 1.15rem; }
.price .cur { font-size: .8rem; font-weight: 600; color: var(--muted); }

.badge-soft { background: var(--brand-light); color: var(--brand-dark); }
.badge-low  { background: #fde8e8; color: var(--danger); }
.badge-out  { background: #f3f4f6; color: var(--muted); }

/* ---------- تصنيفات | Category tiles ---------- */
.cat-tile {
    display:block; background:#fff; border:1px solid var(--line);
    border-radius:14px; padding:22px 14px; text-align:center;
    color:var(--ink); transition:.15s; height:100%;
}
.cat-tile:hover { border-color: var(--brand); color: var(--brand-dark); transform: translateY(-3px); }
.cat-tile .icon { font-size: 2rem; color: var(--brand); }

/* ---------- أزرار | Buttons ---------- */
.btn-brand { background: var(--brand); border-color: var(--brand); color:#fff; }
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color:#fff; }
.btn-outline-brand { color: var(--brand); border-color: var(--brand); }
.btn-outline-brand:hover { background: var(--brand); color:#fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color:#fff; }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color:#fff; }

/* ---------- أقسام | Section titles ---------- */
.section-title {
    font-weight: 800; position: relative; margin-bottom: 22px; padding-bottom: 8px;
}
.section-title::after {
    content:""; position:absolute; inset-inline-start:0; bottom:0;
    width:60px; height:4px; background: var(--accent); border-radius:4px;
}

/* ---------- الفوتر | Footer ---------- */
.site-footer { background: var(--brand-dark); color:#cfe8e8; padding: 36px 0 20px; margin-top: 60px; }
.site-footer a { color:#fff; }

/* ---------- لوحة التحكم | Admin layout ---------- */
.admin-wrap { display:flex; min-height:100vh; }
.admin-sidebar {
    width: 264px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: linear-gradient(180deg, #0b3b3b 0%, #0e1b24 55%, #0b1320 100%);
    color: #c7d6d6; padding-bottom: 24px;
}
.admin-sidebar::-webkit-scrollbar { width: 8px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 8px; }
.admin-sidebar .brand {
    padding: 18px 20px; font-weight: 800; color: #fff; font-size: 1.18rem;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 8px;
    position: sticky; top: 0; z-index: 2;
    background: linear-gradient(180deg, #0b3b3b, #0b3b3b);
}
.admin-sidebar .brand .bi { color: var(--accent); }

/* روابط المستوى الأعلى | top-level links */
.admin-sidebar > nav > a,
.admin-sidebar .erp-nav > a {
    display: flex; align-items: center; gap: 11px; margin: 2px 10px; padding: 10px 14px;
    color: #cfe0e0; text-decoration: none; border-radius: 12px; font-size: .95rem;
    transition: background .15s, color .15s, transform .12s;
}
.admin-sidebar a .bi { font-size: 1.05rem; opacity: .9; width: 20px; text-align: center; }
.admin-sidebar a:hover { background: rgba(255,255,255,.07); color: #fff; }
.admin-sidebar a.active {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff; font-weight: 700; box-shadow: 0 6px 16px rgba(13,110,110,.35);
}
.admin-sidebar a.active .bi { opacity: 1; color: var(--accent); }

/* مجموعات الوحدات القابلة للطي | collapsible module groups */
.erp-nav details { margin: 4px 10px; }
.erp-nav details > summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 11px;
    padding: 10px 14px; color: #8fa6a6; font-weight: 700; user-select: none;
    border-radius: 12px; font-size: .8rem; letter-spacing: .3px; text-transform: none;
}
.erp-nav details > summary::-webkit-details-marker { display: none; }
.erp-nav details > summary .bi { color: var(--accent); opacity: .85; }
.erp-nav details > summary::after {
    content: '\203A'; margin-inline-start: auto; transition: .2s; transform: rotate(90deg); opacity: .6;
}
.erp-nav details[open] > summary { color: #e6f4f4; }
.erp-nav details[open] > summary::after { transform: rotate(-90deg); }
.erp-nav details > summary:hover { color: #fff; background: rgba(255,255,255,.04); }

/* روابط فرعية مع خط إرشادي | sub-links with a guide line */
.erp-nav details > a {
    display: flex; align-items: center; text-decoration: none;
    position: relative; margin: 1px 10px 1px 14px; padding: 8px 14px 8px 30px;
    font-size: .9rem; color: #b7c9c9; border-radius: 10px; white-space: nowrap;
}
.erp-nav details > a::before {
    content: ''; position: absolute; inset-inline-start: 16px; top: 50%; width: 6px; height: 6px;
    border-radius: 50%; background: rgba(255,255,255,.25); transform: translateY(-50%);
}
.erp-nav details > a:hover { background: rgba(255,255,255,.07); color: #fff; }
.erp-nav details > a:hover::before { background: var(--accent); }
.erp-nav details > a.active { background: rgba(13,110,110,.55); color: #fff; font-weight: 600; box-shadow: none; }
.erp-nav details > a.active::before { background: var(--accent); }

.admin-main { flex:1; min-width:0; background: var(--bg-soft); }
.admin-topbar { background:#fff; border-bottom:1px solid var(--line); padding:12px 22px;
    display:flex; justify-content:space-between; align-items:center; }
.admin-content { padding: 22px; }

.kpi-card { background:#fff; border-radius:14px; border:1px solid var(--line); padding:18px 20px; }
.kpi-card .kpi-val { font-size:1.9rem; font-weight:800; color:var(--brand-dark); }
.kpi-card .kpi-label { color:var(--muted); font-size:.9rem; }
.kpi-card .kpi-icon { font-size:1.8rem; opacity:.85; }

.card { border:1px solid var(--line); border-radius:14px; }
.table thead th { background: var(--brand-light); color: var(--brand-dark); border-bottom:none; }

@media (max-width: 768px) {
    .admin-sidebar { position: fixed; inset-inline-start:-260px; transition:.2s; z-index:1050; }
    .admin-sidebar.open { inset-inline-start:0; }
    .hero { padding: 36px 22px; }
    .hero h1 { font-size: 1.8rem; }
}

/* ===== نافذة منبثقة مخصصة (للوحة التحكم) | Custom modal (admin) ===== */
.text-brand { color: var(--brand) !important; }
.modal-backdrop-custom {
    position: fixed; inset: 0; background: rgba(15,23,42,.55);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 16px; z-index: 1060; overflow-y: auto;
}
.modal-card-custom {
    background: #fff; border-radius: 16px; padding: 24px;
    width: 100%; max-width: 720px; box-shadow: 0 18px 48px rgba(0,0,0,.25);
}
@media (max-width: 768px) {
    .modal-backdrop-custom { padding: 16px 10px; }
    .modal-card-custom { padding: 18px; }
}

/* ================================================================================
   الجدول الحديث + شريط الأدوات | Modern data-grid + toolbar (datagrid.js)
   ================================================================================ */
.admin-main table.table { border-collapse: separate; border-spacing: 0; }
.admin-main table.table thead th,
.admin-main table.table tr.dg-head th {
    background: #f1f5f9; color: #334155; font-weight: 700; font-size: .85rem;
    border-bottom: 2px solid #e2e8f0; white-space: nowrap; vertical-align: middle;
}
.admin-main table.table tbody td { vertical-align: middle; border-top: 1px solid #eef2f7; }
.admin-main table.table tbody tr:hover { background: #f8fafc; }
.admin-main table.table tbody tr:nth-child(even) { background: #fcfdfe; }

.dg-table.dg-scroll { }
.dg-scroll { max-height: 72vh; overflow: auto; }
.dg-scroll thead th, .dg-scroll tr.dg-head th { position: sticky; top: 0; z-index: 3; }

th.dg-sortable { cursor: pointer; user-select: none; }
th.dg-sortable:hover { background: #e7edf5; }
th.dg-sortable::after { content: '\2195'; opacity: .35; margin-inline-start: 6px; font-size: .8em; }
th.dg-sortable[data-sort='asc']::after { content: '\2191'; opacity: 1; }
th.dg-sortable[data-sort='desc']::after { content: '\2193'; opacity: 1; }

.dg-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    justify-content: space-between; padding: 10px 12px; }
.dg-search { position: relative; flex: 1 1 240px; max-width: 360px; }
.dg-search .bi { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.dg-search .dg-q { width: 100%; padding: 7px 34px; border: 1px solid var(--line); border-radius: 8px; font-size: .9rem; }
.dg-search .dg-q:focus { outline: none; border-color: var(--accent); }
.dg-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dg-cols-wrap { position: relative; }
.dg-cols-menu { display: none; position: absolute; inset-inline-end: 0; top: 110%; z-index: 1050;
    background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12);
    padding: 8px; min-width: 200px; max-height: 280px; overflow: auto; }
.dg-cols-menu.open { display: block; }
.dg-col-item { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; font-size: .9rem; cursor: pointer; }
.dg-col-item:hover { background: #f1f5f9; }

tr.dg-filter-row th { padding: 4px 6px; background: #fafcff; }
tr.dg-filter-row .dg-cf { font-size: .82rem; }

.dg-pager { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; }
.dg-pager .dg-pinfo { color: #64748b; font-size: .85rem; }
.dg-pager .dg-psize { display: flex; align-items: center; gap: 6px; color: #64748b; font-size: .85rem; }
.dg-pager .dg-psize select { width: auto; }
.dg-pbtns { display: flex; gap: 4px; }
.dg-pbtns .btn { min-width: 36px; }

@media (max-width: 640px) {
    .dg-toolbar { flex-direction: column; align-items: stretch; }
    .dg-search { max-width: none; }
    .dg-actions { justify-content: space-between; }
}

/* ================================================================================
   عرض الخصومات في المتجر | Storefront discount display
   ================================================================================ */
.img-wrap { position: relative; display: block; }
.disc-ribbon {
    position: absolute; inset-inline-start: 10px; top: 10px; z-index: 2;
    background: #dc2626; color: #fff; font-weight: 700; font-size: .78rem;
    padding: 3px 9px; border-radius: 999px; box-shadow: 0 2px 6px rgba(220,38,38,.35);
}
.price { display: inline-flex; flex-direction: column; line-height: 1.25; }
.price .price-now { color: #dc2626; font-weight: 800; }
.price .price-old { color: #9ca3af; font-size: .82em; text-decoration: line-through; }
.price .price-save { color: #16a34a; font-size: .76em; font-weight: 600; }
/* صفحة التفاصيل | details page */
.price-now { color: #dc2626; font-weight: 800; }
.price-old { color: #9ca3af; text-decoration: line-through; margin-inline-start: 8px; }
.price-save { color: #16a34a; font-weight: 600; }

/* ================================================================================
   شريط الموبايل السفلي (تجربة تطبيق) | Mobile bottom tab bar (app-like)
   ================================================================================ */
.mobile-tabbar { display: none; }
@media (max-width: 991.98px) {
    .mobile-tabbar {
        display: flex; position: fixed; inset-inline: 0; bottom: 0; z-index: 1040;
        background: #fff; border-top: 1px solid var(--line);
        box-shadow: 0 -8px 24px rgba(0,0,0,.10);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
        justify-content: space-around;
    }
    .mobile-tabbar .mt-item {
        flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
        color: #6b7280; text-decoration: none; font-size: .7rem; padding: 4px 0; border-radius: 12px;
        transition: color .15s, background .15s;
    }
    .mobile-tabbar .mt-item .bi { font-size: 1.3rem; line-height: 1; }
    .mobile-tabbar .mt-item:active { background: var(--brand-light); }
    .mobile-tabbar .mt-item.active { color: var(--brand); font-weight: 700; }
    .mobile-tabbar .mt-badge { position: absolute; top: -2px; inset-inline-end: 24%; font-size: .58rem; padding: .2em .45em; }
    /* مساحة سفلية حتى لا يغطّي الشريط المحتوى | keep content clear of the bar */
    body { padding-bottom: 66px; }
    .site-footer { margin-bottom: 60px; }
    /* مظهر أنعم للموبايل | softer mobile chrome */
    .shop-navbar { border-radius: 0 0 16px 16px; }
}

/* ================================================================================
   منتقي خيارات الصنف (لون/حجم) في صفحة التفاصيل | product option picker (color/size)
   ================================================================================ */
.opt-btn {
    border: 1.5px solid var(--line); background: #fff; color: var(--ink);
    border-radius: 999px; padding: 6px 16px; font-size: .9rem; cursor: pointer;
    transition: all .15s; min-width: 52px;
}
.opt-btn:hover { border-color: var(--brand); color: var(--brand); }
.opt-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(13,110,110,.3); }
.opt-btn.opt-off, .opt-btn:disabled {
    opacity: .4; text-decoration: line-through; cursor: not-allowed;
    border-style: dashed; pointer-events: none;
}
.opt-group { margin-bottom: 14px; }
#optInfo .price-now { color: var(--brand-dark); font-weight: 800; font-size: 1.1rem; }
.btn.disabled, .btn:disabled { opacity: .55; cursor: not-allowed; }

/* ================================================================================
   قائمة بحث الأصناف (autocomplete) في بطاقة الحركة وتعديل الطلب | product autocomplete dropdown
   ================================================================================ */
.ac-box {
    display: none; position: absolute; z-index: 1050; left: 12px; right: 12px;
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 280px; overflow-y: auto; margin-top: 2px;
}
.ac-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ac-item:last-child { border-bottom: none; }
.ac-item:hover { background: var(--bg-soft); }
.ac-item .ac-qty { font-size: .8rem; color: #64748b; white-space: nowrap; }

/* قائمة التصنيفات المتعددة في الإدارة | admin multi-category checkbox list */
.multi-cats label{ display:inline-flex; align-items:center; gap:4px; margin:0 10px 6px 0; }
.multi-cats input[type=checkbox]{ margin-inline-end:4px; }

/* ===== صور الألوان (شاشة الإدارة) | color images admin screen ===== */
.ci-swatch{ width:22px; height:22px; border-radius:50%; border:1px solid #cbb; display:inline-block; vertical-align:middle; }
.ci-thumb{ position:relative; width:72px; height:72px; border-radius:10px; overflow:hidden; border:2px solid #e6e1d8; background:#faf7f1; }
.ci-thumb.is-main{ border-color:#16a34a; box-shadow:0 0 0 2px #bbf7d0; }
.ci-thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
.ci-main-tag{ position:absolute; top:0; inset-inline-start:0; background:#16a34a; color:#fff; font-size:.62rem; padding:1px 5px; border-end-end-radius:8px; }
.ci-thumb-actions{ position:absolute; bottom:0; inset-inline-end:0; display:flex; gap:2px; padding:2px; }
.ci-act{ width:22px; height:22px; display:flex; align-items:center; justify-content:center; border-radius:6px; background:rgba(255,255,255,.92); color:#444; font-size:.75rem; text-decoration:none; }
.ci-act.ci-del{ color:#dc2626; }
.ci-act.ci-main{ color:#16a34a; }
.ci-act:hover{ background:#fff; }
.ci-zoom{ cursor:zoom-in; }
.ci-vid{ width:100%; max-width:260px; border-radius:10px; background:#000; }
/* نافذة التكبير | image zoom lightbox */
.ci-lightbox{ display:none; position:fixed; inset:0; z-index:3000; background:rgba(0,0,0,.85);
  align-items:center; justify-content:center; padding:24px; cursor:zoom-out; }
.ci-lightbox img{ max-width:95vw; max-height:92vh; border-radius:12px; box-shadow:0 10px 40px rgba(0,0,0,.5); }

/* ===== طباعة الباركود | barcode printing screen ===== */
.bc-picklist{ max-height:420px; overflow:auto; border:1px solid #eee; border-radius:10px; }
.bc-pick{ display:flex; align-items:center; gap:.6rem; padding:.45rem .7rem; border-bottom:1px solid #f1efe9; cursor:pointer; margin:0; }
.bc-pick:last-child{ border-bottom:0; }
.bc-pick:hover{ background:#faf7f1; }
.bc-pick-num{ font-family:monospace; font-weight:700; min-width:90px; color:#7a5; }
.bc-pick-name{ flex:1; font-weight:600; }
.bc-pick-meta{ display:flex; gap:.25rem; }
.bc-labels{ display:flex; flex-wrap:wrap; gap:12px; margin-top:8px; }
.bc-label{ display:flex; flex-direction:column; align-items:center; gap:6px; padding:8px;
  border:1px dashed #d8d2c6; border-radius:10px; background:#fff; }
.bc-label-img{ display:block; max-width:100%; }
/* ===== الطباعة: إظهار الملصقات فقط | print: show labels only ===== */
@media print{
  body * { visibility:hidden !important; }
  #bcLabels, #bcLabels * { visibility:visible !important; }
  #bcLabels{ position:absolute; inset:0 auto auto 0; width:100%; margin:0; gap:6px; }
  .bc-noprint, .bc-dl{ display:none !important; }
  .bc-label{ border:0; padding:2px; break-inside:avoid; page-break-inside:avoid; }
}
