/* ==========================================================================
   Fiori Table Components, Toolbars, Scroll Containers, & Pagination
   ========================================================================== */

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.fiori-so-items-section {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

.fiori-so-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.fiori-so-table th {
    background-color: #1d2d3e;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
    border: 1px solid #1c2d3d;
}

.fiori-so-table td {
    padding: 8px;
    border: 1px solid #e2e8f0;
    vertical-align: middle;
}

.fiori-so-table input[type="text"],
.fiori-so-table input[type="number"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
}

.fiori-so-table input[type="text"]:focus,
.fiori-so-table input[type="number"]:focus {
    border-color: var(--primary, #3E50EB);
    box-shadow: 0 0 0 2px var(--primary-focus, rgba(62, 80, 235, 0.15));
    outline: none;
}

/* Minimal Table Styles */
.fiori-minimal-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.fiori-minimal-table-toolbar .title-area {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.fiori-minimal-table-toolbar .actions-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fiori-minimal-btn {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    color: #475569;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    box-sizing: border-box;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.fiori-minimal-btn:hover {
    background-color: #f8fafc;
    border-color: #94a3b8;
    color: #1e293b;
}

.fiori-minimal-btn-primary,
.fiori-minimal-table-toolbar .actions-area .fiori-minimal-btn.fiori-minimal-btn-primary {
    background-color: var(--primary, #3E50EB) !important;
    border-color: var(--primary, #3E50EB) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px var(--primary-focus, rgba(62, 80, 235, 0.25));
    transition: background-color 0.2s, border-color 0.2s, transform 0.1s, box-shadow 0.2s;
}

.fiori-minimal-btn-primary:hover,
.fiori-minimal-table-toolbar .actions-area .fiori-minimal-btn.fiori-minimal-btn-primary:hover {
    background-color: var(--primary-hover, #243BD4) !important;
    border-color: var(--primary-hover, #243BD4) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px var(--primary-focus, rgba(62, 80, 235, 0.35));
}

.fiori-minimal-btn-primary:active,
.fiori-minimal-table-toolbar .actions-area .fiori-minimal-btn.fiori-minimal-btn-primary:active {
    background-color: var(--primary-active, #17289A) !important;
    border-color: var(--primary-active, #17289A) !important;
    transform: translateY(0);
}

.fiori-minimal-table {
    width: 100%;
    border-collapse: collapse;
}

#pr-items-table {
    min-width: 100%;
}

.fiori-minimal-table th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 12.5px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    padding: 11px 14px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
}

.fiori-minimal-table td {
    padding: 10px 14px;
    font-size: 12.5px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.fiori-minimal-table tbody tr:hover {
    background-color: #f8fafc;
}

/* Document Item Tables (TO, Billing, Delivery, etc.) */
.fiori-item-table th,
#confirm-to-items-table th,
#to-items-table th,
#billing-items-table th {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    background-color: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.fiori-item-table td,
#confirm-to-items-table td,
#to-items-table td,
#billing-items-table td {
    padding: 10px 12px;
    font-size: 13px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.fiori-item-table tbody tr:hover,
#confirm-to-items-table tbody tr:hover,
#to-items-table tbody tr:hover,
#billing-items-table tbody tr:hover {
    background-color: #f8fafc;
}

.btn-delete-row:hover {
    color: #dc2626 !important;
    transform: scale(1.15);
}

/* Pagination Bar */
.fiori-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    font-size: 13px;
    color: #475569;
}

.pagination-info {
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination-btn {
    width: 28px;
    height: 28px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 14px !important;
    font-weight: 600;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Report Table Highlights & Scroll Containers */
.input-highlight-yellow {
    background-color: #fef08a !important;
    border-color: #facc15 !important;
    font-weight: 500;
}

.text-highlight-yellow {
    background-color: #fef08a !important;
    color: #854d0e !important;
}

/* ==========================================================================
   Modern SAP Fiori Horizon Analytical & Report Table Component
   ========================================================================== */

.select-scroll-container,
.swf-table-scroll-container {
    width: 100%;
    max-width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    background-color: #ffffff;
    box-shadow: none !important;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
    -webkit-overflow-scrolling: touch;
}

/* Custom Sleek Modern Horizontal Scrollbar */
.select-scroll-container::-webkit-scrollbar,
.swf-table-scroll-container::-webkit-scrollbar {
    height: 8px;
}

.select-scroll-container::-webkit-scrollbar-track,
.swf-table-scroll-container::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 4px;
}

.select-scroll-container::-webkit-scrollbar-thumb,
.swf-table-scroll-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    border: 2px solid #f8fafc;
}

.select-scroll-container::-webkit-scrollbar-thumb:hover,
.swf-table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Report Table Base */
.fiori-report-table,
.swf-report-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    text-align: left;
    background: #ffffff;
}

.fiori-report-table.table-wide,
.swf-report-table.table-wide {
    min-width: 100%;
}

.fiori-report-table th,
.swf-report-table th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 11px 14px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    user-select: none;
    min-width: auto;
}

.fiori-report-table td,
.swf-report-table td {
    padding: 10px 14px;
    font-size: 12.5px;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    white-space: nowrap;
    transition: background-color 0.12s ease;
}

/* ==========================================================================
   Universal Column Sizing: Action & No/Index (Auto / Fit-to-Content across ALL Tables)
   ========================================================================== */

/* Universal Action Column: Wrap tightly to action button/icon (Auto width / Hug content) */
table th.col-action,
table td.col-action,
table th.col-aksi,
table td.col-aksi,
table th.col-delete,
table td.col-delete,
.fiori-report-table th.col-action,
.fiori-report-table td.col-action,
.swf-report-table th.col-action,
.swf-report-table td.col-action,
.fiori-minimal-table th.col-action,
.fiori-minimal-table td.col-action,
.col-action,
.col-aksi,
.col-delete,
table th:has(> .btn-action-detail),
table td:has(> .btn-action-detail),
table th:has(> .btn-delete-row),
table td:has(> .btn-delete-row),
table th[style*="Aksi"],
table th[style*="Action"],
table td:has(> a.btn-action-detail) {
    width: 1% !important;
    min-width: 0 !important;
    width: auto !important;
    padding: 5px 6px !important;
    text-align: center !important;
    white-space: nowrap !important;
}

/* Universal No / Index / Item Column: Compact narrow size (Auto width / Hug content) */
table th.col-no,
table td.col-no,
table th.col-item,
table td.col-item,
table th.col-idx,
table td.col-idx,
table th.col-pos,
table td.col-pos,
.fiori-report-table th.col-no,
.fiori-report-table td.col-no,
.swf-report-table th.col-no,
.swf-report-table td.col-no,
.fiori-minimal-table th.col-no,
.fiori-minimal-table td.col-no,
.fiori-report-table th.swf-col-idx,
.swf-report-table th.swf-col-idx,
.fiori-report-table td.swf-col-idx,
.swf-report-table td.swf-col-idx,
.col-no,
.col-item,
.col-idx,
.col-pos,
.swf-col-idx {
    width: 1% !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: 50px !important;
    padding: 5px 8px !important;
    text-align: center !important;
    white-space: nowrap !important;
    color: #64748b;
    font-size: 12px;
}

/* Override legacy inline width on Action and No/Item columns */
table th[style*="width: 60px"]:first-child,
table td[style*="width: 60px"]:first-child,
table th[style*="width:60px"]:first-child,
table td[style*="width:60px"]:first-child,
table th[style*="width: 55px"]:first-child,
table td[style*="width: 55px"]:first-child,
table th[style*="width:55px"]:first-child,
table td[style*="width:55px"]:first-child,
table th[style*="width: 50px"]:first-child,
table td[style*="width: 50px"]:first-child,
table th[style*="width:50px"]:first-child,
table td[style*="width:50px"]:first-child,
table th[style*="width: 45px"],
table td[style*="width: 45px"],
table th[style*="width:45px"],
table td[style*="width:45px"] {
    width: 1% !important;
    min-width: 0 !important;
    width: auto !important;
    padding: 5px 6px !important;
    text-align: center !important;
}

table th[style*="width: 50px"]:nth-child(2),
table td[style*="width: 50px"]:nth-child(2),
table th[style*="width: 40px"],
table td[style*="width: 40px"],
table th[style*="width:50px"]:nth-child(2),
table td[style*="width:50px"]:nth-child(2),
table th[style*="width:40px"],
table td[style*="width:40px"] {
    width: 1% !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: 48px !important;
    padding: 5px 6px !important;
    text-align: center !important;
}

/* Sticky First Column (# Index) when scrolling horizontally */
.fiori-report-table th.swf-col-idx,
.swf-report-table th.swf-col-idx,
.fiori-report-table td.swf-col-idx,
.swf-report-table td.swf-col-idx {
    position: sticky;
    left: 0;
    z-index: 2;
    background-color: #ffffff;
    border-right: 1px solid #e2e8f0;
    min-width: 42px !important;
    max-width: 48px !important;
    width: 42px !important;
    text-align: center;
    padding: 5px 4px !important;
}

.fiori-report-table th.swf-col-idx,
.swf-report-table th.swf-col-idx {
    background-color: #f8fafc !important;
    z-index: 3;
}

.fiori-report-table tbody tr:not(.swf-empty-row):hover td.swf-col-idx,
.swf-report-table tbody tr:not(.swf-empty-row):hover td.swf-col-idx {
    background-color: #f0f7ff !important;
}

.fiori-report-table tbody tr:nth-child(even) td.swf-col-idx,
.swf-report-table tbody tr:nth-child(even) td.swf-col-idx {
    background-color: #fafbfc;
}

.fiori-report-table tbody tr:not(.swf-empty-row):nth-child(even):hover td.swf-col-idx,
.swf-report-table tbody tr:not(.swf-empty-row):nth-child(even):hover td.swf-col-idx {
    background-color: #f0f7ff !important;
}

/* Zebra & Hover */
.fiori-report-table tbody tr:not(.swf-empty-row):hover td:not([class*="swf-col-color-"]),
.swf-report-table tbody tr:not(.swf-empty-row):hover td:not([class*="swf-col-color-"]) {
    background-color: #f0f7ff !important;
}

.fiori-report-table tbody tr:nth-child(even) td,
.swf-report-table tbody tr:nth-child(even) td {
    background-color: #fafbfc;
}

.fiori-report-table tbody tr:not(.swf-empty-row):nth-child(even):hover td:not([class*="swf-col-color-"]),
.swf-report-table tbody tr:not(.swf-empty-row):nth-child(even):hover td:not([class*="swf-col-color-"]) {
    background-color: #f0f7ff !important;
}

/* Fiori Horizon Card & Toolbar */
.swf-table-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    margin-top: 20px;
    margin-bottom: 20px;
    overflow: hidden;
    box-sizing: border-box;
}

.swf-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    gap: 12px;
    flex-wrap: wrap;
}

.swf-table-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.swf-table-icon-badge {
    width: 30px;
    height: 30px;
    background: #eff6ff;
    color: #0070f2;
    border: 1px solid #dbeafe;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.swf-table-title {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-bottom: none !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    letter-spacing: -0.2px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.swf-table-count-badge {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.swf-table-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.swf-table-search {
    position: relative;
    display: flex;
    align-items: center;
}

.swf-table-search i {
    position: absolute;
    left: 10px;
    font-size: 12px;
    color: #94a3b8;
    pointer-events: none;
}

.swf-table-search input {
    height: 34px;
    padding: 0 12px 0 32px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 12.5px;
    width: 220px;
    outline: none;
    background: #ffffff;
    color: #1e293b;
    box-sizing: border-box;
    transition: all 0.15s ease;
}

.swf-table-search input:focus {
    border-color: #0070f2;
    box-shadow: 0 0 0 3px rgba(0, 112, 242, 0.12);
    width: 250px;
}

.swf-btn-table-action {
    height: 34px;
    padding: 0 12px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #475569;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
    box-sizing: border-box;
}

.swf-btn-table-action:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

/* Table Badges & Cell Types - Standardized to Plus Jakarta Sans */
.swf-table-card,
.swf-table-toolbar,
.swf-report-table,
.fiori-report-table,
.swf-report-table th,
.swf-report-table td,
.fiori-report-table th,
.fiori-report-table td,
.swf-th-badge,
.swf-col-idx,
.swf-col-price,
.swf-col-year,
.swf-badge-currency,
.swf-cell-badge,
.swf-table-footer {
    font-family: var(--font-family-base) !important;
}

.swf-th-badge {
    font-size: 9.5px;
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 1px 5px;
    font-weight: 600;
    margin-left: 4px;
    text-transform: none;
    letter-spacing: 0;
}

.swf-col-idx {
    width: 50px;
    text-align: center;
    color: #64748b;
    font-size: 12.5px;
    font-weight: 600;
}

.swf-col-price {
    text-align: right !important;
    font-weight: 700;
    color: #0f172a;
    font-size: 13px;
}

.swf-col-year {
    text-align: center;
    color: #475569;
    font-weight: 600;
    font-size: 13px;
}

.swf-badge-currency {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 7px;
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.swf-cell-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

/* Empty State Styling */
.swf-empty-state-wrap {
    padding: 48px 24px;
    text-align: center;
    background: #ffffff;
}

.swf-empty-state-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 14px;
}

.swf-empty-icon-blue {
    background: #eff6ff;
    color: #0070f2;
    border: 1px solid #dbeafe;
}

.swf-empty-icon-amber {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fef3c7;
}

.swf-empty-state-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 6px 0;
}

.swf-empty-state-desc {
    font-size: 13px;
    color: #64748b;
    margin: 0 auto;
    max-width: 460px;
    line-height: 1.5;
}

/* Table Footer Summary Bar */
.swf-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: 12.5px;
    color: #64748b;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-action-detail {
    background-color: var(--primary-light, #eff6ff);
    color: var(--primary, #2563eb);
    border: 1px solid var(--primary-border, #bfdbfe);
    width: 26px;
    height: 26px;
    padding: 3px;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-sizing: border-box;
    text-decoration: none;
}

.btn-action-detail svg {
    width: 13px;
    height: 13px;
}

.btn-action-detail:hover {
    background-color: var(--primary, #2563eb);
    color: #ffffff;
    border-color: var(--primary, #2563eb);
}

#report-search:focus,
#fiori-search-help-search:focus {
    border-color: #0070f2 !important;
    box-shadow: 0 0 0 3px rgba(0, 112, 242, 0.12);
}

.fiori-search-help-row {
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.fiori-search-help-row:hover {
    background-color: #f1f5f9;
}

.fiori-search-help-row:active {
    background-color: #e2e8f0;
}

