@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --background-color: #F3F4F6;
    --card-background: #FFFFFF;
    --text-color: #1F2937;
    --subtle-text: #6B7280;
    --border-color: #D1D5DB;
    --success-color: #10B981;
    --error-color: #EF4444;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 900px;
    background-color: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

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

header p {
    color: var(--subtle-text);
    font-size: 1rem;
}

.settings-panel {
    background-color: #F9FAFB;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.settings-panel h2 {
    margin-top: 0;
    font-size: 1.25rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
}

.warning-text {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    background-color: #FEE2E2;
    border: 1px solid #FCA5A5;
    padding: 0.75rem;
    border-radius: 6px;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab-link {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 1rem;
    font-weight: 500;
    color: var(--subtle-text);
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease-in-out;
}

.tab-link.active, .tab-link:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

.drop-zone.dragover {
    background-color: #E0E7FF;
    border-color: var(--primary-color);
}

.drop-zone p {
    margin: 0;
    color: var(--subtle-text);
}

.file-name, .file-list {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--subtle-text);
}

.file-list ul {
    list-style: none;
    padding: 0;
}

.file-list li {
    background-color: #F9FAFB;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
}

form button {
    width: 100%;
    padding: 0.875rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 1.5rem;
    transition: background-color 0.2s ease-in-out;
}

form button:hover {
    background-color: var(--primary-hover);
}

.output-section {
    margin-top: 2rem;
}

.output-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.preview-area {
    max-height: 300px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    background-color: #F9FAFB;
    font-family: monospace;
    white-space: pre;
}

.preview-area table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.preview-area th, .preview-area td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    text-align: left;
    white-space: nowrap;
}

.preview-area th {
    background-color: #E5E7EB;
    font-weight: 600;
}

.download-button {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--success-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
}

.download-button:hover {
    background-color: #059669;
}

#merge-controls {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #F9FAFB;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

#merge-controls label {
    font-weight: 500;
    margin-right: 1rem;
}

#merge-controls select {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

#merge-controls button {
    padding: 0.6rem 1.2rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 1rem;
}

.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loader {
    border: 8px solid #f3f3f3;
    border-top: 8px solid var(--primary-color);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

.loader-overlay p {
    color: white;
    margin-top: 1rem;
    font-size: 1.1rem;
}

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

.error-message {
    background-color: #FEE2E2;
    color: #B91C1C;
    border: 1px solid #FCA5A5;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    text-align: center;
}
