/* Custom CSS for dEFFECTIVE */

/* Dashboard table font sizes - smaller for compact display */
.dashboard-table tbody td {
    font-size: 0.8rem !important;
}
.dashboard-table thead th {
    font-size: 0.85rem !important;
}

/* Dashboard trends control buttons - slightly smaller font */
.trends-controls .btn {
    font-size: 0.65rem !important;
}
.trends-controls small {
    font-size: 0.65rem !important;
}
.trends-controls .form-control {
    font-size: 0.65rem !important;
}
.trends-controls .form-check-label {
    font-size: 0.65rem !important;
}

/* Header and filter bar - full-width background with inset content */
.inset-bar {
    width: 100% !important;
    padding-left: 20% !important;
    padding-right: 20% !important;
}

@media (max-width: 768px) {
    .inset-bar {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* dEFFECTIVE brand logo - force white color override */
.defective-brand-link,
.defective-brand-link:link,
.defective-brand-link:visited,
.defective-brand-link:hover,
.defective-brand-link:active {
    color: #FFFFFF !important;
}

.defective-brand-link span,
.defective-brand-link i {
    color: #FFFFFF !important;
}

/* Force company logo to be small in header */
#company-logo-container img {
    height: 75px !important;
    max-height: 75px !important;
    width: auto !important;
    max-width: 150px !important;
    object-fit: contain !important;
}

/* Admin panel logo preview - limit to 300px height */
.admin-logo-preview {
    max-height: 300px !important;
    height: auto !important;
    width: auto !important;
    max-width: 100% !important;
    object-fit: contain !important;
}

/* Shared circular button base styles */
.position-fixed .btn.rounded-circle,
.position-fixed a.btn.rounded-circle {
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Top-right navigation button container */
#nav-action-container {
    z-index: 1050 !important;
    margin-top: 20px !important;
}

/* Top-right nav buttons (55x55) */
#nav-action-container .btn.rounded-circle,
#nav-action-container a.btn.rounded-circle {
    width: 55px !important;
    height: 55px !important;
    min-width: 55px !important;
    min-height: 55px !important;
}

/* Bottom-right floating action button container */
#floating-action-container {
    z-index: 100000 !important;
}

/* Bottom-right action buttons (60x60) */
#floating-action-container .btn.rounded-circle,
#floating-action-container a.btn.rounded-circle {
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    min-height: 60px !important;
    position: relative !important;
}

#floating-back-btn {
    z-index: 100000 !important;
}

#floating-back-btn i {
    pointer-events: none !important;
}

/* Auth action buttons (login/register) for non-authenticated users */
#auth-action-container {
    z-index: 1050 !important;
    margin-top: 20px !important;
}

#auth-action-container .btn.rounded-circle,
#auth-action-container a.btn.rounded-circle {
    width: 55px !important;
    height: 55px !important;
    min-width: 55px !important;
    min-height: 55px !important;
}

/* Category filter button styling */
.category-filter-btn {
    font-size: 0.8rem !important;
    white-space: nowrap !important;
}

/* Fix for category system toggle switches visibility */
.category-system-filter.form-check-input {
    background-color: #6c757d !important;
    border: 2px solid #adb5bd !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.category-system-filter.form-check-input:checked {
    background-color: #198754 !important;
    border-color: #198754 !important;
}

.category-system-filter.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25) !important;
}

/* Ensure the switch handle is always visible */
.form-switch .category-system-filter.form-check-input:not(:checked)::before {
    background-color: #ffffff !important;
    border: 1px solid #dee2e6 !important;
}

.form-switch .category-system-filter.form-check-input:checked::before {
    background-color: #ffffff !important;
    border: 1px solid #ffffff !important;
}

/* Remove border between main defect row and description row */
.table tbody tr.description-row td {
    border-top: none !important;
    border-bottom: none !important;
    padding: 0 !important;
    vertical-align: top !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
}

/* Make defect titles bold and larger */
.table tbody tr.main-row td a {
    font-weight: bold !important;
    font-size: 1.1em !important;
}

/* Make description text larger */
.table tbody tr.description-row td small {
    font-size: 1em !important;
}

.table tbody tr.main-row + tr.description-row td {
    border-top: none !important;
    padding: 0 !important;
    padding-left: 0 !important;
    vertical-align: top !important;
}

/* Reduce padding on main rows to bring description closer */
.table tbody tr.main-row td {
    padding-bottom: 0 !important;
    vertical-align: middle !important;
}

/* More specific selectors to override Bootstrap completely */
.table-hover tbody tr.description-row td,
.table-hover tbody tr.description-row:hover td,
.table tbody tr.description-row td {
    border-top: 0 !important;
    border-top-width: 0 !important;
    border-top-style: none !important;
    padding: 0 !important;
    padding-left: 0 !important;
    vertical-align: top !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
}

/* Override Bootstrap's default table cell padding entirely for description rows */
.table > :not(caption) > * > tr.description-row > td {
    padding: 0 !important;
    padding-left: 0 !important;
    border-top: none !important;
    vertical-align: top !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
}

/* Ensure main rows don't have bottom borders when followed by description */
.table tbody tr.main-row:has(+ tr.description-row) td {
    border-bottom: none !important;
    padding-bottom: 0 !important;
}

/* Fallback for browsers that don't support :has() */
.table tbody tr.main-row td {
    border-bottom: 1px solid var(--bs-border-color) !important;
    padding-bottom: 0 !important;
}

.table tbody tr.main-row:last-child td,
.table tbody tr.main-row:nth-last-child(2) td {
    border-bottom: none !important;
}

/* Navigation styling - uniform size */
.navbar-nav .nav-link {
    font-size: 1.05em; /* Reduced by 30% from 1.5em */
    vertical-align: baseline;
    display: inline-flex;
    align-items: baseline;
}

.navbar-nav .nav-link i {
    font-size: 1em; /* Same height as text for all icons */
}

/* Active navigation styling - bold and bright */
.nav-link.active {
    font-weight: bold;
}

/* Inactive navigation styling - normal weight and dimmer */
.nav-link:not(.active) {
    font-weight: normal;
    opacity: 0.7; /* Dimmer appearance */
}

/* Logo styling */
.navbar-logo {
    height: 40px;
    width: 40px;
    object-fit: contain;
}

.navbar-brand i {
    font-size: 1.2em; /* Make icon proportional to the doubled text size */
}

/* Print styles */
@media print {
    /* Universal text color fix - all text should be black */
    * {
        color: #000 !important;
        background-color: transparent !important;
    }
    
    /* Hide UI elements that shouldn't print */
    .navbar,
    .btn,
    .breadcrumb,
    footer,
    .floating-print-btn,
    .position-fixed,
    .pagination,
    .form-control,
    .form-select,
    .input-group,
    .modal,
    .modal-backdrop,
    .tooltip,
    .popover,
    .dropdown-menu {
        display: none !important;
    }
    
    /* Keep essential action buttons visible but style them for print */
    .print-visible {
        display: inline-block !important;
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #000 !important;
        padding: 4px 8px !important;
        font-size: 10px !important;
        margin: 2px !important;
    }
    
    /* Container and layout optimization */
    .container,
    .container-fluid {
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Card styling for clean print */
    .card {
        border: none !important;
        box-shadow: none !important;
        margin-bottom: 20px !important;
        page-break-inside: avoid;
    }
    
    .card-header {
        background: none !important;
        border-bottom: 2px solid #000 !important;
        print-color-adjust: exact;
        font-weight: bold;
        padding: 10px 0 !important;
    }
    
    .card-body {
        padding: 10px 0 !important;
    }
    
    /* Table styling */
    .table {
        font-size: 11px;
        border-collapse: collapse !important;
        color: #000 !important;
    }
    
    .table th,
    .table td {
        border: 1px solid #000 !important;
        padding: 4px !important;
        vertical-align: top;
        color: #000 !important;
        background-color: #fff !important;
    }
    
    .table thead th {
        background: #f0f0f0 !important;
        color: #000 !important;
        font-weight: bold;
        print-color-adjust: exact;
    }
    
    .table tbody tr {
        background-color: #fff !important;
    }
    
    .table tbody tr:nth-child(even) {
        background-color: #f8f9fa !important;
    }
    
    /* Badge styling for print */
    .badge {
        color: #000 !important;
        background: #fff !important;
        border: 1px solid #000 !important;
        print-color-adjust: exact;
        padding: 2px 6px !important;
        font-size: 10px !important;
    }
    
    /* Priority badge specific colors for print */
    .badge-priority-1 {
        background: #ffebee !important;
        border-color: #dc3545 !important;
    }
    
    .badge-priority-2 {
        background: #fff3e0 !important;
        border-color: #fd7e14 !important;
    }
    
    .badge-priority-3 {
        background: #e8f5e8 !important;
        border-color: #28a745 !important;
    }
    
    .badge-priority-4 {
        background: #e3f2fd !important;
        border-color: #007bff !important;
    }
    
    /* Mine plan PDF container - fix zoom scaling issues */
    #pdfContainer {
        height: auto !important;
        overflow: visible !important;
        page-break-inside: avoid;
        max-width: 100% !important;
        transform: none !important;
        zoom: 1 !important;
        position: relative !important;
    }
    
    #pdfCanvas {
        max-width: 100% !important;
        width: auto !important;
        height: auto !important;
        transform: none !important;
        zoom: 1 !important;
        display: block !important;
        margin: 0 auto !important;
        position: relative !important;
    }
    
    /* Hide defect markers during print to avoid artifacts */
    #defectMarkers {
        display: none !important;
    }
    
    /* Fix mine plan scaling issues when zoomed */
    .mine-plan-container {
        transform: none !important;
        zoom: 1 !important;
        max-width: 100% !important;
        overflow: visible !important;
    }
    
    .mine-plan-container * {
        transform: none !important;
        zoom: 1 !important;
    }
    
    /* Print images from container capture */
    .print-container-image,
    .print-mineplan-image,
    .print-chart-image {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
        display: block !important;
        margin: 0 auto !important;
    }
    
    /* Hide sidebars in defect detail view */
    .col-lg-4 {
        display: none !important;
    }
    
    /* Make main content full width when sidebar is hidden */
    .col-lg-8 {
        flex: 0 0 auto !important;
        width: 100% !important;
    }
    
    /* Dashboard specific */
    .dashboard-stats .col-md-3 {
        width: 25% !important;
        float: left !important;
    }
    
    /* Defect list specific */
    .defect-filters {
        display: none !important;
    }
    
    /* Admin panel specific */
    .admin-controls {
        display: none !important;
    }
    
    /* General layout */
    .row {
        margin: 0 !important;
    }
    
    .col-12,
    .col-lg-12 {
        padding: 0 !important;
    }
    
    /* Typography - ensure all text is black */
    h1, h2, h3, h4, h5, h6 {
        color: #000 !important;
        background-color: transparent !important;
        page-break-after: avoid;
    }
    
    p, span, div, td, th, li, a {
        color: #000 !important;
        background-color: transparent !important;
    }
    
    p {
        orphans: 3;
        widows: 3;
    }
    
    /* Preserve line breaks in description fields */
    .description-field,
    .defect-description,
    [data-field="description"] {
        white-space: pre-wrap !important;
        word-wrap: break-word !important;
    }
    
    /* Fix specific elements that might have white text */
    .text-white,
    .text-light,
    .bg-dark,
    .bg-primary,
    .bg-secondary {
        color: #000 !important;
        background-color: #fff !important;
    }
    
    /* Page breaks */
    .page-break-before {
        page-break-before: always;
    }
    
    .page-break-after {
        page-break-after: always;
    }
    
    .no-page-break {
        page-break-inside: avoid;
    }
}

/* Timeline styles for audit trail */
.timeline {
    position: relative;
    padding-left: 3rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 1.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--bs-border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 1rem;
}

.timeline-marker {
    position: absolute;
    left: -3rem;
    top: 0.25rem;
    width: 2rem;
    height: 2rem;
    background: var(--bs-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
}

.timeline-content {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 0.75rem;
}

/* Defect marker styles for mine plan */
.defect-marker {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #000;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease;
}

.defect-marker:hover {
    transform: translate(-50%, -50%) scale(1.2);
    z-index: 1001;
}

.defect-marker.priority-1 {
    background-color: #dc3545;
}

.defect-marker.priority-2 {
    background-color: #fd7e14;
}

.defect-marker.priority-3 {
    background-color: #28a745;
}

.defect-marker.priority-4 {
    background-color: #007bff;
}

.defect-marker.complete {
    opacity: 1.0;
}

/* Overdue animation - 6x diameter, 1x frequency */
.defect-marker.overdue.animations-enabled {
    animation: pulse-overdue 1s infinite;
}

/* Due within 1 week - 6x diameter, 0.5x frequency */
.defect-marker.due-week.animations-enabled {
    animation: pulse-week 2s infinite;
}

/* Due within 4 weeks - 6x diameter, 0.25x frequency */
.defect-marker.due-month.animations-enabled {
    animation: pulse-month 4s infinite;
}

/* When animations are disabled, remove all animations */
.animations-disabled .defect-marker {
    animation: none !important;
}

/* Priority-based animations for overdue items - 1x frequency */
.defect-marker.priority-1.overdue {
    animation: pulse-overdue-p1 1s infinite;
}
.defect-marker.priority-2.overdue {
    animation: pulse-overdue-p2 1s infinite;
}
.defect-marker.priority-3.overdue {
    animation: pulse-overdue-p3 1s infinite;
}
.defect-marker.priority-4.overdue {
    animation: pulse-overdue-p4 1s infinite;
}

/* Priority-based animations for due within 1 week - 0.5x frequency */
.defect-marker.priority-1.due-week {
    animation: pulse-week-p1 2s infinite;
}
.defect-marker.priority-2.due-week {
    animation: pulse-week-p2 2s infinite;
}
.defect-marker.priority-3.due-week {
    animation: pulse-week-p3 2s infinite;
}
.defect-marker.priority-4.due-week {
    animation: pulse-week-p4 2s infinite;
}

/* Priority-based animations for due within 4 weeks - 0.25x frequency */
.defect-marker.priority-1.due-month {
    animation: pulse-month-p1 4s infinite;
}
.defect-marker.priority-2.due-month {
    animation: pulse-month-p2 4s infinite;
}
.defect-marker.priority-3.due-month {
    animation: pulse-month-p3 4s infinite;
}
.defect-marker.priority-4.due-month {
    animation: pulse-month-p4 4s infinite;
}

/* Overdue animations by priority - 6x diameter, reduced transparency */
@keyframes pulse-overdue-p1 {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.56); }
    70% { box-shadow: 0 0 0 60px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}
@keyframes pulse-overdue-p2 {
    0% { box-shadow: 0 0 0 0 rgba(253, 126, 20, 0.56); }
    70% { box-shadow: 0 0 0 60px rgba(253, 126, 20, 0); }
    100% { box-shadow: 0 0 0 0 rgba(253, 126, 20, 0); }
}
@keyframes pulse-overdue-p3 {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.56); }
    70% { box-shadow: 0 0 0 60px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}
@keyframes pulse-overdue-p4 {
    0% { box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.56); }
    70% { box-shadow: 0 0 0 60px rgba(0, 123, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 123, 255, 0); }
}

/* Week animations by priority - 6x diameter, reduced transparency */
@keyframes pulse-week-p1 {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.56); }
    70% { box-shadow: 0 0 0 60px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}
@keyframes pulse-week-p2 {
    0% { box-shadow: 0 0 0 0 rgba(253, 126, 20, 0.56); }
    70% { box-shadow: 0 0 0 60px rgba(253, 126, 20, 0); }
    100% { box-shadow: 0 0 0 0 rgba(253, 126, 20, 0); }
}
@keyframes pulse-week-p3 {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.56); }
    70% { box-shadow: 0 0 0 60px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}
@keyframes pulse-week-p4 {
    0% { box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.56); }
    70% { box-shadow: 0 0 0 60px rgba(0, 123, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 123, 255, 0); }
}

/* Dashboard stat card hover effects */
.dashboard-stat-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.dashboard-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

/* Smooth chart transitions */
.card:has(#monthlyTrendsChart) {
    transition: opacity 0.3s ease, transform 0.2s ease;
}

.chart-loading {
    opacity: 0.7 !important;
    transform: scale(0.98);
}

/* Chart navigation buttons */
.btn-group .btn {
    transition: all 0.2s ease;
}

.btn-group .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Page transition effects */
body {
    transition: opacity 0.2s ease;
}

.page-loading {
    opacity: 0.8;
    pointer-events: none;
}

/* Month animations by priority - 6x diameter, reduced transparency */
@keyframes pulse-month-p1 {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.56); }
    70% { box-shadow: 0 0 0 60px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}
@keyframes pulse-month-p2 {
    0% { box-shadow: 0 0 0 0 rgba(253, 126, 20, 0.56); }
    70% { box-shadow: 0 0 0 60px rgba(253, 126, 20, 0); }
    100% { box-shadow: 0 0 0 0 rgba(253, 126, 20, 0); }
}
@keyframes pulse-month-p3 {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.56); }
    70% { box-shadow: 0 0 0 60px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}
@keyframes pulse-month-p4 {
    0% { box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.56); }
    70% { box-shadow: 0 0 0 60px rgba(0, 123, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 123, 255, 0); }
}

/* Legend styles */
.marker-legend {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #000;
    display: inline-block;
}

.marker-legend.priority-1 {
    background-color: #dc3545;
}

.marker-legend.priority-2 {
    background-color: #fd7e14;
}

.marker-legend.priority-3 {
    background-color: #28a745;
}

.marker-legend.priority-4 {
    background-color: #007bff;
}

.status-legend {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    display: inline-block;
}

.status-legend.complete {
    background-color: #198754;
}

.status-legend.overdue {
    background-color: #dc3545;
    animation: pulse 2s infinite;
}

/* Custom badge colors to match mine plan markers */
.badge-priority-low {
    background-color: #007bff !important;
    color: white;
}

/* Priority badge styles (separate from status badges) */
.badge-priority-1 {
    background-color: #dc3545 !important;
    color: #fff !important;
}

.badge-priority-2 {
    background-color: #fd7e14 !important;
    color: #fff !important;
}

.badge-priority-3 {
    background-color: #28a745 !important;
    color: #fff !important;
}

.badge-priority-4 {
    background-color: #007bff !important;
    color: #fff !important;
}

/* PDF container styles */
#pdfContainer {
    background: #ffffff;
    border-radius: 0.375rem;
    /* Ensure scroll bars appear outside the container */
    box-sizing: border-box;
    /* Remove any padding that might push scroll bars inside */
    padding: 0;
}

/* Hide the scrollbars completely */
#pdfContainer::-webkit-scrollbar {
    width: 0px;
    height: 0px;
    display: none;
}

#pdfContainer {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
}

#pdfCanvas {
    cursor: grab;
    display: block;
    image-rendering: auto;
}

#pdfCanvas:active {
    cursor: grabbing;
}

/* Defect tooltip */
.defect-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 2000;
    max-width: 200px;
    word-wrap: break-word;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .timeline {
        padding-left: 2rem;
    }
    
    .timeline::before {
        left: 1rem;
    }
    
    .timeline-marker {
        left: -2rem;
        width: 1.5rem;
        height: 1.5rem;
    }
    
    .defect-marker {
        width: 16px;
        height: 16px;
        font-size: 8px;
    }
}

/* Status badges with updated colors */
/* Not Started = Yellow */
.badge.bg-secondary {
    background-color: #ffc107 !important;
    color: #000 !important;
}

/* Neutral due date filter badges */
.badge.bg-neutral {
    background-color: #6c757d !important;
    color: #fff !important;
}

/* Started = Purple */
.badge.bg-warning {
    background-color: #9f27b8 !important;
    color: #fff !important;
}

/* Paused = Red-Purple */
.badge.bg-info {
    background-color: #e91e63 !important;
    color: #fff !important;
}

/* Complete = Dimmer Light Blue */
.badge.bg-success {
    background-color: #6bb6ff !important;
    color: #fff !important;
}

/* Monitoring Only = Grey */
.badge.bg-primary {
    background-color: #6c757d !important;
    color: #fff !important;
}

.badge.bg-danger {
    background-color: #dc3545 !important;
}

/* Table row highlighting for overdue defects */
.table .table-danger {
    background-color: rgba(220, 53, 69, 0.1) !important;
}

/* Focus states for accessibility */
.defect-marker:focus,
.btn:focus {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--bs-primary, #0d6efd);
    animation: spin 1s ease-in-out infinite;
}

/* Ensure all loading containers have dark backgrounds */
.loading-container {
    background: var(--bs-dark, #212529) !important;
    color: var(--bs-light, #fff) !important;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

/* Dark theme for all spinners */
.spinner-border {
    color: var(--bs-primary, #0d6efd) !important;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Defect Group Styles for Explosion Effect */
.defect-group {
    transition: all 0.3s ease;
}

.defect-group-indicator {
    transition: all 0.3s ease;
}

.defect-group-indicator:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
}

.defect-group .defect-marker {
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.defect-group:hover .defect-marker {
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

/* Universal Loading Overlay - Dark Theme Preserved */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bs-dark, #212529);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.loading-content {
    text-align: center;
    color: var(--bs-light, #fff);
}

.loading-content .loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--bs-primary, #0d6efd);
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--bs-light, #fff);
    opacity: 0.9;
}
