
/* RTL Layout أساسي */
.layout-container {
    display: flex;
    min-height: 100vh;
    direction: rtl; /* مهم */
}

/* Sidebar على اليمين */
.sidebar {
    background: #343a40;
    color: #fff;
    width: 220px;
    padding: 1rem;
    transition: width 0.3s ease-in-out;
    overflow: hidden;
    order: 2; /* يخليها على اليمين */
}
@media (max-width: 1200px) {
    .top-navbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-links {
        margin-top: 10px;
        justify-content: flex-start;
    }
}
/* ----------------------------------------------------------
   Premium Theme Variables
   ---------------------------------------------------------- */
:root {
    --primary-h: 262;   /* deep purple */
    --primary-s: 80%;
    --primary-l: 55%;
    --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --primary-dark: hsl(var(--primary-h), var(--primary-s), calc(var(--primary-l) - 10%));
    --primary-light: hsl(var(--primary-h), var(--primary-s), calc(var(--primary-l) + 15%));
    --bg-body: #f0f2f5;
    --bg-card: rgba(255,255,255,0.85);
    --text-primary: #212529;
    --text-muted: #6c757d;
    --sidebar-width: 250px;
    --sidebar-collapsed: 70px;
}

/* ----------------------------------------------------------
   Global Reset & Base Styles
   ---------------------------------------------------------- */
body, html {
    height: 100%;
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* ----------------------------------------------------------
   Layout – Flex RTL
   ---------------------------------------------------------- */
.layout {
    display: flex;
    flex-direction: row-reverse;
    min-height: 100vh;
}

/* ----------------------------------------------------------
   Sidebar – Glassmorphism, Responsive & Animations
   ---------------------------------------------------------- */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 1rem;
    transition: width 0.3s ease, transform 0.3s ease;
    overflow-y: auto;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    backdrop-filter: blur(12px);
    box-shadow: -2px 0 8px rgba(0,0,0,0.15);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.4) transparent;
}

/* Chrome/Edge scrollbar */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,0.4); border-radius: 10px; }
.sidebar::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,0.6); }

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
    transform: translateX(calc(var(--sidebar-width) - var(--sidebar-collapsed)));
}

/* Sidebar links */
.sidebar a {
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 5px;
    transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease;
    white-space: nowrap;
}
.sidebar a:hover {
    background: rgba(255,255,255,0.15);
    color: var(--primary-light);
    transform: translateX(4px);
}
.sidebar a i, .sidebar a .emoji { font-size: 1.8rem; transition: transform 0.2s ease; }
.sidebar a:hover i, .sidebar a:hover .emoji { transform: scale(1.3); }
.sidebar.collapsed a span { display: none; }
.sidebar.collapsed i, .sidebar.collapsed .emoji { font-size: 2.2rem; }

/* ----------------------------------------------------------
   Main Content – Adaptive Margin
   ---------------------------------------------------------- */
.main {
    flex-grow: 1;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    margin-right: var(--sidebar-width);
    transition: margin-right 0.3s ease;
    backdrop-filter: blur(4px);
    padding: 1rem;
    border-radius: 0 0 0 12px;
}
.main.collapsed { margin-right: var(--sidebar-collapsed); }

/* ----------------------------------------------------------
   Topbar – Clean & Elevated
   ---------------------------------------------------------- */
.topbar {
    background: #fff;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 10;
}
.toggle-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--primary); }

/* ----------------------------------------------------------
   Footer – Subtle
   ---------------------------------------------------------- */
.footer { text-align: center; padding: 1rem; margin-top: auto; background: #f1f1f1; font-size: 0.9rem; color: #555; }

/* ----------------------------------------------------------
   Responsive Adjustments – Mobile & Tablet
   ---------------------------------------------------------- */
@media (max-width: 1200px) {
    .num-pad-container { margin-left:0 !important; width:100% !important; }
}

@media (max-width: 768px) {
    /* Sidebar becomes overlay */
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(100%);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar.collapsed { transform: translateX(100%); }
    .main { margin-right:0; }
    .overlay {
        display:none;
        position:fixed;
        inset:0;
        background:rgba(0,0,0,0.5);
        z-index:999;
    }
    .overlay.show { display:block; }
}

/* ----------------------------------------------------------
   Utility – Glass Cards
   ---------------------------------------------------------- */
.card-glass {
    background: rgba(255,255,255,0.25);
    border-radius: 12px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.18);
    padding: 1rem;
}

/* ----------------------------------------------------------
   Print Styles – consolidated at the bottom of this file
   ---------------------------------------------------------- */


/* Main content على اليسار */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    order: 1; /* يخليها على اليسار */
}

/* Sidebar links */
.sidebar .menu .nav-link {
    display: block;
    color: #fff;
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 6px;
    margin-bottom: 0.3rem;
    text-align: right; /* النصوص يمين */
}

    .sidebar .menu .nav-link.active,
    .sidebar .menu .nav-link:hover {
        background: #495057;
    }

/* Topbar */
.topbar {
    background: #f8f9fa;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 1rem;
}
/* نخلي الـ layout دايمًا RTL */
.layout {
    display: flex;
    flex-direction: row-reverse; /* ✅ السايدبار يمين */
    min-height: 100vh;
}

/* السايدبار يظل يمين مهما كان حجم الشاشة */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, #0d6efd, #6610f2);
    color: white;
    padding: 1rem;
    transition: width 0.3s ease;
    overflow: hidden;
    position: fixed; /* ✅ نخليه ثابت */
    right: 0; /* ✅ يلتصق باليمين */
    top: 0;
    bottom: 0;
    z-index: 1000; /* فوق باقي العناصر */
}

/* نخلي الـ main يأخذ باقي المساحة مع مراعاة الهامش */
.main {
    flex-grow: 1;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    margin-right: 250px; /* ✅ عشان ما يغطيه السايدبار */
    transition: margin-right 0.3s ease;
}

.sidebar.collapsed {
    width: 70px;
}

.main.collapsed {
    margin-right: 70px;
}
.num-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    justify-items: center;
}

.num-btn {
    width: 100%;
    height: 100px;
    font-size: 2rem;
    border-radius: 15px;
}
/* ==========================================================
   Thermal POS Receipt Printing Styles (.pos-receipt)
   ========================================================== */
.pos-receipt {
    width: 80mm;
    max-width: 100%;
    margin: 0 auto;
    padding: 12px 10px;
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    font-size: 11px;
    color: #000;
    background: #fff;
    direction: rtl;
    box-sizing: border-box;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.pos-receipt .receipt-logo {
    max-width: 55mm;
    max-height: 50px;
    object-fit: contain;
    margin-bottom: 5px;
}

.pos-receipt .store-name {
    font-size: 16px;
    font-weight: 800;
    margin: 2px 0;
    color: #111;
}

.pos-receipt .store-info {
    font-size: 10px;
    color: #444;
    margin-bottom: 2px;
}

.pos-receipt .receipt-title-badge {
    display: inline-block;
    padding: 3px 12px;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 700;
    background-color: #000;
    color: #fff;
    border-radius: 4px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.pos-receipt .receipt-divider {
    border-top: 1px dashed #000;
    margin: 8px 0;
}

.pos-receipt .receipt-divider-light {
    border-top: 1px dotted #888;
    margin: 4px 0;
}

.pos-receipt .receipt-info-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 10.5px;
}

.pos-receipt .info-row {
    display: flex;
    justify-content: space-between;
}

.pos-receipt .info-label {
    color: #333;
}

.pos-receipt .info-val {
    font-weight: 600;
}

.pos-receipt .receipt-table {
    width: 100%;
    border-collapse: collapse;
    margin: 6px 0;
    font-size: 10.5px;
}

.pos-receipt .receipt-table th {
    border-bottom: 1.5px solid #000;
    padding: 4px 2px;
    font-weight: 700;
    font-size: 10px;
}

.pos-receipt .receipt-table td {
    padding: 4px 2px;
    border-bottom: 1px dotted #ccc;
    vertical-align: middle;
}

.pos-receipt .receipt-table .item-name {
    font-weight: 600;
    max-width: 32mm;
    word-wrap: break-word;
}

.pos-receipt .receipt-totals {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
}

.pos-receipt .total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pos-receipt .final-total {
    font-size: 13.5px;
    font-weight: 800;
    border-top: 1.5px solid #000;
    border-bottom: 1.5px double #000;
    padding: 4px 0;
    margin-top: 4px;
}

.pos-receipt .remaining-row {
    font-weight: 700;
    padding-top: 2px;
}

.pos-receipt .barcode-wrapper {
    margin: 8px 0 4px 0;
    text-align: center;
}

.pos-receipt .barcode-wrapper svg {
    max-width: 100%;
    height: auto;
}

.pos-receipt .thanks-msg {
    font-weight: 700;
    font-size: 11px;
    margin-top: 4px;
}

.pos-receipt .policy-msg {
    font-size: 9px;
    color: #555;
    margin-top: 3px;
    line-height: 1.2;
}

@media print {
    @page {
        size: 80mm auto;
        margin: 0;
    }
    body {
        margin: 0;
        padding: 0;
        background: #fff;
    }
    body * {
        visibility: hidden;
    }
    .d-print-none {
        display: none !important;
    }
    #invoice-print-area, #invoice-print-area * {
        visibility: visible;
    }
    #invoice-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 80mm;
        display: block !important;
        border: none !important;
        box-shadow: none !important;
    }
}

/* ✅ تصحيح التداخل على الشاشات الصغيرة */
@media (max-width: 1200px) {
    .num-pad-container {
        margin-left: 0 !important;
        width: 100% !important;
    }
}



