/* Basic input styling */
.number-input {
    width: 70px; /* Increased from 60px */
    text-align: right;
    transition: all 0.3s ease;
    border: 1px solid #ddd;
    padding: 4px 8px;
    height: 32px;
}

/* Calculated field styling */
.calculated {
    background-color: #f8f9fa;
    transition: background-color 0.2s;
    text-align: right !important;
    padding-right: 1.5em !important; /* Increased from 1em */
    min-width: 90px; /* Added minimum width */
}

/* Error state */
.input-error {
    background-color: #ffe6e6;
    border-color: #ff4444;
    transition: all 0.3s ease;
}

/* Input container and error message */
.input-container {
    min-height: 40px;
    position: relative;
    margin: 0;
    padding: 0;
}

/* Input containers should align content in the middle */
.input-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin: 0;
    padding: 0;
    min-height: 32px;
    position: relative;
}

.error-message {
    color: #ff4444;
    font-size: 0.8em;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    visibility: hidden;
    height: 20px;
    margin: 0;
    transition: visibility 0.3s ease;
}

.error-message.visible {
    visibility: visible;
}

.currency-input {
    width: 100%; /* Take full width of the container */
    text-align: right;
    padding: 4px 28px 4px 8px; /* Increased right padding for € symbol */
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background-color: white;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box; /* Ensure padding doesn't affect width */
}

.currency-input:focus {
    outline: none;
    border-color: #4d90fe;
    box-shadow: 0 0 0 2px rgba(77, 144, 254, 0.2);
    background-color: #f8fcff;
}

/* Adjust for touch devices */
@media (hover: none) {
    .currency-input {
        font-size: 16px; /* Larger touch target */
    }
    
    .rabatt-container::after {
        font-size: 16px;
    }
}

/* Add hover effect for better user feedback */
.currency-input:hover {
    border-color: #bbb;
}

/* Also style cell currency inputs */
.cell-currency-input {
    text-align: right;
    padding-right: 24px !important; /* Increased from 12px */
}

/* Remove spinner buttons ONLY from decimal inputs */
input[type="number"].rabatt-netto,
input[type="number"].rabatt-brutto {
    -moz-appearance: textfield; /* Firefox */
}

input[type="number"].rabatt-netto::-webkit-outer-spin-button,
input[type="number"].rabatt-netto::-webkit-inner-spin-button,
input[type="number"].rabatt-brutto::-webkit-outer-spin-button,
input[type="number"].rabatt-brutto::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ALLOW spinners for Stück columns (verkauft, schwund, rabbatiert) */
input[type="number"].verkauft,
input[type="number"].schwund,
input[type="number"].rabbatiert {
    -moz-appearance: auto; /* Firefox - show spinners */
    appearance: auto; /* Standard - show spinners */
}

input[type="number"].verkauft::-webkit-outer-spin-button,
input[type="number"].verkauft::-webkit-inner-spin-button,
input[type="number"].schwund::-webkit-outer-spin-button,
input[type="number"].schwund::-webkit-inner-spin-button,
input[type="number"].rabbatiert::-webkit-outer-spin-button,
input[type="number"].rabbatiert::-webkit-inner-spin-button {
    -webkit-appearance: inner-spin-button; /* WebKit - show spinners */
    margin: 0 2px 0 0;
    height: 14px;
    position: relative;
    opacity: 1;
}

/* Read-only and calculated fields styling */
input[readonly],
.calculated,
td input[readonly],
input.rabatt-brutto[readonly],
input.euro-input[readonly] {
    background-color: #f8f9fa !important;
    color: rgba(0, 0, 0, 0.87) !important;
    border-color: transparent !important;
    box-shadow: none !important;
    cursor: default !important;
    text-align: right !important;
    padding-right: 0.5em !important;
}

/* Create a special container for readonly rabatt values to ensure the Euro sign displays properly */
.rabatt-container input[readonly]::after {
    content: "€";
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

/* Make the € symbol after a readonly field more visible */
.rabatt-container:has(input[readonly])::after {
    right: 8px;
    color: #999;
    z-index: 2;
}

/* Rabatt container styling */
.rabatt-container {
    position: relative;
    width: 100%;
    max-width: 90px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.rabatt-container::after {
    content: "€";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 14px;
    pointer-events: none;
    z-index: 2;
}

/* Width adjustments for currency fields */
.rabatt-container {
    width: 90px;
    position: relative;
}

.rabatt-brutto {
    width: 100%;
    text-align: right;
    padding-right: 24px !important;
}

/* Adjust input padding for currency symbol */
.rabatt-container input {
    width: 100%;
    text-align: right;
}

/* Auto-calculated field */
.auto-calculated {
    background-color: #f0f7ff !important;
    border-color: #cce2ff !important;
}

/* Table row background resets */
.table tr:nth-of-type(odd),
.table tr:nth-of-type(even),
table.dataTable.stripe tbody tr.odd,
table.dataTable.display tbody tr.odd,
table.dataTable.stripe tbody tr.even,
table.dataTable.display tbody tr.even {
    background-color: transparent;
}

/* Row hover styling */
table.dataTable tbody tr:hover,
table.dataTable.hover tbody tr:hover,
table.dataTable.display tbody tr:hover,
.ui.table tr:hover {
    background-color: rgba(0,0,0,.05) !important;
    cursor: pointer;
}

/* Keep calculated cell background on hover */
table.dataTable tbody tr:hover td.calculated {
    background-color: #e9ecef !important;
}

/* Remove old hover overrides */
tr:hover td.calculated {
    background-color: unset;
}

/* Action column and buttons */
.actions-column {
    width: 50px;
    text-align: center;
}

.row-actions {
    visibility: visible;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.edit-row {
    color: #2185d0;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    font-size: 1.2em;
}

.edit-row:hover {
    opacity: 1;
}

.delete-row {
    color: #ff4444;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    font-size: 1.2em;
}

.delete-row:hover {
    opacity: 1;
}

/* Make trash icon more visible */
.trash.icon {
    font-size: 1.2em;
    vertical-align: middle;
}

/* Button styling */
.add-row-button {
    margin: 0 !important;
}

.dt-buttons {
    display: inline-flex;
    gap: 0.5em;
    margin: 0 !important;
    padding: 0 !important;
}

.dt-buttons .ui.button {
    margin: 0 0.5em 0 0 !important;
}

.dt-button {
    margin: 0 !important;
}

/* Table layout */
.ui.table {
    margin-top: 1em;
    border-collapse: collapse !important;
    width: 100% !important;
    table-layout: auto;
}

/* Container spacing */
.ui.container {
    padding: 1em 2em;
    max-width: 95% !important;
    width: 95% !important;
}

/* Input styling */
.sap-input,
.stueck-input,
.ek-input,
.netto-input,
.brutto-input,
.spanne-input {
    width: 80px !important;
    max-width: 80px !important;
}

.article-input {
    width: 100% !important;
    max-width: 350px !important;
}

/* Column widths */
table.dataTable tbody td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 350px;
    white-space: normal;
    word-break: break-word;
    vertical-align: top;
    min-width: 80px;
}

/* Specific column widths - adjust for the new column */
table.dataTable tbody td:nth-child(4), /* Lieferanten-Artnr (new column) */
table.dataTable thead th:nth-child(4) { /* New column header */
    width: 100px !important;
    max-width: 100px !important;
    min-width: 100px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Article column width - make it wider */
table.dataTable tbody td:nth-child(5), /* Article (moved to column 5) */
table.dataTable thead th:nth-child(5) { /* Article header */
    min-width: 250px !important;
    max-width: 350px !important;
    width: auto !important;
}

/* SAP-Nr column width fix - make it narrower to fit 6 digits */
table.dataTable tbody td:nth-child(3), /* SAP-Nr */
table.dataTable thead th:nth-child(3) { /* SAP-Nr header */
    width: 80px !important;
    max-width: 80px !important;
    min-width: 80px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Remove conflicting styles */
table.dataTable tbody td:nth-child(3) {
    min-width: 80px !important; /* Override conflicting rule */
    max-width: 80px !important; /* Override conflicting rule */
}

/* Specific column widths */
table.dataTable tbody td:nth-child(6), /* Stück */
table.dataTable tbody td:nth-child(7), /* EK */
table.dataTable tbody td:nth-child(8), /* Netto */
table.dataTable tbody td:nth-child(9), /* Brutto */
table.dataTable tbody td:nth-child(13), /* Rabatt Netto */
table.dataTable tbody td:nth-child(14) { /* Rabatt Brutto */
    width: 90px; /* Increased from 80px */
    max-width: 90px;
    min-width: 90px; /* Added to ensure consistent width */
}

/* Counter cell styling */
.counter-cell {
    text-align: center !important;
    font-weight: bold;
    width: 40px !important;
    max-width: 40px !important;
    background-color: #f8f9fa;
}

/* Paste indicator */
.ready-for-paste {
    background-color: rgba(33, 133, 208, 0.1) !important;
    cursor: cell !important;
}

td:not(.actions-column):not(:has(input)):hover {
    cursor: cell;
}

/* Header styling */
table.dataTable thead th {
    text-align: left !important;
    vertical-align: middle !important;
}

/* Sorting indicators */
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
    position: relative;
    padding-right: 20px !important;
}

/* Row highlight animation */
@keyframes highlightNewRow {
    0% { background-color: rgba(33, 133, 208, 0.2); }
    100% { background-color: transparent; }
}

.new-row-highlight {
    animation: highlightNewRow 1.5s ease;
}

/* Stats panel */
.stats-panel {
    margin: 1em 0;
    padding: 1em;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: relative;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1em;
}

.stat-card {
    padding: 1em;
    border-radius: 4px;
    border-left: 4px solid;
    transition: transform 0.2s ease;
    position: relative; /* Ensure positioning context for absolute elements */
}

/* Card background and border colors with lower intensity backgrounds */
.stat-card.profit { 
    border-color: #27ae60; /* Green - positive */
    background-color: rgba(39, 174, 96, 0.08);
}

.stat-card.profit-without-nr { 
    border-color: #16a085; /* Teal - slightly different positive */
    background-color: rgba(22, 160, 133, 0.08);
}

.stat-card.nr-highlight { 
    border-color: #2ecc71; /* Bright green - positive bonus */
    background-color: rgba(46, 204, 113, 0.08);
}

.stat-card.sales { 
    border-color: #3498db; /* Blue - neutral/informational */
    background-color: rgba(52, 152, 219, 0.08);
}

.stat-card.discount { 
    border-color: #f39c12; /* Orange - attention but not negative */
    background-color: rgba(243, 156, 18, 0.08);
}

.stat-card.loss { 
    border-color: #e74c3c; /* Red - negative */
    background-color: rgba(231, 76, 60, 0.08);
}

/* Slight hover effect for better interaction */
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    margin: 0.2em 0;
}

.stat-label {
    color: #666;
    font-size: 0.9em;
}

/* NR styling with updated colors to match cards */
.profit-note {
    font-size: 0.8em;
    color: #2ecc71; /* Match NR highlight color */
    font-weight: normal;
}

.nr-highlight .stat-label:last-child {
    font-style: italic;
    font-size: 0.8em;
    color: #2ecc71; /* Match NR highlight color */
}

/* Formula hint positioning fix */
.formula-hint {
    position: relative;
    margin-top: 1.5em;
    font-size: 12px;
    color: #666;
    font-style: italic;
    text-align: center;
}

/* Button container layout */
.button-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1em 0;
    padding: 0.5em 0;
    border-bottom: 1px solid rgba(0,0,0,.1);
}

/* DataTables controls */
.dataTables_length,
.dataTables_filter {
    margin: 0 !important;
}

.dataTables_filter input {
    margin-left: 0.5em !important;
}

.dataTables_paginate {
    margin-top: 1em !important;
}

.dataTables_paginate .ui.pagination.menu {
    border: none;
    box-shadow: none;
}

/* Table controls layout */
.table-controls {
    display: flex;
    align-items: center;
    gap: 1em;
    margin: 1em 0;
    padding-bottom: 1em;
    border-bottom: 1px solid rgba(0,0,0,.1);
}

.table-controls .left-side {
    display: flex;
    align-items: center;
    gap: 1em;
}

.table-controls .right-side {
    margin-left: auto;
}

/* Quick-add notification */
.quick-add-notification {
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-left: 4px solid #2185d0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 4px;
    max-width: 300px;
    font-size: 14px;
}

.quick-add-notification .content {
    display: flex;
    align-items: center;
}

.quick-add-notification .icon {
    margin-right: 8px;
    color: #2185d0;
}

/* Add row button tooltip */
.ui.button.add-row-button {
    position: relative;
}

.ui.button.add-row-button::before {
    content: "Tip: Hold Shift for quick-add";
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    white-space: nowrap;
    z-index: 100;
}

.ui.button.add-row-button:hover::before {
    opacity: 1;
    visibility: visible;
}

/* PDF Import button */
.pdf-import-btn {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.pdf-import-btn input[type="file"] {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 100%;
    min-height: 100%;
    font-size: 100px;
    text-align: right;
    filter: alpha(opacity=0);
    opacity: 0;
    outline: none;
    background: white;
    cursor: inherit;
    display: block;
}

/* PDF Import status */
.pdf-import-status {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

.pdf-import-status .close.icon {
    position: absolute;
    top: 0.5em;
    right: 0.5em;
    cursor: pointer;
}

/* Backup and restore buttons */
.backup-btn,
.restore-btn {
    margin-right: 0.5em !important;
}

.restore-btn {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.restore-btn input[type="file"] {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 100%;
    min-height: 100%;
    font-size: 100px;
    text-align: right;
    filter: alpha(opacity=0);
    opacity: 0;
    outline: none;
    background: white;
    cursor: inherit;
    display: block;
}

/* Delete all button */
.delete-all-button {
    margin-left: 0.5em !important;
}

.delete-all-button:hover {
    background-color: #db2828 !important;
}

/* Confirm dialog */
.custom-confirm-dialog {
    position: fixed;
    background: white;
    padding: 1em;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 9999;
    width: 250px;
    border: 1px solid rgba(0,0,0,0.1);
}

.custom-confirm-dialog .content {
    margin-bottom: 1em;
}

.custom-confirm-dialog .content p {
    margin: 0;
    font-size: 0.9em;
}

.custom-confirm-dialog .actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5em;
}

.custom-confirm-dialog .ui.button {
    margin: 0 !important;
}

.custom-confirm-dialog.ui.modal {
    position: fixed !important;
    margin: 0 !important;
    transform: none !important;
}

/* Support for mobile browsers - remove spinner buttons from all number inputs */
input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Support for touch devices */
@media (hover: none) {
    .currency-input {
        font-size: 16px; /* Larger touch target */
    }
    
    .rabatt-container::after {
        top: 8px;
    }
}

td:nth-child(6)::after,
td:nth-child(7)::after,
td:nth-child(8)::after {
    content: "€";
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 14px;
}

/* Apply the same styling to these cells in editing mode */
.cell-currency-input-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    max-width: 90px; /* Added max-width to match other inputs */
    margin: 0 auto;
}

/* Remove the Euro symbol in edit mode */
.cell-currency-input-container::after {
    content: none; /* Remove the Euro symbol from editing fields */
}

/* Adjust input padding in edit mode since there's no € symbol */
.cell-currency-input {
    text-align: right;
    padding-right: 8px !important; /* Reduced from 24px since no € symbol */
    box-sizing: border-box;
}

/* Add spacing to tables */
.ui.table td {
    padding: 7px 8px; /* Added more vertical padding */
}

.ui.table th {
    padding: 8px 8px; /* Added more vertical padding */
}

/* Standardize vertical alignment for all elements */
.number-input,
.currency-input,
.calculated,
.cell-currency-input,
.input-container,
.rabatt-container,
td {
    vertical-align: middle !important;
    height: 32px;
    box-sizing: border-box;
}

/* Make tables cells consistent */
.ui.table td {
    padding: 7px 8px;
    vertical-align: middle !important;
    height: 42px; /* Standard height for all table cells */
}

/* Center contents of all cells */
table.dataTable tbody td {
    display: table-cell;
    vertical-align: middle !important;
}

/* Ensure calculated fields have consistent styling */
td.calculated,
td.sumVerkauft,
td.sumRabbatiert,
td.sumGesamt,
td.sumProfit {
    background-color: #f8f9fa;
    text-align: right !important;
    padding-right: 1.5em !important;
    vertical-align: middle !important;
    height: 32px;
    line-height: 32px;
}

/* Euro symbol for price cells and calculated columns */
td:nth-child(7), /* EK */
td:nth-child(8), /* Netto */
td:nth-child(9), /* Brutto */
td:nth-child(14), /* Rabatt Brutto */
td.calculated,   /* All calculated fields */
td.sumVerkauft,  /* Sum Verkauft column */
td.sumRabbatiert, /* Sum Rabbatiert column */
td.sumGesamt,    /* Sum Gesamt column */
td.sumProfit     /* Sum Profit column */ {
    position: relative;
    padding-right: 24px !important;
}

td:nth-child(7)::after,
td:nth-child(8)::after,
td:nth-child(9)::after,
td:nth-child(14)::after,
td.calculated::after,
td.sumVerkauft::after,
td.sumRabbatiert::after,
td.sumGesamt::after,
td.sumProfit::after {
    content: "€";
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 14px;
    pointer-events: none;
}

/* Force the € symbol to display outside the input with z-index */
.rabatt-container {
    position: relative;
}

.rabatt-container::after {
    z-index: 2;
}

/* NR styling */
.profit-note {
    font-size: 0.8em;
    color: #27ae60;  /* Changed to green to indicate positive */
    font-weight: normal;
}

.profit-without-nr {
    background-color: #f5f5f5;
    border-left: 4px solid #3498db;
}

.nr-highlight {
    background-color: #e9f7ef;  /* Lighter green background */
    border-left: 4px solid #27ae60;  /* Green border */
}

.nr-highlight .stat-label:last-child {
    font-style: italic;
    font-size: 0.8em;
    color: #27ae60;  /* Green text to highlight positive aspect */
}

/* Stat cards with detailed info */
.stat-info-icon {
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s ease;
    margin-left: 4px;
    font-size: 16px;
}

.stat-info-icon:hover {
    opacity: 1;
    color: #2185d0;
}

.stat-details-popup {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-radius: 4px;
    border: 1px solid #ddd;
    padding: 15px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-details-popup .note {
    font-style: italic;
    color: #666;
    font-size: 12px;
    margin-top: 8px;
}

/* Stat cards with detailed info */
.stat-card {
    position: relative; /* Ensure positioning context for absolute elements */
}

.stat-info-icon {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    font-size: 16px;
    position: absolute;
    top: 10px;
    right: 10px;
    color: inherit;
}

.stat-info-icon:hover {
    opacity: 1;
    color: #2185d0;
}

.stat-details-popup {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    border-radius: 4px;
    border: 1px solid #ddd;
    padding: 15px;
    animation: fadeIn 0.2s ease;
    z-index: 1000;
    min-width: 350px; /* Increased from 320px to ensure headers fit */
    width: auto;
    /* Add more top padding to ensure headers aren't cut off */
    padding-top: 30px;
}

/* Ensure popup header doesn't get cut off */
.stat-details-popup .ui.top.attached.label {
    white-space: nowrap;
    font-size: 0.9em;
    padding: 0.5em 2.5em 0.5em 1em; /* Extra right padding for close button */
    overflow: visible;
    width: 100%; /* Ensure label spans full width */
    box-sizing: border-box;
}

/* Fix internal headers to ensure they're not cut off */
.stat-details-popup h4 {
    margin-top: 10px; /* Increased from 5px */
    margin-bottom: 15px;
    color: #333;
    font-size: 14px; /* Slightly bigger for better visibility */
    padding-top: 5px; /* Extra padding to prevent cutting off */
    line-height: 1.4; /* Improved line height for better readability */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-details-popup .note {
    font-style: italic;
    color: #666;
    font-size: 12px;
    margin-top: 8px;
}

/* Ensure popup content is scrollable if needed */
.popup-content {
    max-height: calc(80vh - 60px);
    overflow-y: auto;
    overflow-x: visible; /* Allow tables to show fully */
    padding-right: 5px; /* Prevent scrollbar from touching content */
    padding-top: 10px; /* Add top padding to ensure content isn't cut off */
}

/* Make sure tables inside popups don't get cut off */
.popup-content .ui.table {
    width: 100%;
    min-width: 300px; /* Increased from 280px */
    margin-top: 8px; /* Add space above table */
    margin-bottom: 8px; /* Add space below table */
}

/* Improve table layout in popups */
.popup-content .ui.table td {
    white-space: normal;
    word-break: break-word;
}

/* Add these styles for drag and drop functionality */
.drag-handle {
    cursor: move;
    color: #999;
    padding-right: 5px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.drag-handle:hover {
    color: #2185d0;
    transform: scale(1.2);
}

tr.dt-rowReorder-moving {
    background-color: #f8f8f8 !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2) !important;
    outline: 2px dashed #2185d0 !important;
}

tr.dt-rowReorder-moving td {
    background-color: #f8f8f8 !important;
}

/* Style for the reorder drop indicator */
.dt-rowReorder-float {
    position: absolute;
    background-color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border-radius: 4px;
    opacity: 0.9 !important;
    z-index: 1060;
}

/* Reorder drop target indicator */
.dt-rowReorder-drop-indicator {
    background-color: #2185d0 !important;
    height: 3px !important;
}

/* Add highlight for counter cell to make it clear it's used for ordering */
.counter-cell {
    position: relative;
    transition: background-color 0.3s ease;
}

.counter-cell:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid transparent;
    transition: border-color 0.3s ease;
}

tr:hover .counter-cell:after {
    border-color: rgba(33, 133, 208, 0.3);
}

/* Animation for position change */
@keyframes positionChanged {
    0%, 100% { background-color: transparent; }
    20%, 80% { background-color: rgba(33, 133, 208, 0.25); }
}

.position-changed {
    animation: positionChanged 2s ease;
    position: relative;
}

.position-changed::before {
    content: '↕';
    position: absolute;
    top: 0;
    left: -15px;
    color: #2185d0;
    font-weight: bold;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    20%, 80% { opacity: 1; }
}

/* Enhanced animation for position change */
@keyframes positionChanged {
    0%, 100% { background-color: transparent; }
    20%, 80% { background-color: rgba(33, 133, 208, 0.25); }
}

.position-changed {
    animation: positionChanged 2s ease;
    position: relative;
}

.position-changed::before {
    content: '↕';
    position: absolute;
    top: 0;
    left: -15px;
    color: #2185d0;
    font-weight: bold;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    20%, 80% { opacity: 1; }
}

/* Improved drag handle visibility */
.drag-handle {
    cursor: move;
    color: #999;
    padding-right: 5px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.drag-handle:hover {
    color: #2185d0;
    transform: scale(1.2);
}

/* Add an indicator when row is being dragged */
tr.dt-rowReorder-moving .drag-handle {
    color: #2185d0;
    animation: pulse 0.5s infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.7; }
    to { opacity: 1; }
}

/* Enhanced animation for position change */
@keyframes positionChanged {
    0%, 100% { background-color: transparent; }
    20%, 80% { background-color: rgba(33, 133, 208, 0.25); }
}

.position-changed {
    animation: positionChanged 2s ease;
    position: relative;
}

.position-changed::before {
    content: '↕';
    position: absolute;
    top: 0;
    left: -15px;
    color: #2185d0;
    font-weight: bold;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    20%, 80% { opacity: 1; }
}

/* Improved drag handle visibility */
.drag-handle {
    cursor: move;
    color: #999;
    padding-right: 5px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.drag-handle:hover {
    color: #2185d0;
    transform: scale(1.2);
}

/* Add an indicator when row is being dragged */
tr.dt-rowReorder-moving .drag-handle {
    color: #2185d0;
    animation: pulse 0.5s infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.7; }
    to { opacity: 1; }
}

/* Button container layout - improved spacing and organization */
.button-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1em 0;
    padding: 0.5em 0;
    border-bottom: 1px solid rgba(0,0,0,.1);
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
    gap: 8px; /* Add consistent spacing between buttons */
}

/* Left side buttons */
.left-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 10px;
}

/* DataTables buttons container - improved layout */
.dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px; /* Consistent spacing between buttons */
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure buttons have consistent spacing */
.dt-buttons .ui.button {
    margin: 0 !important;
    white-space: nowrap; /* Prevent button text from wrapping */
}

/* Increase contrast for important buttons */
.ui.primary.button {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Make import buttons more distinctive */
.supplier-import-btn, .pdf-import-btn {
    margin-right: 8px !important;
}

/* Group related buttons together */
.backup-btn, .restore-btn, .delete-all-button {
    margin-left: 10px !important;
}

/* Add visual separation for report buttons */
.nr-report-btn, .marketing-report-btn {
    margin-left: 10px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Updated button layout styles */
.all-button-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 10px 0;
    width: 100%;
}

.button-group-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
    border: 1px solid #eaeaea;
    padding: 8px;
    border-radius: 4px;
    background-color: #fafafa;
    min-width: 220px;
}

.group-label {
    font-size: 12px;
    color: #666;
    font-weight: bold;
    margin-bottom: 4px;
    border-bottom: 1px solid #eee;
    padding-bottom: 2px;
}

.button-container {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* Ensure buttons are consistent size */
.button-container .ui.button {
    margin: 0 !important;
    white-space: nowrap;
    flex: 1;
    text-align: center;
    min-width: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 10px;
}

/* Ensure the buttons have equal height */
.button-container .ui.button,
.button-container label.ui.button {
    height: 36px;
    box-sizing: border-box;
}

/* Make button icons consistent */
.button-container .ui.button i.icon {
    margin-right: 5px !important;
    margin-left: 0 !important;
}

/* Fix file input buttons to match other buttons */
.pdf-import-btn, 
.supplier-import-btn,
.restore-btn {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.supplier-import-btn {
   width: 230px !important;
}

/* Fix the button spacing in DataTables container */
.dt-buttons {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Remove old button container margin/padding to prevent conflicts */
.button-container {
    border-bottom: none;
    margin: 0;
    padding: 0;
}