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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0d1117;
  color: #e6edf3;
  min-height: 100vh;
}

/* Site navigation */
.site-nav {
  display: flex;
  gap: 0;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  padding: 0 1.5rem;
}

.nav-link {
  padding: 0.75rem 1.25rem;
  color: #7d8590;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.nav-link:hover {
  color: #e6edf3;
}

.nav-link.active {
  color: #f97316;
  border-bottom-color: #f97316;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: #f0f6fc;
}

.subtitle {
  color: #7d8590;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed #30363d;
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #161b22;
  margin-bottom: 1.5rem;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: #f97316;
  background: #1c2128;
}

.drop-zone.has-file {
  border-color: #3fb950;
  border-style: solid;
}

.drop-zone-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.6;
}

.drop-zone-text {
  color: #7d8590;
  font-size: 0.95rem;
}

.drop-zone-text strong {
  color: #f97316;
}

.file-name {
  color: #3fb950;
  font-weight: 600;
  font-size: 1rem;
  margin-top: 0.5rem;
}

.file-input {
  display: none;
}

/* Settings panel */
.settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.setting-group {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1rem;
}

.setting-group label {
  display: block;
  font-size: 0.8rem;
  color: #7d8590;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.setting-group input,
.setting-group select {
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: #e6edf3;
  font-size: 0.95rem;
}

.setting-group input:focus,
.setting-group select:focus {
  outline: none;
  border-color: #f97316;
}

/* Warmup / Cooldown panel */
.warmup-cooldown-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.wc-option {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1rem;
}

.wc-option .toggle-label {
  margin-bottom: 0.75rem;
}

.wc-fields {
  display: flex;
  gap: 0.5rem;
  transition: opacity 0.2s ease;
}

.wc-fields.disabled {
  opacity: 0.3;
  pointer-events: none;
}

.wc-field {
  flex: 1;
}

.wc-field label {
  display: block;
  font-size: 0.65rem;
  color: #7d8590;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.3rem;
}

.wc-field input {
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
  color: #e6edf3;
  font-size: 0.85rem;
}

.wc-field input:focus {
  outline: none;
  border-color: #f97316;
}

/* Actions */
.actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.btn {
  padding: 0.6rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.btn-primary {
  background: #f97316;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #ea580c;
}

.btn-secondary {
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #30363d;
}

.btn-secondary:hover:not(:disabled) {
  background: #30363d;
}

/* Status messages */
.status {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  display: none;
}

.status.error {
  display: block;
  background: #3d1117;
  border: 1px solid #f85149;
  color: #f85149;
}

.status.success {
  display: block;
  background: #122117;
  border: 1px solid #3fb950;
  color: #3fb950;
}

.status.info {
  display: block;
  background: #12213d;
  border: 1px solid #388bfd;
  color: #388bfd;
}

/* Summary */
.summary {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: none;
}

.summary.visible {
  display: block;
}

.summary h3 {
  font-size: 0.9rem;
  color: #7d8590;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.summary-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 1rem;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #f0f6fc;
}

.stat-label {
  font-size: 0.75rem;
  color: #7d8590;
}

.zone-bars {
  display: flex;
  gap: 2px;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.zone-bar {
  height: 100%;
  transition: width 0.3s ease;
}

.zone-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: #7d8590;
}

.zone-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.zone-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Workout preview chart */
.preview {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: none;
}

.preview.visible {
  display: block;
}

.preview h3 {
  font-size: 0.9rem;
  color: #7d8590;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.chart-container {
  height: 200px;
  display: flex;
  align-items: flex-end;
  gap: 1px;
  overflow-x: auto;
  padding-bottom: 1rem;
  position: relative;
}

.chart-bar {
  flex-shrink: 0;
  min-width: 2px;
  border-radius: 2px 2px 0 0;
  transition: opacity 0.15s;
  position: relative;
}

.chart-bar:hover {
  opacity: 0.8;
}

.chart-bar .tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #21262d;
  border: 1px solid #30363d;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  z-index: 10;
  color: #e6edf3;
  pointer-events: none;
}

.chart-bar:hover .tooltip {
  display: block;
}

/* FTP reference lines */
.chart-lines {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 1rem;
  pointer-events: none;
}

.chart-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed #30363d;
  font-size: 0.6rem;
  color: #484f58;
  padding-left: 4px;
}

/* Strava trim panel */
.strava-panel {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: none;
}

.strava-panel.visible {
  display: block;
}

.strava-panel h3 {
  font-size: 0.9rem;
  color: #7d8590;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.strava-desc {
  font-size: 0.8rem;
  color: #484f58;
  margin-bottom: 1rem;
  line-height: 1.4;
}

/* Trim tabs */
.trim-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 1rem;
  background: #0d1117;
  border-radius: 6px;
  padding: 3px;
}

.trim-tab {
  flex: 1;
  padding: 0.45rem 0.75rem;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #7d8590;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.trim-tab:hover {
  color: #e6edf3;
}

.trim-tab.active {
  background: #30363d;
  color: #f97316;
}

.trim-tab-content {
  display: none;
  margin-bottom: 0.75rem;
}

.trim-tab-content.active {
  display: block;
}

.input-hint {
  display: block;
  font-size: 0.7rem;
  color: #484f58;
  margin-top: 0.35rem;
  line-height: 1.3;
}

.strava-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.strava-url-group {
  margin-bottom: 0;
}

.strava-url-row {
  display: flex;
  gap: 0.5rem;
}

.strava-url-row input {
  flex: 1;
}

.btn-sm {
  padding: 0.4rem 0.75rem !important;
  font-size: 0.8rem !important;
}

.trim-three-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

.strava-distance-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.strava-distance-row .setting-group {
  margin-bottom: 0;
}

.strava-info {
  background: #12213d;
  border: 1px solid #388bfd;
  color: #388bfd;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.strava-info.error {
  background: #3d1117;
  border-color: #f85149;
  color: #f85149;
}

.strava-toggle {
  margin-top: 0.25rem;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: #e6edf3;
}

.toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #f97316;
}

.toggle-text {
  user-select: none;
}

/* XML preview (collapsible) */
.xml-preview {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.25rem;
  display: none;
}

.xml-preview.visible {
  display: block;
}

.xml-header {
  font-size: 0.9rem;
  color: #7d8590;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.xml-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.xml-toggle-arrow {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
  display: inline-block;
}

.xml-toggle-arrow.expanded {
  transform: rotate(90deg);
}

.xml-header-actions {
  display: flex;
  gap: 0.5rem;
}

.xml-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease, margin-top 0.2s ease;
  max-height: 500px;
  opacity: 1;
  margin-top: 0.75rem;
}

.xml-body.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.xml-preview pre {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #7ee787;
  max-height: 400px;
  overflow-y: auto;
}

/* Responsive */
@media (max-width: 600px) {
  .settings {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }

  .summary-stats {
    flex-wrap: wrap;
  }
}
