/* List Pages
   Full-page table list pages (Customers, Suppliers, Branches ...) and UnifiedDataTable toolbar */

/* ======= FULL PAGE TABLE LIST STYLES ======= */
/* For list pages like Customers, Suppliers, Branches, Customs Companies */
/* Card-based layout with green header matching Returns page */

.list-page {
    padding: 0;
}

/* Flex layout for full-height table fill */
.list-page.list-page-flex {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.list-page-card.list-page-card-flex {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.list-page-table-fill {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.list-page-body {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.list-page-loading-overlay,
.pi-list-loading-overlay,
.returns-list-loading-overlay,
.pof-list-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(1px);
    pointer-events: none;
}

.list-page-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: var(--spacing-md) 0;
    margin-bottom: var(--spacing-md);
    direction: ltr; /* Keep "New" button on the right in both LTR and RTL */
}

/* Card-based content wrapper */
.list-page-card {
    background: var(--card-bg-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* Simple minimal header - clean, professional */
.list-page-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
}

.list-page-card-header h6 {
    margin: 0;
    font-weight: 500;
    font-size: 0.9375rem;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.list-page-card-header h6 i {
    font-size: 0.8125rem;
    color: #94a3b8;
}

.list-page-card-header .badge {
    background: #f8fafc;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.list-page-card-header .header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.list-page-card-header .header-controls select {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius-sm);
    background: #fff;
    color: #334155;
    cursor: pointer;
}

.list-page-card-header .header-controls select option {
    color: var(--dark-color);
}

/* Search and Filter Bar */
.list-page-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5625rem 1rem;
    background: #fafbfa;
    border-bottom: 1px solid #e3e8e6;
}

.list-page-search {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.list-page-search input {
    width: 100%;
    height: 34px;
    padding: 0 0.75rem 0 2rem;
    font-size: 0.8125rem;
    border: 1px solid #e3e8e6;
    border-radius: 999px;
    background: white;
    transition: all var(--transition-fast);
}

.list-page-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.14);
}

.list-page-search input::placeholder {
    color: #94a3b8;
}

.list-page-search i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.8125rem;
}

html[dir="rtl"] .list-page-search input {
    padding: 0 2rem 0 0.75rem;
}

html[dir="rtl"] .list-page-search i {
    left: auto;
    right: 0.75rem;
}

.list-page-filters {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.list-page-filters select {
    height: 34px;
    padding: 0 1.875rem 0 0.75rem;
    font-size: 0.8125rem;
    border: 1px solid #e3e8e6;
    border-radius: 999px;
    background: white;
    cursor: pointer;
    min-width: 110px;
}

.list-page-filters select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Table wrapper with scrolling */
.list-page-table-wrapper {
    max-height: calc(100vh - 320px);
    overflow-y: auto;
}

.list-page-table-wrapper::-webkit-scrollbar {
    width: 6px;
}

.list-page-table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.list-page-table-wrapper::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.list-page-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Clean table styles matching Returns page */
.list-page-table-wrapper .table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.list-page-table-wrapper .table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.list-page-table-wrapper .table thead th {
    background: #f8f9fa;
    color: #495057;
    font-weight: 600;
    font-size: 0.8125rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #dee2e6;
    white-space: nowrap;
}

.list-page-table-wrapper .table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    font-size: 0.875rem;
    color: #212529;
    border-bottom: 1px solid #e9ecef;
}

.list-page-table-wrapper .table tbody tr:hover {
    background-color: #f8f9fa;
}

.list-page-table-wrapper .table tbody tr:last-child td {
    border-bottom: none;
}

/* Pagination in card footer */
.list-page-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    background: #f8f9fa;
    font-size: 0.8125rem;
    color: #6c757d;
}

/* Loading and empty states */
.list-page-loading,
.list-page-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.list-page-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Keep list-page card visible */
.list-page-card {
    display: block;
}

/* UnifiedDataTable: no stripes, only thin lines between rows */
.unified-data-table .udt-table-wrapper tbody tr td {
    background: #fff !important;
}

/* UnifiedDataTable toolbar filter: override Bootstrap/default select styles */
.unified-data-table .udt-toolbar .udt-filter-wrap select,
.unified-data-table .udt-toolbar select.udt-filter-select {
    height: 34px !important;
    min-width: 110px !important;
    padding: 0 1.875rem 0 0.75rem !important;
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    color: #1d2e29 !important;
    background-color: #fff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.625rem center !important;
    border: 1px solid #e3e8e6 !important;
    border-radius: 999px !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    outline: none !important;
    box-shadow: none !important;
}

html[dir="rtl"] .unified-data-table .udt-toolbar .udt-filter-wrap select,
html[dir="rtl"] .unified-data-table .udt-toolbar select.udt-filter-select {
    padding: 0 0.75rem 0 1.875rem !important;
    background-position: left 0.625rem center !important;
}

/* Date filters in UnifiedDataTable toolbar — match select pills (selectors above only target select) */
.unified-data-table .udt-toolbar input[type="date"].udt-filter-select {
    height: 34px !important;
    min-width: 8.75rem !important;
    padding: 0 0.35rem 0 0.75rem !important;
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    color: #1d2e29 !important;
    background-color: #fff !important;
    background-image: none !important;
    border: 1px solid #e3e8e6 !important;
    border-radius: 999px !important;
    outline: none !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    line-height: 1.2 !important;
}

.unified-data-table .udt-toolbar input[type="date"].udt-filter-select::-webkit-date-and-time-value {
    text-align: start;
}

.unified-data-table .udt-toolbar input[type="date"].udt-filter-select::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.7;
}

.unified-data-table .udt-toolbar input[type="date"].udt-filter-select:hover {
    background-color: color-mix(in srgb, var(--primary-color) 6%, white) !important;
    border-color: color-mix(in srgb, var(--primary-color) 28%, white) !important;
}

.unified-data-table .udt-toolbar input[type="date"].udt-filter-select:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.14) !important;
    background-color: #fff !important;
}

html[dir="rtl"] .unified-data-table .udt-toolbar input[type="date"].udt-filter-select {
    padding: 0 0.75rem 0 0.35rem !important;
}

/* Inventory & Sales Period Report - force visible filter inputs (overrides any theme/global that hides them) */
.inventory-sales-period-report .report-filter-fields input.report-filter-input,
.inventory-sales-period-report .report-filter-fields select.report-filter-input {
    background-color: #fff !important;
    background-image: none !important;
    border: 1px solid #6c757d !important;
    border-radius: 6px !important;
    color: #212529 !important;
    min-height: 2.25rem !important;
    padding: 0.375rem 0.5rem !important;
    font-size: 0.875rem !important;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
}
