:root {
  --bg-color: #0b0f19;
  --glass-bg: rgba(22, 28, 45, 0.4);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.12);
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-glow: rgba(59, 130, 246, 0.5);
  --success: #10b981;
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #cbd5e1;
  --panel-bg: rgba(15, 23, 42, 0.6);
  --input-bg: rgba(15, 23, 42, 0.8);
  --input-border: rgba(148, 163, 184, 0.2);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Background Effects */
.background-effects {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
  animation: float 20s ease-in-out infinite alternate;
}

.orb-1 {
  top: -10%;
  left: 20%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.3) 0%, rgba(0, 0, 0, 0) 70%);
}

.orb-2 {
  bottom: -20%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
  animation-delay: -5s;
}

.orb-3 {
  top: 40%;
  left: -20%;
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, rgba(0, 0, 0, 0) 70%);
  animation-delay: -10s;
}

@keyframes float {
  0% {
    transform: translate(0, 0);
  }

  100% {
    transform: translate(50px, 50px);
  }
}

/* Layout */
.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.glass-header {
  text-align: center;
  margin-bottom: 1rem;
  position: relative;
}

.github-link {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  transition: all 0.2s ease;
  z-index: 10;
}

.github-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.header-content {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.logo {
  width: 32px;
  height: 32px;
  color: var(--accent);
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

header p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Cards */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 1rem;
}

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 0 15px var(--accent-glow);
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Upload Section */
.file-upload {
  border: 2px dashed var(--input-border);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.3);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.file-upload:hover,
.file-upload.dragover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.05);
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon-wrapper {
  background: var(--panel-bg);
  padding: 1rem;
  border-radius: 50%;
  margin-bottom: 1rem;
  color: var(--accent);
  border: 1px solid var(--glass-border);
  transition: transform 0.3s ease, color 0.3s ease;
}

.file-upload:hover .upload-icon-wrapper {
  transform: translateY(-5px);
  color: var(--accent-hover);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.upload-text {
  font-weight: 500;
  color: var(--text-dark);
}

.status-message {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.success-message {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.hidden {
  display: none !important;
}

/* Forms */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

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

.flex-1 {
  flex: 1;
  min-width: 200px;
}

.flex-2 {
  flex: 2;
  min-width: 300px;
}

label {
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.premium-input,
.premium-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s ease;
  outline: none;
}

.premium-input:focus,
.premium-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.premium-input:disabled,
.premium-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.custom-select-wrapper {
  position: relative;
}

.custom-select-wrapper::after {
  content: '';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-muted);
  pointer-events: none;
}

.premium-select {
  appearance: none;
  padding-right: 2.5rem;
}

.input-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Accordion Slots */
.accordion {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.slot-item {
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.3s ease;
}

.slot-item:hover {
  border-color: var(--glass-highlight);
}

.slot-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
}

.slot-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.slot-title {
  font-size: 1.1rem;
  font-weight: 500;
  margin: 0;
}

.slot-status-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.slot-status-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.slot-status-badge.inactive {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.expand-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: transform 0.3s ease, background 0.2s ease, color 0.2s ease;
}

.slot-item.expanded .expand-btn {
  transform: rotate(180deg);
  color: var(--accent);
}

.slot-item.expanded .slot-header {
  border-bottom: 1px solid var(--glass-border);
}

.slot-body {
  transition: opacity 0.3s ease, padding 0.3s ease;
  overflow: hidden;
}

.content-hidden {
  display: none;
}

.slot-body-inner {
  padding: 1.5rem;
}

.slot-body.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s;
  border-radius: 24px;
  border: 1px solid var(--glass-border);
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

input:checked+.slider {
  background-color: var(--accent);
  border-color: var(--accent);
}

input:focus+.slider {
  box-shadow: 0 0 1px var(--accent);
}

input:checked+.slider:before {
  transform: translateX(20px);
}

/* Warnings */
.warning-alert {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--warning-bg);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  align-items: flex-start;
  animation: fadeIn 0.3s ease;
}

.warning-icon {
  color: var(--warning);
  flex-shrink: 0;
}

.warning-content h4 {
  color: #fbbf24;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.warning-text {
  color: #fcd34d;
  font-size: 0.85rem;
  margin: 0;
}

/* Info Pills */
.advanced-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--glass-border);
  margin-top: 0.5rem;
}

.info-pill {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.info-label {
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.info-value {
  color: var(--text-dark);
  font-family: monospace;
}

.info-value.highlight {
  color: #a5b4fc;
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

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

.export-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.export-text-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-width: 250px;
}

.export-desc {
  color: var(--text-muted);
}

.export-path {
  font-size: 0.85rem;
  color: var(--text-dark);
}

.export-path code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: monospace;
  color: var(--accent-hover);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Footer */
.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1rem 0;
  opacity: 0.5;
}

/* Responsive */
@media (max-width: 768px) {
  .export-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .btn {
    width: 100%;
  }

  .github-link {
    position: static;
    display: inline-flex;
    margin-bottom: 1.5rem;
  }
}

/* Searchable Dropdown */
.searchable-dropdown {
  position: relative;
  width: 100%;
}

.sd-list {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 250px;
  overflow-y: auto;
  background: var(--input-bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  margin-top: 5px;
}

.sd-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--glass-border);
  transition: background 0.2s;
}

.sd-item:last-child {
  border-bottom: none;
}

.sd-item:hover {
  background: rgba(59, 130, 246, 0.2);
}

.sd-empty {
  color: var(--text-muted);
  font-style: italic;
  cursor: default;
}

.sd-empty:hover {
  background: none;
}

/* Scrollbar styling for sd-list */
.sd-list::-webkit-scrollbar {
  width: 6px;
}

.sd-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

.sd-list::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

/* Mode Tabs */
.mode-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  background: rgba(15, 23, 42, 0.4);
  padding: 0.5rem;
  border-radius: var(--radius-lg);
  display: inline-flex;
  border: 1px solid var(--glass-border);
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 0.75rem 1.5rem;
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.mode-container {
  display: none;
  animation: fadeIn 0.4s ease;
}

.mode-container.active-mode {
  display: block;
}

/* Secondary Button */
.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  margin-top: 1rem;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

/* DCFG Signal List */
.section-header .signal-counter {
  margin-left: auto;
  font-size: 0.9rem;
  background: var(--panel-bg);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
}

.signal-selector-panel {
  background: rgba(0, 0, 0, 0.2);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  margin-bottom: 2rem;
}

.signal-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-style: italic;
  background: var(--panel-bg);
  border-radius: var(--radius-md);
  border: 1px dashed var(--glass-border);
}

.dcfg-signal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  transition: transform 0.2s, border-color 0.2s;
  animation: fadeIn 0.3s ease;
}

.dcfg-signal-item:hover {
  border-color: var(--glass-highlight);
  transform: translateX(4px);
}

.dcfg-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dcfg-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dcfg-sig-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-hover);
  margin: 0;
}

.dcfg-msg-name {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
}

.dcfg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dcfg-pill {
  font-size: 0.8rem;
  color: var(--text-dark);
  background: rgba(0, 0, 0, 0.3);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.id-pill {
  font-family: monospace;
  color: #a5b4fc;
}

.remove-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.remove-btn:hover {
  background: #ef4444;
  color: white;
  transform: scale(1.1) rotate(90deg);
}