@font-face {
    font-family: 'BluSans';
    src: url('../fonts/NotoSansArabic-Regular.ttf') format('truetype');
    font-weight: 400; font-display: swap;
}
@font-face {
    font-family: 'BluSans';
    src: url('../fonts/NotoSansArabic-Medium.ttf') format('truetype');
    font-weight: 500; font-display: swap;
}
@font-face {
    font-family: 'BluSans';
    src: url('../fonts/NotoSansArabic-Bold.ttf') format('truetype');
    font-weight: 700; font-display: swap;
}
@font-face {
    font-family: 'BluDisplay';
    src: url('../fonts/NotoKufiArabic-ExtraBold.ttf') format('truetype');
    font-weight: 800; font-display: swap;
}

:root {
    --blu: #f97316;
    --blu-dark: #ea580c;
    --blu-soft: #fff7ed;
    --blu-grad: linear-gradient(135deg, #1f2937 0%, #374151 62%, #ea580c 100%);
    --bg: #f1f3f5;
    --card: #ffffff;
    --ink: #1f2937;
    --ink-soft: #4b5563;
    --muted: #6b7280;
    --border: #e5e7eb;
    --green: #10b981;
    --green-soft: #ecfdf5;
    --red: #ef4444;
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --shadow: 0 8px 28px rgba(15, 23, 42, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
    font-family: 'BluSans', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.75;
    direction: rtl;
    padding-bottom: 86px;
}
h1, h2, h3, .brand { font-family: 'BluDisplay', 'BluSans', sans-serif; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { max-width: 1140px; margin: 0 auto; padding: 0 16px; }

.app-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 17px; color: var(--ink); }
.brand-dot {
    width: 34px; height: 34px; border-radius: 12px;
    background: var(--blu-grad); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 800;
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.28);
}
.desktop-nav { display: flex; align-items: center; gap: 20px; font-size: 13.5px; font-weight: 500; color: var(--ink-soft); }
.desktop-nav a:hover { color: var(--blu); }

.bottom-nav {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 70;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    height: 68px;
    grid-template-columns: repeat(4, 1fr);
    align-items: center;
    padding: 0 6px;
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); }
.bottom-nav a.active { color: var(--blu); }
.bottom-nav svg { width: 22px; height: 22px; }

.blu-hero {
    background: var(--blu-grad); color: #fff;
    border-radius: var(--radius-xl); padding: 26px 22px; margin: 16px 0 22px;
    box-shadow: 0 14px 36px rgba(249, 115, 22, 0.22);
    position: relative; overflow: hidden;
}
.blu-hero::after {
    content: ""; position: absolute; width: 220px; height: 220px;
    border-radius: 50%; background: rgba(255,255,255,0.1);
    top: -70px; left: -60px; pointer-events: none;
}
.blu-hero h1 { font-size: 21px; margin-bottom: 6px; }
.blu-hero p { font-size: 13.5px; color: rgba(255,255,255,0.9); max-width: 560px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px; border-radius: var(--radius-md);
    font-size: 13.5px; font-weight: 700; border: none; cursor: pointer;
    transition: all 0.18s ease; font-family: 'BluSans', sans-serif;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--blu); color: #fff; box-shadow: 0 6px 18px rgba(249, 115, 22, 0.22); }
.btn-primary:hover { background: var(--blu-dark); }
.btn-white { background: #fff; color: var(--blu); }
.btn-success { background: var(--green); color: #fff; box-shadow: 0 6px 18px rgba(16, 185, 129, 0.22); }
.btn-light { background: #eaf0f8; color: var(--ink); }
.btn-warning { background: #fef3c7; color: #92400e; }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-sm { padding: 7px 13px; font-size: 12px; border-radius: 10px; }
.btn-lg { padding: 14px 24px; font-size: 14.5px; border-radius: 16px; }
.btn-block { width: 100%; }

.card { background: var(--card); border-radius: var(--radius-xl); border: 1px solid var(--border); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* Square Product Grid (uniform square cards even with 1 product) */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
@media (max-width: 1024px) {
    .products-grid { grid-template-columns: repeat(3, 1fr); }
}
.product-card {
    display: flex; flex-direction: column; justify-content: space-between;
    transition: 0.2s; padding: 14px;
}
.product-card:hover { transform: translateY(-3px); border-color: #fed7aa; }
.product-img-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    background: #f5f8fc;
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}
.product-img-wrap img {
    width: 100%; height: 100%; object-fit: contain; padding: 8px;
}

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge-admin { background: #ede9fe; color: #6d28d9; }
.badge-partner { background: var(--green-soft); color: #047857; }
.badge-customer { background: #f1f5f9; color: #475569; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-info { background: var(--blu-soft); color: var(--blu-dark); }

/* Segmented Switch (Custom Print vs Raw Blank) */
.mode-switch {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    background: #eaf0f8; padding: 6px; border-radius: 16px; margin-bottom: 16px;
}
.mode-switch-btn {
    padding: 10px 12px; border-radius: 12px; border: none; background: transparent;
    font-family: 'BluSans', sans-serif; font-size: 13px; font-weight: 700; color: var(--ink-soft);
    cursor: pointer; transition: 0.2s;
}
.mode-switch-btn.active {
    background: #fff; color: var(--blu); box-shadow: 0 4px 12px rgba(15,23,42,0.08);
}

.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bg); }
.auth-card { width: 100%; max-width: 350px; background: #fff; border-radius: 26px; padding: 24px 20px; box-shadow: 0 16px 40px rgba(249, 115, 22, 0.08); border: 1px solid var(--border); }

.wizard-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.wiz-dot { flex: 1; height: 6px; border-radius: 999px; background: #dbe4f0; transition: 0.25s; }
.wiz-dot.active { background: var(--blu); }
.wiz-dot.done { background: var(--green); }

.tier-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tier-option { border: 2px solid var(--border); border-radius: 16px; padding: 12px; cursor: pointer; transition: 0.18s; background: #fff; }
.tier-option.selected { border-color: var(--blu); background: var(--blu-soft); }

.swatch-row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; border: 2px solid var(--border); background: #fff; cursor: pointer; font-size: 12px; font-weight: 500; }
.swatch.selected { border-color: var(--blu); background: var(--blu-soft); font-weight: 700; }
.swatch-dot { width: 15px; height: 15px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.2); flex-shrink: 0; }

/* 3D Studio Stage + Zoom Controls */
.studio-stage {
    background: radial-gradient(circle at center, #ffffff 0%, #e4ecf7 100%);
    border: 1px solid var(--border); border-radius: 20px;
    padding: 12px; position: relative; overflow: hidden;
}
#bag3dCanvas { width: 100%; height: 360px; display: block; border-radius: 14px; cursor: grab; touch-action: none; }
#bag3dCanvas:active { cursor: grabbing; }
.studio-tools-overlay {
    position: absolute; top: 14px; left: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 5;
}
.tool-circle {
    width: 36px; height: 36px; border-radius: 12px; border: 1px solid var(--border);
    background: rgba(255,255,255,0.92); color: var(--ink); font-weight: 800; font-size: 16px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 10px rgba(15,23,42,0.08);
}

.sample-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.sample-thumb {
    border: 2px solid var(--border); border-radius: 12px; padding: 6px;
    background: #fff; cursor: pointer; text-align: center; font-size: 10.5px;
}
.sample-thumb.selected { border-color: var(--blu); background: var(--blu-soft); }
.sample-thumb img { width: 100%; height: 44px; object-fit: contain; margin-bottom: 3px; }

.wizard-sticky-footer {
    position: sticky; bottom: 72px; z-index: 40;
    background: rgba(255,255,255,0.96); backdrop-filter: blur(12px);
    border: 1px solid var(--border); border-radius: 18px;
    padding: 12px 16px; margin-top: 16px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    box-shadow: 0 10px 28px rgba(15,23,42,0.08);
}

.dropzone { border: 2px dashed #fed7aa; border-radius: 18px; padding: 22px 14px; text-align: center; background: var(--blu-soft); cursor: pointer; transition: 0.2s; }
.dropzone:hover { border-color: var(--blu); }
.progress-track { width: 100%; height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; width: 0%; background: var(--blu-grad); transition: width 0.2s; }

.form-group { margin-bottom: 13px; }
.form-label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin-bottom: 5px; }
.form-control { width: 100%; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: 13px; font-size: 13.5px; font-family: 'BluSans', sans-serif; background: #f8fafc; transition: 0.15s; }
.form-control:focus { outline: none; background: #fff; border-color: var(--blu); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12); }
.dir-ltr { direction: ltr; text-align: left; }

.alert { padding: 12px 14px; border-radius: 14px; font-size: 12.5px; margin-bottom: 14px; font-weight: 500; }
.alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

.table-wrap { overflow-x: auto; background: #fff; border-radius: 18px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: right; }
th, td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; }
th { background: #f8fafc; color: var(--muted); font-weight: 700; }

.admin-wrap { display: flex; min-height: 100vh; }
.admin-sidebar { width: 250px; background: #18181b; color: #fff; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; flex-shrink: 0; }
.admin-sidebar h2 { font-size: 16px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid #27272a; color: #fb923c; }
.admin-nav a { display: block; padding: 10px 14px; border-radius: 12px; font-size: 13px; color: #cbd5e1; margin-bottom: 5px; }
.admin-nav a:hover, .admin-nav a.active { background: var(--blu); color: #fff; font-weight: 700; }
.admin-main { flex: 1; padding: 22px; overflow-x: hidden; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 18px; }
.stat-num { font-family: 'BluDisplay', sans-serif; font-size: 26px; color: var(--ink); margin-top: 4px; }

.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mb-4 { margin-bottom: 14px; } .mb-6 { margin-bottom: 22px; }
.text-muted { color: var(--muted); font-size: 12.5px; }
.price-tag { font-family: 'BluDisplay', sans-serif; font-size: 15.5px; color: var(--blu); }
.hidden { display: none !important; }

@media (max-width: 768px) {
    .desktop-nav { display: none; }
    .bottom-nav { display: grid; }
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .sample-grid { grid-template-columns: repeat(3, 1fr); }
    .admin-wrap { flex-direction: column; }
    .admin-sidebar { width: 100%; }
}
@media (min-width: 769px) {
    body { padding-bottom: 24px; }
    .wizard-sticky-footer { bottom: 16px; }
}
@media print { .no-print { display: none !important; } body { background: #fff; padding: 0; } }

/* v6 Studio Mobile Tabs & Cart/Wallet */
.studio-tabs {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
    background: #eaf0f8; padding: 5px; border-radius: 16px; margin-bottom: 14px;
}
.studio-tab-btn {
    padding: 9px 6px; border-radius: 12px; border: none; background: transparent;
    font-family: 'BluSans', sans-serif; font-size: 12px; font-weight: 700;
    color: var(--ink-soft); cursor: pointer; transition: 0.18s;
}
.studio-tab-btn.active { background: #fff; color: var(--blu); box-shadow: 0 3px 10px rgba(15,23,42,0.08); }
.cart-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
    background: var(--red); color: #fff; font-size: 10.5px; font-weight: 800;
}
.ink-dot {
    width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
    border: 2px solid var(--border); transition: 0.15s;
}
.ink-dot.selected { border-color: var(--blu); transform: scale(1.15); box-shadow: 0 0 0 3px rgba(37,99,235,0.2); }

/* v9 Search Bar, Floating Support, Gallery & Rich Editor */
.search-bar-form { display: flex; gap: 8px; max-width: 440px; width: 100%; }
.floating-support {
    position: fixed; left: 18px; bottom: 84px; z-index: 65;
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
}
.floating-support-menu {
    display: none; flex-direction: column; gap: 6px;
    background: #fff; border: 1px solid var(--border); border-radius: 16px;
    padding: 10px; box-shadow: 0 12px 30px rgba(0,0,0,0.14); min-width: 155px;
}
.floating-support-menu.open { display: flex; }
.floating-support-btn {
    width: 52px; height: 52px; border-radius: 50%; border: none;
    background: var(--blu); color: #fff; font-size: 22px; cursor: pointer;
    box-shadow: 0 8px 22px rgba(249, 115, 22, 0.35);
    display: flex; align-items: center; justify-content: center;
}
.gallery-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; }
.gallery-thumb {
    width: 66px; height: 66px; border-radius: 12px; object-fit: cover;
    border: 2px solid var(--border); cursor: pointer; flex-shrink: 0;
}
.gallery-thumb:hover { border-color: var(--blu); }
.video-box {
    background: #18181b; border-radius: 18px; overflow: hidden;
    border: 1px solid var(--border); margin-bottom: 18px;
}
.video-box video, .video-box iframe { width: 100%; max-height: 360px; display: block; border: 0; }
.rich-toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
@media (min-width: 769px) { .floating-support { bottom: 22px; } }
