/* Responsive Table Styles for DefectDojo */

/* Base responsive table styles */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #ddd;
    border-radius: 4px;
    position: relative;
}

/* Ensure table maintains proper width and doesn't shrink */
.table-responsive table {
    min-width: 100%;
    width: max-content;
    margin-bottom: 0;
}

/* Responsive column visibility classes */
@media (max-width: 1200px) {
    .hide-lg {
        display: none !important;
    }
}

@media (max-width: 992px) {
    .hide-md {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .hide-sm {
        display: none !important;
    }
}

@media (max-width: 576px) {
    .hide-xs {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .hide-xxs {
        display: none !important;
    }
}

/* Priority columns - always visible */
.priority-column {
    /* These columns will always be visible */
}

/* Custom scrollbar styling */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Sticky table headers */
.table-responsive thead th {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    border-bottom: 2px solid #ddd;
}

/* Visual scroll indicators */
.table-responsive.scrollable::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.8));
    pointer-events: none;
    z-index: 5;
}

.table-responsive.scrollable::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to left, transparent, rgba(255,255,255,0.8));
    pointer-events: none;
    z-index: 5;
}

/* Scroll position indicators */
.table-responsive.scrolled-left::before {
    display: none;
}

.table-responsive.scrolled-right::after {
    display: none;
}

/* Table-specific responsive adjustments */

/* Products table */
#products .priority-column {
    min-width: 120px;
}

#products .hide-sm {
    min-width: 100px;
}

#products .hide-md {
    min-width: 80px;
}

/* Engagements table */
#engagements .priority-column {
    min-width: 120px;
}

#engagements .hide-sm {
    min-width: 100px;
}

#engagements .hide-md {
    min-width: 80px;
}

/* Product Types table */
#product_types .priority-column {
    min-width: 150px;
}

#product_types .hide-sm {
    min-width: 100px;
}

/* Users table */
#users .priority-column {
    min-width: 120px;
}

#users .hide-sm {
    min-width: 100px;
}

#users .hide-md {
    min-width: 80px;
}

/* Endpoints table */
#endpoints .priority-column {
    min-width: 120px;
}

#endpoints .hide-sm {
    min-width: 100px;
}

#endpoints .hide-md {
    min-width: 80px;
}

/* Regulations table */
#regulations_table .priority-column {
    min-width: 150px;
}

#regulations_table .hide-sm {
    min-width: 100px;
}

#regulations_table .hide-md {
    min-width: 80px;
}

/* Groups table */
#groups .priority-column {
    min-width: 120px;
}

#groups .hide-sm {
    min-width: 100px;
}

#groups .hide-md {
    min-width: 80px;
}

/* JIRA Configuration table */
#jira_config .priority-column {
    min-width: 120px;
}

#jira_config .hide-sm {
    min-width: 100px;
}

#jira_config .hide-md {
    min-width: 80px;
}

/* GitHub Configuration table */
#github_config .priority-column {
    min-width: 120px;
}

#github_config .hide-sm {
    min-width: 100px;
}

#github_config .hide-md {
    min-width: 80px;
}

/* Templates table */
#templates .priority-column {
    min-width: 120px;
}

#templates .hide-sm {
    min-width: 100px;
}

#templates .hide-md {
    min-width: 80px;
}

/* Test Types table */
#test_types .priority-column {
    min-width: 120px;
}

#test_types .hide-sm {
    min-width: 100px;
}

#test_types .hide-md {
    min-width: 80px;
}

/* Tool Types table */
#tool_types .priority-column {
    min-width: 120px;
}

#tool_types .hide-sm {
    min-width: 100px;
}

#tool_types .hide-md {
    min-width: 80px;
}

/* Note Types table */
#note_types .priority-column {
    min-width: 120px;
}

#note_types .hide-sm {
    min-width: 100px;
}

#note_types .hide-md {
    min-width: 80px;
}

/* Dev Environments table */
#dev_envs .priority-column {
    min-width: 120px;
}

#dev_envs .hide-sm {
    min-width: 100px;
}

#dev_envs .hide-md {
    min-width: 80px;
}

/* SLA Configuration table */
#sla_configs .priority-column {
    min-width: 120px;
}

#sla_configs .hide-sm {
    min-width: 100px;
}

#sla_configs .hide-md {
    min-width: 80px;
}

/* Tool Configuration table */
#tool_configs .priority-column {
    min-width: 120px;
}

#tool_configs .hide-sm {
    min-width: 100px;
}

#tool_configs .hide-md {
    min-width: 80px;
}

/* Regulations Configuration table */
#regulations_config .priority-column {
    min-width: 120px;
}

#regulations_config .hide-sm {
    min-width: 100px;
}

#regulations_config .hide-md {
    min-width: 80px;
}

/* Metrics table */
#metrics .priority-column {
    min-width: 100px;
}

#metrics .hide-sm {
    min-width: 80px;
}

#metrics .hide-md {
    min-width: 60px;
}

/* Dashboard Surveys table */
#surveys .priority-column {
    min-width: 120px;
}

#surveys .hide-sm {
    min-width: 100px;
}

#surveys .hide-md {
    min-width: 80px;
}

/* Engineer Metrics table */
#engineer_metrics .priority-column {
    min-width: 120px;
}

#engineer_metrics .hide-sm {
    min-width: 100px;
}

#engineer_metrics .hide-md {
    min-width: 80px;
}

/* Simple Metrics table */
#simple_metrics .priority-column {
    min-width: 120px;
}

#simple_metrics .hide-sm {
    min-width: 100px;
}

#simple_metrics .hide-md {
    min-width: 80px;
}

/* Product Type Counts table */
#pt_counts .priority-column {
    min-width: 100px;
}

#pt_counts .hide-sm {
    min-width: 80px;
}

#pt_counts .hide-md {
    min-width: 60px;
}

/* Action History table */
#action_history .priority-column {
    min-width: 120px;
}

#action_history .hide-sm {
    min-width: 100px;
}

#action_history .hide-md {
    min-width: 80px;
}

/* Findings Accepted table */
#findings_accepted .priority-column {
    min-width: 120px;
}

#findings_accepted .hide-sm {
    min-width: 100px;
}

#findings_accepted .hide-md {
    min-width: 80px;
}

/* Survey tables */
#surveys, #list_surveys, #list_questions .priority-column {
    min-width: 120px;
}

#surveys, #list_surveys, #list_questions .hide-sm {
    min-width: 100px;
}

#surveys, #list_surveys, #list_questions .hide-md {
    min-width: 80px;
}

/* Profile table */
#profile .priority-column {
    min-width: 120px;
}

#profile .hide-sm {
    min-width: 100px;
}

#profile .hide-md {
    min-width: 80px;
}

/* Notifications table */
#notifications .priority-column {
    min-width: 120px;
}

#notifications .hide-sm {
    min-width: 100px;
}

#notifications .hide-md {
    min-width: 80px;
}

/* Endpoint Findings table */
#endpoint_findings .priority-column {
    min-width: 120px;
}

#endpoint_findings .hide-sm {
    min-width: 100px;
}

#endpoint_findings .hide-md {
    min-width: 80px;
}

/* Finding Related table */
#finding_related .priority-column {
    min-width: 120px;
}

#finding_related .hide-sm {
    min-width: 100px;
}

#finding_related .hide-md {
    min-width: 80px;
}

/* Snippet tables */
#endpoints_snippet, #engagement_list, #sonarqube_history, #comments .priority-column {
    min-width: 120px;
}

#endpoints_snippet, #engagement_list, #sonarqube_history, #comments .hide-sm {
    min-width: 100px;
}

#endpoints_snippet, #engagement_list, #sonarqube_history, #comments .hide-md {
    min-width: 80px;
}

/* Ensure text doesn't wrap in table cells */
.text-nowrap {
    white-space: nowrap;
}

/* Hover effects for better UX */
.table-responsive table tbody tr:hover {
    background-color: #f5f5f5;
}

/* Focus styles for accessibility */
.table-responsive table tbody tr:focus {
    outline: 2px solid #007bff;
    outline-offset: -2px;
}

/* Print styles */
@media print {
    .table-responsive {
        overflow: visible;
        border: none;
    }
    
    .table-responsive table {
        width: 100%;
    }
    
    .hide-sm, .hide-md, .hide-lg, .hide-xs, .hide-xxs {
        display: table-cell !important;
    }
}
