/* ============================================================
   نظام التصميم — متجر الشحن الرقمي
   ألوان: #12172B (كحلي داكن) / #00C2A8 (نعناعي) / #F2B705 (ذهبي)
          #F7F8FA (خلفية) / #1A1D29 (نص) / #E63946 (تنبيه)
   خطوط: Almarai (عناوين) / Tajawal (نص عام)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Almarai:wght@400;700;800&family=Tajawal:wght@400;500;700&display=swap');

:root {
    --ink: #12172B;
    --mint: #00C2A8;
    --mint-dark: #00a892;
    --gold: #F2B705;
    --bg: #F7F8FA;
    --text: #1A1D29;
    --muted: #6B7280;
    --danger: #E63946;
    --card-radius: 14px;
    --shadow: 0 4px 20px rgba(18, 23, 43, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
    text-align: right;
}

h1, h2, h3, h4, .brand, .btn, .section-title {
    font-family: 'Almarai', sans-serif;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.topbar {
    background: var(--ink);
    color: #fff;
    font-size: 13px;
    padding: 6px 0;
}
.topbar .container { display: flex; justify-content: space-between; }

.main-header {
    background: #fff;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}
.main-header .container {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-top: 14px;
    padding-bottom: 14px;
    flex-wrap: wrap;
}
.brand {
    font-weight: 800;
    font-size: 24px;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.brand span { color: var(--mint); }

.search-box {
    flex: 1;
    min-width: 180px;
    display: flex;
    background: var(--bg);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}
.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 11px 14px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
}
.search-box input:focus { outline: none; }
.search-box button {
    border: none;
    background: var(--mint);
    color: #fff;
    padding: 0 18px;
    cursor: pointer;
}

.header-actions { display: flex; align-items: center; gap: 14px; }
.icon-btn {
    position: relative;
    font-size: 20px;
    color: var(--ink);
}
.badge {
    position: absolute;
    top: -8px;
    left: -10px;
    background: var(--gold);
    color: var(--ink);
    font-size: 11px;
    font-weight: 700;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.balance-pill {
    background: var(--bg);
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--mint-dark);
}
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 10px;
    background: var(--mint);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: 0.15s;
}
.btn:hover { background: var(--mint-dark); }
.btn-outline {
    background: transparent;
    border: 1.5px solid var(--ink);
    color: var(--ink);
}
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; text-align: center; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---------- Categories nav ---------- */
.cat-nav {
    background: var(--ink);
    overflow-x: auto;
}
.cat-nav .container {
    display: flex;
    gap: 26px;
    padding-top: 10px;
    padding-bottom: 10px;
    white-space: nowrap;
}
.cat-nav a {
    color: #cdd3e0;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    gap: 6px;
    align-items: center;
}
.cat-nav a:hover, .cat-nav a.active { color: var(--mint); }

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(120deg, var(--ink) 55%, #1c2340 100%);
    color: #fff;
    padding: 46px 0;
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 85% 30%, rgba(0,194,168,0.25), transparent 60%);
}
.hero .container { position: relative; display: flex; align-items: center; gap: 30px; flex-wrap: wrap; }
.hero-text { flex: 1; min-width: 260px; }
.hero-text h1 { font-size: 30px; margin: 0 0 10px; line-height: 1.4; }
.hero-text p { color: #b8bfd4; margin: 0 0 18px; font-size: 15px; }
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,194,168,0.15);
    color: var(--mint);
    border: 1px solid rgba(0,194,168,0.4);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    margin-bottom: 14px;
}

/* ---------- Instant delivery ticker (signature element) ---------- */
.ticker-wrap {
    background: #fff;
    border-bottom: 1px solid #eee;
    overflow: hidden;
    padding: 10px 0;
}
.ticker {
    display: flex;
    gap: 40px;
    white-space: nowrap;
    animation: scroll-rtl 28s linear infinite;
    width: max-content;
}
.ticker span { font-size: 13px; color: var(--muted); }
.ticker b { color: var(--mint-dark); }
@keyframes scroll-rtl {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* ---------- Sections ---------- */
.section { padding: 34px 0; }
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.section-title h2 { font-size: 20px; margin: 0; }
.section-title a { font-size: 13px; color: var(--mint-dark); font-weight: 700; }

/* ---------- Category cards ---------- */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.cat-card {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    padding: 20px 14px;
    text-align: center;
    transition: 0.15s;
}
.cat-card:hover { transform: translateY(-3px); }
.cat-card i { font-size: 26px; color: var(--mint); margin-bottom: 10px; }
.cat-card div { font-weight: 700; font-size: 14px; }

/* ---------- Product grid ---------- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}
.product-card {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.product-card .thumb {
    background: linear-gradient(135deg, var(--ink), #262d4c);
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mint);
    font-size: 34px;
}
.product-card .body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.product-card .name { font-weight: 700; font-size: 14.5px; min-height: 40px; }
.product-card .meta { display: flex; justify-content: space-between; align-items: center; }
.product-card .price { color: var(--mint-dark); font-weight: 800; font-size: 16px; }
.product-card .old-price { color: var(--muted); text-decoration: line-through; font-size: 12px; }
.tag {
    display: inline-block;
    font-size: 11px;
    background: rgba(0,194,168,0.12);
    color: var(--mint-dark);
    padding: 2px 8px;
    border-radius: 6px;
    width: fit-content;
}
.tag.instant { background: rgba(242,183,5,0.15); color: #a5760a; }

/* ---------- Product detail ---------- */
.product-detail { display: flex; gap: 30px; flex-wrap: wrap; background:#fff; border-radius: var(--card-radius); box-shadow: var(--shadow); padding: 26px; }
.product-detail .thumb-lg {
    width: 260px;
    height: 260px;
    border-radius: var(--card-radius);
    background: linear-gradient(135deg, var(--ink), #262d4c);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mint);
    font-size: 60px;
}
.product-detail .info { flex: 1; min-width: 260px; }
.product-detail h1 { font-size: 22px; margin: 0 0 10px; }
.field-group { margin: 16px 0; }
.field-group label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.field-group input, .field-group select {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid #e2e5eb;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
}

/* ---------- Forms / auth ---------- */
.auth-box {
    max-width: 400px;
    margin: 50px auto;
    background: #fff;
    padding: 30px;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
}
.auth-box h1 { font-size: 21px; text-align: center; margin-bottom: 22px; }
.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.alert-success { background: #e5f9f4; color: #067a5f; }
.alert-danger { background: #fdecea; color: #b3261e; }

/* ---------- Cart / checkout tables ---------- */
table.cart-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--card-radius); overflow: hidden; box-shadow: var(--shadow); }
table.cart-table th, table.cart-table td { padding: 14px; text-align: right; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
table.cart-table th { background: var(--bg); }

/* ---------- Footer ---------- */
footer { background: var(--ink); color: #b8bfd4; padding: 40px 0 20px; margin-top: 40px; }
footer .cols { display: grid; grid-template-columns: repeat(4,1fr); gap: 24px; margin-bottom: 26px; }
footer h4 { color: #fff; font-size: 15px; margin-bottom: 12px; }
footer a { color: #b8bfd4; font-size: 13px; display: block; margin-bottom: 8px; }
footer .bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 16px; text-align: center; font-size: 12px; }

/* ---------- Admin ---------- */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-sidebar { width: 230px; background: var(--ink); color: #fff; padding: 20px 0; flex-shrink: 0; }
.admin-sidebar .brand { color: #fff; padding: 0 20px 20px; }
.admin-sidebar a { display: block; padding: 12px 20px; color: #b8bfd4; font-size: 14px; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: rgba(0,194,168,0.15); color: var(--mint); border-right: 3px solid var(--mint); }
.admin-content { flex: 1; padding: 24px; }
.admin-topbar { display:flex; justify-content: space-between; align-items:center; margin-bottom: 22px; }
.stat-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 26px; }
.stat-card { background:#fff; border-radius: var(--card-radius); box-shadow: var(--shadow); padding: 18px; }
.stat-card .num { font-size: 24px; font-weight: 800; color: var(--ink); }
.stat-card .lbl { font-size: 13px; color: var(--muted); }
table.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--card-radius); overflow:hidden; box-shadow: var(--shadow); }
table.admin-table th, table.admin-table td { padding: 12px 14px; border-bottom: 1px solid #f0f0f0; font-size: 13.5px; text-align: right; }
table.admin-table th { background: var(--bg); }
.status-pill { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status-active, .status-completed, .status-paid { background:#e5f9f4; color:#067a5f; }
.status-inactive, .status-failed, .status-cancelled { background:#fdecea; color:#b3261e; }
.status-pending, .status-processing { background:#fff6e0; color:#a5760a; }
.form-card { background:#fff; border-radius: var(--card-radius); box-shadow: var(--shadow); padding: 22px; max-width: 640px; }
.form-row { margin-bottom: 16px; }
.form-row label { display:block; font-weight:700; font-size: 13.5px; margin-bottom: 6px; }
.form-row input, .form-row select, .form-row textarea {
    width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid #e2e5eb; font-family:'Tajawal',sans-serif; font-size: 14px;
}
.checkbox-row { display:flex; align-items:center; gap:8px; }
.checkbox-row input { width:auto; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .cat-grid, .product-grid { grid-template-columns: repeat(2, 1fr); }
    footer .cols { grid-template-columns: repeat(2,1fr); }
    .stat-cards { grid-template-columns: repeat(2,1fr); }
    .admin-sidebar { position: fixed; right: -230px; top:0; height:100%; z-index: 100; transition: 0.2s; }
    .admin-sidebar.open { right: 0; }
    .admin-content { width: 100%; }
}
@media (max-width: 560px) {
    .cat-grid, .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .main-header .container { gap: 10px; }
    .brand { font-size: 19px; }
    .hero-text h1 { font-size: 22px; }
    .product-detail { padding: 16px; }
    .product-detail .thumb-lg { width: 100%; height: 180px; }
    .stat-cards { grid-template-columns: 1fr 1fr; }
}
