/**
 * VIVAIA POS - Standardized Table Styles
 * Version: 1.0.0
 * Standardized styling for all tables across the plugin based on inventory check design
 */

/* ===== STANDARDIZED TABLE STYLES ===== */

/* Base table container */
.vivaia-table-container {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

/* Standardized table styles */
.vivaia-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background-color: white;
    table-layout: fixed;
    min-width: 800px;
}

/* Table header styling with VIVAIA brand color */
.vivaia-table thead th {
    background-color: #804c1a;
    color: white;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Top-left and top-right border radius for first and last header cells */
.vivaia-table thead th:first-child {
    border-top-left-radius: 0.5rem;
}

.vivaia-table thead th:last-child {
    border-top-right-radius: 0.5rem;
}

/* Table body styling */
.vivaia-table tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
    font-size: 0.875rem;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: keep-all;
}

/* Remove border from last row */
.vivaia-table tbody tr:last-child td {
    border-bottom: none;
}

/* Alternating row colors for better readability - light backgrounds with dark text */
.vivaia-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

.vivaia-table tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

/* Hover effect on table rows */
.vivaia-table tbody tr:hover {
    background-color: #f3f4f6;
    transition: background-color 0.2s ease;
}

/* Table cell borders for better separation */
.vivaia-table tbody td:not(:last-child) {
    border-right: 1px solid #e5e7eb;
}

.vivaia-table thead th:not(:last-child) {
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

/* Responsive table container */
.vivaia-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    border-radius: 0.5rem;
    position: relative;
}

.vivaia-table-responsive .vivaia-table {
    min-width: 600px;
    margin-bottom: 0;
}

/* Ensure all tables have responsive behavior */
.vivaia-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    border-radius: 0.5rem;
    position: relative;
}

/* Empty state styling */
.vivaia-table tbody tr.empty-state td {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 2rem;
}

/* Action buttons in table cells */
.vivaia-table .action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-start;
}

.vivaia-table .action-buttons .vivaia-button-small {
    padding: 0.25rem 0.5rem;
    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;
}

.vivaia-table .action-buttons .vivaia-button-small:hover,
.vivaia-table .action-buttons .vivaia-button-small:active,
.vivaia-table .action-buttons .vivaia-button-small:focus {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #000000;
}

.vivaia-table .action-buttons .vivaia-button-small:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Status badges */
.vivaia-table .status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.vivaia-table .status-badge.pending {
    background-color: #fef3c7;
    color: #92400e;
}

.vivaia-table .status-badge.completed {
    background-color: #d1fae5;
    color: #065f46;
}

.vivaia-table .status-badge.cancelled {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Image cells */
.vivaia-table .image-cell {
    width: 60px;
    text-align: center;
}

.vivaia-table .image-cell img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 0.25rem;
    border: 1px solid #e5e7eb;
}

/* Text overflow handling */
.vivaia-table .text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Standardized custom order ID styling */
.vivaia-table .custom-order-id-link {
    color: #804c1a !important;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.vivaia-table .custom-order-id-link:hover {
    color: #6b3d15 !important;
    text-decoration: underline;
}

.vivaia-table .custom-order-id-link:focus {
    outline: 2px solid #804c1a;
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .vivaia-table {
        font-size: 0.75rem;
        min-width: 600px; /* Ensure minimum width for scrolling */
    }

    .vivaia-table thead th,
    .vivaia-table tbody td {
        padding: 0.5rem;
        white-space: nowrap; /* Prevent text wrapping on mobile */
    }

    .vivaia-table .action-buttons {
        flex-direction: column;
        gap: 0.25rem;
    }

    .vivaia-table .action-buttons .vivaia-button-small {
        width: 100%;
        text-align: center;
    }

    .vivaia-table .text-truncate {
        max-width: 120px;
    }
    
    /* Enhanced scroll indicators for mobile */
    .vivaia-table-responsive,
    .vivaia-table-wrapper {
        /* Removed gradient effects */
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .vivaia-table {
        font-size: 0.7rem;
        min-width: 500px;
    }

    .vivaia-table thead th,
    .vivaia-table tbody td {
        padding: 0.375rem;
    }
    
    /* Stronger scroll indicators for very small screens */
    .vivaia-table-responsive,
    .vivaia-table-wrapper {
        /* Removed gradient effects */
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .vivaia-table thead th {
        border-width: 2px;
    }
    
    .vivaia-table tbody td {
        border-width: 1px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .vivaia-table tbody tr {
        transition: none;
    }
} 

.vivaia-table.collapsed-details th.details-col,
.vivaia-table.collapsed-details td.details-col {
    display: none !important;
} 