/* CSV Machine - Minimal Computer-like Interface */

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

body {
    font-family: 'Courier New', monospace;
    background-color: #1a1a1a;
    color: #e0e0e0;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    font-size: 14px;
}

.container {
    /* min-width: 1200px; */
    margin: 0 auto;
    padding: 5px;
}

/* Header - Computer-like title bar */
.header {
    text-align: center;
    color: white;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #333;
}

.header h1 {
    font-size: 1.8em;
    margin-bottom: 6px;
    font-weight: bold;
    letter-spacing: 1px;
}

.header p {
    font-size: 1em;
    opacity: 0.8;
    margin: 0;
}

/* Section styling - Computer-like panels */
.section {
    background: #2a2a2a;
    border: 1px solid #333;
    border-radius: 2px;
    margin-bottom: 8px;
    padding: 0;
}

/* File Manager Section */
.upload-area {
    border: 1px dashed #444;
    border-radius: 0;
    padding: 10px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    background: #222;
    margin: 6px;
    min-height: 100px;
    position: relative;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #4299e1;
    background: #252525;
}

.upload-icon {
    font-size: 1.3em;
    margin-bottom: 6px;
    color: #718096;
    transition: all 0.2s ease;
}

.upload-text {
    color: #aaa;
    margin-bottom: 8px;
    font-size: 0.8em;
    transition: all 0.2s ease;
}

.upload-button {
    background: #4299e1;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 2px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9em;
    transition: all 0.2s ease;
    font-weight: bold;
}

.upload-button:hover {
    background: #3182ce;
}

/* File Columns Container - Column view inside upload area */
.file-columns-container {
    margin-top: 10px;
    display: flex;
    overflow-x: auto;
    gap: 0;
    padding: 0;
    min-height: 40px;
    scrollbar-width: thin;
    scrollbar-color: #444 #222;
}

.file-columns-container::-webkit-scrollbar {
    height: 6px;
}

.file-columns-container::-webkit-scrollbar-track {
    background: #222;
}

.file-columns-container::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.file-column {
    flex: 0 0 auto;
    width: 120px;
    background: #222;
    border-left: 1px solid #333;
    padding: 6px;
    font-size: 0.9em;
    text-align: center;
    cursor: default;
    position: relative;
    transition: all 0.2s ease;
}

.file-column:first-child {
    border-left: none;
}

.file-column:hover {
    background: #252525;
}

.file-column-icon {
    font-size: 2em;
    margin-bottom: 4px;
    color: #4299e1;
}

.file-column-name {
    font-weight: bold;
    color: #e0e0e0;
    font-size: 1em;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.file-column-info {
    color: #718096;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.file-column-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 0.8em;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.file-column-remove:hover {
    background: #c53030;
}

/* Query Editor Section */
.query-editor {
    min-height: 300px;
}

.editor-container {
    padding: 6px;
}

.sql-editor {
    width: 100%;
    height: 120px;
    padding: 6px;
    border: 1px solid #333;
    border-radius: 2px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.3;
    resize: vertical;
    background: #222;
    color: #e0e0e0;
    margin-bottom: 6px;
}

.sql-editor:focus {
    outline: none;
    border-color: #4299e1;
}

.editor-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    border-top: 1px solid #444;
}

.execute-btn {
    background: #48bb78;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 2px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    font-size: 0.9em;
}

.execute-btn:hover {
    background: #38a169;
}

.editor-controls .clear-btn {
    background: #718096;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 2px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9em;
}

.editor-controls .clear-btn:hover {
    background: #4a5568;
}

.query-status {
    margin-left: auto;
    color: #aaa;
    font-size: 0.9em;
}

.query-history {
    margin-top: 6px;
    padding: 4px 8px;
    border-top: 1px solid #444;
}

.history-items {
    max-height: 120px;
    overflow-y: auto;
    background: #222;
    border: 1px solid #333;
    padding: 3px;
}

.history-item {
    padding: 4px 8px;
    margin-bottom: 2px;
    background: #2a2a2a;
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.7em;
    border-left: 2px solid #4299e1;
}

.history-item:hover {
    background: #333;
}

.history-time {
    color: #718096;
    font-size: 0.7em;
    margin-top: 2px;
}

/* Results Section */
.results-section {
    min-height: 200px;
}

#resultsContainer {
    padding: 6px;
    min-height: 80px;
    color: #aaa;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6px;
    font-size: 0.8em;
}

.results-table th,
.results-table td {
    padding: 4px;
    text-align: left;
    border-bottom: 1px solid #333;
    border-right: 1px solid #333;
}

.results-table th {
    background: #1e1e1e;
    color: #4299e1;
    font-weight: bold;
    position: sticky;
    top: 0;
    cursor: pointer;
    user-select: none;
}

.results-table th:last-child {
    border-right: none;
}

.results-table th:hover {
    background: #252525;
}

.results-table tr:hover {
    background: #252525;
}

.results-table tr:nth-child(even) {
    background: #1e1e1e;
}

.results-table tr:nth-child(odd) {
    background: #222;
}

/* Status Messages Container */
#statusMessages {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 350px;
    width: 100%;
}

/* Status Messages */
.status {
    padding: 6px 12px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 0.9em;
    position: relative;
    max-width: 300px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transform: translateX(20px);
    opacity: 0;
    transition: all 0.3s ease-out;
}

.status.show {
    transform: translateX(0);
    opacity: 1;
}

.status.success {
    background: #2d4a3a;
    color: #48bb78;
    border: 1px solid #38a169;
}

.status.error {
    background: #4a2d2d;
    color: #e53e3e;
    border: 1px solid #c53030;
}

.status.info {
    background: #2d4a5a;
    color: #4299e1;
    border: 1px solid #3182ce;
}

/* Progress Bar */
.progress-container {
    margin: 4px 8px;
    padding: 4px;
    background: #1e1e1e;
    border-radius: 2px;
    border: 1px solid #444;
    display: flex;
    align-items: center;
    gap: 6px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: #444;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #48bb78;
    transition: width 0.2s ease;
}

.progress-text {
    font-size: 0.8em;
    color: #aaa;
    min-width: 80px;
    text-align: right;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
    background: #1e1e1e;
    border-top: 1px solid #444;
}

.pagination button {
    background: #4299e1;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 2px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8em;
    font-weight: bold;
}

.pagination button:hover {
    background: #3182ce;
}

.pagination button:disabled {
    background: #555;
    cursor: not-allowed;
}

.pagination .page-info {
    color: #aaa;
    font-size: 0.8em;
}

/* Export Controls */
.export-controls {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
    background: #1e1e1e;
    border-top: 1px solid #444;
}

.export-btn {
    background: #805ad5;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 2px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8em;
    font-weight: bold;
}

.export-btn:hover {
    background: #6b46c1;
}

/* Loading Spinner */
.spinner {
    border: 3px solid #444;
    border-top: 3px solid #4299e1;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 10px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .editor-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .query-status {
        margin-left: 0;
        text-align: center;
        margin-top: 8px;
    }

    .results-table {
        font-size: 0.8em;
    }

    .results-table th,
    .results-table td {
        padding: 6px;
    }
}