/* Crypto Market Pro - التصميم العصري */
/* الخط يتم تحميله من head_perf.php لتجنب @import الحاجب */

/* المود الليلي (افتراضي) — ألوان أفتح وسلسة */
:root, [data-theme="dark"] {
    --bg-dark: #1e1e32;
    --bg-card: #282842;
    --bg-elevated: #32325a;
    --border: rgba(129, 140, 248, 0.12);
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-soft: rgba(99, 102, 241, 0.12);
    --success: #22c55e;
    --danger: #f43f5e;
    --warning: #f59e0b;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 20px;
    --radius-poly: 14px 14px 4px 4px;
    --shadow: 0 4px 20px rgba(0,0,0,0.25);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.35);
    --border-glow: 1px solid rgba(129, 140, 248, 0.2);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* المود النهاري — ألوان حليبية دافئة */
[data-theme="light"] {
    --bg-dark: #f5f0e8;
    --bg-card: #fdfbf7;
    --bg-elevated: #fffdfa;
    --border: rgba(99, 102, 241, 0.14);
    --text: #1e293b;
    --text-muted: #64748b;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
    --border-glow: 1px solid rgba(99, 102, 241, 0.25);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
[data-theme="light"] .hero h2 { background: linear-gradient(135deg, #1e293b 0%, #64748b 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
[data-theme="light"] .app-header h1, [data-theme="light"] .stat-card .num { -webkit-text-fill-color: initial; color: var(--accent); }
[data-theme="light"] .client-sidebar,
[data-theme="light"] .admin-sidebar { box-shadow: -6px 0 20px rgba(0,0,0,0.06); }

/* زر التبديل - عائم */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition, 0.25s ease);
}
.theme-toggle-floating {
    position: fixed !important;
    bottom: 1.25rem;
    left: 1.25rem;
    z-index: 999;
    box-shadow: var(--shadow-lg);
}
@media (max-width: 480px) {
    .theme-toggle-floating {
        bottom: calc(1rem + env(safe-area-inset-bottom, 0));
        left: 1rem;
        padding: 0.6rem 0.9rem;
        font-size: 0.85rem;
    }
}
.theme-toggle:hover { background: rgba(99, 102, 241, 0.25); }

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}
body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.6;
    transition: background-color var(--transition, 0.25s ease), color var(--transition, 0.25s ease);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition, 0.25s ease); }
a:hover { color: var(--accent-hover); }

/* Layout - Mobile-first */
.app-header {
    background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.app-header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.app-header { position: relative; }
.app-header .header-close {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: all .2s;
}
.app-header .header-close:hover { background: rgba(255,255,255,0.15); color: var(--text); }
.app-header.closed {
    display: none !important;
}
.header-show-btn {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 999;
    width: 40px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
}
.header-show-btn:hover { filter: brightness(1.1); }
.notification-bell-wrap { position: relative; }
.notification-bell {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all .2s;
}
.notification-bell:hover { background: rgba(99, 102, 241, 0.25); }
.notification-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    min-width: 18px;
    height: 18px;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    min-width: 280px;
    max-width: 360px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    display: none;
}
.notification-dropdown.open { display: block; }
.notification-dropdown-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.95rem;
}
.notification-dropdown-list {
    max-height: 280px;
    overflow-y: auto;
}
.notification-item {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    transition: background .2s;
}
.notification-item:hover { background: var(--accent-soft); }
.notification-item.unread { background: rgba(99, 102, 241, 0.08); }
.notification-item strong { display: block; font-size: 0.9rem; margin-bottom: 0.25rem; }
.notification-item span { font-size: 0.8rem; color: var(--text-muted); }
.notification-empty { padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.9rem; margin: 0; }
.notification-dropdown-footer {
    display: block;
    padding: 0.75rem 1rem;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--accent);
    font-size: 0.9rem;
}
.notification-dropdown-footer:hover { background: var(--accent-soft); color: var(--accent); }
.notification-read-all {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    background: transparent;
    border: none;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: center;
    transition: background .2s;
}
.notification-read-all:hover { background: var(--accent-soft); color: var(--accent); }
.notification-list { display: flex; flex-direction: column; }
.notification-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    transition: background .2s;
}
.notification-list-item:last-child { border-bottom: none; }
.notification-list-item:hover { background: var(--accent-soft); }
.notification-list-item.unread { background: rgba(99, 102, 241, 0.08); }
.notification-list-content strong { display: block; margin-bottom: 0.35rem; }
.notification-list-content p { margin: 0 0 0.5rem; font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }
.notification-list-arrow { color: var(--accent); font-size: 1.2rem; }

.app-header .header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.app-nav {
    display: flex;
    gap: 0.75rem 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}
.app-nav a {
    color: var(--text-muted);
    font-weight: 500;
}
.app-nav a:hover { color: var(--accent); }
.nav-avatar-link { display: flex; align-items: center; padding: 0.25rem !important; gap: 0.5rem; }
.nav-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.nav-avatar-letter { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; flex-shrink: 0; }
.nav-balance { font-size: 0.9rem; font-weight: 600; color: var(--success); white-space: nowrap; }

@media (min-width: 769px) {
    .app-header { padding: 1rem 2rem; gap: 1rem; }
    .app-header h1 { font-size: 1.4rem; }
}

/* Cards - حواف مضللة مميزة */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: transform var(--transition, 0.25s ease), box-shadow var(--transition, 0.25s ease), background-color var(--transition, 0.25s ease), border-color var(--transition, 0.25s ease);
    position: relative;
    overflow: hidden;
}
@media (min-width: 481px) { .card { padding: 1.25rem; } }
@media (min-width: 769px) { .card { padding: 1.5rem; } }
.card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #a78bfa, var(--accent));
    opacity: 0.6;
}
.card:hover { box-shadow: var(--shadow-lg); border-color: rgba(99, 102, 241, 0.3); }
.card h2, .card h3 { margin-bottom: 1rem; color: var(--text); }

/* أقسام داخل البطاقات - حواف مضللة */
.card-section {
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-right: 3px solid var(--accent);
}
.card-section:last-child { margin-bottom: 0; }
.card-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
}
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"],
select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    min-height: 44px;
    transition: border-color .2s, box-shadow .2s;
}
@media (max-width: 480px) {
    input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"],
    select, textarea { padding: 0.65rem 0.9rem; font-size: 16px; min-height: 44px; }
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    min-height: 44px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: white !important;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform var(--transition, 0.25s ease), box-shadow var(--transition, 0.25s ease), background var(--transition, 0.25s ease);
}
@media (max-width: 480px) {
    .btn { padding: 0.65rem 1.2rem; min-height: 44px; font-size: 0.95rem; }
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35);
}
.btn-block { width: 100%; margin-top: 0.5rem; }
.btn-ghost { background: var(--accent-soft); color: var(--accent) !important; }
.btn-ghost:hover { background: rgba(99, 102, 241, 0.25); }
.btn-danger { background: linear-gradient(135deg, var(--danger), #dc2626); }
.btn-success { background: linear-gradient(135deg, var(--success), #059669); }

/* Grid */
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* Stats */
.stat-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border);
    transition: transform .2s, border-color .2s;
}
.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}
.stat-card .num {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-card .label { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.2rem; }
@media (min-width: 481px) {
    .stat-card { padding: 1.25rem; }
    .stat-card .num { font-size: 1.75rem; }
    .stat-card .label { font-size: 0.9rem; }
}
@media (min-width: 769px) {
    .stat-card { padding: 1.5rem; }
    .stat-card .num { font-size: 2rem; }
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
}
.table-wrap table { min-width: 640px; }
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border);
}
th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
tr:hover td { background: var(--accent-soft); }
@media (max-width: 768px) {
    .table-wrap { margin: 0 -0.5rem; padding: 0 0.5rem; }
    th, td { padding: 0.6rem 0.5rem; font-size: 0.85rem; }
    th { font-size: 0.75rem; }
}
@media (max-width: 480px) {
    th, td { padding: 0.5rem 0.4rem; font-size: 0.8rem; }
    th { font-size: 0.7rem; }
}

/* Order detail table - key-value layout */
.order-detail-table th, .order-detail-table td { padding: 0.6rem 0.5rem; }
@media (max-width: 480px) {
    .order-detail-table th, .order-detail-table td { padding: 0.5rem 0.35rem; font-size: 0.9rem; }
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
}
@media (max-width: 480px) { .badge { font-size: 0.75rem; padding: 0.2rem 0.6rem; } }
.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.badge-info { background: var(--accent-soft); color: var(--accent); }

/* Hero - حواف مميزة */
.hero {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(180deg, var(--bg-elevated) 0%, transparent 100%);
    border-bottom: 1px solid var(--border);
    position: relative;
}
@media (min-width: 481px) { .hero { padding: 3rem 1.5rem; } }
@media (min-width: 769px) { .hero { padding: 4rem 2rem; } }
.hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 50%;
    transform: translateX(50%);
    width: 120px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: 2px;
}
.hero h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #fff 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p {
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto 1.5rem;
    font-size: 0.95rem;
}
@media (min-width: 481px) {
    .hero h2 { font-size: 2rem; }
    .hero p { font-size: 1rem; }
}
@media (min-width: 769px) {
    .hero h2 { font-size: 2.5rem; margin-bottom: 1rem; }
    .hero p { font-size: 1.1rem; margin-bottom: 2rem; }
}

/* Currency Cards - حواف مضللة */
.currency-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--border);
    transition: all .3s ease;
    position: relative;
    overflow: hidden;
}
.currency-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent) 0%, #a78bfa 50%, var(--accent) 100%);
    border-radius: var(--radius) var(--radius) 0 0;
}
.currency-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.2);
}
.currency-card .icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--accent-soft), rgba(124, 58, 237, 0.2));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}
.currency-card img {
    max-width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: contain;
    margin-bottom: 1rem;
}
.currency-card .price {
    color: var(--success);
    font-weight: 700;
    font-size: 1.25rem;
    margin: 0.75rem 0;
}
.currency-card .sym { color: var(--text-muted); font-size: 0.9rem; }

/* شبكة الأقسام - 2 منتجات في كل صف */
.sections-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    padding: 1.5rem 0;
    max-width: 800px;
    margin: 0 auto;
}
.sections-grid .currency-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
}
.sections-grid .currency-card .icon {
    width: 64px;
    height: 64px;
    margin-bottom: 0.75rem;
}
.sections-grid .currency-card img {
    max-width: 100%;
    height: auto;
    max-height: 140px;
    object-fit: contain;
    margin-bottom: 0.75rem;
}
.sections-grid .currency-card h3 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}
.sections-grid .currency-card .price {
    font-size: 1rem;
    margin: 0.5rem 0;
}
.sections-grid .currency-card .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}
@media (max-width: 600px) {
    .sections-grid { gap: 1rem; }
}

/* صفحة المستخدم - الصورة والملف الشخصي */
.profile-avatar-wrap { position: relative; display: inline-block; }
.profile-avatar, .profile-avatar-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    display: block;
}
.profile-avatar-placeholder {
    background: linear-gradient(135deg, var(--accent-soft), rgba(124, 58, 237, 0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
}
.avatar-upload-btn {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--accent-soft);
    border: 1px dashed var(--accent);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all .2s;
}
.avatar-upload-btn:hover { background: rgba(99, 102, 241, 0.25); }
.avatar-upload-btn input { display: none; }

/* كاروسيل البطاقات المتحرك - قائمة عرض متحركة */
.cards-carousel {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 1.5rem 1rem;
    margin: 0 -1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.cards-carousel::-webkit-scrollbar {
    height: 8px;
}
.cards-carousel::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border-radius: 4px;
}
.cards-carousel::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 4px;
}
.cards-carousel-inner {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 0;
}
.cards-carousel .currency-card {
    flex: 0 0 260px;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}
.cards-carousel-wrap {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
}
.cards-carousel-wrap .carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    color: var(--accent);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: all .2s;
}
.cards-carousel-wrap .carousel-nav:hover {
    background: var(--accent);
    color: white;
}
.cards-carousel-wrap .carousel-nav.prev { right: -10px; }
.cards-carousel-wrap .carousel-nav.next { left: -10px; }
@media (max-width: 600px) {
    .cards-carousel .currency-card { flex: 0 0 220px; }
    .carousel-nav { width: 36px; height: 36px; font-size: 1rem; }
    .carousel-nav.prev { right: 5px; }
    .carousel-nav.next { left: 5px; }
}

/* Filter/Scope buttons - horizontal scroll on mobile */
.filters-scroll p, .scope-scroll p {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    margin: 0 -0.25rem;
    scrollbar-width: none;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
}
.filters-scroll p::-webkit-scrollbar, .scope-scroll p::-webkit-scrollbar { display: none; }
.filters-scroll .btn, .scope-scroll .btn { flex-shrink: 0; white-space: nowrap; }
@media (max-width: 768px) {
    .filters-scroll .btn, .scope-scroll .btn { min-height: 38px; padding: 0.5rem 0.75rem; font-size: 0.85rem; }
}

/* Install / Auth pages */
.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: radial-gradient(ellipse at top, var(--bg-elevated) 0%, var(--bg-dark) 70%);
}
.auth-box {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}
@media (min-width: 481px) {
    .auth-page { padding: 1.5rem; }
    .auth-box { padding: 2rem; }
}
@media (min-width: 769px) {
    .auth-page { padding: 2rem; }
    .auth-box { padding: 2.5rem; }
}
.auth-box h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}
.auth-step {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: var(--radius-sm);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-weight: 500;
}
.alert-danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); }
.alert-success { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }

/* Footer */
.app-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

/* Main content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
}
.client-body .main-content {
    padding-top: 1rem;
}
@media (min-width: 481px) {
    .main-content { padding: 1.5rem; }
    .client-body .main-content { padding-top: 1.25rem; }
}
@media (min-width: 769px) {
    .main-content { padding: 2rem; }
    .client-body .main-content { padding-top: 1.5rem; }
}

/* Sidebar layout for admin */
.admin-layout {
    display: flex;
    min-height: 100vh;
}
.admin-sidebar {
    width: 270px;
    background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
    border-left: 1px solid var(--border);
    padding: 0;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
    box-shadow: -6px 0 24px rgba(0,0,0,0.15);
}
.admin-sidebar-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(99,102,241,0.12) 0%, rgba(167,139,250,0.06) 100%);
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.admin-notification-bell-wrap { position: relative; }
.admin-notification-bell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: var(--accent-soft);
    border-radius: 10px;
    font-size: 1.1rem;
    text-decoration: none;
    transition: all var(--transition, 0.25s ease);
}
.admin-notification-bell:hover {
    background: rgba(99, 102, 241, 0.25);
    transform: scale(1.05);
}
/* إشعارات الأدمن: عائمة على الجانب الأيسر فوق جميع النصوص والعناصر */
.admin-notif-dropdown {
    position: fixed !important;
    left: 1rem !important;
    right: auto !important;
    top: 5.5rem;
    min-width: 260px;
    max-width: min(340px, calc(100vw - 2rem));
    max-height: 70vh;
    z-index: 2147483647;
    box-shadow: 0 12px 48px rgba(0,0,0,0.5);
    background: var(--bg-card);
}
.admin-notif-dropdown:not(.open) { display: none !important; }
.admin-notif-dropdown .notification-dropdown-list { max-height: 50vh; }
.admin-notif-dropdown .notification-dropdown-header { padding: 0.6rem 0.9rem; font-size: 0.9rem; }
.admin-notif-dropdown .notification-item { padding: 0.6rem 0.9rem; }
.admin-notif-dropdown .notification-item strong { font-size: 0.85rem; }
.admin-notif-dropdown .notification-item span { font-size: 0.75rem; }
.admin-notif-dropdown .notification-dropdown-footer { padding: 0.6rem 0.9rem; font-size: 0.85rem; }
.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.25rem;
    color: var(--text-muted);
    transition: all var(--transition, 0.25s ease);
    border-radius: var(--radius-sm);
    margin: 0 0.6rem 0.2rem;
}
.admin-sidebar a:hover {
    color: var(--accent);
    background: var(--accent-soft);
    transform: translateX(-3px);
}
.admin-sidebar a.active {
    color: var(--accent);
    background: var(--accent-soft);
    border-right: 3px solid var(--accent);
    font-weight: 600;
}
.admin-body { flex: 1; padding: 1rem; overflow-x: hidden; margin-right: 270px; }
@media (min-width: 481px) { .admin-body { padding: 1.5rem; } }
@media (min-width: 769px) { .admin-body { padding: 2rem; } }

/* Client - شريط علوي وقائمة منزلقة من اليمين */
.client-layout { display: flex; flex-direction: column; min-height: 100vh; }
.client-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    padding-top: calc(0.65rem + env(safe-area-inset-top, 0));
    background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}
@media (min-width: 481px) { .client-top-bar { padding: 0.85rem 1.25rem; padding-top: 0.85rem; } }
.client-top-bar-title {
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent) 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
@media (min-width: 481px) {
    .client-top-bar-title { font-size: 1.15rem; }
}
.client-top-bar-actions { display: flex; align-items: center; gap: 0.5rem; }
.client-notif-bell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
    text-decoration: none;
    position: relative;
    flex-shrink: 0;
    transition: background .2s;
}
.client-notif-bell:hover { background: rgba(99, 102, 241, 0.25); }
.client-notif-bell .notification-badge {
    position: absolute;
    top: -2px;
    left: -2px;
    min-width: 18px;
    height: 18px;
    font-size: 0.7rem;
}
.client-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.35s ease;
}
.client-sidebar-backdrop.show { display: block; opacity: 1; }
.client-sidebar {
    width: 260px;
    max-width: 75vw;
    background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
    border-left: 1px solid var(--border);
    padding: 0;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 999;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 32px rgba(0,0,0,0.3);
}
.client-sidebar.open { transform: translateX(0); }
.client-sidebar-header {
    padding: 1rem 1.15rem;
    background: linear-gradient(135deg, rgba(99,102,241,0.15) 0%, rgba(167,139,250,0.08) 100%);
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}
.client-sidebar-title {
    font-size: 1.05rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent) 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.client-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem 0.85rem;
}
.client-sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin: 0;
    border: 1px solid transparent;
    background: rgba(255,255,255,0.02);
    font-size: 0.85rem;
    font-weight: 500;
}
.client-sidebar-nav a:hover {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: rgba(99, 102, 241, 0.2);
}
.client-sidebar-nav a.active {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: rgba(99, 102, 241, 0.35);
    font-weight: 600;
    border-right: 3px solid var(--accent);
}
.client-sidebar-nav .client-nav-icon {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: var(--bg-dark);
    border-radius: 10px;
    border: 1px solid var(--border);
}
.client-sidebar-nav a:hover .client-nav-icon,
.client-sidebar-nav a.active .client-nav-icon {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.3);
}
.client-nav-item-with-bell { position: relative; }
.client-nav-with-avatar { display: flex !important; align-items: center; gap: 0.75rem !important; }
.client-nav-with-avatar .nav-avatar, .client-nav-with-avatar .nav-avatar-letter { width: 30px; height: 30px; min-width: 30px; font-size: 0.85rem; border-radius: 8px; }
.client-nav-with-avatar .client-nav-icon { width: 30px; height: 30px; min-width: 30px; }
.client-nav-icon { font-size: 1rem; }
.client-nav-icon svg { display: block; }
.client-nav-icon-whatsapp { color: #25D366 !important; background: rgba(37, 211, 102, 0.12) !important; }
.client-nav-icon-whatsapp svg { fill: #25D366; }
.client-sidebar-nav a:hover .client-nav-icon-whatsapp,
.client-sidebar-nav a:focus .client-nav-icon-whatsapp { background: rgba(37, 211, 102, 0.2) !important; }
.client-nav-icon-telegram { color: #0088cc !important; background: rgba(0, 136, 204, 0.12) !important; }
.client-nav-icon-telegram svg { fill: #0088cc; }
.client-sidebar-nav a:hover .client-nav-icon-telegram,
.client-sidebar-nav a:focus .client-nav-icon-telegram { background: rgba(0, 136, 204, 0.2) !important; }
.client-nav-logout { color: var(--danger) !important; }
.client-nav-logout:hover { color: #ff6b8a !important; background: rgba(244,63,94,0.12) !important; border-color: rgba(244,63,94,0.25) !important; }
.client-sidebar-login-block {
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
    margin: 0 0.75rem 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
}
.client-sidebar-login-block h3 { font-size: 1rem; margin: 0 0 0.35rem; color: #fff; font-weight: 700; }
.client-sidebar-login-block p { font-size: 0.8rem; color: rgba(255,255,255,0.9); margin: 0 0 0.85rem; line-height: 1.4; }
.client-sidebar-login-block .btn { display: block; width: 100%; text-align: center; padding: 0.6rem 1rem; font-size: 0.9rem; margin-bottom: 0.5rem; border-radius: var(--radius-sm); text-decoration: none; border: none; cursor: pointer; font-weight: 600; transition: all .2s; }
.client-login-btn { background: #22c55e; color: #fff !important; }
.client-login-btn:hover { background: #16a34a; }
.client-google-btn { background: #fff; color: #1e293b !important; }
.client-google-btn:hover { background: #f1f5f9; }
.client-sidebar-footer {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
    flex-shrink: 0;
    background: var(--bg-card);
    position: sticky;
    bottom: 0;
}
.client-sidebar-footer-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 0.5rem 0;
}
/* زر تشغيل/إطفاء الوضع الليلي - مناسب للجوال */
.client-theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 48px;
    padding: 0.5rem 0;
    font-family: inherit;
    color: var(--text);
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    border-radius: 14px;
    transition: background 0.2s;
}
.client-theme-toggle-btn:hover { background: rgba(255,255,255,0.04); }
.client-theme-toggle-btn:active { background: rgba(255,255,255,0.06); }
.client-theme-toggle-track {
    display: flex;
    align-items: center;
    width: 52px;
    height: 30px;
    min-width: 52px;
    min-height: 30px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 15px;
    position: relative;
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.2s ease;
}
.client-theme-toggle-btn.is-on .client-theme-toggle-track {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3);
}
.client-theme-toggle-thumb {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.client-theme-toggle-btn:not(.is-on) .client-theme-toggle-thumb {
    transform: translateX(-22px);
    right: auto;
    left: 3px;
}
.client-theme-toggle-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.2s;
}
.client-theme-toggle-btn.is-on .client-theme-toggle-text { color: var(--accent); }
.client-body { flex: 1; min-width: 0; }
.client-sidebar-toggle { display: flex !important; }
.client-sidebar { display: flex; flex-direction: column; }

/* شريط التنقل السفلي - للجوال فقط (لوحة العميل) */
.client-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    z-index: 90;
    background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
    border-top: 1px solid var(--border);
    padding: 0.3rem 0.2rem;
    padding-bottom: calc(0.3rem + env(safe-area-inset-bottom, 0));
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    direction: rtl;
}
@media (max-width: 768px) {
    .client-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        gap: 0.15rem;
        padding: 0.2rem 0.15rem;
        padding-bottom: calc(0.2rem + env(safe-area-inset-bottom, 0));
    }
    .client-layout { padding-bottom: calc(46px + env(safe-area-inset-bottom, 0)); }
    .client-bottom-nav-item { padding: 0.12rem 0.15rem; }
    .client-bottom-nav-icon {
        width: 28px;
        height: 28px;
        font-size: 0.95rem;
        margin-bottom: 0.06rem;
    }
    .client-bottom-nav-label { font-size: 0.55rem; }
}
.client-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    padding: 0.25rem 0.2rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: color .2s, background .2s;
    position: relative;
}
.client-bottom-nav-item:hover { color: var(--accent); }
.client-bottom-nav-item.active {
    color: var(--accent);
}
.client-bottom-nav-item.active .client-bottom-nav-icon {
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    color: #fff;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.4);
}
.client-bottom-nav-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    border-radius: 50%;
    margin-bottom: 0.12rem;
    transition: background .2s, box-shadow .2s;
}
.client-bottom-nav-label {
    font-size: 0.6rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.client-bottom-nav-item-bell { position: relative; }
.client-bottom-nav-theme {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
}
.client-bottom-nav-theme:hover { color: var(--accent); }
.client-bottom-nav-badge {
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* القائمة مقفلة افتراضياً - تفتح عند الضغط على الهمبرغر (جميع الأحجام) */
.app-header-mini { padding: 0.75rem 1.5rem; border-bottom: 1px solid var(--border); background: var(--bg-elevated); }
.app-header-mini h1 { font-size: 1.2rem; margin: 0; }
.dashboard-balance { font-size: 1.5rem; font-weight: 700; color: var(--success); margin: 0.25rem 0 0; }

/* Modal - حواف مضللة */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 0.5rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0));
}
.modal.show { display: flex; }
.modal-box {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: var(--radius);
    max-width: 560px;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    width: 100%;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    position: relative;
}
@media (min-width: 481px) { .modal-box { padding: 1.5rem; } }
@media (min-width: 769px) { .modal-box { padding: 2rem; } }
.modal-box::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), #a78bfa);
}
.modal-box h2 { margin-bottom: 1.5rem; color: var(--text); }
.modal-box .form-group { margin-bottom: 1rem; }
.modal-box label { display: block; margin-bottom: 0.35rem; }
.modal-box input, .modal-box select { width: 100%; }
.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}
@media (max-width: 480px) {
    .modal-actions { flex-direction: column; }
    .modal-actions .btn { width: 100%; }
}
.modal-close {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--accent-soft);
    color: var(--text);
    font-size: 1.5rem;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .2s;
}
.modal-close:hover { background: rgba(99, 102, 241, 0.3); }

/* شبكة المنتجات - نفس شكل الأقسام (صورة كبيرة + اسم)، 3 في السطر */
.sections-grid.product-grid-simple {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1.25rem;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}
.sections-grid.product-grid-simple .product-card-simple {
    cursor: pointer;
    text-decoration: none;
}
.sections-grid.product-grid-simple .product-card-simple:hover .home-category-card-title {
    color: var(--accent);
}
/* مربع البحث فوق الأقسام — بعرض الشاشة */
.home-search-wrap {
    width: 100%;
    max-width: 100%;
    margin-bottom: 1.25rem;
}
.home-search-input {
    width: 100%;
    padding: 0.85rem 1.25rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.home-search-input::placeholder {
    color: var(--text-muted);
}
.home-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* الصفحة الرئيسية + صفحة المنتجات: شبكة أقسام/منتجات — صورة كبيرة + اسم */
.home-categories-grid,
.sections-grid.product-grid-simple {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1.25rem;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}
.home-category-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    overflow: hidden;
    min-width: 0;
}
.home-category-card,
.home-category-card-title { transition: color var(--transition, 0.25s ease); }
.home-category-card:hover .home-category-card-title { color: var(--accent); }
.home-category-card-img {
    width: 100%;
    aspect-ratio: 1/1;
    min-height: 140px;
    object-fit: cover;
    object-position: center top;
    display: block;
    margin: 0;
}
.home-category-card-icon {
    width: 100%;
    aspect-ratio: 1/1;
    min-height: 140px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 2.5rem;
    font-weight: 700;
}
.home-category-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    padding: 0.6rem 0.5rem 0.75rem;
    margin: 0;
    line-height: 1.3;
}
.product-card-text .home-category-card-title { padding-bottom: 0; }
.product-card-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0 0.5rem 0.75rem;
}
.product-card-price {
    display: block !important;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    text-align: center;
}
.home-category-smm {
    border: 2px solid rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.08) !important;
}
.home-category-smm:hover { border-color: #8b5cf6; }
.home-category-badge {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: #8b5cf6;
    color: #fff;
    border-radius: 999px;
}
.home-category-card { position: relative; }
.product-card-smm .home-category-card-icon { background: rgba(139, 92, 246, 0.2); color: #8b5cf6; }
.product-card-smm { border: 2px solid rgba(139, 92, 246, 0.4); border-radius: var(--radius-sm); }
.product-card-desc {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.2rem 0.5rem 0.4rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.product-card-smm-badge {
    position: absolute;
    top: 0.35rem;
    left: 0.35rem;
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    background: #8b5cf6;
    color: #fff;
    border-radius: 999px;
}
.product-card-simple { position: relative; }
.smm-platform-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.5rem 0;
}
.smm-tab {
    padding: 0.5rem 1rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}
.smm-tab:hover { background: rgba(139, 92, 246, 0.15); border-color: #8b5cf6; color: #8b5cf6; }
.smm-tab-active { background: #8b5cf6; border-color: #8b5cf6; color: #fff; }
@media (max-width: 600px) {
    .home-search-wrap { margin-bottom: 1rem; }
    .home-search-input { padding: 0.7rem 1rem; font-size: 0.95rem; }
    .home-categories-grid { gap: 0.5rem; }
    .home-category-card-title { font-size: 0.75rem; padding: 0.35rem 0.3rem 0.5rem; }
}

/* الصفحة الرئيسية (قديم): كل قسم ثم تحته منتجاته */
.home-category-block {
    margin-bottom: 2.5rem;
    width: 100%;
}
.home-category-block:first-child {
    margin-top: 0;
}
.home-category-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0 0.75rem;
    border-bottom: 1px solid var(--border);
    width: 100%;
}
.home-category-img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.home-category-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 1.35rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.home-category-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
}
@media (max-width: 768px) {
    .home-category-block { margin-bottom: 1.75rem; }
    .home-category-head { margin-bottom: 0.75rem; padding-bottom: 0.5rem; }
    .home-category-img, .home-category-icon {
        width: 40px; height: 40px;
        min-width: 40px; min-height: 40px;
    }
    .home-category-icon { font-size: 1.15rem; }
    .home-category-title { font-size: 1rem; }
}
@media (max-width: 600px) {
    .sections-grid.product-grid-simple { gap: 0.65rem; }
    .home-category-card-title { font-size: 0.8rem; padding: 0.4rem 0.35rem 0.5rem; }
}
.product-modal-box { z-index: 1001; max-height: 85vh; overflow-y: auto; }
.product-modal-content { padding-top: 0.5rem; }
.product-modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.product-modal-img { width: 80px; height: 80px; object-fit: contain; border-radius: 8px; }
.product-modal-icon {
    width: 64px;
    height: 64px;
    background: var(--accent-soft);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

/* منطقة رفع الصورة - تحسين واجهة إضافة المنتج */
.image-upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 2rem;
    text-align: center;
    background: var(--bg-dark);
    transition: all .25s ease;
    margin-top: 0.5rem;
    cursor: pointer;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.image-upload-zone:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    border-width: 3px;
}
.image-upload-zone.has-file {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    border-style: solid;
}
.image-upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: scale(1.02);
}
.image-upload-wrap {
    position: relative;
    cursor: pointer;
    width: 100%;
}
.image-upload-wrap input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}
.image-upload-wrap .upload-icon {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
    display: block;
}
.image-upload-wrap .upload-text {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.image-upload-wrap .upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.8;
    margin-top: 0.25rem;
}
.image-preview {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    margin-top: 1rem;
    border: 3px solid var(--border);
    box-shadow: var(--shadow);
}

/* ========== Responsive / Mobile-first ========== */
@media (min-width: 481px) {
    .main-content, .admin-body { padding: 1.5rem; }
    .hero { padding: 3rem 1.5rem; }
    .hero h2 { font-size: 2rem; }
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 769px) {
    .main-content, .admin-body { padding: 2rem; }
    .hero { padding: 4rem 2rem; }
    .hero h2 { font-size: 2.5rem; }
    .grid-2 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
    .grid-cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

@media (max-width: 768px) {
    .app-nav { display: none; width: 100%; flex-direction: column; order: 100; }
    .app-nav.open { display: flex; }
    .app-header { position: relative; }
    .app-header.has-hamburger .app-nav {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        background: var(--bg-elevated);
        padding: 1rem;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
    }
    .app-nav a { padding: 0.75rem 1rem; min-height: 44px; display: flex; align-items: center; }
    .stat-card .num { font-size: 1.5rem; }
    .card { padding: 1rem; }
    .theme-toggle { padding: 0.6rem 0.9rem; font-size: 0.85rem; }
}

@media (max-width: 480px) {
    .main-content, .admin-body { padding: 1rem; }
    .hero { padding: 2rem 1rem; }
    .hero h2 { font-size: 1.75rem; }
    .grid-2, .grid-4, .grid-cards { grid-template-columns: 1fr; }
}

/* Hamburger menu */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    z-index: 101;
    touch-action: manipulation;
}
.hamburger span { width: 100%; height: 2px; background: var(--text); border-radius: 1px; transition: transform .3s, opacity .3s; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
@media (max-width: 768px) {
    .hamburger { display: flex; }
    .app-header.has-hamburger { flex-wrap: wrap; }
}

/* Mobile admin sidebar */
@media (max-width: 768px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar {
        width: 100%;
        max-height: 0;
        overflow: hidden;
        position: relative;
        border-left: none;
        border-bottom: none;
        padding: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        justify-content: center;
        transition: max-height .3s ease;
    }
    .admin-sidebar.open {
        max-height: 400px;
        padding: 0.5rem;
        border-bottom: 1px solid var(--border);
    }
    .admin-sidebar a { padding: 0.5rem 0.75rem; font-size: 0.9rem; }
    .admin-sidebar-toggle { display: flex !important; }
}
.admin-sidebar-toggle {
    display: none;
    position: fixed;
    top: calc(0.75rem + env(safe-area-inset-top, 0));
    right: calc(1rem + env(safe-area-inset-right, 0));
    z-index: 1001;
}
@media (max-width: 768px) {
    .admin-sidebar-toggle { display: flex !important; }
}

/* Mobile - القائمة منزلقة من اليمين، عرض مناسب ومرتب */
@media (max-width: 768px) {
    .client-body { margin-right: 0; }
    .admin-body { margin-right: 0; }
    .client-sidebar-toggle { display: flex !important; }
    .client-sidebar {
        width: 260px;
        max-width: 75vw;
        padding-bottom: 0.5rem;
    }
    .client-sidebar-header { padding: 0.85rem 1rem; }
    .client-sidebar-title { font-size: 1rem; }
    .client-sidebar-login-block { margin: 0 0.5rem 0.5rem; padding: 0.85rem 1rem; }
    .client-sidebar-login-block h3 { font-size: 0.95rem; }
    .client-sidebar-login-block p { font-size: 0.75rem; margin-bottom: 0.65rem; }
    .client-sidebar-login-block .btn { padding: 0.5rem 0.85rem; font-size: 0.85rem; }
    .client-sidebar-nav { padding: 0.4rem 0.5rem 0.65rem; gap: 0.2rem; }
    .client-sidebar-nav a { padding: 0.45rem 0.75rem; font-size: 0.82rem; gap: 0.65rem; }
    .client-sidebar-nav .client-nav-icon { width: 26px; height: 26px; min-width: 26px; min-height: 26px; font-size: 0.85rem; }
    .client-sidebar-footer { padding: 0.6rem 0.75rem 0.85rem; }
    .client-theme-toggle-btn { min-height: 44px; }
    .client-theme-toggle-track { width: 48px; height: 28px; min-width: 48px; min-height: 28px; border-radius: 14px; }
    .client-theme-toggle-thumb { width: 20px; height: 20px; top: 3px; right: 3px; }
    .client-theme-toggle-btn:not(.is-on) .client-theme-toggle-thumb { transform: translateX(-20px); left: 3px; }
    .client-theme-toggle-text { font-size: 0.85rem; }
    .home-categories-grid,
    .sections-grid.product-grid-simple { grid-template-columns: repeat(3, 1fr) !important; gap: 0.65rem; }
    .home-category-card { min-height: 0; }
    .home-category-card-title { font-size: 0.75rem; padding: 0.35rem 0.3rem 0.45rem; }
    .home-category-card-img, .home-category-card-icon { height: 95px; min-height: 95px; }
}

/* سطح المكتب: 5 أقسام في كل سطر (أي عرض أكبر من 768px) */
@media (min-width: 769px) {
    .home-categories-grid,
    .sections-grid.product-grid-simple {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 1.25rem;
    }
}

/* تنبيه التعليمات في نموذج الطلب (بدل حقل ملاحظة منفصل) */
.order-notes-alert {
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
    color: var(--text);
    font-size: 0.85rem;
    line-height: 1.5;
}
@media (max-width: 768px) {
    .order-notes-alert { font-size: 0.8rem; padding: 0.5rem 0.75rem; margin-bottom: 0.85rem; }
}

/* نموذج الطلب - تصغير الخطوط والمقاسات للجوال */
@media (max-width: 768px) {
    .order-form .form-group label { font-size: 0.8rem !important; margin-bottom: 0.3rem !important; }
    .order-form input, .order-form select { font-size: 0.9rem !important; padding: 0.55rem 0.8rem !important; min-height: 38px !important; }
    .order-form .form-group { margin-bottom: 0.75rem !important; }
    .order-form small { font-size: 0.75rem !important; }
    .order-form .btn { font-size: 0.9rem !important; padding: 0.55rem 1rem !important; min-height: 38px !important; }
    .order-form p { font-size: 0.8rem !important; }
}
@media (max-width: 480px) {
    .order-form input, .order-form select { font-size: 0.85rem !important; padding: 0.5rem 0.7rem !important; min-height: 36px !important; }
    .order-form .form-group label { font-size: 0.78rem !important; }
}

/* صفحات العميل - أحجام مناسبة للجوال (ليست كبيرة) */
@media (max-width: 768px) {
    .client-body .card { padding: 0.85rem; }
    .client-body .card h2, .client-body .card h3 { font-size: 0.95rem; margin-bottom: 0.6rem; }
    .app-header-mini { padding: 0.6rem 1rem; }
    .app-header-mini h1 { font-size: 1rem; }
    .dashboard-balance { font-size: 1.25rem; }
    .client-body .form-group { margin-bottom: 0.9rem; }
    .client-body .form-group label { font-size: 0.85rem; margin-bottom: 0.35rem; }
    .client-body input[type="text"],
    .client-body input[type="email"],
    .client-body input[type="password"],
    .client-body input[type="number"],
    .client-body input[type="url"],
    .client-body select,
    .client-body textarea {
        padding: 0.6rem 0.85rem;
        font-size: 0.95rem;
        min-height: 40px;
    }
    .client-body .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.95rem;
        min-height: 40px;
    }
    .client-body .main-content { padding: 1rem; }
    .client-body .sections-grid { gap: 0.75rem; }
    .client-body .sections-grid .currency-card:not(.product-card-simple) { padding: 1rem; }
    .client-body .product-grid-simple .home-category-card-title,
    .client-body .home-category-card-title { font-size: 0.9rem; padding: 0.5rem 0.4rem 0.6rem; }
    .client-body .sections-grid .currency-card .price { font-size: 0.95rem; }
    .client-body .sections-grid .currency-card .btn { padding: 0.45rem 0.9rem; font-size: 0.85rem; }
    .client-body .stat-card { padding: 1rem; }
    .client-body .stat-card .num { font-size: 1.5rem; }
    .client-body .stat-card .label { font-size: 0.85rem; }
    .client-body .notification-list-item { padding: 0.75rem 1rem; }
    .client-body .notification-list-content strong { font-size: 0.9rem; }
    .client-body .notification-list-content p { font-size: 0.85rem; }
    .client-body .table-wrap th, .client-body .table-wrap td { padding: 0.5rem 0.4rem; font-size: 0.8rem; }
    .client-body .table-wrap th { font-size: 0.7rem; }
    .client-body .badge { font-size: 0.7rem; padding: 0.15rem 0.5rem; }
    .client-body .card p { font-size: 0.9rem; }
}

/* Touch-friendly buttons (للعناصر العامة خارج client-body) */
@media (pointer: coarse) {
    .btn { min-height: 44px; padding: 0.85rem 1.5rem; }
    .app-nav a { padding: 0.5rem; min-height: 44px; display: flex; align-items: center; }
    input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"],
    select, textarea { min-height: 44px; }
}
/* صفحات العميل على الجوال - أحجام اللمس معقولة */
@media (pointer: coarse) and (max-width: 768px) {
    .client-body .btn { min-height: 40px; padding: 0.6rem 1.2rem; }
    .client-body input[type="text"], .client-body input[type="email"], .client-body input[type="password"],
    .client-body input[type="number"], .client-body input[type="url"], .client-body select, .client-body textarea {
        min-height: 40px;
    }
}

/* Consistent spacing */
.btn + .btn { margin-right: 0.5rem; }

/* الشريط المتحرك - الإعلان (إطار زهري) */
/* الإعلان تحت الشريط العلوي - ترتيب واضح */
.marquee-wrap {
    background: linear-gradient(90deg, rgba(236, 72, 153, 0.2), rgba(219, 39, 119, 0.15), rgba(236, 72, 153, 0.2));
    border: 2px solid #ec4899;
    border-right: 4px solid #db2777;
    border-left: 4px solid #db2777;
    overflow: hidden;
    padding: 0.6rem 0.5rem;
    margin: 0.75rem;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.25);
    position: relative;
}
@media (min-width: 481px) { .marquee-wrap { padding: 0.75rem 0.5rem; margin: 1rem; } }
.marquee-track.marquee-paused { will-change: auto; }
.marquee-wrap::before {
    content: '📢 إعلان';
    position: absolute;
    top: -10px;
    right: 1rem;
    background: linear-gradient(135deg, #ec4899, #db2777);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    z-index: 2;
}
.marquee-track {
    display: flex;
    width: max-content;
    direction: rtl;
    will-change: transform;
}
.marquee-inner {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
}
.marquee-inner span { padding: 0 1.5rem; color: var(--text); font-size: 1rem; font-weight: 500; flex-shrink: 0; }
.marquee-sep { color: #ec4899; opacity: 0.9; font-size: 0.8rem; padding: 0 0.75rem; flex-shrink: 0; }
/* حركة لولبية: ينتهي النص من اليسار فَيبدأ مباشرة من اليمين — لا فجوة */
@keyframes marquee-wheel {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-50%, 0, 0); }
}

/* Banner - صورة إعلان مناسبة للعرض */
.banner-wrap {
    max-width: 1000px;
    margin: 0 auto 1.5rem;
    padding: 0 0.75rem;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
}
.banner-wrap::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), #a78bfa);
    z-index: 1;
}
.banner-wrap img {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    object-position: center;
    display: block;
}
@media (min-width: 481px) { .banner-wrap { padding: 0 1rem; margin-bottom: 2rem; } }
@media (min-width: 769px) { .banner-wrap img { max-height: 220px; } }
