/* ============================================================
   MESH HEALER TAB STYLES
   3D Scanner - Mesh Healer / Repair Tool
   Theme: Dark (#0a0a0a), Accent: #10b981 (green/teal)
   ============================================================ */

/* ============================================================
   1. HEALER DROP ZONE
   ============================================================ */

.healer-drop-zone {
    border: 2px dashed #444;
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 24px;
    background: transparent;
}

.healer-drop-zone:hover,
.healer-drop-zone.dragover {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.healer-drop-zone .drop-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    opacity: 0.5;
    display: block;
}

.healer-drop-zone:hover .drop-icon {
    opacity: 0.8;
}

.healer-drop-zone h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #fff;
}

.healer-drop-zone p {
    color: #888;
    font-size: 14px;
    margin: 0;
}

.healer-drop-zone .accepted-formats {
    font-size: 12px;
    color: #666;
    margin-top: 12px;
}

.healer-drop-zone input[type="file"] {
    display: none;
}


/* ============================================================
   2. STATS PANEL
   ============================================================ */

.healer-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.healer-stat-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    transition: border-color 0.2s;
}

.healer-stat-card .stat-icon {
    font-size: 22px;
    margin-bottom: 6px;
    display: block;
}

.healer-stat-card .stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.healer-stat-card .stat-label {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Color-coded stat cards */
.healer-stat-card.good {
    border-color: rgba(16, 185, 129, 0.3);
}

.healer-stat-card.good .stat-value {
    color: #10b981;
}

.healer-stat-card.warning {
    border-color: rgba(245, 158, 11, 0.3);
}

.healer-stat-card.warning .stat-value {
    color: #f59e0b;
}

.healer-stat-card.error {
    border-color: rgba(239, 68, 68, 0.3);
}

.healer-stat-card.error .stat-value {
    color: #ef4444;
}

.healer-stat-card.neutral .stat-value {
    color: #ccc;
}


/* ============================================================
   3. ISSUES LIST
   ============================================================ */

.healer-issues {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
}

.healer-issues-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #222;
}

.healer-issues-header h4 {
    font-size: 14px;
    color: #ccc;
    margin: 0;
}

.healer-issues-count {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    font-weight: 600;
}

.healer-issues-count.clean {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.healer-issues-list {
    max-height: 280px;
    overflow-y: auto;
}

.healer-issue-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #1a1a1a;
    font-size: 13px;
    transition: background 0.15s;
}

.healer-issue-row:last-child {
    border-bottom: none;
}

.healer-issue-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Severity borders */
.healer-issue-row.critical {
    border-left: 3px solid #ef4444;
}

.healer-issue-row.warning {
    border-left: 3px solid #f59e0b;
}

.healer-issue-row.info {
    border-left: 3px solid #3b82f6;
}

.healer-issue-row .issue-icon {
    font-size: 16px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.healer-issue-row.critical .issue-icon {
    color: #ef4444;
}

.healer-issue-row.warning .issue-icon {
    color: #f59e0b;
}

.healer-issue-row.info .issue-icon {
    color: #3b82f6;
}

.healer-issue-row .issue-desc {
    flex: 1;
    color: #ccc;
}

.healer-issue-row .issue-count {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    background: #1a1a1a;
    padding: 2px 8px;
    border-radius: 8px;
    flex-shrink: 0;
}

/* Scrollbar styling for issues list */
.healer-issues-list::-webkit-scrollbar {
    width: 6px;
}

.healer-issues-list::-webkit-scrollbar-track {
    background: #111;
}

.healer-issues-list::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.healer-issues-list::-webkit-scrollbar-thumb:hover {
    background: #444;
}


/* ============================================================
   4. REPAIR OPTIONS
   ============================================================ */

.healer-options {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}

.healer-options h4 {
    font-size: 14px;
    margin: 0 0 12px 0;
    color: #ccc;
}

.healer-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.healer-option-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 8px;
    transition: border-color 0.2s;
}

.healer-option-item:hover {
    border-color: #333;
}

.healer-option-item input[type="checkbox"] {
    margin-top: 2px;
    accent-color: #10b981;
    flex-shrink: 0;
}

.healer-option-item .option-content {
    flex: 1;
    min-width: 0;
}

.healer-option-item .option-name {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
}

.healer-option-item .option-desc {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
    line-height: 1.3;
}

/* Reuse existing toggle styles from scan page */
.healer-options .option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #1a1a1a;
}

.healer-options .option-row:last-child {
    border-bottom: none;
}

.healer-options .toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.healer-options .toggle input {
    display: none;
}

.healer-options .toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #333;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.healer-options .toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: all 0.3s;
}

.healer-options .toggle input:checked + .toggle-slider {
    background: #10b981;
}

.healer-options .toggle input:checked + .toggle-slider::after {
    transform: translateX(20px);
}

.healer-fix-all-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
    transition: all 0.2s;
}

.healer-fix-all-btn:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: #10b981;
}


/* ============================================================
   5. BEFORE / AFTER PREVIEW
   ============================================================ */

.healer-preview {
    margin-bottom: 24px;
}

.healer-preview-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.healer-preview-pane {
    position: relative;
    background: #111;
    border: 2px solid #222;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4/3;
}

.healer-preview-pane.active {
    border-color: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.15);
}

.healer-preview-pane canvas,
.healer-preview-pane model-viewer {
    width: 100% !important;
    height: 100% !important;
}

.healer-preview-label {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #ccc;
    z-index: 10;
    pointer-events: none;
}

.healer-preview-pane.active .healer-preview-label {
    color: #10b981;
}

.healer-preview-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
}

.healer-preview-tab {
    padding: 8px 16px;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    color: #888;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.healer-preview-tab:hover {
    border-color: #555;
    color: #ccc;
}

.healer-preview-tab.active {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
    color: #10b981;
}

.healer-preview-tab:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.healer-wireframe-toggle {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #888;
    cursor: pointer;
}

.healer-wireframe-toggle input {
    accent-color: #10b981;
}

.healer-preview-container {
    position: relative;
    min-height: 300px;
    background: #111;
    border-radius: 12px;
    overflow: hidden;
}

/* Toggle mode (single pane with toggle) */
.healer-preview-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.healer-preview-toggle-btn {
    flex: 1;
    padding: 8px;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    color: #888;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.healer-preview-toggle-btn.active {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    color: #10b981;
}

/* Stats diff below previews */
.healer-stats-diff {
    display: flex;
    gap: 16px;
    padding: 10px 16px;
    background: #111;
    border: 1px solid #222;
    border-radius: 8px;
    font-size: 12px;
    color: #888;
    flex-wrap: wrap;
}

.healer-stats-diff .diff-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.healer-stats-diff .diff-label {
    color: #666;
}

.healer-stats-diff .diff-old {
    color: #888;
    text-decoration: line-through;
}

.healer-stats-diff .diff-arrow {
    color: #555;
}

.healer-stats-diff .diff-new {
    color: #10b981;
    font-weight: 600;
}

.healer-stats-diff .diff-new.worse {
    color: #f59e0b;
}


/* ============================================================
   6. PROGRESS BAR
   ============================================================ */

.healer-progress {
    margin-bottom: 24px;
    display: none;
}

.healer-progress.active {
    display: block;
}

.healer-progress-track {
    height: 8px;
    background: #222;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.healer-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #059669);
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

@keyframes healer-progress-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.healer-progress-fill.animated {
    animation: healer-progress-pulse 1.5s ease-in-out infinite;
}

.healer-progress-steps {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.healer-progress-step {
    font-size: 11px;
    color: #555;
    text-align: center;
    flex: 1;
    transition: color 0.3s;
}

.healer-progress-step.active {
    color: #10b981;
    font-weight: 600;
}

.healer-progress-step.done {
    color: #888;
}

.healer-progress-status {
    text-align: center;
    font-size: 13px;
    color: #888;
    margin-top: 8px;
}


/* ============================================================
   7. REPAIR BUTTON
   ============================================================ */

.healer-repair-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    transition: all 0.2s;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.healer-repair-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.healer-repair-btn:active {
    transform: translateY(0);
}

.healer-repair-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@keyframes healer-btn-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
}

.healer-repair-btn.processing {
    animation: healer-btn-pulse 2s infinite;
    pointer-events: none;
}

.healer-repair-btn.processing::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: healer-btn-shimmer 1.5s infinite;
}

@keyframes healer-btn-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}


/* ============================================================
   8. DOWNLOAD BUTTON
   ============================================================ */

.healer-download-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: #10b981;
    color: #fff;
    transition: all 0.2s;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.healer-download-btn:hover {
    background: #059669;
}

.healer-download-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

.healer-download-btn .file-size {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.8;
}

.healer-download-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.healer-download-actions .healer-download-btn {
    flex: 1;
    min-width: 140px;
    margin-bottom: 0;
}

.healer-download-actions .healer-download-btn.secondary {
    background: #222;
    color: #fff;
    border: 1px solid #444;
}

.healer-download-actions .healer-download-btn.secondary:hover {
    background: #333;
}


/* ============================================================
   9. RESULTS SUMMARY
   ============================================================ */

.healer-results {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}

.healer-results-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.healer-results-header h4 {
    font-size: 14px;
    color: #ccc;
    margin: 0;
}

.healer-results-header .results-icon {
    font-size: 20px;
    color: #10b981;
}

.healer-results-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.healer-result-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 20px;
    font-size: 12px;
    color: #10b981;
    font-weight: 500;
}

.healer-result-badge .badge-check {
    font-size: 14px;
}

.healer-result-badge.skipped {
    background: rgba(255, 255, 255, 0.05);
    border-color: #333;
    color: #888;
}

.healer-results-summary {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #222;
    font-size: 12px;
    color: #888;
    line-height: 1.5;
}


/* ============================================================
   10. RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
    .healer-preview-layout {
        grid-template-columns: 1fr;
    }

    .healer-preview-pane {
        aspect-ratio: 16/10;
    }

    .healer-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .healer-options-grid {
        grid-template-columns: 1fr;
    }

    .healer-download-actions {
        flex-direction: column;
    }

    .healer-download-actions .healer-download-btn {
        min-width: unset;
    }

    .healer-repair-btn {
        padding: 14px;
        font-size: 15px;
    }

    .healer-stats-diff {
        flex-direction: column;
        gap: 8px;
    }

    .healer-progress-steps {
        flex-wrap: wrap;
        gap: 4px;
    }

    .healer-progress-step {
        font-size: 10px;
    }

    .healer-issues-list {
        max-height: 200px;
    }

    .healer-results-badges {
        gap: 6px;
    }

    .healer-result-badge {
        font-size: 11px;
        padding: 4px 10px;
    }
}

@media (max-width: 380px) {
    .healer-stats {
        grid-template-columns: 1fr;
    }
}


/* ============================================================
   11. HEALTH BADGE
   ============================================================ */

.healer-health-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
}

.healer-health-badge.healthy {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.healer-health-badge.issues {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.healer-health-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.healer-health-badge .badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.healer-health-badge.healthy .badge-dot {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.healer-health-badge.issues .badge-dot {
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444;
}

.healer-health-badge.warning .badge-dot {
    background: #f59e0b;
    box-shadow: 0 0 6px #f59e0b;
}

/* Large prominent placement after analysis */
.healer-health-badge-container {
    text-align: center;
    margin-bottom: 20px;
}

.healer-health-badge-container .healer-health-badge {
    font-size: 16px;
    padding: 8px 24px;
}


/* ============================================================
   12. WIREFRAME TOGGLE
   ============================================================ */

.healer-wireframe-toggle {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    border: 1px solid #444;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    color: #888;
    transition: all 0.2s;
}

.healer-wireframe-toggle:hover {
    border-color: #666;
    color: #ccc;
}

.healer-wireframe-toggle.active {
    border-color: #10b981;
    color: #10b981;
}

.healer-wireframe-toggle .wireframe-icon {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.healer-wireframe-toggle.active .wireframe-icon {
    opacity: 1;
}


/* ============================================================
   UTILITY: HEALER SECTION CONTAINER
   ============================================================ */

.healer-section {
    display: none;
}

.healer-section.active {
    display: block;
}

.healer-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #ccc;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.healer-section-title .title-icon {
    font-size: 16px;
}

/* Divider between sections */
.healer-divider {
    height: 1px;
    background: #222;
    margin: 20px 0;
}

/* Fade-in animation for sections appearing */
@keyframes healer-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.healer-section.active {
    animation: healer-fade-in 0.3s ease;
}

/* Empty state */
.healer-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 14px;
}

.healer-empty-state .empty-icon {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.4;
    display: block;
}
