* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    background: linear-gradient(135deg, #00416A 0%, #E4E5E6 100%);
    display: flex;
    flex-wrap: wrap;
}

.split {
    height: 20vh;  /* Default height when comparison pane is closed */
    width: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: all 0.3s ease-out;  /* Smooth transition for height changes */
}

.left {
    border-right: 2px solid rgba(255, 255, 255, 0.3);
}

.right {
    border-left: 2px solid rgba(255, 255, 255, 0.3);
}

input[type="file"] {
    padding: 10px;
    margin: 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 3px;
    padding: 8px 16px;
    cursor: pointer;
    margin-right: 10px;
}

.file-label {
    color: white;
    font-family: Arial, sans-serif;
    font-size: 1.2em;
    margin-bottom: 10px;
}

.file-info {
    color: white;
    font-family: Arial, sans-serif;
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    display: none;
}

.remove-file {
    color: #ff4444;
    cursor: pointer;
    margin-top: 10px;
    font-size: 0.9em;
    text-decoration: underline;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.comparison-pane {
    width: 100%;
    height: 95vh;  /* Increased height */
    background: rgba(255, 255, 255, 0.95);
    display: none;
    padding: 20px;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 1000;
}

.comparison-pane.show {
    display: block;
    animation: slideUp 0.3s ease-out forwards;
}

.comparison-header {
    margin-bottom: 20px;
}

.legend {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #333;
    font-family: Arial, sans-serif;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 3px;
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    margin: 0;
}

.legend span {
    padding: 5px 10px;
    border-radius: 3px;
}

/* Remove any previous controls class styles if they exist */
.controls {
    display: none;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-family: Arial, sans-serif;
}

.comparison-table th,
.comparison-table td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
}

.comparison-table th {
    background-color: #f5f5f5;
}

.comparison-table th:first-child,
.comparison-table th:last-child {
    width: 80px;
    text-align: center;
}

.comparison-table td:first-child,
.comparison-table td:last-child {
    text-align: center;
    color: #666;
    font-size: 0.9em;
}

.matching {
    background-color: #ffffff;  /* White for matching rows */
}

.missing {
    background-color: #ffebee;  /* Red for rows missing in file2 */
}

.new {
    background-color: #e8f5e9;  /* Green for new rows in file2 */
}

.changed-col2 td {
    background-color: #ffffff;  /* Reset background for changed-col2 rows */
}

.changed-col2 td:nth-child(1),  /* First row number */
.changed-col2 td:nth-child(3),  /* File 1 Col 2 */
.changed-col2 td:nth-child(6),  /* File 2 Col 2 */
.changed-col2 td:nth-child(8) { /* Second row number */
    background-color: #fff3cd;  /* Yellow for column 2 changes */
}

.changed-col3 td {
    background-color: #ffffff;  /* Reset background for changed-col3 rows */
}

.changed-col3 td:nth-child(1),  /* First row number */
.changed-col3 td:nth-child(4),  /* File 1 Col 3 */
.changed-col3 td:nth-child(7),  /* File 2 Col 3 */
.changed-col3 td:nth-child(8) { /* Second row number */
    background-color: #e3f2fd;  /* Light blue for column 3 changes */
}

.legend .matching {
    background-color: #ffffff;
}

.legend .missing {
    background-color: #ffebee;
}

.legend .new {
    background-color: #e8f5e9;
}

.legend .changed-col2 {
    background-color: #fff3cd;
}

.legend .changed-col3 {
    background-color: #e3f2fd;
}

#comparisonResults {
    max-height: calc(95vh - 100px);  /* Adjust for header space */
    overflow-y: auto;
}

/* Add styles for hiding/showing matching rows */
/* Only hide exact matches by default */
tr.matching {
    display: none;  /* Hide exact matches by default */
}

/* Keep changed rows visible by default */
tr.changed-col2,
tr.changed-col3 {
    display: table-row;  /* Show by default */
}

/* Show matching rows when toggled */
tr.matching.show {
    display: table-row;
}

/* New styles for when comparison pane is open */
body.pane-open .split {
    height: 5vh;
    flex-direction: row;
    justify-content: flex-start;
    gap: 20px;
    padding: 0 20px;
}

body.pane-open .file-label {
    margin: 0;  /* Remove margin when inline */
}

body.pane-open .file-info {
    margin: 0;
    padding: 8px 15px;
}

body.pane-open .remove-file {
    margin-top: 0;
    margin-left: 10px;
}

body.pane-open input[type="file"] {
    padding: 5px;
    margin: 5px;
}
