
/* General Body and Typography */
body {
    font-family: 'Cairo', sans-serif;
    background-color: #e9ecef;
    color: #343a40;
    font-size: 1.1rem; /* Base font size for better readability on touchscreens */
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Cairo', sans-serif;
    font-weight: 700; /* Bold for headings */
}

/* Container and Layout */
.container-fluid.custom-container-padding {
    padding-inline-start: 30px;
    padding-inline-end: 30px;
}

.container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
    margin-bottom: 30px;
}

/* Navbar */
.navbar {
    background-color: #007bff !important; /* Primary blue */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.navbar-brand {
    font-weight: bold;
    font-size: 1.8rem; /* Larger brand text */
}
.nav-link {
    font-size: 1.3rem; /* Larger navigation links */
    transition: color 0.3s ease;
    padding: 15px 20px !important; /* More padding for touch */
}
.nav-link:hover {
    color: #e2e6ea !important;
}
.dropdown-menu {
    font-size: 1.2rem; /* Larger dropdown items */
}
.dropdown-item {
    padding: 10px 20px; /* More padding for dropdown items */
}

/* Cards */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.card-header {
    background-color: #f0f2f5;
    color: #343a40;
    font-weight: bold;
    border-bottom: 1px solid #dee2e6;
    padding: 18px 25px; /* Increased padding */
    font-size: 1.4rem; /* Larger header font */
}
.card-body {
    padding: 25px;
}

/* Forms */
.form-control {
    border-radius: 5px;
    border: 1px solid #ced4da;
    padding: 12px 18px; /* Increased padding for touch */
    font-size: 1.1rem; /* Larger font in inputs */
    height: auto; /* Allow height to adjust with padding */
}
.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
.form-group label {
    font-weight: 600;
    margin-bottom: 10px; /* More space below labels */
    font-size: 1.15rem; /* Larger label font */
}

/* Buttons */
.btn {
    border-radius: 5px;
    padding: 12px 25px; /* Increased padding for touch */
    font-size: 1.2rem; /* Larger button text */
    font-weight: 600;
    transition: all 0.3s ease;
    min-height: 50px; /* Minimum height for easy tapping */
}
.btn-sm {
    padding: 8px 15px; /* Smaller padding for small buttons */
    font-size: 1rem; /* Smaller font for small buttons */
    min-height: 40px; /* Minimum height for small buttons */
}
.btn-lg {
    padding: 15px 30px; /* Larger padding for large buttons */
    font-size: 1.4rem; /* Larger font for large buttons */
    min-height: 60px; /* Minimum height for large buttons */
}

.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
    color: #ffffff !important;
}
.btn-primary:hover {
    background-color: #0056b3;
    border-color: #004085;
    color: #ffffff !important;
}
.btn-success {
    background-color: #28a745;
    border-color: #28a745;
    color: #ffffff !important;
}
.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
    color: #ffffff !important;
}
.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #ffffff !important;
}
.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
    color: #ffffff !important;
}
.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529 !important;
}
.btn-warning:hover {
    background-color: #e0a800;
    border-color: #d39e00;
    color: #212529 !important;
}
.btn-info {
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: #ffffff !important;
}
.btn-info:hover {
    background-color: #138496;
    border-color: #117a8b;
    color: #ffffff !important;
}
.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #ffffff !important;
}
.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
    color: #ffffff !important;
}
.btn-outline-primary {
    color: #007bff;
    border-color: #007bff;
    background-color: transparent;
}
.btn-outline-primary:hover {
    background-color: #007bff;
    color: #fff !important;
}

/* Flash Messages */
.flash-messages .alert {
    border-radius: 5px;
    font-size: 1.2rem; /* Larger flash messages */
    padding: 15px 20px;
}

/* Tables */
.table {
    margin-top: 20px;
    font-size: 1.1rem; /* Larger table text */
}
.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: bold;
    padding: 15px; /* More padding in table headers */
}
.table tbody td {
    padding: 12px 15px; /* More padding in table cells */
}

/* POS Specific */
.product-item {
    padding: 15px !important;
    height: 120px; /* Increased height for more space */
    text-align: start; /* RTL-compatible alignment */
    white-space: normal;
    word-wrap: break-word;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
    background-color: #fff;
    border: 1px solid #dee2e6;
    display: block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.product-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: #007bff;
}

.product-item .d-flex {
    height: 100%;
    width: 100%;
}

.product-img-pos {
    width: 80px;
    height: 80px;
    min-width: 80px;
    object-fit: cover;
    border-radius: 5px;
}

.product-img-placeholder {
    width: 80px;
    height: 80px;
    min-width: 80px;
    background-color: #f0f2f5;
    border: 1px dashed #ced4da;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 0.9rem;
    text-align: center;
    margin-inline-end: 10px; /* RTL-compatible margin */
}

/* Container for text, ensures no overlap */
.product-item .text-left {
    flex: 1;
    min-width: 0; /* Allows text to wrap inside flex item */
    padding-left: 15px; /* Spacing between image and text */
}

html[dir="rtl"] .product-item .text-left {
    padding-left: 0;
    padding-right: 15px;
}

.product-item strong {
    font-size: 1.2rem; /* Larger product name */
    font-weight: 700;
    color: #343a40;
    display: block;
    margin-bottom: 5px;
}

.product-item span {
    font-size: 1.1rem;
    font-weight: 600;
    color: #007bff;
}
#cartItems .list-group-item {
    font-size: 1.2rem; /* Larger font for cart items */
    padding: 12px 15px; /* More padding for cart items */
}
#cartTotal {
    font-size: 1.8rem; /* Larger total font */
    font-weight: bold;
    color: #007bff;
}

/* Custom Modal Styling */
/* Alert Modal - Ensure it appears on top */
#alertModal {
    z-index: 9999 !important;
}

#alertModal .modal-dialog {
    z-index: 10000 !important;
}

#alertModal .modal-backdrop {
    z-index: 9998 !important;
}

#customModal .modal-content {
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}
#customModal .modal-header {
    background-color: #007bff;
    color: white;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    padding: 15px 20px;
}
#customModal .modal-title {
    font-size: 1.5rem;
    font-weight: bold;
}
#customModal .modal-body {
    padding: 25px;
    font-size: 1.1rem;
}
#customModal .modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
}

/* Receipt Specific Styles */
.receipt-container {
    max-width: 400px;
    margin: 0 auto;
    font-family: 'Cairo', sans-serif;
    padding: 15px;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin: 4px 0;
    gap: 20px; /* Space between columns */
}

.receipt-row > span {
    word-wrap: break-word;
    overflow-wrap: break-word;
    flex-shrink: 0;
}

/* Default: two-column layout (label-value pairs) */
.receipt-row > span:first-child {
    flex: 1 1 40%;
    text-align: left;
}

.receipt-row > span:last-child {
    flex: 1 1 60%;
    text-align: right;
}

/* Three-column layout for item rows (Item, Qty, Price) */
.receipt-item-row > span:first-child {
    flex: 1 1 50%; /* Item name - takes most space */
    text-align: left;
}

.receipt-item-row > span:nth-child(2) {
    flex: 0 0 60px; /* Qty - fixed width */
    text-align: center;
}

.receipt-item-row > span:nth-child(3) {
    flex: 0 0 100px; /* Price - fixed width */
    text-align: right;
}

.receipt-price {
    text-align: right !important;
    font-weight: 600;
}

.receipt-row.bold {
    font-weight: bold;
    border-bottom: 1px solid #ddd;
    padding-bottom: 4px;
    margin-bottom: 8px;
}

.receipt-row.bold > span {
    font-weight: bold;
}

.text-center {
    text-align: center;
}

.bold {
    font-weight: bold;
}

.small {
    font-size: 12px;
}

/* Receipt Specific Styles (for print) */
@media print {
    body * {
        visibility: hidden;
    }
    #receipt-print-area, #receipt-print-area * {
        visibility: visible;
    }
    #receipt-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        font-family: 'Cairo', sans-serif;
        font-size: 12px; /* Standard receipt font size */
        padding: 10px;
        box-sizing: border-box;
    }
    .no-print {
        display: none !important;
    }
    /* Ensure text alignment for RTL in print */
    html[dir="rtl"] #receipt-print-area {
        text-align: right;
        direction: rtl;
    }
    /* Receipt styles for print */
    .receipt-container {
        max-width: 100%;
        margin: 0;
        padding: 10px;
    }
    .receipt-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin: 3px 0;
        gap: 25px; /* More space between columns in print */
    }
    .receipt-row > span {
        word-wrap: break-word;
        overflow-wrap: break-word;
        flex-shrink: 0;
    }
    /* Default: two-column layout */
    .receipt-row > span:first-child {
        flex: 1 1 40%;
        text-align: left;
    }
    .receipt-row > span:last-child {
        flex: 1 1 60%;
        text-align: right;
    }
    /* Three-column layout for item rows */
    .receipt-item-row > span:first-child {
        flex: 1 1 50%; /* Item name */
        text-align: left;
    }
    .receipt-item-row > span:nth-child(2) {
        flex: 0 0 70px; /* Qty - fixed width */
        text-align: center;
    }
    .receipt-item-row > span:nth-child(3) {
        flex: 0 0 120px; /* Price - fixed width */
        text-align: right;
    }
    .receipt-price {
        text-align: right !important;
        font-weight: 600;
    }
}

/* RTL Adjustments (Override Bootstrap defaults) */
html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .navbar-nav .ml-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}

html[dir="rtl"] .form-group label {
    text-align: right;
    width: 100%; /* Ensure label takes full width for text-align */
}

html[dir="rtl"] .form-control {
    text-align: right;
}

html[dir="rtl"] .input-group-append {
    margin-left: 0;
    margin-right: -1px; /* Adjust for RTL */
}

html[dir="rtl"] .input-group-prepend {
    margin-right: 0;
    margin-left: -1px; /* Adjust for RTL */
}

html[dir="rtl"] .d-flex.justify-content-between {
    flex-direction: row-reverse; /* Reverse order for RTL */
}

html[dir="rtl"] .mr-1 {
    margin-right: 0 !important;
    margin-left: 0.25rem !important; /* Equivalent of mr-1 in LTR */
}

html[dir="rtl"] .ml-2 {
    margin-left: 0 !important;
    margin-right: 0.5rem !important; /* Equivalent of ml-2 in LTR */
}

/* Specific adjustments for tables in RTL */
html[dir="rtl"] .table thead th,
html[dir="rtl"] .table tbody td {
    text-align: right;
}

/* Ensure icons/buttons within text flow correctly */
html[dir="rtl"] .btn-sm.mr-1,
html[dir="rtl"] .btn-sm.ml-2 {
    float: left; /* Keep action buttons on the left in RTL list items */
}

/* Transaction Summary Modal Alignment */
#transactionSummaryModal .card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#transactionSummaryModal .card-body {
    padding: 1.25rem;
}

/* Summary Row Layout - Flexbox for perfect alignment */
.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    min-height: 40px;
}

.summary-row:first-child {
    padding-top: 0;
}

.summary-row:last-child {
    padding-bottom: 0;
}

.summary-label {
    flex: 0 0 auto;
    font-size: 1.1rem;
    text-align: left;
    padding-right: 15px;
    white-space: nowrap;
}

.summary-value {
    flex: 1 1 auto;
    font-size: 1.1rem;
    text-align: right;
    padding-left: 15px;
    min-width: 0;
    word-wrap: break-word;
}

/* Financial Summary Table */
#transactionSummaryModal .table-lg td {
    padding: 12px 0;
}

#transactionSummaryModal .table-lg tr.border-top {
    border-top: 2px solid #dee2e6 !important;
}
