/* Order History Page Styles - v106 */

/* Hide merchant selected info display for order history search */
#merchantSearchContainer #merchantSearch_selectedInfo {
    display: none !important;
}

/* Page Title - Minimized */
.page-title-compact {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    padding: 0;
    line-height: 1.2;
}

.content-header {
    margin-bottom: 0.25rem;
}

/* Dashboard Button - Fixed Position in Corner */
.dashboard-btn-corner {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #212529;
    color: white;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 1.2rem;
}

.dashboard-btn-corner:hover {
    background-color: #0d6efd;
    color: white;
    transform: translateY(-2px);
}

/* Hide on desktop, show on mobile */
@media (min-width: 769px) {
    .dashboard-btn-corner {
        display: none;
    }
}

/* Adjust for mobile */
@media (max-width: 768px) {
    .dashboard-btn-corner {
        top: 15px;
        right: 15px;
        display: flex;
    }
}

/* Breadcrumb Navigation */
.breadcrumb-nav {
    margin-bottom: 0.5rem;
}

.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-item {
    font-size: 0.75rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    padding: 0 0.5rem;
    color: #6c757d;
}

.breadcrumb-link {
    color: #007bff;
    text-decoration: none;
}

.breadcrumb-link:hover {
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #6c757d;
}

/* Search Section */
.card {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 0.5rem;
}

/* Compact spacing for cards */
.card.mb-2 {
    margin-bottom: 0.5rem !important;
}

.card.mb-3 {
    margin-bottom: 0.75rem !important;
}

/* User Information Section */
#userInfoSection {
    background-color: #f8f9fa;
    border-left: 3px solid #007bff;
}

#userInfoSection .card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #495057;
}

.user-info-value {
    font-size: 12px;
    font-weight: 500;
    color: #212529;
    padding: 0.25rem 0;
    word-break: break-word;
}

.user-info-value:empty::before {
    content: '-';
    color: #6c757d;
}

/* Multiple Users Display */
#userInfoMultipleUsers {
    margin-top: 0.5rem;
}

#userInfoMultipleUsers > div {
    transition: background-color 0.2s ease;
}

#userInfoMultipleUsers > div:hover {
    background-color: #e9ecef !important;
}

#searchForm .row {
    margin-right: 0;
}

#searchForm .row > .col-auto {
    flex-shrink: 0;
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
}

/* User Info and Filter box title rows - reduced size */
#userInfoHeader,
#filtersSection .card-header {
    padding: 0.35rem 0.5rem;
}

#userInfoHeader h6,
#filtersSection .card-header h6 {
    font-size: 0.8rem;
    margin: 0;
    line-height: 1.2;
}

/* Reduce toggle button size for User Info and Filter headers */
#userInfoHeader .filter-toggle-btn,
#filtersSection .card-header .filter-toggle-btn {
    width: 18px;
    height: 18px;
}

#userInfoHeader .filter-toggle-btn i,
#filtersSection .card-header .filter-toggle-btn i {
    font-size: 0.75rem;
}

.filter-toggle-btn {
    color: #495057;
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: color 0.2s ease;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-toggle-btn:hover {
    color: #007bff;
}

.filter-toggle-btn:focus {
    outline: none;
    box-shadow: none;
}

.filter-toggle-btn i {
    font-size: 0.875rem;
    transition: transform 0.2s ease;
}

#clearFiltersBtn {
    background-color: #ffffff;
    border-color: #6c757d;
    color: #6c757d;
}

#clearFiltersBtn:hover {
    background-color: #f8f9fa;
    border-color: #6c757d;
    color: #495057;
}

.card-body {
    padding: 0.75rem;
}

/* Compact card body for search section */
#searchForm .card-body {
    padding: 0.5rem 0.75rem;
}

/* Table Wrapper */
.table-wrapper {
    position: relative;
}

.table-scrollbar-top {
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 0;
    border-bottom: 1px solid #dee2e6;
    max-height: 17px;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

.table-scrollbar-top::-webkit-scrollbar {
    height: 12px;
}

.table-scrollbar-top::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0;
}

.table-scrollbar-top::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 6px;
}

.table-scrollbar-top::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.table-scrollbar-content {
    height: 1px;
    min-width: 100%;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
}

#orderHistoryTable {
    min-width: 800px;
    width: 100%;
    table-layout: auto;
}

/* On wider viewports, make table columns fit to container width */
@media (min-width: 992px) {
    #orderHistoryTable {
        table-layout: fixed;
        width: 100%;
    }
    
    /* Base column widths - columns will distribute to fill available space */
    #orderHistoryTable thead th,
    #orderHistoryTable tbody td {
        width: auto;
    }
    
    /* Specific column widths to fill container (9 columns without user column, 10 with user column) */
    /* Optimized widths based on typical content sizes */
    #orderHistoryTable thead th[data-column="merchant"],
    #orderHistoryTable tbody td.merchant-cell {
        width: 24%;
    }
    
    /* Order ID column - numbers, can be smaller */
    #orderHistoryTable thead th[data-column="orderId"],
    #orderHistoryTable tbody td.order-id-cell {
        width: 6%;
    }
    
    /* User column width when present - names can be longer */
    #orderHistoryTable thead th[data-column="user"],
    #orderHistoryTable tbody td.user-name-cell {
        width: 11%;
    }
    
    /* Order Type - text like "Scan to order (eat in)" can be long */
    #orderHistoryTable thead th[data-column="orderType"],
    #orderHistoryTable tbody td.order-type-cell {
        width: 11%;
    }
    
    /* Price - currency values like £999.99 */
    #orderHistoryTable thead th[data-column="price"],
    #orderHistoryTable tbody td.price-cell {
        width: 3.5%;
    }
    
    /* Status - status text can be long like "Confirmed (Uncaptured)" */
    #orderHistoryTable thead th[data-column="status"],
    #orderHistoryTable tbody td.status-cell {
        width: 10%;
    }
    
    /* Date - DD/MM/YYYY HH:mm format */
    #orderHistoryTable thead th[data-column="date"],
    #orderHistoryTable tbody td.date-cell {
        width: 11%;
    }
    
    /* Order Number - order numbers/tags are usually short */
    #orderHistoryTable thead th[data-column="orderNumber"],
    #orderHistoryTable tbody td.order-number-cell {
        width: 7%;
    }
    
    /* Refund - currency values */
    #orderHistoryTable thead th[data-column="refunded"],
    #orderHistoryTable tbody td.refunded-cell {
        width: 3.5%;
    }
    
    /* Charge ID - long alphanumeric strings */
    #orderHistoryTable thead th[data-column="chargeId"],
    #orderHistoryTable tbody td.charge-id-cell {
        width: 13%;
    }
}

/* Sortable Column Headers */
#orderHistoryTable thead {
    background-color: #343a40;
}

#orderHistoryTable thead th {
    background-color: #343a40;
    color: #ffffff;
    font-weight: 600;
    font-size: 12px;
    border-color: #495057;
    transition: background-color 0.2s ease;
    padding: 0.4rem 0.5rem;
}

.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    background-color: #495057 !important;
}

.sortable i {
    opacity: 0.7;
    transition: opacity 0.2s;
    color: #ffffff;
}

.sortable:hover i {
    opacity: 1;
}

.sortable.sort-asc i.fa-sort::before {
    content: "\f0de";
}

.sortable.sort-desc i.fa-sort::before {
    content: "\f0dd";
}

/* Table Row Clickable */
#orderHistoryTable tbody tr {
    cursor: pointer;
    transition: background-color 0.2s;
}

#orderHistoryTable tbody td {
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1.3;
}

#orderHistoryTable tbody tr:hover {
    background-color: #f8f9fa;
}

/* Widget Cards */
.widgets-container {
    position: static;
}

.widget-card {
    display: flex;
    flex-direction: column;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 0.75rem;
}

/* On wider viewports, reduce spacing between widgets */
@media (min-width: 992px) {
    .widget-card {
        margin-bottom: 0.5rem;
    }
}

.widget-card .card-header {
    flex-shrink: 0;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
}

.widget-card .card-header h6 {
    margin: 0;
    font-weight: 600;
    font-size: 0.95rem;
}

/* Widget Filter Input */
.widget-filter-input {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    height: auto;
}

.widget-card .card-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.widget-card .card-body > .mb-2 {
    flex-shrink: 0;
}

.widget-scrollbar-top {
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 0;
    border-bottom: 1px solid #dee2e6;
    height: 17px;
    min-height: 17px;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
    display: block !important;
    visibility: visible !important;
}

.widget-scrollbar-top::-webkit-scrollbar {
    height: 12px;
    display: block;
}

.widget-scrollbar-top::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0;
}

.widget-scrollbar-top::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 6px;
}

.widget-scrollbar-top::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.widget-scrollbar-content {
    height: 1px;
    min-width: 100%;
    width: 100%;
}

/* Payment widget scrollbar - allow dynamic width */
#paymentHistoryScrollbarTop .widget-scrollbar-content {
    min-width: 100%;
}

.widget-table-wrapper {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
    width: 100%;
    max-width: 100%;
    display: block;
}

.widget-table-wrapper::-webkit-scrollbar {
    height: 12px;
}

.widget-table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0;
}

.widget-table-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 6px;
}

.widget-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.widget-table {
    flex: 1;
    overflow-y: auto;
    overflow-x: visible;
    max-height: 200px; /* Show approximately 4 rows - reduced for compact view */
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
    display: block;
    width: 100%;
}

.widget-table::-webkit-scrollbar {
    width: 12px;
}

.widget-table::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0;
}

.widget-table::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 6px;
}

.widget-table::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.widget-table-content {
    width: max-content;
    min-width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
    table-layout: auto;
    display: table;
    white-space: nowrap;
}

.widget-table-content thead {
    position: sticky;
    top: 0;
    background-color: #fff;
    z-index: 10;
}

.widget-table-content thead th {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
    white-space: nowrap;
    text-align: left;
    color: #495057;
    min-width: 100px;
}

.widget-table-content tbody td {
    font-size: 0.8rem;
    padding: 0.35rem 0.5rem;
    white-space: nowrap;
    border-bottom: 1px solid #f0f0f0;
    color: #212529;
    overflow: visible;
    min-width: 100px;
}

.widget-table-content tbody tr:hover {
    background-color: #f8f9fa;
}

.widget-table-content tbody tr:last-child td {
    border-bottom: none;
}

/* Widget Sortable Column Headers */
.widget-sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.widget-sortable:hover {
    background-color: #e9ecef !important;
}

.widget-sortable i {
    opacity: 0.7;
    transition: opacity 0.2s;
    color: #495057;
    font-size: 0.7rem;
}

.widget-sortable:hover i {
    opacity: 1;
}

.widget-sortable.widget-sort-asc i.fa-sort::before {
    content: "\f0de";
}

.widget-sortable.widget-sort-desc i.fa-sort::before {
    content: "\f0dd";
}

/* Payment Widget - Minimize column widths */
#paymentHistoryWidget .widget-table-content {
    min-width: 600px; /* Reduced from 800px */
}

#paymentHistoryWidget .widget-table-content thead th {
    padding: 0.25rem 0.3rem;
    font-size: 0.75rem;
}

#paymentHistoryWidget .widget-table-content tbody td {
    padding: 0.25rem 0.3rem;
    font-size: 0.75rem;
}

/* Payment Widget - Column specific widths */
#paymentHistoryWidget .widget-table-content thead th:nth-child(1),
#paymentHistoryWidget .widget-table-content tbody td:nth-child(1) {
    min-width: 100px;
    max-width: 120px;
}

#paymentHistoryWidget .widget-table-content thead th:nth-child(2),
#paymentHistoryWidget .widget-table-content tbody td:nth-child(2) {
    min-width: 80px;
    max-width: 100px;
}

#paymentHistoryWidget .widget-table-content thead th:nth-child(3),
#paymentHistoryWidget .widget-table-content tbody td:nth-child(3) {
    min-width: 60px;
    max-width: 80px;
}

#paymentHistoryWidget .widget-table-content thead th:nth-child(4),
#paymentHistoryWidget .widget-table-content tbody td:nth-child(4) {
    min-width: 90px;
    max-width: 110px;
}

#paymentHistoryWidget .widget-table-content thead th:nth-child(5),
#paymentHistoryWidget .widget-table-content tbody td:nth-child(5) {
    min-width: 100px;
    max-width: 130px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

#paymentHistoryWidget .widget-table-content thead th:nth-child(6),
#paymentHistoryWidget .widget-table-content tbody td:nth-child(6) {
    min-width: 90px;
    max-width: 110px;
}

/* Payment Widget - Charge ID column styling */
#paymentHistoryWidget .charge-id-cell {
    font-size: 9px;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-all;
    overflow-wrap: break-word;
}

/* Payment Widget - Charge ID Link Styling */
#paymentHistoryWidget .charge-id-link {
    color: #007bff;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

#paymentHistoryWidget .charge-id-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Payment Widget - Charge ID column (2nd column) font size and wrapping */
#paymentHistoryWidget .widget-table-content tbody td:nth-child(2) {
    font-size: 9px;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-all;
    overflow-wrap: break-word;
    line-height: 1.3;
}

/* Payment Widget - Merchant info in payment widget (more compact) */
#paymentHistoryWidget .merchant-info {
    gap: 4px;
}

#paymentHistoryWidget .merchant-id-badge {
    padding: 2px 4px;
    font-size: 0.65rem;
    min-width: 30px;
}

#paymentHistoryWidget .merchant-name-text {
    font-size: 0.7rem;
}

/* Payment Type Badges */
.payment-type-badge {
    padding: 0.15rem 0.3rem;
    border-radius: 0.2rem;
    font-size: 0.65rem;
    font-weight: 500;
    display: inline-block;
    white-space: nowrap;
}

.payment-type-online {
    background-color: #007bff;
    color: #fff;
}

.payment-type-booking {
    background-color: #17a2b8;
    color: #fff;
}

.payment-type-link {
    background-color: #6c757d;
    color: #fff;
}

.payment-type-unknown {
    background-color: #6c757d;
    color: #fff;
}

/* Payment Status Badges */
.payment-status-badge {
    padding: 0.15rem 0.3rem;
    border-radius: 0.2rem;
    font-size: 0.65rem;
    font-weight: 500;
    display: inline-block;
    white-space: normal;
    word-wrap: break-word;
    max-width: 100%;
}

.payment-status-unconfirmed {
    background-color: #ffc107;
    color: #000;
}

.payment-status-confirmed {
    background-color: #28a745;
    color: #fff;
}

.payment-status-uncaptured {
    background-color: #17a2b8;
    color: #fff;
}

.payment-status-captured {
    background-color: #28a745;
    color: #fff;
}

.payment-status-refunded {
    background-color: #dc3545;
    color: #fff;
}

.payment-status-auto-refund {
    background-color: #fd7e14;
    color: #fff;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.2;
    font-size: 0.6rem;
}

.payment-status-unknown {
    background-color: #6c757d;
    color: #fff;
}

/* PIN History Widget - User ID column font size (data cells only) */
#pinHistoryWidget .widget-table-content tbody td:nth-child(1) {
    font-size: 9px;
}

/* Loyalty PIN Widget - Minimize column widths */
#loyaltyPinWidget .widget-table-content {
    min-width: 500px;
}

#loyaltyPinWidget .widget-table-content thead th {
    padding: 0.25rem 0.3rem;
    font-size: 0.75rem;
}

#loyaltyPinWidget .widget-table-content tbody td {
    padding: 0.25rem 0.3rem;
    font-size: 0.75rem;
}

/* Loyalty PIN Widget - Column specific widths */
#loyaltyPinWidget .widget-table-content thead th:nth-child(1),
#loyaltyPinWidget .widget-table-content tbody td:nth-child(1) {
    min-width: 120px;
    max-width: 150px;
    white-space: normal;
}

/* Loyalty PIN Widget - Merchant column text wrapping for medium to large screens */
@media (min-width: 992px) and (max-width: 1800px) {
    #loyaltyPinWidget .widget-table-content thead th:nth-child(1),
    #loyaltyPinWidget .widget-table-content tbody td:nth-child(1) {
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
        line-height: 1.3;
    }
}

/* Loyalty PIN Widget - Merchant column spreads on wide screens */
@media (min-width: 1200px) {
    #loyaltyPinWidget .widget-table-content thead th:nth-child(1),
    #loyaltyPinWidget .widget-table-content tbody td:nth-child(1) {
        max-width: 190px;
    }
}

@media (min-width: 1400px) {
    #loyaltyPinWidget .widget-table-content thead th:nth-child(1),
    #loyaltyPinWidget .widget-table-content tbody td:nth-child(1) {
        max-width: 220px;
    }
}

#loyaltyPinWidget .widget-table-content thead th:nth-child(2),
#loyaltyPinWidget .widget-table-content tbody td:nth-child(2) {
    min-width: 70px;
    max-width: 85px;
}

#loyaltyPinWidget .widget-table-content thead th:nth-child(3),
#loyaltyPinWidget .widget-table-content tbody td:nth-child(3) {
    min-width: 60px;
    max-width: 80px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

/* Loyalty PIN Widget - PIN column with text wrapping */
#loyaltyPinWidget .loyalty-pin-pin-cell {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

/* Loyalty PIN Widget - PIN column spreads on wide screens */
@media (min-width: 1200px) {
    #loyaltyPinWidget .widget-table-content thead th:nth-child(3),
    #loyaltyPinWidget .widget-table-content tbody td:nth-child(3) {
        max-width: 120px;
    }
}

@media (min-width: 1400px) {
    #loyaltyPinWidget .widget-table-content thead th:nth-child(3),
    #loyaltyPinWidget .widget-table-content tbody td:nth-child(3) {
        max-width: 150px;
    }
}

/* Loyalty PIN Widget - PIN column 2x wider from 1600px */
@media (min-width: 1600px) {
    #loyaltyPinWidget .widget-table-content thead th:nth-child(3),
    #loyaltyPinWidget .widget-table-content tbody td:nth-child(3) {
        min-width: 120px;
        max-width: 300px;
    }
}

#loyaltyPinWidget .widget-table-content thead th:nth-child(4),
#loyaltyPinWidget .widget-table-content tbody td:nth-child(4) {
    min-width: 70px;
    max-width: 85px;
}

/* Loyalty PIN Widget - Source column with text wrapping */
#loyaltyPinWidget .widget-table-content thead th:nth-child(5),
#loyaltyPinWidget .widget-table-content tbody td:nth-child(5) {
    min-width: 120px;
    max-width: 160px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

/* Loyalty PIN Widget - Source column spreads on wide screens */
@media (min-width: 1200px) {
    #loyaltyPinWidget .widget-table-content thead th:nth-child(5),
    #loyaltyPinWidget .widget-table-content tbody td:nth-child(5) {
        max-width: none;
        width: auto;
    }
}

@media (min-width: 1400px) {
    #loyaltyPinWidget .widget-table-content thead th:nth-child(5),
    #loyaltyPinWidget .widget-table-content tbody td:nth-child(5) {
        max-width: none;
        width: auto;
    }
}

/* Loyalty PIN Widget - Source column 2x wider from 1660px */
@media (min-width: 1660px) {
    #loyaltyPinWidget .widget-table-content thead th:nth-child(5),
    #loyaltyPinWidget .widget-table-content tbody td:nth-child(5) {
        min-width: 240px;
        max-width: 320px;
    }
}

#loyaltyPinWidget .loyalty-pin-source-cell {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
    font-size: 0.7rem;
}

/* Loyalty PIN Widget - Merchant info (more compact with text wrapping) */
#loyaltyPinWidget .merchant-info {
    gap: 4px;
    white-space: normal;
    flex-wrap: wrap;
    align-items: flex-start;
}

#loyaltyPinWidget .merchant-id-badge {
    padding: 2px 4px;
    font-size: 0.65rem;
    min-width: 30px;
    flex-shrink: 0;
}

#loyaltyPinWidget .merchant-name-text {
    font-size: 0.7rem;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

/* Loyalty PIN Widget - Row text colors based on Cashback value */
#loyaltyPinWidget .widget-table-content tbody tr.loyalty-pin-negative td {
    color: #dc3545 !important; /* Red for negative numeric values */
}

#loyaltyPinWidget .widget-table-content tbody tr.loyalty-pin-free-item td {
    color: #007bff !important; /* Blue for 'Free Item' */
}

#loyaltyPinWidget .widget-table-content tbody tr.loyalty-pin-text-value td {
    color: #006400 !important; /* Dark green for other text values */
}

/* Loyalty PIN Widget - Apply colors to Merchant column elements */
#loyaltyPinWidget .widget-table-content tbody tr.loyalty-pin-negative td .merchant-info,
#loyaltyPinWidget .widget-table-content tbody tr.loyalty-pin-negative td .merchant-id-badge,
#loyaltyPinWidget .widget-table-content tbody tr.loyalty-pin-negative td .merchant-name-text {
    color: #dc3545 !important; /* Red for negative numeric values */
}

#loyaltyPinWidget .widget-table-content tbody tr.loyalty-pin-free-item td .merchant-info,
#loyaltyPinWidget .widget-table-content tbody tr.loyalty-pin-free-item td .merchant-id-badge,
#loyaltyPinWidget .widget-table-content tbody tr.loyalty-pin-free-item td .merchant-name-text {
    color: #007bff !important; /* Blue for 'Free Item' */
}

#loyaltyPinWidget .widget-table-content tbody tr.loyalty-pin-text-value td .merchant-info,
#loyaltyPinWidget .widget-table-content tbody tr.loyalty-pin-text-value td .merchant-id-badge,
#loyaltyPinWidget .widget-table-content tbody tr.loyalty-pin-text-value td .merchant-name-text {
    color: #006400 !important; /* Dark green for other text values */
}

/* PIN History Widget */
#pinHistoryWidget .widget-table-content {
    min-width: 600px;
}

/* PIN History Widget - Reduced height for compact view */
#pinHistoryWidget .widget-table {
    max-height: 350px; /* Reduced from 500px - Show approximately 7 rows */
}

#pinHistoryWidget .widget-table-content thead th {
    padding: 0.25rem 0.3rem;
    font-size: 0.75rem;
}

#pinHistoryWidget .widget-table-content tbody td {
    padding: 0.25rem 0.3rem;
    font-size: 0.75rem;
}

/* PIN History Widget - Column specific widths */
#pinHistoryWidget .widget-table-content thead th:nth-child(1),
#pinHistoryWidget .widget-table-content tbody td:nth-child(1) {
    min-width: 120px;
    max-width: 150px;
    white-space: normal;
}

#pinHistoryWidget .widget-table-content thead th:nth-child(2),
#pinHistoryWidget .widget-table-content tbody td:nth-child(2) {
    min-width: 70px;
    max-width: 85px;
}

#pinHistoryWidget .widget-table-content thead th:nth-child(3),
#pinHistoryWidget .widget-table-content tbody td:nth-child(3) {
    min-width: 60px;
    max-width: 80px;
}

#pinHistoryWidget .widget-table-content thead th:nth-child(4),
#pinHistoryWidget .widget-table-content tbody td:nth-child(4) {
    min-width: 70px;
    max-width: 85px;
}

/* PIN History Widget - Source column with text wrapping */
#pinHistoryWidget .widget-table-content thead th:nth-child(5),
#pinHistoryWidget .widget-table-content tbody td:nth-child(5) {
    min-width: 120px;
    max-width: 160px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

#pinHistoryWidget .loyalty-pin-source-cell {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
    font-size: 0.7rem;
}

/* PIN History Widget - User column */
#pinHistoryWidget .widget-table-content thead th:nth-child(6),
#pinHistoryWidget .widget-table-content tbody td:nth-child(6) {
    min-width: 180px;
    max-width: 250px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
}

/* PIN History Widget - User info container */
.pin-history-user-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* PIN History Widget - User name */
.pin-user-name {
    font-size: 0.7rem;
    color: #495057;
    line-height: 1.4;
}

/* PIN History Widget - User ID, Email, Phone */
.pin-user-id,
.pin-user-email,
.pin-user-phone {
    font-size: 0.7rem;
    color: #495057;
    line-height: 1.4;
}

/* PIN History Widget - User label */
.pin-user-label {
    font-weight: 500;
    color: #6c757d;
    margin-right: 0.25rem;
}

/* PIN History Widget - User cell */
.pin-history-user-cell {
    vertical-align: top;
}

/* PIN History Widget - Merchant info (more compact with text wrapping) */
#pinHistoryWidget .merchant-info {
    gap: 4px;
    white-space: normal;
    flex-wrap: wrap;
    align-items: flex-start;
}

#pinHistoryWidget .merchant-id-badge {
    padding: 2px 4px;
    font-size: 0.65rem;
    min-width: 30px;
    flex-shrink: 0;
}

#pinHistoryWidget .merchant-name-text {
    font-size: 0.7rem;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

/* PIN History Widget - Row style for deleted users */
#pinHistoryWidget .widget-table-content tbody tr.pin-history-deleted-user {
    background-color: #f8d7da !important; /* Light red background */
}

#pinHistoryWidget .widget-table-content tbody tr.pin-history-deleted-user td {
    color: #dc3545 !important; /* Red text for deleted users */
}

/* PIN History Widget - Apply red color to Merchant column elements for deleted users */
#pinHistoryWidget .widget-table-content tbody tr.pin-history-deleted-user td .merchant-info,
#pinHistoryWidget .widget-table-content tbody tr.pin-history-deleted-user td .merchant-id-badge,
#pinHistoryWidget .widget-table-content tbody tr.pin-history-deleted-user td .merchant-name-text {
    color: #dc3545 !important; /* Red text for deleted users */
}

/* PIN History Widget - Apply red color to User column elements for deleted users */
#pinHistoryWidget .widget-table-content tbody tr.pin-history-deleted-user td .pin-history-user-info,
#pinHistoryWidget .widget-table-content tbody tr.pin-history-deleted-user td .pin-user-name,
#pinHistoryWidget .widget-table-content tbody tr.pin-history-deleted-user td .pin-user-id,
#pinHistoryWidget .widget-table-content tbody tr.pin-history-deleted-user td .pin-user-email,
#pinHistoryWidget .widget-table-content tbody tr.pin-history-deleted-user td .pin-user-phone,
#pinHistoryWidget .widget-table-content tbody tr.pin-history-deleted-user td .pin-user-label {
    color: #dc3545 !important; /* Red text for deleted users */
}

/* Custom scrollbar for widget tables */
.widget-table::-webkit-scrollbar {
    width: 8px;
}

.widget-table::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.widget-table::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.widget-table::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Loading Components */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.progress-container {
    width: 300px;
    height: 4px;
    background-color: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    background-color: #007bff;
    animation: progress-animation 1.5s ease-in-out infinite;
}

.loading-text {
    color: #6c757d;
    font-size: 1rem;
}

.loading-component {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.progress-container-component {
    width: 200px;
    height: 3px;
    background-color: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-component {
    height: 100%;
    background-color: #007bff;
    animation: progress-animation 1.5s ease-in-out infinite;
}

.loading-text-component {
    color: #6c757d;
    font-size: 0.9rem;
}

@keyframes progress-animation {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Status Badges */
.status-badge {
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 500;
    display: inline-block;
    white-space: nowrap;
}

.status-live {
    background-color: #ffc107;
    color: #000;
}

.status-captured {
    background-color: #28a745;
    color: #fff;
}

.status-uncaptured {
    background-color: #ffc107;
    color: #000;
}

.status-incomplete {
    background-color: #6c757d;
    color: #fff;
}

.status-cancelled {
    background-color: #dc3545;
    color: #fff;
}

/* Merchant Column - Minimized */
#orderHistoryTable thead th[data-column="merchant"],
#orderHistoryTable tbody td.merchant-cell {
    width: 1.75%;
    white-space: normal;
    max-width: 400px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    word-wrap: break-word;
    line-height: 1.3;
}

/* Order ID Column - Optimized */
#orderHistoryTable thead th[data-column="orderId"],
#orderHistoryTable tbody td.order-id-cell {
    width: 1%;
    white-space: nowrap;
    max-width: 80px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    font-size: 0.8rem;
}

/* User Column - When multiple users present */
#orderHistoryTable thead th[data-column="user"],
#orderHistoryTable tbody td.user-name-cell {
    width: 1%;
    white-space: normal;
    max-width: 180px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    word-wrap: break-word;
    line-height: 1.3;
}

/* Order Type Column - Optimized with wrapping for data cells only */
#orderHistoryTable thead th[data-column="orderType"],
#orderHistoryTable tbody td.order-type-cell {
    width: 1.25%;
    white-space: normal;
    max-width: 140px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    word-wrap: break-word;
    line-height: 1.3;
}

#orderHistoryTable thead th[data-column="orderType"] {
    white-space: nowrap;
}

/* Price Column - Optimized */
#orderHistoryTable thead th[data-column="price"],
#orderHistoryTable tbody td.price-cell {
    width: 0.75%;
    white-space: nowrap;
    max-width: 50px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Status Column - Optimized */
#orderHistoryTable thead th[data-column="status"],
#orderHistoryTable tbody td.status-cell {
    width: 1%;
    white-space: normal;
    max-width: 140px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    word-wrap: break-word;
    line-height: 1.3;
}

/* Date Column - Optimized with wrapping */
#orderHistoryTable thead th[data-column="date"],
#orderHistoryTable tbody td.date-cell {
    width: 1%;
    white-space: normal;
    max-width: 110px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.3;
    word-wrap: break-word;
}

#orderHistoryTable tbody td.date-cell {
    font-size: 0.7rem;
}

/* Order Number Column - Optimized */
#orderHistoryTable thead th[data-column="orderNumber"],
#orderHistoryTable tbody td.order-number-cell {
    width: 1%;
    white-space: nowrap;
    max-width: 90px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    font-size: 0.8rem;
}

/* Refund Column - Optimized */
#orderHistoryTable thead th[data-column="refunded"],
#orderHistoryTable tbody td.refunded-cell {
    width: 0.85%;
    white-space: nowrap;
    max-width: 50px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Charge ID Column - Optimized with small font */
#orderHistoryTable thead th[data-column="chargeId"],
#orderHistoryTable tbody td.charge-id-cell {
    width: 1%;
    white-space: normal;
    max-width: 140px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    word-wrap: break-word;
    line-height: 1.3;
}

#orderHistoryTable tbody td.charge-id-cell {
    font-size: 9px;
}

/* Charge ID Link Styling */
#orderHistoryTable .charge-id-link {
    color: #007bff;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

#orderHistoryTable .charge-id-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Order Type Badges */
.order-type-badge {
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.65rem;
    font-weight: 500;
    display: inline-block;
    background-color: #007bff;
    color: #fff;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.3;
    max-width: 100%;
}

/* Merchant Display - Same style as Reminder table */
.merchant-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    white-space: normal;
    flex-wrap: wrap;
}

.merchant-id-badge {
    background-color: #e9ecef;
    color: #495057;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-block;
    min-width: 35px;
    text-align: center;
    flex-shrink: 0;
}

.merchant-name-text {
    color: #495057;
    font-size: 0.8rem;
    overflow: visible;
    text-overflow: clip;
    display: inline-block;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.3;
}

/* Pagination */
.pagination {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Pagination container - flex layout to prevent overlap */
#paginationNav > div {
    min-height: 2rem;
    width: 100%;
}

/* Items per page container */
#itemsPerPageContainer {
    flex-shrink: 0;
}

/* Center pagination relative to table on large screens */
@media (min-width: 1323px) {
    #paginationNav > div {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: relative;
    }
    
    #itemsPerPageContainer {
        flex-shrink: 0;
        order: 1;
    }
    
    #pagination {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        order: 2;
        z-index: 1;
    }
    
    #paginationSpacer {
        flex-shrink: 0;
        order: 3;
        visibility: hidden;
        height: 0;
        overflow: hidden;
    }
}

/* Pagination icon buttons */
.pagination .page-link i {
    font-size: 0.875rem;
}

/* Items per page dropdown in pagination */
#itemsPerPageSelect {
    min-width: 70px;
    display: inline-block;
}

/* Responsive pagination layout - prevent overlap on medium screens */
@media (max-width: 1320px) and (min-width: 769px) {
    #paginationNav > div {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    #itemsPerPageContainer {
        order: 2;
    }
    
    #pagination {
        order: 1;
    }
    
    #paginationSpacer {
        display: none;
    }
}

/* Add gap between pagination and widgets on medium screens */
@media (min-width: 769px) and (max-width: 991px) {
    #paginationNav {
        margin-bottom: 2rem;
    }
}

/* Hide items per page on mobile */
@media (max-width: 768px) {
    #itemsPerPageSelect,
    label[for="itemsPerPageSelect"],
    #itemsPerPageContainer {
        display: none !important;
    }
    
    #paginationNav > div {
        display: flex;
        justify-content: center;
    }
    
    #paginationSpacer {
        display: none;
    }
}

.page-link {
    color: #007bff;
    border: 1px solid #dee2e6;
}

.page-link:hover {
    color: #0056b3;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.page-item.active .page-link {
    background-color: #007bff;
    border-color: #007bff;
    color: #fff;
}

.page-item.disabled .page-link {
    color: #6c757d;
    pointer-events: none;
    cursor: auto;
    background-color: #fff;
    border-color: #dee2e6;
}

/* Modal Styles */
.modal-body .row {
    margin-bottom: 1rem;
}

/* Copy Charge ID Button */
.copy-charge-id-btn {
    color: #6c757d;
    font-size: 0.875rem;
    transition: color 0.2s ease;
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.copy-charge-id-btn:hover {
    color: #007bff;
}

.copy-charge-id-btn:focus {
    outline: none;
    box-shadow: none;
}

.copy-charge-id-btn i {
    font-size: 0.875rem;
}

/* Open Charge ID Link Button */
.open-charge-id-link-btn {
    color: #6c757d;
    font-size: 0.875rem;
    transition: color 0.2s ease;
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.open-charge-id-link-btn:hover {
    color: #007bff;
}

.open-charge-id-link-btn:focus {
    outline: none;
    box-shadow: none;
}

.open-charge-id-link-btn i {
    font-size: 0.875rem;
}

/* Open User Tab Button */
.open-user-tab-btn {
    color: #6c757d;
    font-size: 0.875rem;
    transition: color 0.2s ease;
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.open-user-tab-btn:hover {
    color: #007bff;
}

.open-user-tab-btn:focus {
    outline: none;
    box-shadow: none;
}

.open-user-tab-btn i {
    font-size: 0.875rem;
}

.modal-body strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #495057;
    font-size: 0.875rem;
}

.modal-body div {
    color: #212529;
    font-size: 0.95rem;
}

/* Main Content and Widgets Column Widths - 6:4 Ratio */
@media (min-width: 992px) {
    .main-content-column {
        flex: 0 0 60%;
        max-width: 60%;
    }
    
    .widgets-column {
        flex: 0 0 40%;
        max-width: 40%;
        display: flex;
        flex-direction: column;
    }
    
    /* Make widgets fill available space */
    .widgets-container {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        margin-top: 0;
    }
    
    .widget-card {
        flex: 0 0 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }
    
    .widget-card:last-child {
        margin-bottom: 0;
    }
    
    /* Make widget tables expand to fill available space */
    .widget-card .card-body {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }
    
    .widget-table-wrapper {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }
    
    .widget-table {
        flex: 1;
        min-height: 0;
    }
}

/* Compact table row height */
#orderHistoryTable tbody tr {
    height: auto;
    min-height: 35px;
}

/* Reduce widget card header font size */
.widget-card .card-header h6 {
    font-size: 0.85rem;
}

/* Compact form labels */
.form-label.small {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

/* Compact search form spacing */
#searchForm .row {
    margin-bottom: 0.25rem;
}

#searchForm .row.mt-1 {
    margin-top: 0.25rem !important;
}

/* Responsive Design */
@media (max-width: 991.98px) {
    .widgets-container {
        position: static;
        margin-top: 1rem;
    }
}

@media (max-width: 768px) {
    .content-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-container {
        width: 100%;
        margin-top: 10px;
    }
    
    .table-responsive {
        font-size: 0.8rem;
        margin: 0 -15px;
        border-left: none;
        border-right: none;
        border-radius: 0;
    }
    
    .table th,
    .table td {
        padding: 8px 4px;
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Ensure all order history table columns wrap on mobile */
    #orderHistoryTable th,
    #orderHistoryTable td {
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        line-height: 1.3;
    }
    
    /* Specific column wrapping on mobile */
    #orderHistoryTable tbody td.order-id-cell,
    #orderHistoryTable tbody td.price-cell,
    #orderHistoryTable tbody td.refunded-cell,
    #orderHistoryTable tbody td.order-number-cell {
        white-space: normal !important;
        word-wrap: break-word !important;
    }
    
    /* Merchant info wrapping on mobile - ID badge on first line, name on second line */
    #orderHistoryTable .merchant-info {
        flex-direction: column !important;
        align-items: flex-start !important;
        white-space: normal !important;
        gap: 4px !important;
    }
    
    #orderHistoryTable .merchant-id-badge {
        width: auto !important;
        flex-shrink: 0 !important;
    }
    
    #orderHistoryTable .merchant-name-text {
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow: visible !important;
        width: 100% !important;
    }
    
    .widget-card {
        max-height: 300px;
    }
    
    .widget-table {
        max-height: 200px; /* Show approximately 4 rows on mobile */
    }
    
    /* Add space between pagination and widgets on mobile */
    #paginationNav {
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    #orderHistoryTable {
        min-width: 700px;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .widget-card .card-body {
        padding: 0.5rem;
    }
}

/* Search Button - Minimized with no padding */
#searchBtn {
    padding: 0.25rem 0.5rem;
    min-width: auto;
    width: auto;
}

/* Search Button Loading Spinner */
#searchBtn i.fa-spinner {
    animation: fa-spin 1s infinite linear;
}

#searchBtn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

