:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --optional-color: #e67e22;
    --optional-hover: #d35400;
    --background-color: #f4f7fc;
    --card-background: #ffffff;
    --text-color: #333;
    --border-color: #e0e0e0;
    --error-color: #e74c3c;         
    --warning-color: #f39c12;        
    --success-color: #2ecc71;        
    --missing-color: #95a5a6;        
    --neutral-color: #7f8c8d;        
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    padding-bottom: 3rem; 
}
.btn,
.toggle-switch label,
.dashboard-card,
.sortable-header,
.summary-row,
.view-selector {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.main-container {
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    overflow-x: hidden;
}

/* Header Section */
.app-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.app-header h1 {
    margin: 0;
    color: var(--secondary-color);
    border-bottom: none;
}

.btn-run-comparison:hover {
    background-color: #27ae60;
}

.btn-run-comparison:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* Card Styling */
.card {
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

h2 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

/* File Picker Grid Layout */
.file-picker-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    align-items: start;
    overflow: hidden;
}

.file-picker-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

.file-status-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
    overflow: hidden;
}

/* Button Styling */
.file-input-group {
    display: flex;
    flex-direction: column;
    height: 42px;
    justify-content: center;
}

.run-comparison-row {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.btn {
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
    width: 100%;
    text-align: center;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-run-comparison {
    background-color: var(--success-color);
    font-size: 1rem;
    font-weight: 600;
}

.btn-run-comparison:hover {
    background-color: #27ae60;
}

.btn-run-comparison:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.btn-standard {
    background-color: var(--primary-color);
}

.btn-standard:hover {
    background-color: #2980b9;
}

.btn-optional {
    background-color: var(--optional-color);
}

.btn-optional:hover {
    background-color: var(--optional-hover);
}

.btn-secondary {
    background-color: var(--neutral-color);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-secondary:hover {
    background-color: #6c7a89;
}

/* File Status Display */
.file-status-item {
    height: 42px;
    display: flex;
    align-items: center;
    min-width: 0;
}

.file-status-display {
    background-color: #ecf0f1;
    padding: 0.6rem 0.75rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-size: 0.9em;
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    color: var(--neutral-color);
    height: 42px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    min-width: 0;
}

/* Machine Code Section */
.machine-code-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.section-label {
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.machine-code-input-group {
    margin-bottom: 0.75rem;
    height: 42px;
    display: flex;
    align-items: center;
}

.machine-code-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    box-sizing: border-box;
    height: 42px;
}

.machine-code-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* FS Files Section */
.fs-files-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.fs-file-item {
    margin-bottom: 0.75rem;
    height: 42px;
    display: flex;
    align-items: center;
    min-width: 0;
}

.fs-file-name {
    background-color: #ecf0f1;
    padding: 0.6rem 0.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: monospace;
    color: var(--neutral-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    height: 42px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    min-width: 0;
}

/* Status Message */
.status-message-row {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    height: 42px;
    display: flex;
    align-items: center;
    min-width: 0;
}

.status-message-box {
    padding: 0.6rem 0.75rem;
    border-radius: 4px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    height: 42px;
    box-sizing: border-box;
    min-width: 0;
}

.status-success {
    background-color: #e8f5e9; 
    color: #2e7d32; 
    border: 1px solid #a5d6a7;
}

.status-error {
    background-color: #ffebee; 
    color: #c62828; 
    border: 1px solid #ef9a9a;
}

.status-neutral {
    background-color: #e9ecef; 
    color: #495057; 
    border: 1px solid #ced4da;
}

.status-icon {
    font-size: 1.2em;
}

/* Priority Mapping Table */
.priority-table {
    width: 100%;
    border-collapse: collapse;
}

.priority-table th, .priority-table td {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.priority-table input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* Log Section */
.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.log-header h2 {
    margin: 0;
    border-bottom: none;
}

.log-controls {
    display: flex;
    gap: 0.5rem;
}

.log-controls .btn-secondary {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    height: 32px;
    white-space: nowrap;
    min-width: auto;
}

.log-panel {
    background-color: #2c3e50;
    color: #ecf0f1;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85em;
    padding: 1rem;
    border-radius: 4px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Dashboard */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    text-align: center;
}

.dashboard-card {
    padding: 1rem;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.dashboard-card .value {
    font-size: 2rem;
    font-weight: bold;
}

.dashboard-card .label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.dashboard-card.clickable:hover {
    transform: translateY(-1px); 
}

.dashboard-card.active-filter {
    border: 3px solid rgba(52, 152, 219, 0.5); 
    box-shadow: none; 
}

.bg-total { background-color: var(--primary-color); }
.bg-mismatch { background-color: var(--error-color); }
.bg-warning { background-color: var(--warning-color); }
.bg-missing { background-color: var(--missing-color); }

/* Comparison Details Section */
.comparison-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.comparison-details-header h2 {
    margin: 0;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.view-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.view-label {
    color: var(--neutral-color);
    transition: color 0.2s ease;
}

.view-label.active-view {
    color: var(--primary-color);
    font-weight: bold;
}

/* Filter Controls */
.filter-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.filter-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-section label {
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Toggle Switches */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.toggle-switch input { 
    display: none; 
}

.toggle-switch label {
    cursor: pointer;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 10px;
    position: relative;
    transition: background-color 0.2s;
}

.toggle-switch label::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

.toggle-switch input:checked + label { 
    background-color: var(--primary-color); 
}

.toggle-switch input:checked + label::after { 
    transform: translateX(20px); 
}

.toggle-switch.small-toggle label {
    width: 30px;
    height: 15px;
    border-radius: 7.5px;
}

.toggle-switch.small-toggle label::after {
    width: 11px;
    height: 11px;
    top: 2px;
    left: 2px;
}

.toggle-switch.small-toggle input:checked + label::after {
    transform: translateX(15px);
}

/* Results Table */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.results-table th {
    background-color: var(--secondary-color);
    color: white;
    text-align: left;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    font-weight: 600;
}

.results-table td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
}

.improved-results {
    font-size: 0.9em;
}

.improved-results td, .improved-results th {
    white-space: nowrap;
    vertical-align: middle;
}

.summary-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.summary-row:hover {
    background-color: #e9ecef !important;
}

.summary-row td {
    text-align: center;
}

.summary-row td:first-child, 
.summary-row td.text-col {   
    text-align: left;
}

.text-col {
    max-width: 350px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Status Colors */
.status-ok { color: var(--success-color); font-weight: bold;}
.status-mismatch { color: var(--error-color); font-weight: bold; }
.status-warning { color: var(--warning-color); font-weight: bold; }
.status-missing { color: var(--missing-color); font-weight: bold; }

.results-table td.status-ok { color: var(--success-color); }
.results-table td.status-mismatch { color: var(--error-color); } 
.results-table td.status-warning { color: var(--warning-color); }
.results-table td.status-missing { color: var(--missing-color); }

.status-separator {
    color: var(--neutral-color);
    margin: 0 0.25em;
}

/* Expanded Details */
.details-row-open td {
    white-space: normal;
    background-color: #f8f9fa;
    border-bottom: 2px solid var(--primary-color);
}

.details-content {
    padding: 15px;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.details-section {
    background-color: #fff;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    color:black;
}

.details-section h4 {
    margin-top: 0;
    color: var(--secondary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.details-section div {
    margin-bottom: 0.25rem;
    font-size: 0.95em;
    word-break: break-all;
}

/* Validation Details */
.validation-details-box {
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: var(--warning-color);
    background-color: #f39c1212;
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.validation-details-box.core-mismatch-details {
    background-color: rgba(231, 76, 60, 0.05);
    color: var(--error-color);
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.validation-details-box.core-mismatch-details pre {
     white-space: pre-wrap;
     word-break: break-all;
     margin: 0;
}

.validation-details-box.int-pair-details.warning-details {
    background-color: rgba(243, 156, 18, 0.1);
    color: var(--warning-color);
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.validation-details-box.int-pair-details.not-found-details {
    background-color: rgba(149, 165, 166, 0.08);
    color: var(--missing-color);
    border: 1px solid rgba(149, 165, 166, 0.3);
}

.validation-details-box .detail-check strong {
    color: var(--secondary-color);
}

.validation-details-box pre {
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    font-weight: bold;
}

/* Hidden File Input */
.file-input {
    display: none;
}

.fs-input-file {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .file-picker-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .filter-controls {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .comparison-details-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .header-controls {
        justify-content: space-between;
    }
    
    .app-header {
        text-align: center;
    }
    
    .run-comparison-row,
    .status-message-row {
        margin-top: 1rem;
        border-top: 1px solid var(--border-color);
        padding-top: 1rem;
    }
}

/* Add these CSS rules to your existing stylesheet */

/* Sortable header styling */
.sortable-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    position: relative;
}

.sortable-header:hover {
    background-color: #34495e !important;
}

.sortable-header:active {
    background-color: #1a252f !important;
}

/* Sort icon styling */
.sort-icon {
    display: inline-block;
    margin-left: 5px;
    font-size: 0.8em;
    color: #ecf0f1;
    opacity: 0.8;
    min-width: 12px;
    text-align: center;
}

/* Optional: Add a subtle visual cue for sortable headers */
.sortable-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.2s ease;
}

.sortable-header:hover::after {
    width: 80%;
}

/* Add this to your existing app.css file */

/* Ensure duplicate alarm rows maintain their bisque background even on hover */
.summary-row[style*="background-color: bisque"]:hover {
    background-color: #f4ddb0 !important; /* Slightly darker bisque on hover */
}

.details-row-open[style*="background-color: bisque"] td {
    background-color: bisque !important;
}

/* Style for the duplicate warning box */
.validation-details-box.duplicate-warning {
    background-color: rgba(255, 228, 196, 0.3); /* Light bisque background */
    border: 2px solid #f4a460; /* Sandy brown border */
    color: #8b4513; /* Saddle brown text */
}

.validation-details-box.duplicate-warning strong {
    color: #a0522d; /* Sienna color for emphasis */
}

/* Add this CSS to your app.css file for duplicate row highlighting */

/* Duplicate row styling with high specificity */
.results-table .duplicate-row {
    background-color: bisque !important;
}

/* Ensure duplicate rows maintain their background even on hover */
.results-table .duplicate-row:hover {
    background-color: #f4ddb0 !important; /* Slightly darker bisque on hover */
}

/* Duplicate details row styling */
.results-table .details-row-open.duplicate-row td {
    background-color: bisque !important;
}

/* Ensure the duplicate warning maintains its bisque background */
.details-row-open.duplicate-row td {
    background-color: bisque !important;
}


/* Error UI */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none; 
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}