/* Enhanced shadcn-inspired styling with better typography and hierarchy */

:root {
  --bg: #ffffff;
  --bg-elevated: #f8fafc;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.08);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --radius-xl: 16px;
  --radius-md: 8px;
  --radius-sm: 4px;
  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.06);
  --shadow-subtle: 0 4px 16px rgba(0, 0, 0, 0.04);
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    -system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", Monaco, "Cascadia Code", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  font-family: var(--font-sans);
}

html,
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 50%, #f1f5f9 100%);
  color: var(--text-main);
  line-height: 1.5;
  font-feature-settings: "rlig" 1, "calt" 1;
  height: 100vh;
}

body {
  display: flex;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 100vw;
  background: var(--bg);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  position: relative;
  min-height: 100vh;
}

/* Header */

h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.2;
}

h1::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.4);
  flex-shrink: 0;
}

.subtitle {
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-muted);
  font-weight: 400;
}

/* Panels */

.panel {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  padding: 20px 18px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-subtle);
  transition: box-shadow 0.2s ease;
}

.panel:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.panel h2::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* Left and Right Sections */

.left-section {
  padding: 32px 24px 24px;
  background: var(--bg);
  min-height: 100vh;
}

.right-section {
  padding: 32px 24px 24px;
}

/* Inputs & buttons */

input[type="file"] {
  display: inline-block;
  margin-right: 8px;
  font-size: 14px;
  color: var(--text-main);
}

button {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  font-family: var(--font-sans);
  position: relative;
  overflow: hidden;
}

button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

button:hover::before {
  left: 100%;
}

button:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  background: #f1f5f9;
  color: var(--text-subtle);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.hint {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Validation list */

#validation-summary {
  margin-bottom: 4px;
  font-weight: 500;
}

#validation-list {
  margin: 0;
  padding-left: 16px;
  font-size: 13px;
  max-height: 120px;
  overflow-y: auto;
  color: #dc2626;
  line-height: 1.6;
}

/* Preview table */

#preview-wrapper {
  flex: 1;
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

#preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: var(--font-sans);
}

#preview-table thead {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  z-index: 5;
  box-shadow: 0 1px 0 var(--border-subtle);
}

#preview-table th,
#preview-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

#preview-table th {
  font-weight: 600;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 11px;
  background: var(--bg-elevated);
}

.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
}

.sortable:hover {
  background-color: var(--accent-soft);
}

.sort-indicator {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.6;
}

.sortable.sorted-asc .sort-indicator::before {
  content: "↑";
  opacity: 1;
}

.sortable.sorted-desc .sort-indicator::before {
  content: "↓";
  opacity: 1;
}

#preview-table tbody tr:nth-child(even) {
  background-color: var(--bg);
}

#preview-table tbody tr:nth-child(odd) {
  background-color: var(--bg-elevated);
}

#preview-table tbody tr:hover {
  background-color: var(--accent-soft);
}

#no-data {
  padding: 40px 12px 36px;
  font-size: 16px;
  color: var(--text-muted);
  text-align: center;
}

/* Responsive */

@media (max-width: 1024px) {
  .container {
    flex-direction: column;
  }

  .left-section,
  .right-section {
    width: 100%;
  }

  .right-section .panel {
    height: auto;
    min-height: 400px;
  }

  #preview-wrapper {
    max-height: 400px;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0;
    border-radius: 0;
    min-height: 100vh;
  }

  .left-section,
  .right-section {
    padding: 24px 16px 16px;
  }

  h1 {
    font-size: 24px;
  }

  .panel {
    padding: 16px 14px 12px;
  }

  #preview-table th,
  #preview-table td {
    padding: 8px 10px;
    font-size: 12px;
  }
}

/* Code elements */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-elevated);
  padding: 2px 4px;
  border-radius: 3px;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}