/* Tinx Customer Portal Styles - Sleek Modern Design */

/* CSS Variables for Styling */
:root {
    --tinx-cp-primary-color: #333333;
    --tinx-cp-secondary-color: #888888;
    --tinx-cp-text-color: #ffffff;
    --tinx-cp-text-color-detail: #ffffff;
    --tinx-cp-font-size: 14px;
    --tinx-cp-font-size-detail: 13px;
    --tinx-cp-font-size_extra: 13px;
    --tinx-cp-button-color: #f5f5f5;
    --tinx-cp-button-text-color: #333333;
    
    /* Sales Documents row styles */
    --tinx-cp-row-bg-color: #ffffff;
    --tinx-cp-row-alt-bg-color: #f3f3f3;
    --tinx-cp-row-text-color: #333333;
    --tinx-cp-row-font-size: 14px;
    
    /* Sales Lines row styles */
    --tinx-cp-detail-row-bg-color: #ffffff;
    --tinx-cp-detail-row-alt-bg-color: #f5f5f5;
    --tinx-cp-detail-row-text-color: #333333;
    --tinx-cp-detail-row-font-size: 13px;
}

.tinx-cp-section {
    margin-bottom: 2em;
}

/* Table controls section */
.tinx-cp-controls {
    /* display: flex; */
    justify-content: flex-start;
    margin-bottom: 1em;
    display: none;
}

/* Table container with better responsive approach */
.tinx-cp-table-container {
    width: 100%;
    margin-bottom: 1.5em;
    overflow-x: auto; /* Always allow horizontal scrolling */
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    -webkit-overflow-scrolling: touch;
    
}

/* When full-width mode is enabled */
.tinx-cp-table-container.tinx-cp-full-width {
    overflow-x: unset;
    max-width: none;
}

.tinx-cp-table-container.tinx-cp-full-width .tinx-cp-table {
    width: 100%;
    table-layout: auto;
}

/* Modern table styling */
.tinx-cp-table {
    width: 100%;
    /* border-collapse: collapse; */
    border-spacing: 0;
    margin: 0;
    table-layout: auto;
    font-size: var(--tinx-cp-font-size);
}

.tinx-cp-table th,
.tinx-cp-table td {
    padding: 0.75em 1em;
    text-align: left;
    border: none;
    border-bottom: 1px solid #f0f0f0;
}

.tinx-cp-table th {
    background-color: var(--tinx-cp-primary-color);
    font-weight: 600;
    color: var(--tinx-cp-text-color);
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Alternating row colors */
/* .tinx-cp-table tbody tr:not(.tinx-cp-details-row):nth-child(4n+1),
.tinx-cp-table tbody tr:not(.tinx-cp-details-row):nth-child(4n+2) {
    background-color: #ffffff;
}

.tinx-cp-table tbody tr:not(.tinx-cp-details-row):nth-child(4n+3),
.tinx-cp-table tbody tr:not(.tinx-cp-details-row):nth-child(4n+4) {
    background-color: #efefef;
} */

.tinx-cp-table tbody tr.tinx-cp-details-row {
    background-color: transparent;
}

.tinx-cp-table tr:last-child td {
    border-bottom: none;
}


/* Unified styling for expandable rows */
.tinx-cp-table tr.tinx-cp-details-row td {
    padding: 0;
}

.tinx-cp-table tr.tinx-cp-details-row td .tinx-cp-details-content {
    padding: 0em;
}

/* Create visual connection between parent row and its details */
.tinx-cp-parent-highlight {
    /* background-color: #f0f7ff !important; */
    /* border-left: 1.15px solid var(--tinx-cp-border-color);
    border-right: 1.15px solid var(--tinx-cp-border-color);
    border-top: 1.15px solid var(--tinx-cp-border-color); */
}

.tinx-cp-parent-highlight td {
    border-top: 1.15px solid var(--tinx-cp-border-color);
}

.tinx-cp-parent-highlight td:first-child {
    border-left: 1.15px solid var(--tinx-cp-border-color);
}

.tinx-cp-parent-highlight td:last-child {
    border-right: 1.15px solid var(--tinx-cp-border-color);
}

.tinx-cp-details-row.show {
    /* background-color: #f0f7ff; */
    /* border-left: 1.15px solid var(--tinx-cp-border-color);
    border-right: 1.15px solid var(--tinx-cp-border-color);
    border-bottom: 1.15px solid var(--tinx-cp-border-color); */
}

.tinx-cp-lines-table tr:last-child td {
    border-bottom: 1.15px solid var(--tinx-cp-border-color);
}


.tinx-cp-lines-table tr td:first-child {
    border-left: 1.15px solid var(--tinx-cp-border-color);
}

.tinx-cp-lines-table tr td:last-child {
    border-right: 1.15px solid var(--tinx-cp-border-color);
}

.tinx-cp-lines-table tr th:first-child {
    border-left: 1.15px solid var(--tinx-cp-border-color);
}

.tinx-cp-lines-table tr th:last-child {
    border-right: 1.15px solid var(--tinx-cp-border-color);
}

.tinx-cp-details-content {
    padding: 1em;
    background-color: #fafafa;
}

/* Action buttons */
.tinx-cp-actions {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: no-wrap;
}

.tinx-cp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5em 1em;
    background-color: var(--tinx-cp-button-color);
    color: var(--tinx-cp-button-text-color);
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.tinx-cp-btn:hover {
    background-color: #e8e8e8;
    color: #000;
}

/* Loading spinner */
.tinx-cp-loading {
    text-align: center;
    height: 20px;
    width: 20px;
}

.tinx-cp-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0,0,0,0.1);
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: tinx-cp-spin 0.8s linear infinite;
}

.tinx-cp-loading-more {
    font-style: italic;
    font-size: 0.9em;
    color: var(--tinx-cp-secondary-color);
    display: inline-block;
    margin-left: 5px;
    animation: tinx-cp-pulse 1.5s infinite;
}

/* Loading animation for the text indicator */
@keyframes tinx-cp-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

@keyframes tinx-cp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Details row transition */
.tinx-cp-details-row {
    transition: all 0.2s ease-in-out;
}

.tinx-cp-details-row.show {
    display: table-row;
}

/* Field checkboxes in admin */
.fields-container {
    max-height: 300px;
    overflow-y: auto;
    padding: 1em;
    border: 1px solid #f0f0f0;
    margin-top: 1em;
}

/* Detail view styles */
.tinx-cp-details-lines {
    /* margin: 0.5em 0; */
}

.tinx-cp-lines-table {
    /* width: 100%; */
    /* border-collapse: collapse; */
    border-spacing: 0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.tinx-cp-lines-table th,
.tinx-cp-lines-table td {
    padding: 0.6em 0.8em;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
}

/* Alternating row colors for Sales Liness too */
/* .tinx-cp-lines-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

.tinx-cp-lines-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
} */

.tinx-cp-table tr.tinx-cp-details-row td .tinx-cp-lines-table tbody td {
    padding: 0.6em 0.8em;
}

.tinx-cp-lines-table th {
    background-color: var(--tinx-cp-secondary-color);
    font-weight: 500;
    font-size: 0.9em;
    color: var(--tinx-cp-text-color_detail);
}

.tinx-cp-lines-table tr:hover {
    background-color: #f5f5f5;
}

.tinx-cp-details-content h3 {
    font-size: 1.1em;
    margin: 0.8em 0 0.5em;
    font-weight: 500;
    color: #333;
}

/* Loading indicators */
.tinx-cp-loading-more {
    font-style: italic;
    font-size: 0.9em;
    color: var(--tinx-cp-secondary-color);
    display: inline-block;
    margin-left: 5px;
    animation: tinx-cp-pulse 1.5s infinite;
}

.tinx-cp-load-complete {
    color: var(--tinx-cp-loading-color);
    padding: 4px 12px;
    border-radius: 3px;
    text-align: center;
    margin: 0;
    font-size: var(--tinx-cp-loading-font-size);
}

/* Loading animation */
@keyframes tinx-cp-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}


/* Responsive adjustments for smaller screens */
@media screen and (max-width: 768px) {
    .tinx-cp-table th,
    .tinx-cp-table td,
    .tinx-cp-lines-table th,
    .tinx-cp-lines-table td {
        padding: 0.5em 0.6em;
        font-size: 0.75em;
    }
    
    .tinx-cp-btn {
        padding: 0.4em 0.8em;
        font-size: 0.85em;
    }
    
    /* Show toggle button only on mobile */
    .tinx-cp-controls {
        display: flex;
    }
    
    /* Enable horizontal scrolling on mobile when necessary */
    .tinx-cp-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Make the nested Sales Liness scroll independently when needed */
.tinx-cp-details-row .tinx-cp-details-content {
    width: 100%;
    max-width: 100%;
}

.woocommerce-account .wp-block-post-title, .woocommerce-account main .woocommerce, .woocommerce-cart .wp-block-post-title, .woocommerce-cart main .woocommerce, .woocommerce-checkout .wp-block-post-title, .woocommerce-checkout main .woocommerce {
    max-width: 90vw;
}

.woocommerce-account .woocommerce-MyAccount-content {
    width: 70%;
}

.woocommerce-MyAccount-navigation ul li.woocommerce-MyAccount-navigation-link--business-central-info a {
    /* font-weight: bold; */
    cursor: default;
    pointer-events: none;
}

.tinx-cp-endpoint .woocommerce-MyAccount-navigation ul li.woocommerce-MyAccount-navigation-link--business-central-info a { 
    font-weight: bold;
}

/* Enhanced collapsible menu styles with animated arrow */
.woocommerce-MyAccount-navigation li.bc-section-header {
    position: relative;
}

.woocommerce-MyAccount-navigation li.bc-section-header a {
    position: relative;
    /* font-weight: 600; */
    cursor: pointer;
}

/* Style the toggle icon using :after pseudo-element */
.woocommerce-MyAccount-navigation li.bc-section-header a:after {
    content: '';
    position: absolute;
    right: -20px;
    top: 60%;
    transform: translateY(-50%) rotate(-180deg);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #333333;
    transition: transform 0.3s ease;
}

/* Rotate the arrow when collapsed */
.woocommerce-MyAccount-navigation li.bc-section-header.collapsed a:after {
    transform: translateY(-50%) rotate(0deg);
}

/* Hover effect on the arrow */
.woocommerce-MyAccount-navigation li.bc-section-header:hover a:after {
    border-top-color: #222;
}

.woocommerce-MyAccount-navigation li.bc-submenu-item {
    padding-left: 15px;
    border-left: 2px solid #33333310;
    margin-left: 10px;
    font-size: 0.95em;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease, margin 0.3s ease;
    overflow: hidden;
    max-height: 40px; /* Approximate height of a nav item */
    opacity: 1;
}

.woocommerce-MyAccount-navigation li.bc-submenu-item a {
    padding-top: 8px;
    padding-bottom: 8px;
}

.woocommerce-MyAccount-navigation li.bc-submenu-item.hidden {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    opacity: 0;
    pointer-events: none;
}

/* Make Business Central header clickable */
.woocommerce-MyAccount-navigation ul li.woocommerce-MyAccount-navigation-link--business-central-info a {
    /* font-weight: 600; */
    cursor: pointer;
    pointer-events: auto;
}

/* Responsive tables using "No More Tables" approach */
@media only screen and (max-width: 768px) {
    /* Force tables to not be like tables anymore */
    .tinx-cp-table,
    .tinx-cp-table thead, 
    .tinx-cp-table tbody, 
    .tinx-cp-table th, 
    .tinx-cp-table td, 
    .tinx-cp-table tr,
    .tinx-cp-lines-table,
    .tinx-cp-lines-table thead, 
    .tinx-cp-lines-table tbody, 
    .tinx-cp-lines-table th, 
    .tinx-cp-lines-table td, 
    .tinx-cp-lines-table tr { 
        display: block; 
    }
 
    /* Hide table headers (but not display: none;, for accessibility) */
    .tinx-cp-table thead tr,
    .tinx-cp-lines-table thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
 
    .tinx-cp-table tr,
    .tinx-cp-lines-table tr { 
        border: 1px solid #eee; 
        margin-bottom: 1em;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        background-color: #fff;
    }
 
    .tinx-cp-table td,
    .tinx-cp-lines-table td { 
        /* Behave like a "row" */
        border: none;
        border-bottom: 1px solid #eee; 
        position: relative;
        padding-left: 40% !important; 
        min-height: 30px;
        text-align: left;
        text-overflow: ellipsis;
        overflow: hidden;
    }
 
    .tinx-cp-table td:before,
    .tinx-cp-lines-table td:before { 
        /* Now like a table header */
        content: attr(data-title);
        position: absolute;
        top: 0.5em;
        left: 0.6em;
        width: 45%; 
        padding-right: 10px; 
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: #444;
    }

    /* Handle special case for actions column */
    .tinx-cp-table td.tinx-cp-actions {
        padding-left: 0.6em !important;
    }

    .tinx-cp-table td.tinx-cp-actions:before {
        content: none;
    }

    /* Special handling for details rows */
    .tinx-cp-details-row td {
        padding-left: 0 !important;
    }

    .tinx-cp-details-row td:before {
        /* content: none; */
    }

    .tinx-cp-details-content {
        padding: 0;
    }

    /* Adjust parent-detail relationship styling for mobile */
    .tinx-cp-parent-highlight,
    .tinx-cp-details-row.show {
        border-left: none;
        border-right: none;
        border-top: none;
        border-bottom: none;
    }

    .tinx-cp-parent-highlight {
        border-left: 2px solid #333333;
    }

    .tinx-cp-details-row.show {
        border-left: 2px solid #333333;
        margin-top: -1em; /* Connect to parent visually */
        display: block;
    }

    /* Reset scroll container behavior on mobile */
    .tinx-cp-table-container {
        overflow-x: visible;
        max-width: 100%;
    }

    .tinx-cp-endpoint.woocommerce-account .woocommerce-MyAccount-content {
        width: 100%;
        max-width: 100%;
    }

    /* Adjust details table for mobile */
    .tinx-cp-details-content {
        padding: 0;
        background-color: transparent;
        width: 100%;
    }
    
    /* Match the styling of the parent table */
    .tinx-cp-details-row .tinx-cp-lines-table tr {
        border: 1px solid #eee;
        margin-bottom: 1em;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        background-color: #fff;
        width: 100%;
    }
    
    /* Ensure the details table cells match the main table cells */
    .tinx-cp-lines-table td {
        padding-left: 40% !important;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Make sure the data-title content shows correctly */
    .tinx-cp-lines-table td:before {
        font-weight: bold;
        width: 35%;
    }
    
    /* Ensure column width consistency */
    .tinx-cp-action-col {
        width: 50px;
    }
    
    /* Make sure the details row spans the full width */
    .tinx-cp-details-row td {
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Ensure details container is full width */
    .tinx-cp-details-lines {
        width: 100%;
    }
    
    /* Fix any padding issues */
    .tinx-cp-table tr.tinx-cp-details-row td .tinx-cp-details-content {
        padding: 0;
    }
    
    /* Fix the layout of nested tables */
    .tinx-cp-details-row .tinx-cp-lines-table {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Icon button styles for tables */
.tinx-cp-action-col {
    width: 50px;
    text-align: center;
}

.tinx-cp-action-cell {
    text-align: center !important;
    padding: 0.5em !important;
}

.tinx-cp-icon-btn {
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    position: relative; /* For positioning the diagonal line */
}

.tinx-cp-icon-btn:hover {
    background-color: rgba(80, 80, 80, 0.1);
}

.tinx-cp-icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: #555;
    stroke-width: 1.5;
    transition: stroke 0.2s ease;
}

.tinx-cp-icon-btn:hover .tinx-cp-icon {
    stroke: #333;
}

/* Styling for open/closed eye icon states */
.tinx-cp-eye-icon {
    color: #555;
}

.tinx-cp-icon-btn.active .tinx-cp-eye-icon {
    color: #777;
}

/* Add diagonal line through eye when active (details are showing) */
.tinx-cp-icon-btn.active::after {
    content: none;
}

.tinx-cp-pdf-icon {
    color: #555;
}

/* Mobile responsive icon adjustments */
@media only screen and (max-width: 768px) {
    .tinx-cp-action-cell {
        /* Left align icons on mobile */
        text-align: left !important;
        padding-left: 0.6em !important;
    }
    
    .tinx-cp-icon-btn {
        /* Make the tap target larger on mobile */
        padding: 0px;
        z-index: 10;
        position: relative;
        background-color: unset !important;
    }
    
    .tinx-cp-icon {
        /* Slightly larger icons for better visibility on mobile */
        width: 22px;
        height: 22px;
    }
    
    /* Adjust the headers for icons on mobile */
    .tinx-cp-action-col {
        text-align: left;
    }
}

/* Detail view styles with responsive support */
.tinx-cp-details-lines {
    margin-bottom: 0;
}

.tinx-cp-lines-table {
    width: 100%;
    /* border-collapse: collapse; */
    border-spacing: 0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.tinx-cp-lines-table th,
.tinx-cp-lines-table td {
    padding: 0.6em 0.8em;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
}

.tinx-cp-lines-table th {
    background-color: var(--tinx-cp-secondary-color);
    font-weight: 500;
    font-size: 0.9em;
    color: var(--tinx-cp-text-color_detail);
}


.tinx-cp-lines-table tr:hover {
    background-color: var(--tinx-cp-detail-row-bg-color);
}

/* Mobile responsive adaptations for No More Tables */
@media only screen and (max-width: 768px) {
    /* Adjust details table for mobile */
    .tinx-cp-details-content {
        padding: 0;
        background-color: transparent;
        width: 100%;
    }
    
    /* Match the styling of the parent table */
    .tinx-cp-details-row .tinx-cp-lines-table tr {
        border: 1px solid #eee;
        margin-bottom: 0;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        background-color: #fff;
        width: 100%;
    }
    
    /* Ensure the details table cells match the main table cells */
    .tinx-cp-lines-table td {
        padding-left: 40% !important;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Make sure the data-title content shows correctly */
    .tinx-cp-lines-table td:before {
        font-weight: bold;
        width: 35%;
    }
    
    /* Ensure column width consistency */
    .tinx-cp-action-col {
        width: 50px;
    }
    
    /* Make sure the details row spans the full width */
    .tinx-cp-details-row td {
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Ensure details container is full width */
    .tinx-cp-details-lines {
        width: 100%;
        margin-bottom: 0;
    }
    
    /* Fix any padding issues */
    .tinx-cp-table tr.tinx-cp-details-row td .tinx-cp-details-content {
        padding: 0;
    }
    
    /* Fix the layout of nested tables */
    .tinx-cp-details-row .tinx-cp-lines-table {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Search and pagination styles */
.tinx-cp-table-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1em;
    align-items: center;
}

.tinx-cp-search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.tinx-cp-search-input {
    padding: 0.5em 2.5em 0.5em 0.8em;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: var(--tinx-cp-font-size_extra);
    width: 200px;
    transition: border-color 0.2s ease;
}

.tinx-cp-search-input:focus {
    border-color: #888;
    outline: none;
}

.tinx-cp-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #888;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.tinx-cp-search-clear:hover {
    opacity: 1;
}

/* Pagination container with 3-column layout */
.tinx-cp-pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1em;
    flex-wrap: wrap;
    gap: 1em;
}

/* Left column - results count */
.tinx-cp-results-count {
    font-size: var(--tinx-cp-font-size_extra);;
    color: #666;
    white-space: nowrap;
    flex: 1;
}

.tinx-cp-filtered-count {
    font-style: italic;
    margin-left: 0.5em;
}

/* Middle column - pagination */
.tinx-cp-pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
    flex: 2;
}

.tinx-cp-page-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 0.25em;
}

/* Page number blocks styling */
.tinx-cp-pagination-btn,
.tinx-cp-page-number {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4em 0.8em;
    background-color: var(--tinx-cp-button-color);
    border: 1px solid #ddd;
    font-size: var(--tinx-cp-font-size_extra);
    color: var(--tinx-cp-button-text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 2em;
    border-radius: 3px;
}

.tinx-cp-pagination-btn:hover:not([disabled]),
.tinx-cp-page-number:hover:not(.active) {
    background-color: #e8e8e8;
}

.tinx-cp-pagination-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.tinx-cp-page-number.active {
    background-color: var(--tinx-cp-button-active-color);
    color: var(--tinx-cp-button-active-text-color);
    border-color: var(--tinx-cp-button-active-color);
    font-weight: bold;
}

.tinx-cp-page-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2em;
    font-size: 0.9em;
}

/* Right column - items per page */
.tinx-cp-per-page {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: var(--tinx-cp-font-size_extra);
    white-space: nowrap;
    flex: 1;
    justify-content: flex-end;
}

/* Style the items per page select to match pagination */
.tinx-cp-items-per-page {
    padding: 0.4em 0.8em;
    background-color: var(--tinx-cp-button-color);
    color: var(--tinx-cp-button-text-color);
    border: 1px solid #ddd;
    font-size: var(--tinx-cp-font-size_extra) !important;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5em center;
    background-size: 0.8em;
    padding-right: 2em;
}

.tinx-cp-per-page label {
    margin-bottom: 0;
}

.tinx-cp-items-per-page:hover {
    background-color: var(--tinx-cp-button-active-color);
    color: var(--tinx-cp-button-active-text-color);
    background-blend-mode: difference;

}

.tinx-cp-items-per-page:focus {
    outline: none;
    border-color: #aaa;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .tinx-cp-pagination-container {
        flex-direction: column;
        align-items: center;
    }
    
    .tinx-cp-results-count {
        margin-bottom: 0.5em;
        text-align: center;
    }
    
    .tinx-cp-pagination {
        margin: 0.5em 0;
        justify-content: center;
    }
    
    .tinx-cp-per-page {
        margin-top: 0.5em;
        justify-content: center;
    }
}

.tinx-cp-no-results {
    padding: 2em;
    text-align: center;
    color: #666;
    background-color: #f9f9f9;
    border-radius: 4px;
    margin: 1em 0;
}

/* Responsive adjustments for search and pagination */
@media screen and (max-width: 768px) {
    .tinx-cp-table-controls {
        justify-content: start;
        margin-bottom: 1.5em;
    }
    
    .tinx-cp-pagination-container {
        flex-direction: column;
        align-items: center;
    }
    
    .tinx-cp-per-page {
        margin-top: 0.5em;
    }
    
    .tinx-cp-search-input {
        width: 100%;
    }


    .tinx-cp-parent-highlight td:first-child {
        border-left: unset;
    }
    .tinx-cp-parent-highlight td:last-child {
        border-right: unset;
    }

    .tinx-cp-lines-table tr td:first-child {
        border-left: unset;
    }
    .tinx-cp-lines-table tr td:last-child {
        border-right: unset;
    }

    .tinx-cp-lines-table tr td:first-child {
        border-left: unset;
    }
    .tinx-cp-lines-table tr td:last-child {
        border-right: unset;
    }
    .tinx-cp-lines-table tr:last-child td {
        border-bottom: unset;
    }
}

/* Ensure detail rows are part of pagination groups */
.tinx-cp-data-row.hidden + .tinx-cp-details-row {
    display: none !important;
}

/* Add a specific CSS class for pagination functionality */
.tinx-cp-data-row.hidden {
    display: none !important;
}

/* Ensure details rows don't affect the alternating pattern */
.tinx-cp-table tbody tr.tinx-cp-details-row {
    background-color: #f5f5f5; /* Slightly different background for detail rows */
}

/* Table styling with alternating row colors - specifically for .tinx-cp-data-row always at odd positions */
.tinx-cp-table tbody tr.tinx-cp-data-row {
    background-color: #F3F3F3; /* All data rows get this color */
}

.tinx-cp-table tbody tr.tinx-cp-data-row:nth-of-type(4n+1) {
    background-color: #ffffff; /* Every second data row gets this color instead */
}

/* Ensure details rows don't affect the alternating pattern */
.tinx-cp-table tbody tr.tinx-cp-details-row {
    background-color: #f5f5f5; /* Slightly different background for detail rows */
}

/* Styling for plus/minus icons for details toggle */
.tinx-cp-details-btn {
    position: relative;
    width: 28px;
    height: 28px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tinx-cp-details-btn:focus, .tinx-cp-details-btn:active {
    outline: none;

    position: relative;
    width: 28px;
    height: 28px;
    border: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tinx-cp-details-btn:hover {
    background-color: #e8e8e8;
}

/* Default state (collapsed/plus) */
.tinx-cp-details-btn:before {
    content: '+';
    font-size: 18px;
    font-weight: bold;
    color: #555555;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Active state (expanded/minus) */
.tinx-cp-details-btn.active:before {
    content: '−'; /* Unicode minus sign */
    color: #555555;
    transform: translate(-50%, -50%) rotate(180deg);
}

/* Additional styling for active button state */
.tinx-cp-details-btn.active {
    
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Hide the eye icon SVG when using plus/minus text */
.tinx-cp-details-btn .tinx-cp-icon {
    visibility: hidden;
}

/* Table styling with alternating row colors */
.tinx-cp-table tbody tr.tinx-cp-data-row {
    background-color: var(--tinx-cp-row-bg-color);
    color: var(--tinx-cp-row-text-color);
    font-size: var(--tinx-cp-row-font-size);
}

/* When details are enabled, use the 4n+1 pattern to account for detail rows */
.tinx-cp-table.has-details tbody tr.tinx-cp-data-row:nth-of-type(4n+1) {
    background-color: var(--tinx-cp-row-alt-bg-color);
}

/* When details are disabled, use a simple odd/even pattern */
.tinx-cp-table:not(.has-details) tbody tr.tinx-cp-data-row:nth-of-type(odd) {
    background-color: var(--tinx-cp-row-alt-bg-color);
}

/* Ensure details rows don't affect the alternating pattern */
.tinx-cp-table tbody tr.tinx-cp-details-row {
    background-color: #f5f5f5; /* Slightly different background for detail rows */
}

/* Sales Lines row styling */
.tinx-cp-lines-table tbody tr {
    background-color: var(--tinx-cp-detail-row-bg-color);
    color: var(--tinx-cp-detail-row-text-color);
    font-size: var(--tinx-cp-detail-row-font-size);
}

.tinx-cp-lines-table tbody tr:nth-of-type(odd) {
    background-color: var(--tinx-cp-detail-row-alt-bg-color);
}

.tinx-cp-details-row .tinx-cp-loading {
    width: 100%;
}