/* =========================================================
   نظام يُسر المحاسبي المتكيف الذكي - نظام التصميم المحسن (Premium)
   ========================================================= */

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

/* === تعريف المتغيرات والثيمات الأكثر تناسقاً وفخامة === */
:root {
    /* ثيم الأخضر الزمردي الهادئ (Emerald Mint) */
    --primary: #0f9f6e;
    --primary-rgb: 15, 159, 110;
    --primary-hover: #0b7a54;
    --bg-dark: #0a0f18;
    --bg-card: #121a29;
    --bg-header: #1b263b;
    --border-color: #2b3a54;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --accent: #34d399;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    
    /* ألوان كروت الجولة والمستندات */
    --color-welcome: #0284c7;
    --color-setup: #0891b2;
    --color-items: #3b82f6;
    --color-accounts: #d97706;
    --color-daily: #1e3a8a;
    --color-sales-analysis: #475569;
    
    --color-sale: #0f9f6e;
    --color-purchase: #ef4444;
    --color-expense: #ec4899;
    --color-inventory: #0891b2;
    --color-sale-ret: #0b7a54;
    --color-quote: #2563eb;
    --color-pur-ret: #8b5cf6;
    --color-receipt: #10b981;
    --color-transfer: #0891b2;
    --color-adjust: #14b8a6;
}

/* ثيم الأزرق الملكي المتناسق (Royal Blue) */
body.theme-royal-blue {
    --primary: #3b82f6;
    --primary-rgb: 59, 130, 246;
    --primary-hover: #2563eb;
    --bg-dark: #0b0f19;
    --bg-card: #131d31;
    --bg-header: #1e293b;
    --border-color: #2a3b5c;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #60a5fa;
}

/* ثيم البنفسجي الأنيق (Amethyst Violet) */
body.theme-neon-violet {
    --primary: #8b5cf6;
    --primary-rgb: 139, 92, 246;
    --primary-hover: #7c3aed;
    --bg-dark: #0f0a1c;
    --bg-card: #18112c;
    --bg-header: #241942;
    --border-color: #382566;
    --text-main: #f5f3ff;
    --text-muted: #c084fc;
    --accent: #a78bfa;
}

/* ثيم الرمادي والذهبي الفخم (Obsidian Gold) */
body.theme-obsidian-slate {
    --primary: #d97706;
    --primary-rgb: 217, 119, 6;
    --primary-hover: #b45309;
    --bg-dark: #111111;
    --bg-card: #1c1c1c;
    --bg-header: #282828;
    --border-color: #383838;
    --text-main: #f5f5f5;
    --text-muted: #a3a3a3;
    --accent: #f59e0b;
}

/* ثيم الياقوت الوردي الفاخر (Ruby Crimson) */
body.theme-ruby-rose {
    --primary: #e11d48;
    --primary-rgb: 225, 29, 72;
    --primary-hover: #be123c;
    --bg-dark: #0f050a;
    --bg-card: #1c0b15;
    --bg-header: #29101f;
    --border-color: #401831;
    --text-main: #fff1f2;
    --text-muted: #fda4af;
    --accent: #fb7185;
}

/* ثيم ماكياتو الدافئ (Macchiato Warm) */
body.theme-macchiato {
    --primary: #b45309;
    --primary-rgb: 180, 83, 9;
    --primary-hover: #92400e;
    --bg-dark: #0f0d0a;
    --bg-card: #1c160f;
    --bg-header: #282017;
    --border-color: #3c2f22;
    --text-main: #fef3c7;
    --text-muted: #fcd34d;
    --accent: #fbbf24;
}

/* ثيم الصنوبر الاسكندنافي الهادئ (Nordic Pine) */
body.theme-nordic-pine {
    --primary: #059669;
    --primary-rgb: 5, 150, 105;
    --primary-hover: #047857;
    --bg-dark: #070f0d;
    --bg-card: #0d1b17;
    --bg-header: #152722;
    --border-color: #203c34;
    --text-main: #ecfdf5;
    --text-muted: #6ee7b7;
    --accent: #34d399;
}

/* ثيم الفضاء النيوني المتوهج (Cyberpunk Midnight) */
body.theme-cyberpunk {
    --primary: #06b6d4;
    --primary-rgb: 6, 182, 212;
    --primary-hover: #0891b2;
    --bg-dark: #030712;
    --bg-card: #0b1329;
    --bg-header: #111c44;
    --border-color: #1b2a5a;
    --text-main: #f3f4f6;
    --text-muted: #a5f3fc;
    --accent: #ec4899;
}

/* تنسيق دوائر معاينة الثيمات التفاعلية */
.theme-grid-visual {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.theme-swatch-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-swatch-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.theme-swatch-card.active {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.02);
}

.swatch-colors {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 50px;
}

.swatch-color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-swatch-card span {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-main);
}

/* === التنسيق العام وإعادة التعيين === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 0),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.3));
    background-size: 24px 24px, 100% 100%;
    color: var(--text-main);
    direction: rtl;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* مؤشر الربح الفوري في مودال الأصناف */
.margin-indicator {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: bold;
    color: #10b981;
    background: rgba(16, 185, 129, 0.08);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(16, 185, 129, 0.15);
    text-align: center;
}

.margin-indicator.loss {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.15);
}

/* === صفحة تسجيل الدخول وفّر المحدثة === */
.login-wrapper {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, var(--bg-card) 0%, var(--bg-dark) 100%);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.4s ease-out;
}

.login-card {
    background: var(--bg-card);
    border: 2.5px solid var(--primary);
    border-radius: 40px;
    padding: 40px 30px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 20px var(--primary);
    backdrop-filter: blur(15px);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Waffar Logo styling matching photo */
.waffar-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.waffar-logo-text {
    font-size: 38px;
    font-weight: 800;
    color: #ffffff;
    font-family: 'Cairo', sans-serif;
    letter-spacing: -1px;
}

.waffar-logo-icon {
    width: 48px;
    height: 48px;
    fill: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary));
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 6px;
    border: 1px solid var(--border-color);
}

/* Segmented sliding tabs toggle matching photo */
.segmented-toggle-container {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border: 1.5px solid var(--border-color);
    border-radius: 50px;
    padding: 4px;
    margin-bottom: 30px;
    position: relative;
}

.toggle-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 10px 14px;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

.toggle-tab-btn.active {
    background: var(--primary);
    color: #000000;
}

/* Dark pill inputs matching photo */
.waffar-form-group {
    text-align: right;
    margin-bottom: 20px;
}

.waffar-form-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.waffar-input-wrapper {
    position: relative;
    width: 100%;
}

.waffar-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.25) !important;
    border: 1.5px solid var(--border-color);
    border-radius: 50px;
    padding: 12px 20px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    text-align: center;
}

.waffar-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.1);
}

.waffar-password-toggle {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    outline: none;
    user-select: none;
    padding: 2px;
}

/* Waffar primary action button matching photo */
.waffar-btn-primary {
    background: var(--primary);
    color: #000000;
    border: none;
    border-radius: 50px;
    width: 100%;
    padding: 14px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.waffar-btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4), 0 0 15px var(--primary);
}

/* === شاشة حظر انتهاء الاشتراك === */
.expiry-block-wrapper {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 15, 24, 0.95);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.expiry-block-card {
    background: var(--bg-card);
    border: 2px solid #ef4444;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    text-align: center;
    box-shadow: var(--shadow);
}

.expiry-block-icon {
    font-size: 60px;
    color: #ef4444;
    margin-bottom: 20px;
    animation: pulse 1.5s infinite;
}

/* === شريط الحالة العلوي === */
.top-bar {
    background-color: var(--bg-header);
    border-bottom: 2px solid var(--border-color);
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-name {
    color: var(--primary);
    font-size: 18px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.separator {
    color: var(--border-color);
    margin: 0 4px;
}

.user-badge {
    background: rgba(255,255,255,0.04);
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 13px;
}

/* === قائمة التبويبات العلوية === */
.main-nav {
    background-color: var(--bg-header);
    display: flex;
    gap: 4px;
    padding: 0 16px;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: thin;
}

.nav-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 14px 20px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.nav-btn:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.015);
}

.nav-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(255, 255, 255, 0.03);
}

/* === المحتوى الرئيسي === */
.content {
    padding: 24px;
    max-width: 1600px;
    margin: 0 auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* === البانر كروت الإحصائيات (تخطيط سهل) === */
.dashboard-banner-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr) 2.5fr;
    gap: 12px;
    margin-bottom: 24px;
}

.hero-banner {
    background: linear-gradient(135deg, var(--bg-header), var(--bg-card));
    border-radius: 16px;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid var(--primary);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.hero-banner::after {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 200px; height: 200px;
    background: var(--primary);
    filter: blur(100px);
    opacity: 0.1;
    pointer-events: none;
}

.hero-banner-content h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}

.hero-banner-content p {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

.hero-banner-logo {
    width: 60px; height: 60px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.hero-banner-logo svg {
    width: 38px; height: 38px;
    fill: var(--primary);
}

/* الكروت الخمسة العلوية */
.top-menu-card {
    background-color: var(--primary);
    color: #fff;
    border-radius: 14px;
    padding: 16px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255,255,255,0.08);
}

.top-menu-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
    filter: brightness(1.1);
}

.top-menu-card svg {
    width: 32px; height: 32px;
    fill: currentColor;
}

.top-menu-card-label {
    font-size: 14px;
    font-weight: 700;
}

/* === قسم الجولة السريعة === */
.section-header {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-muted);
    border-right: 4px solid var(--primary);
    padding-right: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quick-tour-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.quick-tour-card {
    border-radius: 14px;
    padding: 20px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.03);
}

.quick-tour-card:hover {
    transform: translateY(-3px);
    filter: brightness(1.08);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.quick-tour-card svg {
    width: 32px; height: 32px;
    fill: currentColor;
}

.quick-tour-card.welcome { background-color: var(--color-welcome); }
.quick-tour-card.setup { background-color: var(--color-setup); }
.quick-tour-card.items { background-color: var(--color-items); }
.quick-tour-card.accounts { background-color: var(--color-accounts); }
.quick-tour-card.daily { background-color: var(--color-daily); }
.quick-tour-card.sales-analysis { background-color: var(--color-sales-analysis); }

/* === قسم المستندات (الـ 10 مستندات) === */
.doc-cards-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.doc-tile {
    border-radius: 14px;
    padding: 22px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.03);
}

.doc-tile:hover {
    transform: translateY(-3px) scale(1.01);
    filter: brightness(1.08);
}

.doc-tile svg {
    width: 36px; height: 36px;
    fill: currentColor;
}

.doc-tile-label {
    font-size: 15px;
    font-weight: 700;
}

.doc-tile.sale { background-color: var(--color-sale); }
.doc-tile.purchase { background-color: var(--color-purchase); }
.doc-tile.expense { background-color: var(--color-expense); }
.doc-tile.inventory { background-color: var(--color-inventory); }
.doc-tile.sale-ret { background-color: var(--color-sale-ret); }
.doc-tile.quote { background-color: var(--color-quote); }
.doc-tile.pur-ret { background-color: var(--color-pur-ret); }
.doc-tile.receipt { background-color: var(--color-receipt); }
.doc-tile.transfer { background-color: var(--color-transfer); }
.doc-tile.adjust { background-color: var(--color-adjust); }

/* === بطاقات الملخص لليوم === */
.summary-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.summary-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
}

.summary-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 2px;
}

.summary-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}

/* === شاشة الكاشير ونقطة البيع (POS) === */
.pos-container {
    display: grid;
    grid-template-columns: 1.3fr 1.7fr;
    gap: 16px;
    height: calc(100vh - 140px);
}

.pos-billing-section {
    background-color: var(--bg-card);
    border-radius: 14px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.pos-products-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pos-categories-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
}

.pos-cat-btn {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    transition: all 0.2s;
}

.pos-cat-btn.active, .pos-cat-btn:hover {
    background-color: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pos-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    overflow-y: auto;
    flex-grow: 1;
    padding-bottom: 10px;
    scrollbar-width: thin;
}

.pos-item-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 95px;
}

.pos-item-card:hover {
    border-color: var(--primary);
    transform: scale(1.02);
}

.pos-item-name {
    font-weight: 700;
    font-size: 13px;
    line-height: 1.3;
}

.pos-item-price {
    color: var(--primary);
    font-weight: 800;
    font-size: 12px;
}

.pos-item-qty {
    font-size: 10px;
    color: var(--text-muted);
}

/* سلة الفاتورة الجانبية للكاشير */
.pos-invoice-header {
    background-color: var(--bg-header);
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 14px;
}

.pos-invoice-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 8px;
}

.pos-invoice-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 4px;
    border-bottom: 1px solid var(--border-color);
}

.pos-invoice-details {
    flex-grow: 1;
}

.pos-invoice-title {
    font-weight: 700;
    font-size: 12px;
}

.pos-invoice-qty-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.pos-qty-btn {
    width: 20px; height: 20px;
    border-radius: 4px;
    border: none;
    background-color: var(--border-color);
    color: var(--text-main);
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
}

.pos-invoice-summary {
    background-color: var(--bg-header);
    padding: 14px;
    border-top: 2px solid var(--border-color);
}

.pos-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 12px;
}

.pos-summary-total {
    border-top: 1px dashed var(--border-color);
    margin-top: 6px;
    padding-top: 8px;
    font-weight: 800;
    font-size: 16px;
    color: var(--primary);
}

/* === شاشة الكوفيهات: الطاولات والتحضير === */
.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.table-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.table-card.occupied {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.table-card.available {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    color: #10b981;
}

/* === شاشة السكوترات === */
.scooter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 10px;
}

.scooter-card {
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s;
}

.scooter-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.scooter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.scooter-title {
    font-size: 18px;
    font-weight: 800;
}

.scooter-timer-display {
    font-family: monospace;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
    text-align: center;
    margin: 15px 0;
    letter-spacing: 1px;
}

.scooter-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background-color: #ef4444;
    display: inline-block;
}

.scooter-card.active .scooter-dot {
    background-color: #10b981;
    animation: blink 1s infinite;
}

@keyframes blink {
    50% { opacity: 0.3; }
}

/* === واجهة دردشة المساعد الذكي (AI Chatbot) === */
.ai-chatbot-widget {
    position: fixed;
    bottom: 20px; left: 20px;
    z-index: 999;
}

.ai-chatbot-button {
    width: 54px; height: 54px;
    border-radius: 50%;
    background-color: var(--primary);
    color: #fff;
    border: none;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-chatbot-button:hover {
    transform: scale(1.08);
}

.ai-chatbot-button svg {
    width: 26px; height: 26px;
    fill: currentColor;
}

.ai-chatbot-panel {
    position: absolute;
    bottom: 66px; left: 0;
    width: 350px; height: 460px;
    background-color: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    display: none;
    animation: zoomIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.92) translateY(15px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.ai-chatbot-header {
    background-color: var(--bg-header);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chatbot-title {
    font-weight: 800;
    font-size: 14px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-chatbot-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
}

.chat-msg {
    max-width: 82%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
}

.chat-msg.bot {
    background-color: var(--bg-header);
    color: var(--text-main);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    border-left: 3px solid var(--primary);
}

.chat-msg.user {
    background-color: var(--primary);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.ai-chatbot-suggestions {
    display: flex;
    gap: 4px;
    padding: 6px;
    overflow-x: auto;
    border-top: 1px solid var(--border-color);
    scrollbar-width: none;
}

.ai-suggestion-chip {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.ai-suggestion-chip:hover {
    background-color: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.ai-chatbot-input-container {
    display: flex;
    padding: 8px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-header);
}

.ai-chatbot-input {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-main);
    border-radius: 8px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 13px;
}

.ai-chatbot-input:focus {
    border-color: var(--primary);
    outline: none;
}

.ai-chatbot-send {
    background-color: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 32px; height: 32px;
    margin-right: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === الرسوم البيانية التفاعلية === */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.chart-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.chart-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.svg-chart-container {
    height: 180px;
    width: 100%;
}

/* === النوافذ المنبثقة === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(3px);
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background-color: var(--bg-card);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.modal-large {
    max-width: 850px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-header);
}

.modal-header h3 {
    color: var(--primary);
    font-size: 15px;
    font-weight: 800;
}

.close-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 18px;
    overflow-y: auto;
}

.modal-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-header);
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}

/* === النماذج والإدخالات === */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    outline: none;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* === جداول وتقارير === */
.data-table-container {
    background-color: var(--bg-card);
    border-radius: 14px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}

.data-table th {
    background-color: var(--bg-header);
    color: var(--primary);
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 700;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background-color: rgba(255,255,255,0.012);
}

/* === أزرار التفاعل === */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    transition: all 0.2s;
}

.btn-primary { background-color: var(--primary); color: #fff; }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-success { background-color: #10b981; color: #fff; }
.btn-success:hover { background-color: #059669; }
.btn-danger { background-color: #ef4444; color: #fff; }
.btn-danger:hover { background-color: #dc2626; }
.btn-secondary { background-color: #4b5563; color: #fff; }
.btn-secondary:hover { background-color: #374151; }
.btn-warning { background-color: #f59e0b; color: #fff; }
.btn-warning:hover { background-color: #d97706; }
.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 6px; }

/* === بادجات === */
.badge-danger { background: rgba(239, 68, 68, 0.12); color: #ef4444; padding: 3px 6px; border-radius: 6px; font-weight: bold; font-size: 11px; }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: #f59e0b; padding: 3px 6px; border-radius: 6px; font-weight: bold; font-size: 11px; }
.badge-success { background: rgba(16, 185, 129, 0.12); color: #10b981; padding: 3px 6px; border-radius: 6px; font-weight: bold; font-size: 11px; }

/* === طباعة === */
@media print {
    .top-bar, .main-nav, .btn, .modal-overlay, .search-container, .ai-chatbot-widget, .pos-products-section {
        display: none !important;
    }
    body {
        background: #fff !important;
        color: #000 !important;
    }
    .thermal-receipt {
        width: 78mm !important;
        max-width: 78mm !important;
        padding: 4px !important;
        margin: 0 auto !important;
        color: #000 !important;
        direction: rtl;
    }
}

/* استجابة الشاشات */
@media (max-width: 1024px) {
    .dashboard-banner-row {
        grid-template-columns: repeat(3, 1fr);
    }
    .hero-banner {
        grid-column: span 3;
    }
    .quick-tour-grid, .doc-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .dashboard-banner-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .hero-banner {
        grid-column: span 2;
    }
    .quick-tour-grid, .doc-cards-grid, .summary-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* === مؤشر المزامنة وحالة الاتصال النبضي (Connection Pulse Badge) === */
.connection-pulse {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px !important;
    border-radius: 50px !important;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.connection-pulse .pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* حالة متصل وسحابي (Green) */
.connection-pulse.pulse-green {
    background: rgba(16, 185, 129, 0.08) !important;
    border-color: #10b981 !important;
    color: #10b981 !important;
}
.connection-pulse.pulse-green .pulse-dot {
    background-color: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-green-anim 1.6s infinite;
}

/* حالة جاري المزامنة / تعليق (Orange) */
.connection-pulse.pulse-orange {
    background: rgba(245, 158, 11, 0.08) !important;
    border-color: #f59e0b !important;
    color: #f59e0b !important;
}
.connection-pulse.pulse-orange .pulse-dot {
    background-color: #f59e0b;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    animation: pulse-orange-anim 1.6s infinite;
}

/* حالة دون اتصال / محلي (Red) */
.connection-pulse.pulse-red {
    background: rgba(239, 68, 68, 0.08) !important;
    border-color: #ef4444 !important;
    color: #ef4444 !important;
}
.connection-pulse.pulse-red .pulse-dot {
    background-color: #ef4444;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: pulse-red-anim 1.6s infinite;
}

@keyframes pulse-green-anim {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes pulse-orange-anim {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

@keyframes pulse-red-anim {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* Custom Autofill Styles to match dark theme */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px rgba(20, 25, 35, 1) inset !important;
    -webkit-text-fill-color: #ffffff !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Camera Barcode Scanner Laser Line */
@keyframes scanLine {
    0% { top: 0%; }
    50% { top: 100%; }
    100% { top: 0%; }
}

/* Toast Notifications animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOutDown {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(20px); }
}
