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

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-secondary: #06b6d4;
    --color-success: #10b981;
    --color-success-hover: #059669;
    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;
    --color-warning: #f59e0b;
    --border-color: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(12px);
    --font-family: 'Cairo', sans-serif;
    --transition-speed: 0.3s;
}

[data-theme="light"] {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.85);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-secondary: #0891b2;
    --color-success: #10b981;
    --color-success-hover: #059669;
    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;
    --color-warning: #f59e0b;
    --border-color: rgba(15, 23, 42, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
    scrollbar-width: thin;
    scrollbar-color: var(--color-primary) var(--bg-secondary);
}

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-hover);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    direction: rtl;
    overflow-x: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Layout Grid */
.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    transition: grid-template-columns 0.3s ease;
}

.app-container.sidebar-collapsed {
    grid-template-columns: 1fr;
}

@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
    }
}

/* Sidebar Styling */
.sidebar {
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 10;
    overflow-y: auto;
    transition: transform 0.3s ease, width 0.3s ease;
}

@media (max-width: 1024px) {
    .sidebar {
        height: auto;
        position: relative;
        border-left: none;
        border-bottom: 1px solid var(--border-color);
    }
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 2rem;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

@media (max-width: 1024px) {
    .nav-links {
        flex-direction: row;
        flex-wrap: wrap;
        margin-bottom: 1rem;
    }
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all var(--transition-speed);
}

.nav-link:hover, .nav-link.active {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(80, 70, 229, 0.15), rgba(6, 182, 212, 0.15));
    border-right: 4px solid var(--color-primary);
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.user-details h4 {
    font-size: 0.875rem;
    font-weight: 600;
}

.user-details span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content Area */
.main-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-theme {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color var(--transition-speed);
}

.btn-theme:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* Common Components */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all var(--transition-speed);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
}
.btn-primary:hover {
    box-shadow: 0 0 15px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.btn-success {
    background-color: var(--color-success);
    color: white;
}
.btn-success:hover {
    background-color: var(--color-success-hover);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background-color: var(--color-danger);
    color: white;
}
.btn-danger:hover {
    background-color: var(--color-danger-hover);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.btn-warning {
    background-color: var(--color-warning);
    color: white;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.825rem;
    border-radius: 8px;
}

.btn-block {
    display: flex;
    width: 100%;
}

.card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* POS Interface Specific Layout */
.pos-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    flex-grow: 1;
    height: calc(100vh - 65px);
}

@media (max-width: 1200px) {
    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
    }
}

.pos-products-section {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
}

.pos-cart-section {
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

@media (max-width: 1200px) {
    .pos-cart-section {
        height: 600px;
        border-right: none;
        border-top: 1px solid var(--border-color);
    }
}

/* Category Slider */
.categories-tabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    list-style: none;
}

.category-tab {
    padding: 0.4rem 1rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: all var(--transition-speed);
}

.category-tab:hover, .category-tab.active {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* Search Bar */
.search-container {
    position: relative;
    width: 100%;
}

.form-control {
    width: 100%;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: all var(--transition-speed);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Product Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-speed);
    position: relative;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-4px);
    border-color: var(--color-primary);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.15);
}

.product-img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-muted);
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.product-name {
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
    height: 2rem; /* Allow up to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.product-barcode {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.product-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--color-secondary);
}

.product-stock {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 30px;
    background-color: rgba(255, 255, 255, 0.05);
}

.product-stock.out {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

/* Cart Styles */
.cart-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-title {
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem;
    animation: slideIn 0.2s ease-out;
}

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

.cart-item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cart-item-name {
    font-size: 0.875rem;
    font-weight: 700;
}

.cart-item-price {
    font-size: 0.875rem;
    font-weight: 800;
    color: var(--color-secondary);
}

.cart-item-qty-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-qty {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.btn-qty:hover {
    background-color: var(--color-primary);
    color: white;
}

.cart-item-total {
    font-size: 0.95rem;
    font-weight: 800;
    width: 70px;
    text-align: left;
}

.btn-remove-item {
    background: none;
    border: none;
    color: var(--color-danger);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    transition: background-color var(--transition-speed);
}

.btn-remove-item:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 1rem;
    text-align: center;
    padding: 2rem;
}

.cart-empty-icon {
    font-size: 3rem;
}

/* Cart Summary */
.cart-summary {
    padding: 0.75rem 1rem;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.summary-row.total {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    border-top: 1px dashed var(--border-color);
    padding-top: 0.75rem;
    margin-top: 0.25rem;
}

.summary-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* Modal Styling */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed) ease;
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 500px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    transition: transform var(--transition-speed) ease;
}

.modal-backdrop.show .modal {
    transform: scale(1);
}

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

.modal-title {
    font-weight: 700;
    font-size: 1.15rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Checkout Calculator inside Modal */
.checkout-calc {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.payment-methods {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.payment-method-btn {
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: bold;
    color: var(--text-muted);
    transition: all var(--transition-speed);
}

.payment-method-btn.active, .payment-method-btn:hover {
    border-color: var(--color-primary);
    color: var(--text-main);
    background-color: rgba(79, 70, 229, 0.05);
}

.calc-display {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
}

.calc-row.total-amount {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-secondary);
}

.received-input-wrapper {
    position: relative;
}

.received-input {
    width: 100%;
    font-size: 1.75rem;
    font-weight: 800;
    text-align: center;
    background-color: var(--bg-primary);
    border: 2px solid var(--color-primary);
    border-radius: 12px;
    color: var(--text-main);
    padding: 0.5rem 1rem;
}

.change-amount-display {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-success);
    text-align: center;
    padding: 0.5rem;
    background-color: rgba(16, 185, 129, 0.05);
    border-radius: 8px;
    border: 1px dashed var(--color-success);
}

.change-amount-display.negative {
    color: var(--color-danger);
    background-color: rgba(239, 68, 68, 0.05);
    border-color: var(--color-danger);
}

/* Quick Cash Buttons */
.quick-cash {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.quick-cash-btn {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-main);
    transition: all var(--transition-speed);
}

.quick-cash-btn:hover {
    background-color: var(--color-primary);
    color: white;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background-color: var(--bg-secondary);
    border-right: 4px solid var(--color-primary);
    border-left: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    min-width: 250px;
    color: var(--text-main);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.success { border-right-color: var(--color-success); }
.toast.danger { border-right-color: var(--color-danger); }
.toast.warning { border-right-color: var(--color-warning); }

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
}

/* Login Page CSS */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #1e1b4b, #0f172a);
    padding: 1rem;
}

.login-card {
    width: 420px;
    max-width: 100%;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.invalid-feedback {
    color: var(--color-danger);
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-check input {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* Dashboard Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card:nth-child(2) .stat-icon {
    background-color: rgba(6, 182, 212, 0.1);
    color: var(--color-secondary);
}

.stat-card:nth-child(3) .stat-icon {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.stat-card:nth-child(4) .stat-icon {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
}

/* Tables and Admin CRUD Lists */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    text-align: right;
}

.table th, .table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-success { background-color: rgba(16, 185, 129, 0.15); color: var(--color-success); }
.badge-danger { background-color: rgba(239, 68, 68, 0.15); color: var(--color-danger); }
.badge-warning { background-color: rgba(245, 158, 11, 0.15); color: var(--color-warning); }
.badge-info { background-color: rgba(6, 182, 212, 0.15); color: var(--color-secondary); }

/* Thermal Receipt Styling (Print Media) */
@media print {
    body * {
        visibility: hidden;
    }
    
    #receipt-print-area, #receipt-print-area * {
        visibility: visible;
    }
    
    #receipt-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 80mm; /* Standard thermal roll width */
        font-size: 11px;
        color: #000;
        background: #fff;
        padding: 5mm;
        direction: rtl;
        font-family: monospace;
    }
    
    #receipt-print-area .receipt-header,
    #receipt-print-area .receipt-footer {
        text-align: center;
        margin-bottom: 4mm;
    }
    
    #receipt-print-area .receipt-title {
        font-size: 14px;
        font-weight: bold;
    }
    
    #receipt-print-area .receipt-table {
        width: 100%;
        border-collapse: collapse;
        margin: 4mm 0;
    }
    
    #receipt-print-area .receipt-table th,
    #receipt-print-area .receipt-table td {
        padding: 1.5mm 0;
        border-bottom: 1px dashed #000;
        font-size: 10px;
        text-align: right;
    }
    
    #receipt-print-area .receipt-summary {
        margin-top: 3mm;
        border-top: 1px solid #000;
        padding-top: 2mm;
    }
    
    #receipt-print-area .receipt-row {
        display: flex;
        justify-content: space-between;
        padding: 1mm 0;
    }
    
    #receipt-print-area .receipt-row.bold {
        font-weight: bold;
        font-size: 12px;
    }
}

/* ============================================================
   RESPONSIVE – Tablet (max 1024px) already partly covered above.
   Below targets Mobile (max 768px) comprehensively.
   ============================================================ */

/* ---------- Sidebar: collapse to a sticky top tab bar ---------- */
@media (max-width: 768px) {

    /* App grid: single column */
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    /* Sidebar becomes a compact horizontal scrollable bar */
    .sidebar {
        height: auto;
        position: sticky;
        top: 0;
        z-index: 200;
        padding: 0.5rem 0.75rem;
        border-left: none;
        border-bottom: 2px solid var(--border-color);
        overflow-x: auto;
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        background-color: var(--bg-secondary);
    }

    /* Brand: smaller */
    .brand {
        font-size: 1.1rem;
        margin-bottom: 0;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Nav links: horizontal scrollable strip */
    .nav-links {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0.25rem;
        flex-grow: 1;
        padding-bottom: 0;
        margin-bottom: 0;
    }

    /* Each nav link: icon + compact label */
    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.78rem;
        border-radius: 8px;
        white-space: nowrap;
        gap: 0.4rem;
        flex-direction: row;
    }

    .nav-link svg {
        flex-shrink: 0;
        width: 16px;
        height: 16px;
    }

    /* Hide section dividers in the nav */
    .sidebar > ul > li[style*="margin-top: 1"] {
        display: none;
    }

    /* Sidebar footer: hide on mobile to save space */
    .sidebar-footer {
        display: none;
    }

    /* Header: reduce padding */
    .header {
        padding: 0.75rem 1rem;
    }

    .header-title {
        font-size: 1rem;
    }

    /* Main content padding */
    main {
        padding: 0.75rem !important;
    }

    /* ---------- POS Interface on mobile ---------- */
    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
        min-height: calc(100vh - 120px);
    }

    /* Give products section reasonable height */
    .pos-products-section {
        padding: 0.75rem;
        gap: 1rem;
    }

    /* Products grid: 2 columns on mobile */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    /* Product card: more compact */
    .product-card {
        padding: 0.75rem;
        gap: 0.5rem;
        border-radius: 12px;
    }

    .product-img {
        height: 80px;
        font-size: 1.5rem;
    }

    .product-name {
        font-size: 0.8rem;
    }

    .product-price {
        font-size: 0.95rem;
    }

    /* Cart section: fixed height, full width */
    .pos-cart-section {
        height: 450px;
        border-right: none;
        border-top: 2px solid var(--border-color);
    }

    /* Cart items: reduce padding */
    .cart-item {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .cart-item-name { font-size: 0.8rem; }
    .cart-item-price { font-size: 0.8rem; }
    .cart-item-total { font-size: 0.85rem; width: 55px; }

    .btn-qty {
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
    }

    /* Cart summary */
    .cart-summary { padding: 0.75rem; gap: 0.5rem; }
    .summary-row { font-size: 0.85rem; }
    .summary-row.total { font-size: 1.1rem; }

    /* Summary action buttons – stack vertically on very small screens */
    .summary-actions {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    /* ---------- POS Sidebar (delivery/customer fields) ---------- */
    /* The right sidebar with order mode / customer fields */
    .pos-sidebar, [class*="pos-sidebar"] {
        padding: 0.75rem !important;
    }

    /* ---------- Modals: full-screen on mobile ---------- */
    .modal-backdrop {
        align-items: flex-end;
    }

    .modal {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }

    .modal-backdrop.show .modal {
        transform: translateY(0);
    }

    .modal-header { padding: 1rem; }
    .modal-body   { padding: 1rem; }
    .modal-footer { padding: 1rem; flex-wrap: wrap; }

    /* Payment methods: 3 cols become 2 */
    .payment-methods {
        grid-template-columns: repeat(2, 1fr);
    }

    .quick-cash {
        grid-template-columns: repeat(3, 1fr);
    }

    .received-input { font-size: 1.4rem; }
    .change-amount-display { font-size: 1.2rem; }

    /* ---------- Tables: mobile-friendly ---------- */
    .table th, .table td {
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Hide less important columns on mobile */
    .table .hide-mobile { display: none !important; }

    /* ---------- Cards ---------- */
    .card { padding: 1rem; border-radius: 12px; }

    /* ---------- Stats grid: 2 per row ---------- */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-value { font-size: 1.4rem; }

    /* ---------- Buttons ---------- */
    .btn {
        padding: 0.55rem 0.9rem;
        font-size: 0.85rem;
    }

    .btn-sm {
        padding: 0.35rem 0.65rem;
        font-size: 0.78rem;
    }

    /* ---------- Toast: full-width on mobile ---------- */
    .toast-container {
        left: 8px;
        right: 8px;
        top: 12px;
    }

    .toast {
        min-width: unset;
        width: 100%;
    }
}

/* ---------- Very small phones (max 480px) ---------- */
@media (max-width: 480px) {

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pos-cart-section {
        height: 400px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .summary-actions {
        grid-template-columns: 1fr;
    }

    .payment-methods {
        grid-template-columns: 1fr 1fr;
    }

    .header-title {
        font-size: 0.9rem;
    }

    /* POS sidebar fields: full width stack */
    .pos-sidebar .form-control,
    .pos-sidebar input {
        font-size: 0.9rem;
        padding: 0.6rem 0.75rem;
    }

    /* Larger touch targets for qty buttons */
    .btn-qty {
        width: 32px;
        height: 32px;
    }

    /* Table: hide more columns */
    .table .hide-sm { display: none !important; }

    /* Cards full padding reduction */
    .card { padding: 0.75rem; }

    /* Brand name hidden on very small screens, keep logo icon */
    .brand span { display: none; }
}
