/* ===== VARIABLES ===== */
:root {
    --primary: #333;
    --background: #fafafa;
    --surface: #ffffff;
    --text: #333;
    --text-light: #666;
    --border: #e0e0e0;
    --success: #10b981;
    --warning: #f59e0b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.5;
}

/* ===== NAVBAR ===== */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-size: 24px;
    font-weight: 300;
    color: var(--text);
}

.nav-links {
    display: flex;
    gap: 40px;
}

.nav-link {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 0;
}

.nav-link.active {
    color: var(--text);
    border-bottom: 2px solid var(--primary);
}

/* ===== LAYOUT ===== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.page-header {
    margin-bottom: 40px;
    text-align: center;
}

.page-title {
    font-size: 32px;
    font-weight: 300;
    color: var(--text);
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-light);
    font-size: 16px;
}

/* ===== GRID SYSTEM ===== */
.grid {
    display: grid;
    gap: 30px;
    margin-bottom: 60px;
}

.grid-4-8 {
    grid-template-columns: 1fr 2fr;
}


/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-content {
    padding: 40px;
}

.card-title {
    font-size: 20px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 20px;
}

/* ===== UPLOAD ZONE ===== */
.upload-area {
    text-align: center;
    padding: 60px 20px;
    border: 2px dashed var(--border);
    background: var(--background);
}

.upload-area h4 {
    margin-bottom: 16px;
    font-weight: 500;
    color: var(--text);
}

.upload-area p {
    color: var(--text-light);
    margin-bottom: 24px;
}

.file-input {
    display: none;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 24px;
}

.label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
}

.input {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border);
    font-size: 14px;
    background: var(--surface);
    font-family: inherit;
}

.input:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.textarea {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border);
    font-size: 16px;
    min-height: 150px;
    resize: vertical;
    font-family: inherit;
}

.help-text {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 8px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.btn:hover {
    opacity: 0.9;
}

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

.btn-outline {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

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


.btn-delete {
    background: var(--surface);
    color: var(--text-light);
    border: 1px solid var(--border);
    padding: 8px 12px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.2s;
    min-width: 36px;
}

.btn-delete:hover {
    background: var(--background);
}
/* ===== SIDEBAR ===== */
.sidebar {
    background: var(--surface);
    padding: 30px;
    max-height: 650px; /* Set a maximum height */
    overflow-y: auto; /* Add vertical scrollbar when needed */
}

/* Style the scrollbar for webkit browsers */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--background);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

.sidebar-title {
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--text);
}

.sidebar-help {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 20px;
}

.field-item {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 8px;
    cursor: pointer;
}

.field-item:hover {
    background: var(--background);
}

.field-name {
    font-weight: 600;
    color: var(--primary);
    font-family: monospace;
}

.field-sample {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

/* ===== TABLES ===== */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
}

.table-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.table-title {
    font-size: 20px;
    font-weight: 500;
    color: var(--text);
}

/* Data Preview Scrolling */
.preview-table-container {
    overflow: auto;
    max-height: 400px;
    max-width: 100%;
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* Ensures horizontal scrolling when needed */
}

.table th {
    background: var(--background);
    padding: 16px 24px;
    text-align: left;
    font-weight: 500;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.table th:nth-child(1), .table td:nth-child(1) { 
    width: 30%;
}

.table th:nth-child(2), .table td:nth-child(2) { 
    width: 50%;
}

.table th:nth-child(3), .table td:nth-child(3) { 
    width: 20%;
}


.table td {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
}

.table tr:hover {
    background: var(--background);
}

/* ===== UTILITIES ===== */
.fallback-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.fallback-message h4 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 500;
}

.fallback-message p {
    font-size: 14px;
}

/* ===== DATA PREVIEW ===== */
.preview-header {
    padding: 20px;
    background: var(--background);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-stats {
    color: var(--text-light);
    font-size: 14px;
}

.hidden {
    display: none;
}