/* Modern Dark Theme Global Styles with Brand Colors */
:root {
  /* Brand colors */
  --brand-orange: #E64100;
  --brand-dark-orange: #9C2F04;
  --brand-light-orange: #FD591A;
  --brand-cyan: #0AD0F8;
  --brand-purple: #413EDC;

  /* Primary/Secondary based on brand */
  --primary-color: #E64100;
  --primary-hover: #9C2F04;
  --secondary-color: #0AD0F8;
  --secondary-hover: #08B8D8;
  --accent-color: #413EDC;
  --accent-hover: #3632C4;
  --error-color: #dc2626;
  --warning-color: #FD591A;
  --success-color: #16a34a;

  /* Dark theme colors with subtle brand influence */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-card: #161b22;
  --bg-hover: #21262d;

  /* Text colors */
  --text-primary: #f0f6fc;
  --text-secondary: #c9d1d9;
  --text-muted: #8b949e;
  --text-inverse: #0d1117;

  /* Border colors */
  --border-primary: #30363d;
  --border-secondary: #484f58;
  --border-focus: #0AD0F8;

  /* Shadows with subtle blue hints */
  --shadow-sm: 0 1px 2px 0 rgba(10, 208, 248, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(10, 208, 248, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(10, 208, 248, 0.08);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(10, 208, 248, 0.08);

  /* Brand gradients */
  --gradient-primary: linear-gradient(135deg, #E64100 0%, #9C2F04 100%);
  --gradient-secondary: linear-gradient(135deg, #0AD0F8 0%, #413EDC 100%);
  --gradient-accent: linear-gradient(135deg, #FD591A 0%, #E64100 100%);
  --gradient-hero: linear-gradient(135deg, #E64100 0%, #413EDC 50%, #0AD0F8 100%);
}

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

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  background-image:
    radial-gradient(circle at 20% 80%, rgba(10, 208, 248, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(65, 62, 220, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(230, 65, 0, 0.05) 0%, transparent 50%);
  background-attachment: fixed;
  font-size: 14px;
  overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(45deg, var(--brand-cyan), var(--brand-purple));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(45deg, var(--secondary-hover), var(--accent-hover));
}

a {
  text-decoration: none;
  color: var(--primary-color);
  transition: all 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
}

ul {
  list-style: none;
}

h1, h2, h3, h4 {
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.025em;
}

h1 {
  font-size: 2.25rem;
  font-weight: 700;
}

h2 {
  font-size: 1.875rem;
}

h3 {
  font-size: 1.5rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.color-primary {
  color: var(--primary-color);
}

.color-secondary {
  color: var(--secondary-color);
}

/* Layout */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
}

/* Card Styles */
.card {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-primary);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
  border-color: var(--border-secondary);
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--primary-color);
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-right: 0.75rem;
  margin-bottom: 0.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.btn:hover::before {
  transform: translateX(100%);
}

.btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  opacity: 0.6;
}

.btn:disabled::before {
  display: none;
}

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

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

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-secondary);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-focus);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

.ml-2 {
  margin-left: 0.5rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.875rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  font-size: 0.875rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: var(--bg-card);
}

input[type="file"] {
  padding: 0.5rem 0;
  background: transparent;
  border: 2px dashed var(--border-primary);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

input[type="file"]:hover {
  border-color: var(--primary-color);
  background: rgba(59, 130, 246, 0.05);
}

input[type="range"] {
  padding: 0;
  background: transparent;
  border: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-track {
  background: var(--bg-tertiary);
  height: 6px;
  border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(45deg, var(--brand-cyan), var(--brand-purple));
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

/* Error and Loading States */
.error-message {
  padding: 1rem;
  background: rgba(220, 38, 38, 0.1);
  border-left: 4px solid var(--error-color);
  margin-bottom: 1rem;
  color: var(--error-color);
  border-radius: 8px;
  border: 1px solid rgba(220, 38, 38, 0.2);
  backdrop-filter: blur(10px);
}

.loading {
  text-align: center;
  padding: 2rem;
  color: var(--primary-color);
  font-weight: 500;
}

/* File List */
.file-list {
  margin-top: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border-primary);
  transition: all 0.2s ease;
}

.file-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-secondary);
}

.file-item small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-completed {
  background: rgba(22, 163, 74, 0.15);
  color: var(--success-color);
  border: 1px solid rgba(22, 163, 74, 0.3);
}

.status-processing {
  background: rgba(253, 89, 26, 0.15);
  color: var(--warning-color);
  border: 1px solid rgba(253, 89, 26, 0.3);
}

.status-failed {
  background: rgba(220, 38, 38, 0.15);
  color: var(--error-color);
  border: 1px solid rgba(220, 38, 38, 0.3);
}

/* Enhanced Spinner */
.spinner {
  border: 3px solid rgba(10, 208, 248, 0.15);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border-left-color: var(--brand-cyan);
  animation: spin 1s linear infinite;
  margin: 1rem auto;
}

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

/* Task Error Details */
.task-error {
  margin-top: 1.5rem;
  background: rgba(220, 38, 38, 0.05);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid rgba(220, 38, 38, 0.2);
  backdrop-filter: blur(10px);
}

.task-error h3 {
  color: var(--error-color);
  margin-bottom: 0.75rem;
}

.error-details {
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid var(--border-primary);
}

.error-details pre {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* Navbar Styles */
app-navbar {
  display: block;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-primary);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-brand a {
  color: inherit;
  text-decoration: none;
}

.navbar-nav {
  display: flex;
  list-style: none;
  gap: 0.5rem;
}

.nav-item {
  position: relative;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  position: relative;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--brand-cyan);
  background: rgba(10, 208, 248, 0.15);
}

/* Home Page Styles */
app-home {
  display: block;
}

.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 0;
}

.home-header {
  text-align: center;
  margin-bottom: 4rem;
}

.home-header h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
}

.home-header p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  width: 100%;
  margin-bottom: 4rem;
}

.feature-card {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  border: 1px solid var(--border-primary);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-secondary);
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: var(--border-secondary);
}

.feature-card h2 {
  color: var(--brand-cyan);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.feature-card p {
  flex-grow: 1;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}

.status-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  width: 100%;
}

.status-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-primary);
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.status-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-secondary);
  transform: translateY(-2px);
}

.status-card h3 {
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

/* Task Styles */
.task-list {
  width: 100%;
}

.task-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.task-table th,
.task-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-primary);
}

.task-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.task-table tr:last-child td {
  border-bottom: none;
}

/* Task Details Styles */
.task-details-card {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border-primary);
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-primary);
}

.task-info {
  margin-bottom: 1.5rem;
}

.info-item {
  display: flex;
  margin-bottom: 0.75rem;
  align-items: center;
}

.info-item .label {
  font-weight: 600;
  width: 120px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.info-item .value {
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
}

.task-results {
  margin-top: 1.5rem;
}

.result-files {
  margin-top: 1rem;
}

.preview-image {
  max-width: 80px;
  max-height: 80px;
  border-radius: 8px;
  border: 1px solid var(--border-primary);
}

.file-preview {
  margin-right: 1rem;
}

.file-icon {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-weight: 600;
  color: var(--brand-purple);
  font-size: 0.75rem;
  border: 1px solid var(--border-primary);
}

.download-link, .view-link {
  margin-left: 1rem;
  font-size: 0.8rem;
  color: var(--brand-cyan);
}

.actions {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* 404 Not Found */
.not-found {
  text-align: center;
  padding: 4rem 1rem;
}

.not-found h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.not-found p {
  margin-bottom: 2rem;
  color: var(--text-secondary);
  font-size: 1.125rem;
}

/* Processing indicator */
.processing-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  background: rgba(253, 89, 26, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(253, 89, 26, 0.2);
}

.processing-indicator p {
  color: var(--warning-color);
  margin-top: 1rem;
  text-align: center;
}

/* No content states */
.no-tasks, .no-models {
  text-align: center;
  padding: 3rem 1rem;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 2px dashed var(--border-primary);
}

.no-tasks p, .no-models p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.8rem;
  }

  .navbar {
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
  }

  .navbar-nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .home-header h1 {
    font-size: 2rem;
  }

  .home-header p {
    font-size: 1rem;
  }

  .features {
    grid-template-columns: 1fr;
  }

  .status-section {
    grid-template-columns: 1fr;
  }

  .task-table {
    font-size: 0.8rem;
  }

  .task-table th,
  .task-table td {
    padding: 0.75rem 0.5rem;
  }

  .task-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .actions {
    flex-direction: column;
  }

  .info-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .info-item .label {
    width: auto;
  }
}

/* Smooth transitions for theme changes */
* {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Focus styles for accessibility */
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand-cyan);
  outline-offset: 2px;
}

/* Custom selection colors */
::selection {
  background: rgba(10, 208, 248, 0.3);
  color: var(--text-primary);
}