/* React Table Styles - SCOPED TO INVOICE TABLE SHORTCODE ONLY */
.cfw-invoice-table-shortcode .rt-table {
    border-collapse: collapse;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cfw-invoice-table-shortcode .rt-thead {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.cfw-invoice-table-shortcode .rt-thead.-header {
    background: linear-gradient(135deg, #56a052 0%, #8ec66a 100%);
    color: white;
}

.cfw-invoice-table-shortcode .rt-thead.-header .rt-th {
    color: white;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 12px;
}

.cfw-invoice-table-shortcode .rt-thead.-filters {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.cfw-invoice-table-shortcode .rt-thead.-filters .rt-th {
    padding: 16px 16px;
    vertical-align: top;
}

.cfw-invoice-table-shortcode .rt-tr {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.cfw-invoice-table-shortcode .rt-th, .cfw-invoice-table-shortcode .rt-td {
    flex: 100 0 auto;
    width: 100px;
    padding: 12px 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    border-right: 1px solid #dee2e6;
}

.cfw-invoice-table-shortcode .rt-th:last-child, .cfw-invoice-table-shortcode .rt-td:last-child {
    border-right: none;
}

.cfw-invoice-table-shortcode .rt-th {
    font-weight: 600;
    text-align: left;
    position: relative;
    user-select: none;
}

.cfw-invoice-table-shortcode .rt-resizable-header-content {
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cfw-invoice-table-shortcode .rt-resizer {
    display: inline-block;
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 6px;
    cursor: col-resize;
    background: transparent;
    border-right: 2px solid transparent;
}

.cfw-invoice-table-shortcode .rt-resizer:hover {
    border-right-color: #56a052;
}

.cfw-invoice-table-shortcode .rt-tbody {
    overflow-y: auto;
    max-height: 600px;
}

.cfw-invoice-table-shortcode .rt-tr-group {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.cfw-invoice-table-shortcode .rt-tr-group:hover {
    background-color: #f8f9ff;
}

.cfw-invoice-table-shortcode .rt-tr-group:last-child {
    border-bottom: none;
}

.cfw-invoice-table-shortcode .rt-tr.-odd {
    background-color: #ffffff;
}

.cfw-invoice-table-shortcode .rt-tr.-even {
    background-color: #fafafa;
}

.cfw-invoice-table-shortcode .rt-tr.-padRow {
    background-color: transparent;
}

.cfw-invoice-table-shortcode .rt-td {
    font-size: 14px;
    line-height: 1.4;
    color: #495057;
}

.cfw-invoice-table-shortcode .text-right {
    text-align: right;
}

.cfw-invoice-table-shortcode .date-input-margin {
    margin-right: 10px;
}

.cfw-invoice-table-shortcode .testunderlineDate {
    border-bottom: 1px solid #e0e0e0;
}

.cfw-invoice-table-shortcode .myaccountTableDate {
    font-weight: bold;
}

/* Sortable headers */
.cfw-invoice-table-shortcode .sortable-header {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.cfw-invoice-table-shortcode .sortable-header:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.cfw-invoice-table-shortcode .sort-indicator {
    font-size: 12px;
    margin-left: 4px;
    color: #ffffff;
    opacity: 0.8;
    font-weight: bold;
}

/* Date picker styles */
.cfw-invoice-table-shortcode .InputFromTo {
    display: flex;
    align-items: stretch;
    gap: 6px;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

/* jQuery UI Datepicker styling - scoped to invoice tables only */
.cfw-invoice-table-shortcode .ui-datepicker {
    background: #ffffff !important;
    border: 1px solid #ced4da !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    padding: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.cfw-invoice-table-shortcode .ui-datepicker-header {
    background: linear-gradient(135deg, #56a052 0%, #8ec66a 100%) !important;
    border: none !important;
    border-radius: 8px 8px 0 0 !important;
    padding: 12px !important;
    color: white !important;
}

.cfw-invoice-table-shortcode .ui-datepicker-prev, 
.cfw-invoice-table-shortcode .ui-datepicker-next {
    background: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 4px !important;
    width: 30px !important;
    height: 30px !important;
    margin: 0 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.cfw-invoice-table-shortcode .ui-datepicker-prev:hover, 
.cfw-invoice-table-shortcode .ui-datepicker-next:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}

.cfw-invoice-table-shortcode .ui-datepicker-title select {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
    margin: 0 4px !important;
    color: #333 !important;
}

.cfw-invoice-table-shortcode .ui-datepicker-calendar {
    margin: 0 !important;
    padding: 8px !important;
}

.cfw-invoice-table-shortcode .ui-datepicker-calendar th {
    background: #f8f9fa !important;
    color: #495057 !important;
    font-weight: 600 !important;
    padding: 8px 4px !important;
    text-align: center !important;
}

.cfw-invoice-table-shortcode .ui-datepicker-calendar td {
    padding: 2px !important;
    text-align: center !important;
}

.cfw-invoice-table-shortcode .ui-datepicker-calendar td a {
    display: block !important;
    padding: 6px !important;
    text-decoration: none !important;
    border-radius: 4px !important;
    color: #495057 !important;
    border: 1px solid transparent !important;
}

.cfw-invoice-table-shortcode .ui-datepicker-calendar td a:hover,
.cfw-invoice-table-shortcode .ui-datepicker-calendar td .ui-state-hover {
    background: #56a052 !important;
    color: white !important;
}

.cfw-invoice-table-shortcode .ui-datepicker-calendar td .ui-state-active {
    background: #8ec66a !important;
    color: white !important;
}

.cfw-invoice-table-shortcode .ui-datepicker-buttonpane {
    background: #f8f9fa !important;
    border-top: 1px solid #dee2e6 !important;
    border-radius: 0 0 8px 8px !important;
    padding: 8px 12px !important;
    text-align: right !important;
}

.cfw-invoice-table-shortcode .ui-datepicker-buttonpane button {
    background: #56a052 !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 6px 12px !important;
    margin-left: 8px !important;
    cursor: pointer !important;
}

.cfw-invoice-table-shortcode .ui-datepicker-buttonpane button:hover {
    background: #4a8a46 !important;
}

.cfw-invoice-table-shortcode .InputFromTo-from, .cfw-invoice-table-shortcode .InputFromTo-to {
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 2px;
    width: 100%;
    max-width: 110px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.cfw-invoice-table-shortcode .InputFromTo-from:focus-within, .cfw-invoice-table-shortcode .InputFromTo-to:focus-within {
    border-color: #8ec66a;
    box-shadow: 0 0 0 2px rgba(86, 160, 82, 0.25);
}

.cfw-invoice-table-shortcode .InputFromTo .DayPickerInput {
    flex: 1;
}

.cfw-invoice-table-shortcode .InputFromTo input {
    width: 100px;
    padding: 8px 28px 8px 12px;
    border: none;
    outline: none;
    font-size: 13px;
    color: #495057;
    background: #ffffff;
    border-radius: 4px;
    z-index: 1;
    position: relative;
}

.cfw-invoice-table-shortcode .InputFromTo input::placeholder {
    color: #6c757d;
    font-size: 12px;
}

.cfw-invoice-table-shortcode .InputFromTo span {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #6c757d;
    font-size: 12px;
    padding: 2px;
    border-radius: 3px;
    transition: color 0.2s ease, background-color 0.2s ease;
    z-index: 2;
    background: rgba(255, 255, 255, 0.9);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cfw-invoice-table-shortcode .InputFromTo span:hover {
    color: #56a052;
    background-color: #f8f9fa;
}

.cfw-invoice-table-shortcode .InputFromTo span i {
    font-size: 11px;
}

.cfw-invoice-table-shortcode .filter-displayActionPay {
    padding: 8px 0;
    display: flex;
    align-items: center;
}

.cfw-invoice-table-shortcode .filter-displayActionPay label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    user-select: none;
}

.cfw-invoice-table-shortcode .filter-displayActionPay input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #56a052;
}

.cfw-invoice-table-shortcode .filter-displayActionPay span {
    vertical-align: middle;
}

/* Invoice search input - scoped to table container */
.cfw-invoice-table-shortcode #invoice-search {
    width: 100% !important;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 13px;
    color: #495057;
    background-color: white;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.cfw-invoice-table-shortcode #invoice-search:focus {
    outline: none;
    border-color: #8ec66a;
    box-shadow: 0 0 0 2px rgba(86, 160, 82, 0.25);
}

.cfw-invoice-table-shortcode #invoice-search::placeholder {
    color: #6c757d;
    font-size: 12px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .cfw-invoice-table-shortcode .rt-table {
        min-width: 100%;
        overflow-x: auto;
    }
    
    .cfw-invoice-table-shortcode .rt-th, .cfw-invoice-table-shortcode .rt-td {
        min-width: 80px;
    }
    
    .cfw-invoice-table-shortcode .InputFromTo {
        flex-direction: column;
        gap: 4px;
    }
    
    .cfw-invoice-table-shortcode .InputFromTo-from, .cfw-invoice-table-shortcode .InputFromTo-to {
        width: 100%;
    }
    
    .cfw-invoice-table-shortcode .InputFromTo input {
        width: calc(100% - 44px);
    }
}

/* Due Input styles */
.cfw-invoice-table-shortcode .due-input {
    width: 70px;
    text-align: right;
}

/* Pagination styles */
.cfw-invoice-table-shortcode .cfw-pagination {
    margin-top: 20px;
    text-align: center;
}

.cfw-invoice-table-shortcode .cfw-page-number {
    margin: 0 5px;
    padding: 5px 10px;
    text-decoration: none;
    border: 1px solid #ddd;
    display: inline-block;
}

.cfw-invoice-table-shortcode .cfw-page-number.current {
    background-color: #f5f5f5;
    font-weight: bold;
}

/* Checkbox styling - scoped to invoice shortcode */
.cfw-invoice-table-shortcode input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #56a052;
    border-radius: 3px;
}

/* Invoice checkbox in table rows */
.cfw-invoice-table-shortcode .invoice-checkbox {
    transform: scale(1.1);
    margin: 0 auto;
    display: block;
}

/* Column-specific styling */
.cfw-invoice-table-shortcode .column-pay {
    text-align: center !important;
    padding: 12px 8px !important;
}

.cfw-invoice-table-shortcode .column-date {
    font-weight: 500;
    color: #495057;
}

.cfw-invoice-table-shortcode .column-invoice-number {
    font-weight: 600;
    color: #000;
}

.cfw-invoice-table-shortcode .column-amount-due, .cfw-invoice-table-shortcode .column-balance {
    font-weight: 600;
    color: #28a745;
}

.cfw-invoice-table-shortcode .column-invoice-discount {
    color: #dc3545;
    font-weight: 500;
}

/* Improved table borders and spacing */
.cfw-invoice-table-shortcode .rt-table {
    border: 1px solid #dee2e6;
}

/* Better spacing for the "Select All" in filters */
.cfw-invoice-table-shortcode .filter-displayActionPay {
    text-align: center !important;
}

.cfw-invoice-table-shortcode .filter-displayActionPay label {
    font-size: 11px !important;
    white-space: nowrap;
}

/* Responsive adjustments for date picker */
@media (min-width: 1400px) {
    .cfw-invoice-table-shortcode .InputFromTo {
        flex-direction: row;
        gap: 4px;
        align-items: center;
    }
    
    .cfw-invoice-table-shortcode .InputFromTo-from, .cfw-invoice-table-shortcode .InputFromTo-to {
        max-width: 95px;
    }
}

/* Hover effects for table rows */
.cfw-invoice-table-shortcode .rt-tbody .rt-tr-group:hover .rt-td {
    background-color: rgba(86, 160, 82, 0.05);
}

/* Better styling for empty discount cells */
.cfw-invoice-table-shortcode .column-invoice-discount:empty::after {
    content: "—";
    color: #6c757d;
    font-weight: normal;
}

/* SCOPED STYLES: Only apply iframe/container styles within .cfw-invoice-table-shortcode */
.cfw-invoice-table-shortcode .rt-table-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: #ffffff;
    margin: 0;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 500px;
}

/* Container adjustments - scoped */
.cfw-invoice-table-shortcode .rt-table-container .rt-table {
    margin-bottom: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
}

.cfw-invoice-table-shortcode .rt-table-container .rt-tbody {
    max-height: 400px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* Invoice actions styling - scoped */
.cfw-invoice-table-shortcode .cfw-invoice-actions {
    margin-top: 16px !important;
    margin-bottom: 0 !important;
}

/* Pagination styling - scoped */
.cfw-invoice-table-shortcode .cfw-pagination {
    margin-top: 16px !important;
    margin-bottom: 0 !important;
}

/* Iframe-specific adjustments - only when in iframe and within table container */
.cfw-invoice-table-shortcode.iframe-content .rt-table {
    height: auto !important;
}

.cfw-invoice-table-shortcode.iframe-content .rt-tbody {
    max-height: 300px !important;
}

.cfw-invoice-table-shortcode.iframe-content {
    height: auto !important;
    min-height: auto !important;
}

.cfw-invoice-table-shortcode.iframe-content .rt-tbody {
    overflow-y: auto !important;
    overflow-x: hidden !important;
} 