/**
 * Waclaude Components CSS
 * Consolidated component styles for DefectDojo
 * Includes: Scanning components, Tables, Tags
 */

/* ============================================
   SCANNING MODULE COMPONENTS
   ============================================ */

/* Severity Cards - Using Waclaude brand colors */
.severity-card {
    border-radius: 12px !important;
    border: 1px solid rgba(27, 27, 27, 0.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

.severity-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transform: translateY(-2px);
}

.severity-card .card-body {
    padding: 1.5rem;
}

.severity-card .card-title {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.severity-card .display-4 {
    font-size: 3rem;
    font-weight: 700;
    margin: 0;
    line-height: 1;
}

/* Critical - Waclaude danger red with white text */
.severity-card-critical {
    background-color: #a01424;
    color: white;
}

.severity-card-critical .card-body {
    background-color: #a01424;
}

/* High - Waclaude brand blood with white text */
.severity-card-high {
    background-color: #7d0c19;
    color: white;
}

.severity-card-high .card-body {
    background-color: #7d0c19;
}

/* Medium - Waclaude brand glare with white text */
.severity-card-medium {
    background-color: #f38a00;
    color: white;
}

.severity-card-medium .card-body {
    background-color: #f38a00;
}

/* Low - Waclaude muted orange with white text */
.severity-card-low {
    background-color: #c47316;
    color: white;
}

.severity-card-low .card-body {
    background-color: #c47316;
}

/* Info - Waclaude gray with white text */
.severity-card-info {
    background-color: #666666;
    color: white;
}

.severity-card-info .card-body {
    background-color: #666666;
}

/* Scan summary grid */
.scan-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Scan status indicator */
.scan-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.scan-status-indicator .spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

/* Animation for running scans */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.scan-running {
    animation: pulse 2s infinite;
}

/* Log viewer styling - Clean integrated design */
.scan-logs-viewer {
    background-color: transparent;
    color: #495057;
    padding: 0;
    border-radius: 0;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    max-height: 500px;
    overflow-y: auto;
    border: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
}

.scan-logs-viewer::-webkit-scrollbar {
    width: 6px;
}

.scan-logs-viewer::-webkit-scrollbar-track {
    background: transparent;
}

.scan-logs-viewer::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.scan-logs-viewer::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* Fix for card backgrounds that might conflict with link colors */
.card {
    background-color: white;
}

.card-header {
    background-color: #f8f8f8;
    border-bottom: 2px solid #7d0c19;
}

.card-body {
    background-color: white !important;
}

/* Ensure links are visible in all card contexts */
.card-body p a {
    color: #7d0c19 !important;
    font-weight: 600;
    text-decoration: underline;
}

.card-body p a:hover {
    color: #f38a00 !important;
}

/* ============================================
   TABLE COMPONENTS
   ============================================ */

/* Base table styling */
.table {
    background-color: white !important;
    color: #333 !important;
}

/* Table headers - clean and visible */
.table thead th,
.table > thead > tr > th,
table.dataTable thead th,
.dataTables_scrollHead th {
    background: linear-gradient(to bottom, #ffffff, #f8f8f8) !important;
    color: #333 !important;
    font-weight: 600 !important;
    border-bottom: 3px solid #7d0c19 !important;
    border-top: 1px solid #e7e7e7 !important;
    padding: 12px 8px !important;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    font-family: 'Space Grotesk', sans-serif;
}

/* Sortable columns */
.table thead th.sorting,
.table thead th.sorting_asc,
.table thead th.sorting_desc {
    cursor: pointer;
    position: relative;
    padding-right: 20px !important;
}

.table thead th.sorting:after,
.table thead th.sorting_asc:after,
.table thead th.sorting_desc:after {
    color: #7d0c19 !important;
}

/* Table cells */
.table tbody td,
.table > tbody > tr > td,
table.dataTable tbody td {
    color: #333 !important;
    padding: 10px 8px !important;
    vertical-align: middle !important;
    background-color: white !important;
}

/* Striped rows */
.table-striped > tbody > tr:nth-of-type(odd),
table.dataTable.stripe tbody tr.odd {
    background-color: #fafafa !important;
}

.table-striped > tbody > tr:nth-of-type(even),
table.dataTable.stripe tbody tr.even {
    background-color: white !important;
}

/* Hover effect */
.table-hover > tbody > tr:hover,
table.dataTable.hover tbody tr:hover {
    background-color: #fff5f0 !important;
}

/* Links in tables */
.table a,
table.dataTable a {
    color: #7d0c19 !important;
    font-weight: 500 !important;
    text-decoration: none !important;
}

.table a:hover,
table.dataTable a:hover {
    color: #f38a00 !important;
    text-decoration: underline !important;
}

/* Buttons in tables */
.table .btn,
table.dataTable .btn {
    padding: 4px 12px !important;
    font-size: 12px !important;
    margin: 2px !important;
}

.table .btn-sm {
    padding: 3px 8px !important;
    font-size: 11px !important;
}

.table .btn-group .btn {
    margin: 0 !important;
}

/* DataTable specific */
.dataTables_filter input {
    border: 1px solid #ddd !important;
    padding: 6px 12px !important;
    border-radius: 4px !important;
}

.dataTables_filter input:focus {
    border-color: #7d0c19 !important;
    box-shadow: 0 0 0 2px rgba(125, 12, 25, 0.1) !important;
}

.dataTables_paginate .paginate_button {
    color: #7d0c19 !important;
    border: 1px solid #ddd !important;
    background: white !important;
}

.dataTables_paginate .paginate_button:hover {
    background: #f8f8f8 !important;
    border-color: #7d0c19 !important;
}

.dataTables_paginate .paginate_button.current {
    background: #7d0c19 !important;
    color: white !important;
    border-color: #7d0c19 !important;
}

.dataTables_info {
    color: #666 !important;
}

.dataTables_length select {
    border: 1px solid #ddd !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
}

/* Code snippets in tables */
.table code,
table.dataTable code {
    background-color: #f4f4f4 !important;
    color: #d14 !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    font-family: 'Fira Code', monospace !important;
    font-size: 12px !important;
}

/* ============================================
   TAG & BADGE COMPONENTS
   ============================================ */

/* Universal tag override - Maximum specificity */
.tag,
span.tag,
a.tag,
div.tag,
.tag-color,
span.tag-color,
a.tag-color,
div.tag-color,
td .tag,
td span.tag,
td a.tag,
td .tag-color,
.table .tag,
.table .tag-color,
table .tag,
table .tag-color,
.datatable .tag,
.datatable .tag-color,
#product_wrapper .tag,
#product_wrapper .tag-color,
.product-tags .tag,
.product-tags span,
.product-tags a,
.tags .tag,
.tags span,
.tags a {
    /* Force light backgrounds */
    background-color: #e8f4fd !important;
    color: #0066cc !important;
    border: 1px solid #b3d9f2 !important;
    
    /* Ensure readability */
    padding: 3px 10px !important;
    margin: 2px !important;
    display: inline-block !important;
    border-radius: 12px !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
}

/* Hover states for tag links */
a.tag:hover,
a.tag-color:hover,
.tags a:hover,
.product-tags a:hover {
    background-color: #d4ebfa !important;
    color: #0052a3 !important;
    border-color: #8cc5ed !important;
    text-decoration: none !important;
}

/* Label styles */
.label,
span.label,
td .label,
.table .label {
    padding: 4px 10px !important;
    margin: 2px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
}

/* Label variants */
.label-default,
.label.label-default {
    background-color: #f0f0f0 !important;
    color: #666 !important;
    border: 1px solid #ddd !important;
}

.label-primary,
.label.label-primary {
    background-color: #f0e6e8 !important;
    color: #7d0c19 !important;
    border: 1px solid #d4b3b6 !important;
}

.label-success,
.label.label-success {
    background-color: #e6f4e6 !important;
    color: #0d6e0d !important;
    border: 1px solid #b3d4b3 !important;
}

.label-warning,
.label.label-warning {
    background-color: #fff0e6 !important;
    color: #cc6600 !important;
    border: 1px solid #ffd4b3 !important;
}

.label-danger,
.label.label-danger {
    background-color: #ffe6e6 !important;
    color: #a01424 !important;
    border: 1px solid #ffb3b3 !important;
}

.label-info,
.label.label-info {
    background-color: #e6f7ff !important;
    color: #0066cc !important;
    border: 1px solid #b3d9ff !important;
}

/* Badge styles */
.badge {
    padding: 4px 10px !important;
    margin: 2px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
}

.badge-primary {
    background-color: #f0e6e8 !important;
    color: #7d0c19 !important;
    border: 1px solid #d4b3b6 !important;
}

.badge-secondary {
    background-color: #f0f0f0 !important;
    color: #666 !important;
    border: 1px solid #ddd !important;
}

.badge-success {
    background-color: #e6f4e6 !important;
    color: #0d6e0d !important;
    border: 1px solid #b3d4b3 !important;
}

.badge-warning {
    background-color: #fff0e6 !important;
    color: #cc6600 !important;
    border: 1px solid #ffd4b3 !important;
}

.badge-danger {
    background-color: #ffe6e6 !important;
    color: #a01424 !important;
    border: 1px solid #ffb3b3 !important;
}

.badge-info {
    background-color: #e6f7ff !important;
    color: #0066cc !important;
    border: 1px solid #b3d9ff !important;
}

/* Severity-specific badges (solid backgrounds) */
.severity-Critical,
.severity-CRITICAL,
.severity-badge-critical,
.label-critical:not(.tag) {
    background-color: #a01424 !important;
    color: white !important;
    border: none !important;
}

.severity-High,
.severity-HIGH,
.severity-badge-high,
.label-high:not(.tag) {
    background-color: #7d0c19 !important;
    color: white !important;
    border: none !important;
}

.severity-Medium,
.severity-MEDIUM,
.severity-badge-medium,
.label-medium:not(.tag) {
    background-color: #f38a00 !important;
    color: white !important;
    border: none !important;
}

.severity-Low,
.severity-LOW,
.severity-badge-low,
.label-low:not(.tag) {
    background-color: #c47316 !important;
    color: white !important;
    border: none !important;
}

.severity-Info,
.severity-INFO,
.severity-badge-info,
.label-info-severity:not(.tag) {
    background-color: #666666 !important;
    color: white !important;
    border: none !important;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Space Grotesk', sans-serif;
}

.status-badge-success {
    background-color: #0d6e0d;
    color: white;
}

.status-badge-warning {
    background-color: #f38a00;
    color: white;
}

.status-badge-danger {
    background-color: #7d0c19;
    color: white;
}

.status-badge-info {
    background-color: #5bc0de;
    color: white;
}

.status-badge-secondary {
    background-color: #888888;
    color: white;
}

/* Type and Status tags */
.tag-type,
.type-tag {
    background-color: #f0e6f9 !important;
    color: #6b2c91 !important;
    border: 1px solid #d4b3e6 !important;
}

.tag-status,
.status-tag {
    background-color: #e6f9f0 !important;
    color: #0e7c3a !important;
    border: 1px solid #b3e6d4 !important;
}

/* Override inline styles */
[style*="background-color: #666"],
[style*="background-color:#666"],
[style*="background-color: rgb(102"],
[style*="background: #666"],
[style*="background:#666"] {
    background-color: #e8f4fd !important;
    color: #0066cc !important;
}

/* ============================================
   PANEL COMPONENTS
   ============================================ */

.panel-severity {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.panel-severity .panel-heading {
    border-radius: 12px 12px 0 0;
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    /* Scanning components */
    .severity-card .display-4 {
        font-size: 2rem;
    }
    
    .scan-summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    /* Table components */
    .table-responsive {
        border: 1px solid #ddd !important;
        border-radius: 4px;
    }
    
    .table thead th {
        font-size: 11px !important;
        padding: 8px 4px !important;
    }
    
    .table tbody td {
        font-size: 12px !important;
        padding: 8px 4px !important;
    }
    
    /* Tag components */
    td .label,
    td .badge {
        font-size: 10px !important;
        padding: 2px 6px !important;
    }
}

/* ============================================
   SPECIAL TABLE CONTEXTS
   ============================================ */

/* Product list specific */
.product-list-table td {
    vertical-align: middle !important;
}

/* Finding list specific */
.finding-list-table .severity-badge {
    min-width: 80px;
    text-align: center;
}

/* Scan results table */
.scan-results-table td {
    font-family: 'Inter', sans-serif !important;
    font-size: 13px !important;
}

/* Findings table improvements */
.findings-table {
    border-radius: 0;
}

.findings-table thead {
    background-color: #f5f5f5;
}

.findings-table th {
    border-bottom: 2px solid #ddd;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}