/* Unio Theme - Based on Unio Tailwind Design System */

:root {
  /* Unio Brand Colors */
  --brand: #47b3b3;
  --brand-hover: #2d9999;  /* Mørkere turkis for hover */
  --brand-light: #e6f7f7;  /* Lys turkis */
  
  /* Unio Red - for errors, warnings og viktige handlinger */
  --unio-red: hsl(5, 96%, 49%);
  --unio-red-hover: hsl(5, 96%, 42%);
  --unio-red-light: hsl(5, 96%, 95%);
  
  /* Neutral palette (oklch-inspired, converted to hsl for compatibility) */
  --background: #ffffff;
  --foreground: #1a1a1a;
  --card: #ffffff;
  --card-foreground: #1a1a1a;
  
  /* Primary - dark neutral */
  --primary: #262626;
  --primary-foreground: #fafafa;
  
  /* Secondary - light gray */
  --secondary: #f5f5f5;
  --secondary-foreground: #262626;
  
  /* Muted */
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  
  /* Accent */
  --accent: #f5f5f5;
  --accent-foreground: #262626;
  
  /* Borders & inputs */
  --border: #e5e5e5;
  --input: #e5e5e5;
  --ring: #a3a3a3;
  
  /* Status colors */
  --success: hsl(150, 70%, 45%);
  --success-light: hsl(150, 70%, 95%);
  --success-foreground: hsl(150, 70%, 25%);
  
  --warning: hsl(40, 90%, 50%);
  --warning-light: hsl(40, 90%, 95%);
  --warning-foreground: hsl(40, 90%, 25%);
  
  --destructive: var(--unio-red);
  --destructive-light: var(--unio-red-light);
  --destructive-foreground: hsl(5, 96%, 30%);
  
  /* Chart colors */
  --chart-1: hsl(5, 96%, 49%);
  --chart-2: hsl(220, 80%, 55%);
  --chart-3: hsl(150, 70%, 45%);
  --chart-4: hsl(280, 70%, 55%);
  --chart-5: hsl(40, 90%, 50%);
  
  /* Radius */
  --radius: 0.625rem;
  --radius-sm: 0.375rem;
  --radius-lg: 0.75rem;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--foreground);
  background: var(--secondary);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  border: 1px solid var(--border);
}

header {
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 24px 40px;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

.unio-logo {
  flex-shrink: 0;
}

.header-text h1 {
  font-size: 1.875rem;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.025em;
}

.header-text p {
  font-size: 1rem;
  opacity: 0.8;
  font-weight: 400;
  margin: 0;
}

main {
  padding: 40px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  color: var(--foreground);
  margin-bottom: 16px;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.help-text {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 20px;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  background: var(--secondary);
}

.drop-zone:hover {
  border-color: var(--muted-foreground);
  background: var(--muted);
}

.drop-zone.drag-over {
  border-color: var(--brand);
  background: var(--brand-light);
}

.drop-zone-content svg {
  color: var(--muted-foreground);
  margin-bottom: 16px;
}

.drop-zone-content p {
  font-size: 1rem;
  color: var(--muted-foreground);
  margin-bottom: 8px;
}

.or-text {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin: 16px 0;
}

.file-info {
  padding: 16px;
  background: var(--secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.file-info p {
  margin-bottom: 8px;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

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

.btn-primary:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
}

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

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

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

.btn-danger {
  background: var(--unio-red);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background 0.15s ease;
}

.btn-danger:hover {
  background: var(--unio-red-hover);
}

.btn-danger:disabled {
  background: var(--muted);
  color: var(--muted-foreground);
  cursor: not-allowed;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

/* Column Configuration Table */
.columns-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 0.875rem;
}

.columns-table th {
  background: var(--secondary);
  padding: 12px 16px;
  text-align: left;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  color: var(--muted-foreground);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.columns-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.column-row {
  transition: background 0.15s ease;
}

.column-row:hover {
  background: var(--secondary) !important;
}

/* Color coding for rows based on type */
.row-preserve {
  background-color: hsl(40, 90%, 95%) !important;
}

.row-generate {
  background-color: hsl(150, 70%, 95%) !important;
}

.row-unknown {
  background-color: hsl(5, 96%, 97%) !important;
}

.column-name {
  font-weight: 500;
  color: var(--foreground);
}

.sample-values {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  font-style: italic;
}

.confidence-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.confidence-high {
  background: var(--success-light);
  color: var(--success-foreground);
}

.confidence-medium {
  background: var(--warning-light);
  color: var(--warning-foreground);
}

.confidence-low {
  background: var(--destructive-light);
  color: var(--destructive-foreground);
}

.type-select {
  width: 100%;
  min-width: 180px;
  padding: 8px 12px;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: var(--background);
  color: var(--foreground);
}

.type-select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.generate-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--brand);
}

/* Settings */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--foreground);
  font-size: 0.875rem;
}

.form-group input,
.form-group select {
  padding: 10px 12px;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: var(--background);
  color: var(--foreground);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Status/Loading */
.status-content {
  text-align: center;
  padding: 40px;
}

.spinner {
  border: 3px solid var(--border);
  border-top: 3px solid var(--brand);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

/* Error Message */
.error-message {
  background: var(--destructive-light);
  color: var(--destructive-foreground);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
  border-left: 3px solid var(--destructive);
  font-size: 0.875rem;
}

.success-message {
  background: var(--success-light);
  color: var(--success-foreground);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
  border-left: 3px solid var(--success);
  font-size: 0.875rem;
}

/* Footer */
footer {
  background: var(--secondary);
  padding: 16px 24px;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  border-top: 1px solid var(--border);
}

/* Result Report */
#result-section {
  margin-top: 24px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#result-section h2 {
  color: var(--success-foreground);
  margin-bottom: 16px;
}

.result-summary {
  background: var(--secondary);
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.result-summary h3 {
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--foreground);
  font-size: 1rem;
  font-weight: 600;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--card);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
}

.stat-box h4 {
  margin: 0 0 4px 0;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-box p {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--foreground);
}

.column-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.column-list {
  background: var(--card);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.column-list h4 {
  margin: 0 0 12px 0;
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 600;
}

.column-list ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.column-list li {
  padding: 4px 0;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.column-list li::before {
  content: "→ ";
  color: var(--brand);
  font-weight: 500;
  margin-right: 4px;
}

.download-section {
  text-align: center;
  padding: 24px;
  background: var(--secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.download-section p {
  margin-bottom: 12px;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.btn-download {
  background: var(--brand);
  color: white;
  padding: 12px 24px;
  font-size: 1rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  font-weight: 500;
}

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

/* Responsive */
@media (max-width: 768px) {
  header h1 {
    font-size: 1.5rem;
  }

  main {
    padding: 20px;
  }

  .card {
    padding: 16px;
  }

  .action-buttons {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .columns-table {
    font-size: 0.8125rem;
  }

  .columns-table th,
  .columns-table td {
    padding: 8px 12px;
  }

  .column-lists {
    grid-template-columns: 1fr;
  }

  .result-stats {
    grid-template-columns: 1fr;
  }
}

/* Advanced Options */
.advanced-options {
  padding: 12px 16px;
  background: var(--secondary);
  border-radius: var(--radius-sm);
  margin-top: 8px;
  display: none;
  font-size: 0.875rem;
  border: 1px solid var(--border);
}

.advanced-options.show {
  display: block;
}

.advanced-options label {
  display: block;
  margin: 8px 0;
  color: var(--muted-foreground);
}

.advanced-options input[type="checkbox"] {
  margin-right: 8px;
  accent-color: var(--brand);
}

.advanced-options input[type="number"] {
  width: 80px;
  padding: 4px 8px;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  margin-left: 8px;
  font-size: 0.875rem;
}

.advanced-toggle {
  color: var(--brand);
  cursor: pointer;
  font-size: 0.8125rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-weight: 500;
}

.advanced-toggle:hover {
  color: var(--brand-hover);
}

/* Detected metadata badge */
.detected-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background-color: var(--success);
  color: white;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.detected-badge:empty {
  display: none;
}

/* Filename preview section */
.filename-preview-section {
  margin: 20px 0;
  padding: 16px 20px;
  background-color: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filename-preview-section label {
  display: block;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 8px;
  font-size: 0.875rem;
}

.filename-preview {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  color: var(--foreground);
  word-break: break-all;
  min-height: 42px;
  display: flex;
  align-items: center;
}

.filename-preview.empty {
  color: var(--muted-foreground);
  font-style: italic;
  font-family: inherit;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--secondary);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: var(--muted-foreground);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--foreground);
}
