/* Base Table Responsive Design - Common styles for all tables */

/* Base table styling */
.base-table {
    font-size: 0.95rem;
    margin-bottom: 0;
    min-width: 800px; /* Adjust based on columns */
    border-collapse: collapse;
}

/* Row hover effects */
.base-table .table-row {
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.base-table .table-row:hover {
    background-color: rgba(0, 123, 255, 0.05) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-left-color: #007bff;
}

.base-table th,
.base-table td {
    vertical-align: middle;
}

/* Badges styling */
.base-table .badge {
    font-weight: 500;
    font-size: 0.8rem;
}

.base-table .badge.w-100 {
    border-radius: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.2;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
}

.base-table .badge.rounded-pill {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Action buttons */
.base-table .action-btn {
    min-width: 100%;
    text-align: left;
    transition: all 0.2s ease-in-out;
}

.base-table .action-btn:hover {
    transform: translateY(-1px);
}

.base-table .action-btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

.base-table .action-btn:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Force horizontal scroll on mobile devices */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scroll-behavior: auto; /* Allow native physics for more natural feel */
    /* Remove any potential side borders/lines */
    background: transparent !important;
    position: relative;
    transition: background-color 0.2s ease;
    /* Optimize for native scrolling */
    overscroll-behavior-x: auto;
}

/* More subtle visual indicators for scrollable tables */
.table-responsive.can-scroll {
    /* Very subtle horizontal scroll indicators */
    background: linear-gradient(to right, 
                rgba(0, 123, 255, 0.05) 0%, 
                transparent 2%, 
                transparent 98%, 
                rgba(0, 123, 255, 0.05) 100%) !important;
    cursor: grab;
}

/* Active scrolling state - more subtle */
.table-responsive.scrolling {
    cursor: grabbing;
    /* Slightly increased brightness of indicators during scroll */
    background: linear-gradient(to right, 
                rgba(0, 123, 255, 0.1) 0%, 
                transparent 3%, 
                transparent 97%, 
                rgba(0, 123, 255, 0.1) 100%) !important;
}

/* Scroll hint styling */
.table-scroll-hint {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Empty state styling */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.empty-icon {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.3; }
    50% { opacity: 0.6; }
    100% { opacity: 0.3; }
}

/* Avatar styling */
.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

/* Subtle custom scrollbar for webkit browsers */
.table-responsive::-webkit-scrollbar {
    height: 6px; /* Slightly smaller for better mobile experience */
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(0, 123, 255, 0.3); /* More subtle */
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 123, 255, 0.5);
}

/* Enhanced Touch Scrolling for Mobile */
@media (pointer: coarse) {
    /* Optimizations for touch devices */
    .table-responsive {
        -webkit-overflow-scrolling: touch !important;
        overflow-x: auto !important;
        /* Increase touch target area */
        padding-bottom: 8px;
        /* More subtle visual indicators */
        box-shadow: none;
    }
    
    /* Make the scrollbar more discreet on touch devices */
    .table-responsive::-webkit-scrollbar {
        height: 4px;
    }
    
    .table-responsive::-webkit-scrollbar-thumb {
        background: rgba(0, 123, 255, 0.3);
        border-radius: 4px;
    }
    
    /* Native scrolling physics */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: auto;
    }
}

/* Responsive Design Media Queries */
@media (max-width: 1200px) {
    .base-table {
        min-width: 900px;
    }
}

@media (max-width: 992px) {
    .base-table {
        min-width: 1000px;
    }
}

@media (max-width: 768px) {
    .base-table {
        min-width: 1100px; /* Force horizontal scroll */
    }
    
    .table-responsive {
        position: relative;
        /* Remove any background gradients that create vertical lines */
        background: transparent !important;
        overflow-x: auto !important;
    }
    
    /* Remove the pseudo-element that creates the right vertical line */
    .table-responsive::after {
        display: none !important;
    }
    
    /* More subtle pull handles for smaller screens */
    .table-responsive.can-scroll::before,
    .table-responsive.can-scroll::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 15px;
        pointer-events: none;
        z-index: 2;
        opacity: 0.3;
    }
    
    .table-responsive.can-scroll::before {
        left: 0;
        background: linear-gradient(to right, rgba(0, 123, 255, 0.05), transparent);
    }
    
    .table-responsive.can-scroll::after {
        right: 0;
        background: linear-gradient(to left, rgba(0, 123, 255, 0.05), transparent);
    }
    
    /* Slightly enhance visibility during scroll */
    .table-responsive.scrolling::before,
    .table-responsive.scrolling::after {
        opacity: 0.5;
    }
}

@media (max-width: 576px) {
    /* Disable any existing ::before pseudo-elements for the scroll message */
    .table-responsive::before {
        display: none !important;
    }
    
    @keyframes fadeInOut {
        0%, 50%, 100% { opacity: 0.7; }
        25%, 75% { opacity: 1; }
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .base-table .table-row:hover {
        background-color: rgba(255, 255, 255, 0.05) !important;
    }
    
    .table-responsive.can-scroll {
        background: linear-gradient(to right, 
                    rgba(255, 255, 255, 0.04) 0%, 
                    transparent 2%, 
                    transparent 98%, 
                    rgba(255, 255, 255, 0.04) 100%) !important;
    }
    
    .table-responsive.scrolling {
        background: linear-gradient(to right, 
                    rgba(255, 255, 255, 0.08) 0%, 
                    transparent 3%, 
                    transparent 97%, 
                    rgba(255, 255, 255, 0.08) 100%) !important;
    }
    
    .table-scroll-hint {
        background: rgba(255, 255, 255, 0.1) !important;
        color: white !important;
    }
}

/* Print styles */
@media print {
    .base-table {
        min-width: auto !important;
        font-size: 10px;
    }
    
    .base-table .btn,
    .base-table .action-btn {
        display: none;
    }
    
    .base-table .table-row:hover {
        background-color: transparent !important;
        transform: none;
        box-shadow: none;
    }
    
    .base-table .badge {
        background-color: transparent !important;
        border: 1px solid #000;
        color: #000 !important;
    }
    
    .table-scroll-hint,
    .table-responsive::before,
    .table-responsive::after {
        display: none !important;
    }
}