:root {
    --primary-color: #0070d2;
    --primary-hover: #005fb8;
    --bg-color: #1a1b1e;
    --card-bg: #25262b;
    --text-color: #c1c2c5;
    --text-secondary: #909296;
    --border-color: #373a40;
    --header-bg: #101113;
    --header-text: #ffffff;
    --accent-color: #10b981;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --radius: 0.5rem;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--header-text);
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-secondary);
}

/* Modal Styles */
.modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    /* Stay in place */
    z-index: 1000;
    /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    /* Full width */
    height: 100%;
    /* Full height */
    overflow: auto;
    /* Enable scroll if needed */
    background-color: rgba(0, 0, 0, 0.8);
    /* Black w/ opacity */
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Version Tag */
.version {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
    background-color: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.modal-content {
    position: relative;
    background-color: var(--card-bg);
    margin: auto;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    /* Increased from 80% */
    max-width: 1350px;
    /* Increased from 900px (~1.5x) */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.modal-content img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover,
.close:focus {
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
}

.modal-caption {
    margin-top: 15px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Controls */
.toolbar-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    align-items: stretch;
    /* Make heights equal */
}

.controls-area {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-end;
    flex: 1;
    /* Allow it to grow */
}

.actions-area {
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    /* Center buttons vertically */
    justify-content: center;
}

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

.control-group.buttons-row {
    flex-direction: row;
    align-items: flex-end;
    /* Align with bottom of inputs */
    gap: 1rem;
}

.control-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

select,
input[type="text"] {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background-color: #2c2e33;
    color: var(--text-color);
    min-width: 200px;
}

.file-label {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
    min-width: 180px;
}

.file-label:hover {
    background-color: var(--primary-hover);
}

input[type="file"] {
    display: none;
}

.btn {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn.secondary {
    background-color: var(--text-secondary);
    color: white;
}

/* Drop Zone */
/* Drop Zone (Compact) */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    /* Compact padding */
    text-align: center;
    background-color: #2c2e33;
    transition: all 0.2s;
    margin-bottom: 0;
    /* Remove bottom margin */
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    min-width: 200px;
    /* Minimal width to look good */
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary-color);
    background-color: #25262b;
}

.drop-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
}

.drop-content svg {
    color: var(--text-secondary);
    margin-bottom: 0;
    /* Remove vertical spacing */
}

.drop-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Table Area */
.filter-area {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    justify-content: space-between;
}

/* Highlight Controls */
.highlight-area {
    background-color: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.highlight-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.highlight-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-height: 32px;
}

.highlight-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1a1b1e;
    /* Dark text for pastel backgrounds */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.highlight-tag .remove-btn {
    margin-left: 8px;
    cursor: pointer;
    font-weight: bold;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.highlight-tag .remove-btn:hover {
    opacity: 1;
}

.error-msg {
    color: #ff6b6b;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Highlight Colors (Pastels for readability in Dark Mode) */
.row-highlight-0 {
    background-color: #ffec99 !important;
    color: #1a1b1e !important;
}

/* Yellow */
.row-highlight-1 {
    background-color: #a5d8ff !important;
    color: #1a1b1e !important;
}

/* Blue */
.row-highlight-2 {
    background-color: #b2f2bb !important;
    color: #1a1b1e !important;
}

/* Green */
.row-highlight-3 {
    background-color: #ffc9c9 !important;
    color: #1a1b1e !important;
}

/* Red */
.row-highlight-4 {
    background-color: #e599f7 !important;
    color: #1a1b1e !important;
}

/* Purple */

.table-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th,
td {
    padding: 0.75rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #2c2e33;
    font-weight: 600;
    color: var(--text-color);
    position: sticky;
    top: 0;
}

tr:hover {
    background-color: #2c2e33;
}

.raw-record {
    font-family: monospace;
    color: #a5d8ff;
    font-size: 0.85rem;
}

.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-secondary);
}

.hidden {
    display: none;
}

.log-info {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: right;
}

/* Info Icon & Tooltip */
.info-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: help;
    position: relative;
}

/* Global Tooltip */
.global-tooltip {
    position: fixed;
    background-color: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    line-height: 1.4;
    white-space: pre-wrap;
    max-width: 300px;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    display: none;
}



/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
}

/* Floating Action Button for Flow Chart */
#show-flow-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-radius: 50px;
    /* Pill shape */
    padding: 12px 24px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: var(--primary-color);
    /* Make it stand out */
    color: white;
}

#show-flow-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
    filter: brightness(1.1);
}

#show-flow-btn:disabled {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}