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

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: rgba(79, 70, 229, 0.1);
    --accent: #7c3aed;
    --success: #10b981;
    --success-soft: rgba(16, 185, 129, 0.12);
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.1);

    --bg: #f8fafc;
    --bg-subtle: #f1f5f9;
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.85);
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 12px 30px -8px rgba(15, 23, 42, 0.1);
    --shadow-lg: 0 24px 50px -12px rgba(15, 23, 42, 0.16);
}

[data-theme="dark"] {
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-soft: rgba(99, 102, 241, 0.18);
    --accent: #a78bfa;
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.15);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.15);

    --bg: #0b1120;
    --bg-subtle: #111827;
    --surface: #141d31;
    --surface-glass: rgba(11, 17, 32, 0.82);
    --text: #f8fafc;
    --muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.16);

    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 14px 32px -8px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 55px -12px rgba(0, 0, 0, 0.65);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Cairo', Tahoma, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.25s ease, color 0.25s ease;
}

html[dir="ltr"] body {
    font-family: 'Inter', 'Cairo', system-ui, -apple-system, sans-serif;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-hover); }

.container {
    width: 100%;
    max-width: 1180px;
    margin-inline: auto;
    padding-inline: 20px;
}

main { flex: 1; }

/* ===== Navbar ===== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--surface-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.navbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-block: 14px;
    gap: 14px;
    flex-wrap: wrap;
}

.brand {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.brand:hover { color: var(--text); }

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
    flex-shrink: 0;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.92rem;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.2s, color 0.2s;
}
.nav-link:hover { background: var(--bg-subtle); color: var(--text); }
.nav-link.active { color: var(--primary); background: var(--primary-soft); }
.nav-link.danger { color: var(--danger); }
.nav-link.danger:hover { background: var(--danger-soft); }

.user-pill {
    background: var(--primary-soft);
    color: var(--primary);
    padding: 6px 13px;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.icon-btn:hover { border-color: var(--primary); transform: translateY(-1px); }

/* ===== Language Switcher ===== */
.lang-switcher {
    position: relative;
}

.lang-switcher summary {
    list-style: none;
    height: 38px;
    padding-inline: 11px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.84rem;
    font-weight: 700;
    user-select: none;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.lang-switcher summary::-webkit-details-marker { display: none; }
.lang-switcher summary:hover,
.lang-switcher[open] summary {
    border-color: var(--primary);
    transform: translateY(-1px);
}
.lang-switcher .lang-chevron {
    transition: transform 0.2s ease;
    opacity: 0.7;
}
.lang-switcher[open] .lang-chevron {
    transform: rotate(180deg);
}

.lang-menu {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    min-width: 152px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 6px;
    z-index: 65;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.lang-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 11px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    transition: background 0.15s, color 0.15s;
}
.lang-option:hover {
    background: var(--bg-subtle);
    color: var(--primary);
}
.lang-option.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
}
.lang-code {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--muted);
    letter-spacing: 0.04em;
}
.lang-option.active .lang-code {
    color: var(--primary);
}

.cart-trigger {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.28);
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}
.cart-trigger:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(79, 70, 229, 0.36); }

.cart-badge {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    font-size: 0.78rem;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-inline: 6px;
}

/* ===== Hero Section ===== */
.hero {
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 15% 20%, rgba(124, 58, 237, 0.35), transparent 45%),
                radial-gradient(circle at 85% 80%, rgba(79, 70, 229, 0.4), transparent 50%),
                #0f172a;
    color: #fff;
    padding: 64px 0 56px;
    margin-bottom: 42px;
}

.hero-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
}

.hero-text { max-width: 600px; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 16px;
}

.hero h1 {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 12px;
}

.hero p {
    color: #cbd5e1;
    font-size: 1.02rem;
    margin-bottom: 22px;
}

.trust-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 0.86rem;
    color: #cbd5e1;
}
.trust-pills span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 390px;
}

.search-box svg {
    position: absolute;
    inset-inline-start: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #cbd5e1;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding-block: 14px;
    padding-inline-start: 46px;
    padding-inline-end: 18px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}
.search-box input::placeholder { color: #cbd5e1; }
.search-box input:focus {
    background: #fff;
    color: #0f172a;
    border-color: #fff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.35);
}
.search-box input:focus + svg,
.search-box:focus-within svg { color: var(--primary); }

/* ===== Section Header & Products Grid ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 12px;
}
.section-header h2 { font-size: 1.4rem; font-weight: 800; }
.count-label {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 24px;
    padding-bottom: 64px;
}

.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.product-thumb {
    height: 175px;
    background: linear-gradient(135deg, var(--primary-soft), rgba(124, 58, 237, 0.14));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    position: relative;
    overflow: hidden;
}
.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}
.product-card:hover .product-thumb img { transform: scale(1.04); }

.digital-tag {
    position: absolute;
    top: 12px;
    inset-inline-start: 12px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 0.75rem;
    padding: 4px 11px;
    border-radius: 999px;
    font-weight: 700;
    z-index: 2;
}

.product-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.product-title {
    font-size: 1.12rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text);
}
.product-desc {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
    flex: 1;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    gap: 10px;
}

.price {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
}
.price span { font-size: 0.85rem; color: var(--muted); font-weight: 600; }

/* ===== Buttons ===== */
.btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}
.btn-primary:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}
.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover { color: #fff; opacity: 0.92; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger-ghost {
    background: var(--danger-soft);
    color: var(--danger);
    padding: 6px 11px;
    font-size: 0.82rem;
}
.btn-danger-ghost:hover { background: var(--danger); color: #fff; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; padding: 13px; font-size: 0.98rem; }

/* ===== Slide-Over Cart Drawer (RTL & LTR Aware) ===== */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(4px);
    z-index: 1300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.cart-drawer {
    position: fixed;
    top: 0;
    inset-inline-end: 0;
    height: 100vh;
    width: 100%;
    max-width: 430px;
    background: var(--surface);
    z-index: 1310;
    border-inline-start: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}
html[dir="rtl"] .cart-drawer {
    transform: translateX(-100%);
}
html[dir="ltr"] .cart-drawer {
    transform: translateX(100%);
}
.cart-drawer.open,
html[dir="rtl"] .cart-drawer.open,
html[dir="ltr"] .cart-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.drawer-header h2 { font-size: 1.15rem; font-weight: 800; }

.close-btn {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.close-btn:hover { border-color: var(--danger); color: var(--danger); }

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px;
}

.cart-list { list-style: none; }
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 14px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    gap: 12px;
}
.cart-item-title { font-weight: 700; font-size: 0.94rem; }
.cart-item-price { color: var(--primary); font-weight: 700; font-size: 0.86rem; }

.empty-state {
    text-align: center;
    padding: 46px 18px;
    color: var(--muted);
}

.drawer-footer {
    padding: 20px 22px;
    border-top: 1px solid var(--border);
    background: var(--bg-subtle);
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.12rem;
    font-weight: 800;
    margin-bottom: 14px;
}

/* ===== Forms & Alerts ===== */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}

.input-wrap { position: relative; }

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 0.94rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}
.input-wrap .form-input { padding-inline-end: 44px; }

.toggle-pass {
    position: absolute;
    inset-inline-end: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    align-items: center;
}
.toggle-pass:hover { color: var(--primary); }

.hint-text {
    font-size: 0.84rem;
    color: var(--muted);
    margin-top: 12px;
    text-align: center;
}

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 18px;
}
.alert-error {
    background: var(--danger-soft);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}
.alert-success {
    background: var(--success-soft);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: var(--success);
}

.checkout-result { margin-top: 16px; }
.download-box {
    background: var(--success-soft);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 12px;
    padding: 14px;
    color: var(--text);
}
.download-box h4 { margin-bottom: 10px; font-size: 0.95rem; color: var(--success); }
.download-link {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    margin-top: 8px;
    font-weight: 700;
    color: var(--primary);
}
.download-link:hover { border-color: var(--primary); }

/* ===== Auth Pages (Unified Layout) ===== */
.auth-page {
    background: radial-gradient(circle at 20% 15%, var(--primary-soft), transparent 40%),
                radial-gradient(circle at 80% 85%, rgba(124, 58, 237, 0.12), transparent 45%),
                var(--bg);
}

.auth-topbar {
    padding-block: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px 56px;
}

.auth-card {
    width: 100%;
    max-width: 430px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 34px 30px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 26px;
}
.auth-header .brand-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    margin-bottom: 14px;
}
.auth-header h1 {
    font-size: 1.45rem;
    font-weight: 800;
    margin-bottom: 6px;
}
.auth-header p {
    font-size: 0.92rem;
    color: var(--muted);
}

.auth-footer {
    text-align: center;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===== Orders Panel & Table ===== */
.panel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    margin: 34px auto 60px;
    box-shadow: var(--shadow-sm);
}

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.data-table th, .data-table td {
    padding: 14px 14px;
    border-bottom: 1px solid var(--border);
    text-align: start;
    white-space: nowrap;
}
.data-table th {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
    background: var(--bg-subtle);
}
.data-table th:first-child {
    border-start-start-radius: 10px;
    border-end-start-radius: 10px;
}
.data-table th:last-child {
    border-start-end-radius: 10px;
    border-end-end-radius: 10px;
}
.data-table tbody tr:hover { background: var(--bg-subtle); }

.order-badge {
    display: inline-block;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    inset-inline-start: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: #0f172a;
    color: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: slideUp 0.25s ease;
}
.toast.success { background: #059669; }
.toast.error { background: #dc2626; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Footer ===== */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding-block: 24px;
    margin-top: auto;
    font-size: 0.88rem;
    color: var(--muted);
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* ===== Gift Code & Stock Badges ===== */
.digital-tag.gift {
    background: linear-gradient(135deg, #7c3aed, #db2777);
}
.digital-tag.out {
    background: rgba(220, 38, 38, 0.9);
}

.stock-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    padding: 3px 10px;
    border-radius: 999px;
    width: fit-content;
}
.stock-meta.in-stock {
    background: var(--success-soft);
    color: var(--success);
}
.stock-meta.out-stock {
    background: var(--danger-soft);
    color: var(--danger);
}

.code-chip {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--surface);
    border: 1px dashed var(--primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    margin-top: 8px;
    width: 100%;
    direction: ltr;
}
.code-chip code {
    font-family: Consolas, monospace;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    word-break: break-all;
}
.copy-btn {
    background: var(--primary-soft);
    color: var(--primary);
    border: none;
    padding: 5px 10px;
    border-radius: 7px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.copy-btn:hover {
    background: var(--primary);
    color: #fff;
}

/* ===== Request Products, Modal & Status Badges ===== */
.digital-tag.request {
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-overlay.open { display: flex; }

.modal-card {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.22s ease;
}

.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { font-size: 1.15rem; font-weight: 800; }

.modal-body { padding: 20px 22px; }

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}
.status-pending    { background: rgba(245, 158, 11, 0.14); color: #d97706; }
.status-processing { background: rgba(14, 165, 233, 0.14); color: #0284c7; }
.status-approved   { background: var(--success-soft); color: var(--success); }
.status-rejected   { background: var(--danger-soft); color: var(--danger); }

.kv-list {
    list-style: none;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.86rem;
    margin-block: 6px;
}
.kv-list li { padding-block: 3px; white-space: normal; }

.reply-box {
    background: var(--primary-soft);
    border-inline-start: 3px solid var(--primary);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.88rem;
    white-space: normal;
    margin-bottom: 8px;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.filter-tab {
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
}
.filter-tab.active, .filter-tab:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

textarea.form-input { min-height: 85px; resize: vertical; }

/* ===== Categories, Sub-categories & Breadcrumbs ===== */
.breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs .sep { color: var(--muted); opacity: 0.5; }
.breadcrumbs .current { color: var(--text); font-weight: 800; }

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 36px;
}

.category-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.category-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    color: var(--text);
}

.category-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
    flex-shrink: 0;
    overflow: hidden;
}
.category-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-info { min-width: 0; flex: 1; }
.category-name {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.category-meta {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 600;
}

.cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--muted);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    padding: 2px 9px;
    border-radius: 999px;
    margin-bottom: 8px;
    width: fit-content;
}

.view-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== Directional Icon Utility ===== */
html[dir="rtl"] .rtl-flip {
    transform: scaleX(-1);
}