/* Table Styles for WCAG Issues Interactive Table */

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.table-container {
    width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.table-header {
    padding: 20px;
    background: #2C3E50;
    color: white;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.header-flex-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin: 0;
}

.table-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.table-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Global Search Container */
.global-search-container {
    margin: 0;
    max-width: 600px;
    margin-left: 0;
    margin-right: 0;
    padding: 12px;
    background-color: #2C3E50;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    min-height: auto;
    padding-top: 0;
    width: 600px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.global-search-input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    background-color: #fff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    color: #333 !important;
    background-color: white !important;
}

.global-search-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.clear-search-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    color: #666 !important;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.clear-search-btn:hover {
    background-color: #f0f0f0;
    color: #333;
}

.clear-search-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.search-results-info {
    font-size: 14px;
    color: #FFFFFF !important;
    text-align: center;
    margin-top: 8px;
    padding: 0 4px;
    min-height: 20px;
}

.search-results-info.has-results {
    color: #28a745;
}

.search-results-info.no-results {
    color: #dc3545;
}

/* Search Result Highlighting */
.search-highlight {
    background-color: #fff3cd;
    color: #856404;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 500;
    box-shadow: 0 0 0 1px rgba(255, 193, 7, 0.3);
}

.search-highlight.exact-match {
    background-color: #d4edda;
    color: #155724;
    box-shadow: 0 0 0 1px rgba(40, 167, 69, 0.3);
}

.search-highlight.fuzzy-match {
    background-color: #f8d7da;
    color: #721c24;
    box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.3);
}

/* Highlight animation */
@keyframes highlight-fade {
    0% {
        background-color: #ffc107;
        transform: scale(1.05);
    }
    100% {
        background-color: #fff3cd;
        transform: scale(1);
    }
}

.search-highlight.new-highlight {
    animation: highlight-fade 0.6s ease-out;
}

.table-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.btn-primary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-primary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.view-options {
    position: relative;
}

.column-filter-dropdown {
    position: relative;
    display: inline-block;
}

.column-filter-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.column-filter-btn:hover {
    background: #005a87;
}

.column-filter-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.column-filter-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
    padding: 8px 0;
    margin-top: 4px;
}

.column-filter-menu[aria-hidden="true"] {
    display: none;
}

.column-filter-menu[aria-hidden="false"] {
    display: block;
}

.column-filter-menu label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: #333;
}

.column-filter-menu label:hover {
    background: #f5f5f5;
}

.column-filter-menu input[type="checkbox"] {
    margin: 0;
}

.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    width: 100%;
    height: fit-content;
}

.interactive-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 1400px; /* Ensure horizontal scroll on smaller screens */
}

/* Selection column styles */
.selection-column {
    width: 50px;
    text-align: center;
    padding: 8px 4px !important;
}

.selection-cell {
    width: 50px;
    height: 250px;
    max-width: 50px;
    max-height: 250px;
    text-align: center;
    padding: 8px 4px !important;
    overflow-y: auto;
    overflow-x: hidden;
}

.checkbox-container {
    display: inline-block;
    position: relative;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: relative;
    display: inline-block;
    height: 18px;
    width: 18px;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.checkbox-container:hover .checkmark {
    border-color: #007bff;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: #007bff;
    border-color: #007bff;
}

.checkbox-container input:indeterminate ~ .checkmark {
    background-color: #6c757d;
    border-color: #6c757d;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 5px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:indeterminate ~ .checkmark:after {
    left: 3px;
    top: 7px;
    width: 10px;
    height: 2px;
    border: solid white;
    border-width: 0 0 2px 0;
    transform: none;
}

/* Bulk operations styles */
.bulk-operations {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 10px;
}

.selected-count {
    font-weight: 500;
    color: #495057;
    margin-right: 10px;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.interactive-table th {
    background: #f8f9fa;
    border: 2px solid #000000;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
    min-width: 120px;
}

.interactive-table th:first-child {
    min-width: 80px; /* S.No column */
}

.interactive-table th[data-column="title"] {
    min-width: 200px;
}

.interactive-table th[data-column="description"],
.interactive-table th[data-column="recommendation"],
.interactive-table th[data-column="exampleFix"] {
    min-width: 250px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 6px;
    position: relative;
}

.header-text {
    font-weight: 600;
    color: #333;
    flex: 1;
    margin-right: 8px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}
.header-actions {
    display: grid;
    grid-template-columns: repeat(2, 24px);
    align-items: center;
    gap: 4px;
}

.sort-btn,
.filter-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    transition: all 0.2s ease;
}

.sort-btn:hover,
.filter-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.sort-btn.active,
.filter-btn.active {
    background: rgba(25, 118, 210, 0.1);
    border: 1px solid rgba(25, 118, 210, 0.3);
    padding: 3px;
}

.sort-btn:focus,
.filter-btn:focus {
    outline: 2px solid #1976d2;
    outline-offset: 1px;
}

.sort-icon,
.filter-icon {
    font-size: 12px;
    color: #666;
    transition: all 0.2s ease;
}

.sort-icon.active,
.filter-icon.active {
    color: #1976d2;
    font-weight: bold;
}

.sort-icon.active {
    color: #1976d2;
    font-weight: bold;
}

.filter-icon.active {
    color: #1976d2;
    font-weight: bold;
}

.sortable[aria-sort="ascending"] .sort-icon::before {
    content: "↑";
}

.sortable[aria-sort="descending"] .sort-icon::before {
    content: "↓";
}

.sortable[aria-sort="none"] .sort-icon::before {
    content: "↕";
}

.filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px; /* Minimum width for the dropdown */
    width: auto; /* Allow it to grow based on content */
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.filter-dropdown[aria-hidden="true"] {
    display: none;
}

.filter-content {
    padding: 12px;
}

.filter-search {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

.filter-search:focus {
    outline: 2px solid #1976d2;
    border-color: #1976d2;
}

.filter-options {
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 8px;
    padding: 0 8px;
}

.filter-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.filter-checkboxes label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.filter-checkboxes label:hover {
    background: #f0f0f0;
}

.filter-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 8px;
    border-top: 1px solid #eee;
}

.filter-actions button {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.filter-actions button:hover {
    background: #e0e0e0;
}

.filter-actions .apply-filter {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

.filter-actions .apply-filter:hover {
    background: #1565c0;
}

.apply-filter,
.clear-filter {
    padding: 6px 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.apply-filter {
    background: #1976d2;
    color: white;
}

.apply-filter:hover {
    background: #1565c0;
}

.clear-filter {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ccc;
}

.clear-filter:hover {
    background: #e0e0e0;
}

.interactive-table td {
    border: 1px solid #dee2e6;
    padding: 12px 8px;
    vertical-align: top;
    width: 250px;
    height: 250px;
    max-width: 250px;
    max-height: 250px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow-y: auto;
    overflow-x: hidden;
}

.cell-content {
    display: block;
}

/* Truncated text styles */
.truncated-text {
    display: block;
    line-height: 1.4;
}

.truncated-content {
    display: inline;
}

.full-content {
    display: block;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
}

.expand-btn {
    background: none;
    border: 2px solid white;
    color: #96B1E9;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    padding: 2px 4px;
    margin-left: 4px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
    background-color: #ffffff;
    outline: 2px dotted white;
}

.expand-btn:hover {
    text-decoration:solid;
    outline-offset: 2px;
}

.expand-btn:focus {
    outline: 2px solid #1976d2;
    outline-offset: 1px;
}

/* Column-specific styles for better alignment */
.recommendation-cell,
.exampleFix-cell {
    width: 250px;
    height: 250px;
    max-width: 250px;
    max-height: 250px;
    line-height: 1.6;
    overflow-y: auto;
    overflow-x: hidden;
}

.exampleFix-cell .code-snippet {
    margin: 10px 0;
    clear: both;
    padding: 12px;
}

.exampleFix-cell .truncated-text {
    display: block;
    margin: 6px 0;
    line-height: 1.6;
}

.exampleFix-cell pre {
    margin: 8px 0;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.referenceLink-cell {
    min-width: 100px;
    text-align: center;
}

.referenceLink-cell a {
    color: #052054;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
    background: #e3f2fd;
}

.referenceLink-cell a:hover {
    background: #e3f2fd;
    text-decoration: underline;
}

.empty-value {
    color: #666;
    font-style: italic;
    max-height: 100px;
    overflow-y: auto;
}

.cell-content.expanded {
    max-height: none;
}

.expand-btn {
    background: none;
    border: none;
    color: #f5f6f7;
    cursor: pointer;
    font-size: 12px;
    margin-top: 4px;
    text-decoration: underline;
    background-color: #052054;
}

.expand-btn:hover {
    color: #96B1E9;
}

.tag {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 11px;
    margin: 1px;
    font-weight: 500;
}

.severity-badge {
    display: inline-block;
    padding: 3px 10px;
    margin: 2px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 600;
    text-align: center;
}

.severity-badge.critical {
    background-color: #dc3545;
    color: white;
}

.severity-badge.serious {
    background-color: #fd7e14;
    color: white;
}

.severity-badge.moderate {
    background-color: #ffc107;
    color: #212529;
}

.severity-badge.minor {
    background-color: #6c757d;
    color: white;
}

.severity-badge.cosmetic {
    background-color: #20c997;
    color: white;
}

.reference-link {
    color: #1976d2;
    text-decoration: none;
    font-weight: 500;
}

.reference-link:hover {
    text-decoration: underline;
}

.code-snippet {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 10px 12px;
    margin: 8px 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    display: block;
    clear: both;
    min-height: 1.6em;
    box-sizing: border-box;
}

.code-snippet code {
    background: none;
    padding: 0;
    border: none;
    font-family: inherit;
    font-size: inherit;
    color: #333;
}

/* Dark mode support for code snippets */
@media (prefers-color-scheme: dark) {
    .code-snippet {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .code-snippet code {
        color: #e2e8f0;
    }
}

.table-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    font-size: 14px;
    color: #666;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-numbers {
    display: flex;
    gap: 5px;
}

.page-number {
    padding: 6px 10px;
    border: 1px solid #ccc;
    background: white;
    cursor: pointer;
    border-radius: 3px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.page-number:hover {
    background: #f0f0f0;
}

.page-number.active {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

.page-number:focus {
    outline: 2px solid #1976d2;
    outline-offset: 1px;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.page-size-selector select {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
}

.page-size-selector select:focus {
    outline: 2px solid #1976d2;
    border-color: #1976d2;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay[aria-hidden="true"] {
    display: none;
}

.loading-spinner {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1976d2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

/* Error and Message Containers */
.error-container {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #f44336;
    color: white;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-width: 400px;
    font-weight: 500;
}

/* Highlighted Row Styles */
.highlighted-row {
    background-color: #fff3cd !important;
    border: 2px solid #ffc107 !important;
    animation: highlight-fade 3s ease-out;
}

@keyframes highlight-fade {
    0% {
        background-color: #ffc107;
        transform: scale(1.02);
    }
    50% {
        background-color: #fff3cd;
    }
    100% {
        background-color: #fff3cd;
        transform: scale(1);
    }
}

.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #4caf50;
    color: white;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-width: 400px;
    font-weight: 500;
}

.message-container.info {
    background-color: #2196f3;
}

.message-container.warning {
    background-color: #ff9800;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .table-header {
        padding: 15px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-header h1 {
        font-size: 1.25rem;
        margin-bottom: 10px;
    }
    
    .table-controls {
        justify-content: center;
    }
    
    .table-wrapper {
        max-height: 60vh;
    }
    
    .interactive-table {
        font-size: 12px;
    }
    
    .header-content {
        padding: 8px 6px;
    }
    
    .interactive-table td {
        padding: 8px 6px;
    }
    
    .table-footer {
        padding: 10px 15px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .pagination-controls {
        justify-content: center;
    }
    
    .page-size-selector {
        justify-content: center;
    }
    
    .error-container,
    .message-container {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .table-header h1 {
        font-size: 1.1rem;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .interactive-table {
        font-size: 11px;
    }
    
    .header-content {
        padding: 6px 4px;
    }
    
    .interactive-table td {
        padding: 6px 4px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .interactive-table th {
        background: #000;
        color: #fff;
    }
    
    .interactive-table tbody tr:nth-child(even) {
        background: #f0f0f0;
    }
    
    .highlighted-row {
        background: #000 !important;
        color: #fff !important;
    }
    
    .btn-primary {
        background: #000;
        border-color: #fff;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .btn,
    .sort-btn,
    .filter-btn,
    .page-number {
        transition: none;
    }
    
    .spinner {
        animation: none;
    }
}

/* Focus Management */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Print Styles */
@media print {
    .table-header,
    .table-footer,
    .header-controls,
    .filter-dropdown {
        display: none;
    }
    
    .table-wrapper {
        overflow: visible;
        max-height: none;
    }
    
    .interactive-table {
        font-size: 10px;
    }
    
    .interactive-table th,
    .interactive-table td {
        border: 1px solid #000;
        padding: 4px;
    }
}