/* File: wp-content/plugins/vivaia-pos/assets/css/past-orders.css */
/* Description: Styles for VIVAIA POS past orders page */
/**
 * VIVAIA POS - Past Orders CSS
 * Version: 1.6.0
 * Last Updated: 2025-01-30
 * Enhanced mobile responsiveness and skeleton loader
 */

body, html {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.flex.min-h-screen {
    min-height: 100vh;
    display: flex;
}

#main-content {
    flex: 1;
    padding: 1.5rem;
    background-color: #f9fafb;
}

/* Enhanced Mobile Styles */
@media (max-width: 640px) {
    #main-content {
        padding: 1rem;
    }
    
    #order-items-list {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: #cbd5e0 #f7fafc;
    }
    
    #order-items-list table {
        min-width: 600px; /* Ensure table is wide enough to trigger scrolling */
    }
    
    .order-table {
        display: block; /* Show table on mobile instead of hiding it */
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: #cbd5e0 #f7fafc;
        border-radius: 0.5rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .order-table table {
        min-width: 800px; /* Ensure minimum width for proper scrolling */
        margin: 0;
    }
    
    .order-cards {
        display: none; /* Hide cards since we removed them */
    }
    
    /* Enhanced search filter container for mobile */
    .search-filter-container {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem;
        margin-bottom: 1rem;
        background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
        border: 1px solid #e2e8f0;
    }
    
    .search-filter-container input[type="text"],
    .search-filter-container input[type="date"],
    .search-filter-container select {
        min-width: auto;
        width: 100%;
        padding: 0.875rem;
        font-size: 1rem; /* Larger font for mobile */
        border-radius: 0.5rem;
        border: 2px solid #e2e8f0;
        transition: all 0.2s ease;
    }
    
    .search-filter-container input[type="text"]:focus,
    .search-filter-container input[type="date"]:focus,
    .search-filter-container select:focus {
        border-color: #804c1a;
        box-shadow: 0 0 0 3px rgba(128, 76, 26, 0.1);
        outline: none;
    }
    
    .search-filter-container button {
        width: 100%;
        justify-content: center;
        padding: 1rem;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 0.5rem;
        transition: all 0.2s ease;
        min-height: 3rem; /* Ensure touch-friendly height */
    }
    
    .search-filter-container button:active {
        transform: scale(0.98);
    }
    
    /* Custom date range mobile styles */
    .custom-date-range {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }
    
    .custom-date-range input[type="date"] {
        width: 100%;
        min-width: auto;
        padding: 0.875rem;
        font-size: 1rem;
        border: 2px solid #e2e8f0;
    }
    
    .custom-date-range input[type="date"]:focus {
        border-color: #804c1a;
        box-shadow: 0 0 0 3px rgba(128, 76, 26, 0.1);
        outline: none;
    }
    
    /* Adjust exchange modal for mobile */
    .exchange-modal-columns {
        flex-direction: column;
        gap: 1rem;
    }
    .exchange-modal-column {
        min-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    #order-items-list table th,
    #order-items-list table td {
        min-width: 180px;
        font-size: 1rem;
        white-space: nowrap;
    }
    
    /* Improve table header visibility on mobile */
    .vivaia-table thead {
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    /* Better spacing for table cells on mobile */
    .vivaia-table th,
    .vivaia-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Ensure action buttons are properly sized on mobile */
    .action-button-icon {
        padding: 0.5rem;
        min-width: 2.5rem;
        height: 2.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .action-button-icon svg {
        width: 1.25rem;
        height: 1.25rem;
    }
}

@media (min-width: 641px) {
    .order-table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
    }
    .order-cards {
        display: none;
    }
}

/* Style buttons */
.print-invoice, .view-details, .cancel-order, .exchange-item-button, .fulfill-store-pickup, #confirm-exchange, .mark-fulfilled, .return-order {
    padding: 0.25rem 0.5rem;
    white-space: nowrap;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    border: none;
    display: inline-block;
    pointer-events: auto;
    position: relative;
    z-index: 1;
    background-color: #000000;
    color: #ffffff;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
    font-weight: bold;
}


.print-invoice:hover, .print-invoice:hover, .view-details:hover, .cancel-order:hover, .exchange-item-button:hover, .fulfill-store-pickup:hover, #confirm-exchange:hover, .mark-fulfilled:hover,
.view-details:active, .cancel-order:active, .exchange-item-button:active, .fulfill-store-pickup:active, #confirm-exchange:active, .mark-fulfilled:active,
.view-details:focus, .cancel-order:focus, .exchange-item-button:focus, .fulfill-store-pickup:focus, #confirm-exchange:focus, .mark-fulfilled:focus, .return-order:hover , .return-order:focus, .return-order:active {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #000000;
    font-weight: bold;
}

.search-filter-container {
    background-color: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-filter-container input[type="text"],
.search-filter-container input[type="date"],
.search-filter-container select {
    flex: 1;
    min-width: 200px;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background-color: white;
}

.search-filter-container input[type="text"]:focus,
.search-filter-container input[type="date"]:focus,
.search-filter-container select:focus {
    outline: none;
    border-color: #804c1a;
    box-shadow: 0 0 0 3px rgba(128, 76, 26, 0.1);
}

.search-filter-container button {
    background-color: #000000;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    white-space: nowrap;
}

.search-filter-container button:hover,
.search-filter-container button:active,
.search-filter-container button:focus {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #000000;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Custom date range styling */
.custom-date-range {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.custom-date-range.hidden {
    display: none !important;
}

.custom-date-range input[type="date"] {
    flex: 1;
    min-width: 150px;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background-color: white;
    padding: 0.75rem;
}

.custom-date-range input[type="date"]:focus {
    outline: none;
    border-color: #804c1a;
    box-shadow: 0 0 0 3px rgba(128, 76, 26, 0.1);
}

/* Add focus styles for accessibility */
.view-details:focus, .cancel-order:focus, .exchange-item-button:focus, .fulfill-store-pickup:focus, .search-filter-container button:focus, #confirm-exchange:focus, .mark-fulfilled:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.3);
}

/* Disabled state for confirm-exchange button */
#confirm-exchange:disabled {
    background-color: #4b5563;
    cursor: not-allowed;
}

/* Specific styling for confirm-return button */
#confirm-return {
    background-color: #000000;
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

#confirm-return:hover:not(:disabled),
#confirm-return:active:not(:disabled),
#confirm-return:focus:not(:disabled) {
    background-color: #663d14;
    color: #ffffff;
}

#confirm-return:disabled {
    background-color: #cccccc;
    color: #6b7280;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Cancel return button styling */
#cancel-return {
    background-color: #000000;
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

#cancel-return:hover,
#cancel-return:active,
#cancel-return:focus {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #000000;
}

/* Style table rows with hover effect */
.order-table table tbody tr:hover {
    background-color: #f3f4f6;
}

/* Modal Overlay for Edit Member Modal */
#modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

#modal-overlay.active {
    display: block;
}

/* Style modal (excluding edit-member-modal) */
#order-details-modal,
#fulfill-store-pickup-modal,
#exchange-item-modal {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    width: 600px;
}

@media (min-width: 769px) {
    #order-details-modal,
    #fulfill-store-pickup-modal,
    #exchange-item-modal {
        width: 800px;
    }
    
    body.admin-bar #order-details-modal,
    body.admin-bar #fulfill-store-pickup-modal,
    body.admin-bar #exchange-item-modal {
        top: calc(50% + 16px);
    }
    
    @media (max-width: 782px) {
        body.admin-bar #order-details-modal,
        body.admin-bar #fulfill-store-pickup-modal,
        body.admin-bar #exchange-item-modal {
            top: calc(50% + 32px);
        }
    }
}

@media (max-width: 768px) {
    #order-details-modal,
    #fulfill-store-pickup-modal,
    #exchange-item-modal {
        width: 95%;
        max-width: 95%;
        margin: 2.5% auto;
    }
    
    body.admin-bar #order-details-modal,
    body.admin-bar #fulfill-store-pickup-modal,
    body.admin-bar #exchange-item-modal {
        margin-top: 5%;
    }
    
    /* Enhanced search filter container for tablets */
    .search-filter-container {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1.25rem;
        background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
        border: 1px solid #e2e8f0;
    }
    
    .search-filter-container input[type="text"],
    .search-filter-container input[type="date"],
    .search-filter-container select {
        min-width: auto;
        width: 100%;
        padding: 0.75rem;
        font-size: 0.95rem;
        border: 2px solid #e2e8f0;
        transition: all 0.2s ease;
    }
    
    .search-filter-container input[type="text"]:focus,
    .search-filter-container input[type="date"]:focus,
    .search-filter-container select:focus {
        border-color: #804c1a;
        box-shadow: 0 0 0 3px rgba(128, 76, 26, 0.1);
        outline: none;
    }
    
    .search-filter-container button {
        width: 100%;
        justify-content: center;
        padding: 0.875rem;
        font-size: 0.95rem;
        font-weight: 600;
        border-radius: 0.5rem;
        transition: all 0.2s ease;
        min-height: 2.75rem;
    }
    
    .search-filter-container button:active {
        transform: scale(0.98);
    }
    
    /* Custom date range tablet styles */
    .custom-date-range {
        flex-direction: row;
        width: auto;
        gap: 0.5rem;
    }
    
    .custom-date-range input[type="date"] {
        width: auto;
        min-width: 140px;
        padding: 0.75rem;
        font-size: 0.95rem;
        border: 2px solid #e2e8f0;
    }
    
    .custom-date-range input[type="date"]:focus {
        border-color: #804c1a;
        box-shadow: 0 0 0 3px rgba(128, 76, 26, 0.1);
        outline: none;
    }
}

#order-details-modal.hidden,
#fulfill-store-pickup-modal.hidden,
#exchange-item-modal.hidden {
    display: none;
}

.modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .modal-content {
        padding: 0;
    }
}

/* Edit Member Modal - REMOVED - now using dedicated members.css */

.fulfill-warehouse,
.exchange-item-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.exchange-item-select {
    margin-bottom: 0.5rem;
}

#fulfill-quantity {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.fulfill-warehouse:focus,
.exchange-item-select:focus,
#fulfill-quantity:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.error-message {
    color: #dc2626;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    padding: 0.75rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Enhanced Exchange Modal Styling - Compact Version */
.exchange-modal-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
    align-items: start;
}

.exchange-modal-column {
    min-width: 0;
    background: #ffffff;
    border-radius: 0.5rem;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.exchange-modal-column:first-child {
    background: #ffffff;
    border-color: #e5e7eb;
}

.exchange-modal-column:last-child {
    background: #ffffff;
    border-color: #e5e7eb;
}

.exchange-modal-column label {
    display: block;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Fix number input width in exchange modal */
.exchange-replacement input[type="number"],
.replacement-details input[type="number"],
.exchange-item-quantity {
    max-width: 80px !important;
    width: 80px !important;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    text-align: center;
}

.exchange-item-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem;
    background-color: #f9fafb;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.exchange-item {
    display: flex;
    align-items: flex-start;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    background-color: #ffffff;
    border-radius: 0.375rem;
    margin-bottom: 0.375rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.exchange-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.exchange-item:last-child {
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0;
}

.exchange-item input[type="checkbox"] {
    margin-right: 0.75rem;
    margin-top: 0.125rem;
    width: 1.125rem;
    height: 1.125rem;
    accent-color: #804c1a;
}

.exchange-item label {
    flex: 1;
    cursor: pointer;
    margin: 0;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
}

.exchange-item-details {
    flex: 1;
    margin-left: 0;
}

.exchange-item-details .product-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

.exchange-item-details .product-meta {
    font-size: 0.75rem;
    color: #64748b;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.25rem;
}

.exchange-search-filters {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.exchange-search-filters select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background-color: #ffffff;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.exchange-search-filters select:focus {
    outline: none;
    border-color: #804c1a;
    box-shadow: 0 0 0 3px rgba(128, 76, 26, 0.1);
}

.quick-product-search {
    position: relative;
    margin-bottom: 1rem;
}

.quick-product-search input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.quick-product-search input:focus {
    outline: none;
    border-color: #804c1a;
    box-shadow: 0 0 0 3px rgba(128, 76, 26, 0.1);
}

.quick-product-search .spinner {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
}

.quick-product-search .dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 0.25rem;
}

.quick-product-search .dropdown-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s ease;
}

.quick-product-search .dropdown-item:hover {
    background-color: #f8fafc;
}

.quick-product-search .dropdown-item:last-child {
    border-bottom: none;
}

.exchange-replacement {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.exchange-replacement.hidden {
    display: none;
}

.exchange-replacement h4 {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.exchange-replacement .replacement-details {
    margin-bottom: 0;
}

.exchange-replacement .replacement-details .font-medium {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.exchange-replacement .replacement-details .text-sm.text-gray-500 {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.exchange-item-total {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-weight: 600;
    color: #374151;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.exchange-item-total.positive {
    background: #f0fdf4;
    border-color: #22c55e;
    color: #166534;
}

.exchange-item-total.negative {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .exchange-modal-columns {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .exchange-modal-column {
        padding: 1rem;
    }
    
    .exchange-search-filters {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .exchange-item-list {
        max-height: 250px;
    }
    
    .exchange-item-details .product-meta {
        grid-template-columns: 1fr;
        gap: 0.125rem;
    }
}

/* Enhanced modal sizing for better 2-column layout */
@media (min-width: 769px) {
    #exchange-item-modal {
        width: 1000px;
        max-width: 90vw;
    }
}

@media (min-width: 1024px) {
    #exchange-item-modal {
        width: 1200px;
    }
}

.order-discount-label {
    display: inline-block;
    background-color: #fef3c7;
    color: #92400e;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.points-used-label {
    display: inline-block;
    background-color: #dbeafe;
    color: #1e40af;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

/* ===== ICON-BASED ACTION BUTTONS ===== */

/* Icon-based action buttons */
.action-button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    border: 1px solid #d1d5db;
    background-color: #ffffff;
    color: #374151;
    transition: all 0.2s ease-in-out;
    position: relative;
    z-index: 1;
    text-decoration: none;
}

.action-button-icon:hover,
.action-button-icon:focus,
.action-button-icon:active {
    background-color: #000000;
    color: #ffffff;
    border-color: #000000;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Tooltip styles */
.action-button-icon::before {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937;
    color: #ffffff;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-in-out;
    z-index: 999999;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    /* Ensure tooltip is never clipped by parent containers */
    max-width: 200px;
    overflow: visible;
}

.action-button-icon::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #1f2937;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-in-out;
    z-index: 999999;
    margin-bottom: 0.25rem;
    pointer-events: none;
}

.action-button-icon:hover::before,
.action-button-icon:focus::before {
    opacity: 1;
    visibility: visible;
}

.action-button-icon:hover::after,
.action-button-icon:focus::after {
    opacity: 1;
    visibility: visible;
}

/* Specific button colors */
.action-button-icon.view-details {
    border-color: #3b82f6;
    color: #3b82f6;
}

.action-button-icon.view-details:hover,
.action-button-icon.view-details:focus {
    background-color: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.action-button-icon.cancel-order {
    border-color: #ef4444;
    color: #ef4444;
}

.action-button-icon.cancel-order:hover,
.action-button-icon.cancel-order:focus {
    background-color: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

.action-button-icon.exchange-item-button {
    border-color: #f59e0b;
    color: #f59e0b;
}

.action-button-icon.exchange-item-button:hover,
.action-button-icon.exchange-item-button:focus {
    background-color: #f59e0b;
    color: #ffffff;
    border-color: #f59e0b;
}

.action-button-icon.return-order {
    border-color: #8b5cf6;
    color: #8b5cf6;
}

.action-button-icon.return-order:hover,
.action-button-icon.return-order:focus {
    background-color: #8b5cf6;
    color: #ffffff;
    border-color: #8b5cf6;
}

.action-button-icon.print-invoice {
    border-color: #10b981;
    color: #10b981;
}

.action-button-icon.print-invoice:hover,
.action-button-icon.print-invoice:focus {
    background-color: #10b981;
    color: #ffffff;
    border-color: #10b981;
}

/* Focus styles for accessibility */
.action-button-icon:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
    .action-button-icon {
        width: 36px;
        height: 36px;
    }
    
    .action-button-icon svg {
        width: 1.25rem;
        height: 1.25rem;
    }
    
    /* Hide tooltips on mobile to prevent layout issues */
    .action-button-icon::before,
    .action-button-icon::after {
        display: none;
    }
}

/* Ensure tooltips are never clipped by table rows */
.order-table table tbody tr {
    position: relative;
    overflow: visible !important;
}

.order-table table tbody td {
    position: relative;
    overflow: visible !important;
}

/* Ensure action button container doesn't clip tooltips */
.order-table table tbody td:last-child {
    overflow: visible !important;
}

/* Enhanced table wrapper with better mobile support */
.order-table {
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
}

.order-table table {
    overflow: visible !important;
    min-width: 800px; /* Ensure minimum width for proper scrolling */
    width: 100%;
}

/* Enhanced mobile support for vivaia-table-wrapper when used with order-table */
.vivaia-table-wrapper.order-table {
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
    position: relative;
}

.vivaia-table-wrapper.order-table table {
    min-width: 800px; /* Ensure minimum width for proper scrolling */
    width: 100%;
    margin: 0;
}

/* Custom scrollbar styling for webkit browsers */
.order-table::-webkit-scrollbar,
.vivaia-table-wrapper.order-table::-webkit-scrollbar {
    height: 8px;
}

.order-table::-webkit-scrollbar-track,
.vivaia-table-wrapper.order-table::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.order-table::-webkit-scrollbar-thumb,
.vivaia-table-wrapper.order-table::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.order-table::-webkit-scrollbar-thumb:hover,
.vivaia-table-wrapper.order-table::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Skeleton Loader Styles */
.skeleton-row {
    animation: skeleton-loading 1.5s infinite ease-in-out;
}

.skeleton {
    display: inline-block;
    height: 1em;
    position: relative;
    overflow: hidden;
    background-color: #eee;
    border-radius: 4px;
}

.skeleton::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0.2) 20%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0));
    animation: shimmer 2s infinite;
    content: '';
}

@keyframes skeleton-loading {
    0% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.7;
    }
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.skeleton-text {
    margin-bottom: 0.5em;
}

.skeleton-text:last-child {
    margin-bottom: 0;
}

/* Mobile skeleton adjustments */
@media (max-width: 768px) {
    .skeleton-card {
        background: #fff;
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .skeleton-card .skeleton-text {
        width: 100%;
        margin-bottom: 0.75em;
    }
}