@import './DesignTokens.css';

/* Theme-Aware Swarm Trajectory Styles */
.swarm-trajectory {
  padding: var(--spacing-xl);
  margin: 0 auto;
  font-family: var(--font-family-primary);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  min-height: 100vh;
  transition: var(--transition-all);
}

/* Smart Processing Recommendation Styles */
.processing-recommendation {
  margin-top: var(--spacing-xl);
  padding: var(--spacing-base);
  border-radius: var(--border-radius-base);
  border-left: 4px solid;
  animation: fadeIn 0.3s ease-in;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-primary);
}

.processing-recommendation.mandatory-full-reprocess {
  background: linear-gradient(135deg, var(--color-danger-light), var(--color-bg-secondary));
  border-left-color: var(--color-danger);
}

.processing-recommendation.recommended-full-reprocess {
  background: linear-gradient(135deg, var(--color-warning-light), var(--color-bg-secondary));
  border-left-color: var(--color-warning);
}

.processing-recommendation.incremental-with-option {
  background: linear-gradient(135deg, var(--color-info-light), var(--color-bg-secondary));
  border-left-color: var(--color-info);
}

.processing-recommendation.safe-incremental {
  background: linear-gradient(135deg, var(--color-success-light), var(--color-bg-secondary));
  border-left-color: var(--color-success);
}

.processing-recommendation.no-uploads {
  background: var(--color-bg-tertiary);
  border-left-color: var(--color-text-tertiary);
}

.recommendation-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.recommendation-icon {
  font-size: var(--font-size-lg);
}

.recommendation-title {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  font-size: var(--font-size-base);
}

.recommendation-details {
  margin: var(--spacing-sm) 0;
  padding-left: var(--spacing-xl);
}

.recommendation-detail {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-xs);
  line-height: var(--line-height-normal);
}

.advanced-processing-options {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-base);
  flex-wrap: wrap;
}

.process-option-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-base);
  border: none;
  border-radius: var(--border-radius-base);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family-primary);
  cursor: pointer;
  transition: var(--transition-all);
  min-width: 100px;
  justify-content: center;
}

.process-option-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.process-option-btn.primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

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

.process-option-btn.secondary:hover:not(:disabled) {
  background: var(--color-bg-quaternary);
  transform: translateY(-1px);
}

.process-option-btn.tertiary {
  background: var(--color-danger-light);
  color: var(--color-danger);
  border: 1px solid var(--color-danger-border);
}

.process-option-btn.tertiary:hover:not(:disabled) {
  background: var(--color-danger);
  color: var(--color-text-primary);
  transform: translateY(-1px);
}

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

/* Enhanced Cluster Plot Header */
.cluster-plot-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-base);
  gap: var(--spacing-base);
}

.plot-header-left {
  flex: 1;
}

.plot-header-left h5 {
  margin: 0 0 var(--spacing-xs) 0;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.plot-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin: 0;
}

.plot-header-actions {
  flex-shrink: 0;
}

/* Professional Cluster KML Button */
.cluster-kml-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-base);
  background: linear-gradient(135deg, var(--color-success), #047857);
  border: none;
  border-radius: var(--border-radius-base);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: var(--transition-all);
  box-shadow: var(--shadow-base);
  font-family: var(--font-family-primary);
  position: relative;
  overflow: hidden;
}

.cluster-kml-btn::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: var(--transition-base);
}

.cluster-kml-btn:hover::before {
  left: 100%;
}

.cluster-kml-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-md);
}

.cluster-kml-btn:active {
  transform: translateY(-1px) scale(1.01);
  box-shadow: var(--shadow-sm);
}

.cluster-kml-btn:disabled,
.cluster-kml-btn.loading {
  cursor: not-allowed;
  opacity: 0.8;
  transform: none;
}

.cluster-kml-btn:disabled:hover,
.cluster-kml-btn.loading:hover {
  transform: none;
  box-shadow: var(--shadow-base);
}

.cluster-kml-btn .spinner {
  animation: spin 1s linear infinite;
}

.cluster-kml-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.cluster-kml-btn .btn-icon {
  font-size: var(--font-size-lg);
  flex-shrink: 0;
}

.btn-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.btn-text {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
}

.btn-subtitle {
  font-size: var(--font-size-xs);
  opacity: 0.85;
  font-weight: var(--font-weight-normal);
  line-height: 1;
}

/* Cluster Features */
.cluster-features {
  display: flex;
  justify-content: space-around;
  margin-top: var(--spacing-sm);
  padding-top: var(--spacing-sm);
  border-top: 1px solid var(--color-border-primary);
}

.feature-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.feature-icon {
  font-size: var(--font-size-base);
}

/* Header Section */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-base);
  background: var(--color-bg-secondary);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-base);
  border: 1px solid var(--color-border-primary);
}

/* Clean Workflow Guidance */
.workflow-guide {
  background: linear-gradient(135deg, var(--color-primary), var(--brand-secondary));
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-base) var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  box-shadow: var(--shadow-base);
  border: 1px solid var(--color-primary-border);
}

.guide-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.guide-icon {
  font-size: var(--font-size-xl);
  flex-shrink: 0;
}

.guide-text {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.guide-main {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-base);
}

.guide-steps {
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
}

.guide-link {
  color: #ffd700;
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  transition: var(--transition-base);
  border-bottom: 1px solid transparent;
}

.guide-link:hover {
  color: var(--color-text-primary);
  border-bottom-color: #ffd700;
  text-decoration: none;
}

.title-section h1 {
  color: var(--color-text-primary);
  margin: 0 0 var(--spacing-xs) 0;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
}

.subtitle {
  color: var(--color-text-secondary);
  margin: 0;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
}

.mode-badge {
  background: linear-gradient(135deg, var(--color-primary), var(--brand-secondary));
  color: var(--color-text-primary);
  padding: var(--spacing-xs) var(--spacing-base);
  border-radius: var(--border-radius-full);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-base);
}

/* Status Card */
.status-card {
  background: var(--color-bg-secondary);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-2xl);
  box-shadow: var(--shadow-base);
  border: 1px solid var(--color-border-primary);
}

.status-card h2 {
  margin: 0 0 var(--spacing-xl) 0;
  color: var(--color-text-primary);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
}

.status-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-base);
  align-items: center;
}

.metric {
  text-align: center;
  padding: var(--spacing-base);
  background: var(--color-bg-tertiary);
  border-radius: var(--border-radius-base);
  border: 1px solid var(--color-border-primary);
}

.metric-value {
  display: block;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  margin-bottom: var(--spacing-xs);
}

.metric-label {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
}

/* Workflow Steps */
.workflow-step {
  background: var(--color-bg-secondary);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  box-shadow: var(--shadow-base);
  border-left: 4px solid var(--color-primary);
  border: 1px solid var(--color-border-primary);
}

.step-header h3 {
  margin: 0 0 var(--spacing-xs) 0;
  color: var(--color-text-primary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  display: flex;
  align-items: center;
}

.step-number {
  background: var(--color-primary);
  color: var(--color-text-primary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  margin-right: var(--spacing-sm);
}

.step-header p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
}

/* Leader Cards */
.leaders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-xl);
  margin-top: var(--spacing-xl);
}

.leader-card {
  background: var(--color-bg-tertiary);
  border: 2px solid var(--color-border-primary);
  border-radius: var(--border-radius-base);
  padding: var(--spacing-xl);
  transition: var(--transition-all);
}

.leader-card.completed {
  border-color: var(--color-success);
  background: var(--color-success-light);
}

.leader-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.leader-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-base);
}

.leader-header h4 {
  margin: 0;
  color: var(--color-text-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
}

.follower-badge {
  background: var(--color-primary);
  color: var(--color-text-primary);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.upload-area {
  text-align: center;
}

.upload-controls {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  align-items: center;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  background: var(--color-primary);
  color: var(--color-text-primary);
  padding: var(--spacing-sm) var(--spacing-xl);
  border-radius: var(--border-radius-base);
  cursor: pointer;
  font-weight: var(--font-weight-semibold);
  transition: var(--transition-all);
  text-decoration: none;
  width: 100%;
  justify-content: center;
  max-width: 200px;
  font-family: var(--font-family-primary);
}

.upload-btn:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

.leader-card.completed .upload-btn {
  background: var(--color-success);
}

.leader-card.completed .upload-btn:hover {
  background: var(--color-success-hover);
}

.upload-icon {
  font-size: var(--font-size-base);
}

.remove-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  background: var(--color-danger-light);
  color: var(--color-danger);
  padding: var(--spacing-xs) var(--spacing-base);
  border: 1px solid var(--color-danger-border);
  border-radius: var(--border-radius-base);
  cursor: pointer;
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-base);
  transition: var(--transition-all);
  max-width: 200px;
  justify-content: center;
  font-family: var(--font-family-primary);
}

.remove-btn:hover {
  background: var(--color-danger);
  color: var(--color-text-primary);
  transform: translateY(-1px);
}

.remove-icon {
  font-size: var(--font-size-base);
}

/* Process Controls */
.process-controls {
  text-align: center;
  margin-top: var(--spacing-xl);
}

.process-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  background: linear-gradient(135deg, var(--color-primary), var(--brand-secondary));
  color: var(--color-text-primary);
  padding: var(--spacing-base) var(--spacing-2xl);
  border: none;
  border-radius: var(--border-radius-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-family-primary);
  cursor: pointer;
  transition: var(--transition-all);
  box-shadow: var(--shadow-base);
}

.process-btn:hover:not(.disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.process-btn.disabled {
  background: var(--color-text-tertiary);
  cursor: not-allowed;
  box-shadow: none;
}

.process-btn.processing {
  background: var(--color-info);
}

.process-icon {
  font-size: var(--font-size-lg);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.requirement-note {
  margin-top: var(--spacing-base);
  color: var(--color-danger);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
}

/* Results Cards */
.success-card {
  background: linear-gradient(135deg, var(--color-success-light), var(--color-bg-secondary));
  border: 1px solid var(--color-success);
  border-radius: var(--border-radius-base);
  padding: var(--spacing-xl);
  margin-top: var(--spacing-xl);
}

.success-header {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-base);
  margin-bottom: var(--spacing-xl);
}

.success-icon {
  font-size: var(--font-size-2xl);
}

.success-header h4 {
  margin: 0 0 var(--spacing-xs) 0;
  color: var(--color-text-primary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.success-header p {
  margin: 0;
  color: var(--color-text-secondary);
}

.processing-stats {
  display: flex;
  gap: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
}

.stat {
  text-align: center;
  padding: var(--spacing-sm);
  background: var(--color-bg-primary);
  border-radius: var(--border-radius-base);
  min-width: 80px;
  border: 1px solid var(--color-border-primary);
}

.stat-value {
  display: block;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-success);
  margin-bottom: var(--spacing-xs);
}

.stat.error .stat-value {
  color: var(--color-danger);
}

.stat-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
}

.next-steps {
  background: var(--color-info-light);
  border: 1px solid var(--color-info);
  border-radius: var(--border-radius-base);
  padding: var(--spacing-base);
}

.next-steps p {
  margin: 0;
  color: var(--color-text-primary);
  font-size: var(--font-size-base);
}

.error-card {
  background: linear-gradient(135deg, var(--color-danger-light), var(--color-bg-secondary));
  border: 1px solid var(--color-danger);
  border-radius: var(--border-radius-base);
  padding: var(--spacing-xl);
  margin-top: var(--spacing-xl);
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-base);
}

.error-icon {
  font-size: var(--font-size-2xl);
}

.error-card h4 {
  margin: 0 0 var(--spacing-xs) 0;
  color: var(--color-text-primary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.error-card p {
  margin: 0;
  color: var(--color-text-secondary);
}

/* Utility Actions */
.utility-actions {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
  margin-top: var(--spacing-2xl);
  padding-top: var(--spacing-2xl);
  border-top: 1px solid var(--color-border-primary);
}

.utility-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-primary);
  padding: var(--spacing-sm) var(--spacing-base);
  border-radius: var(--border-radius-base);
  cursor: pointer;
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family-primary);
  transition: var(--transition-all);
  text-decoration: none;
}

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

.utility-btn.danger:hover {
  background: var(--color-danger-light);
  border-color: var(--color-danger-border);
  color: var(--color-danger);
}

.utility-btn.commit {
  background: linear-gradient(135deg, var(--color-primary), var(--brand-secondary));
  color: var(--color-text-primary);
  border: 1px solid var(--color-primary);
}

.utility-btn.commit:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--color-primary-hover), var(--brand-secondary));
  border-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.utility-btn.commit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Professional Progress Modal */
.progress-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  animation: progressOverlayFadeIn 0.3s ease;
}

.progress-modal {
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-2xl);
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-dark-lg);
  border: 1px solid var(--color-border-primary);
  animation: progressModalSlideIn 0.4s ease;
}

.progress-header h3 {
  margin: 0 0 var(--spacing-xs) 0;
  color: var(--color-text-primary);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  text-align: center;
}

.progress-subtitle {
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
  text-align: center;
  margin-bottom: var(--spacing-2xl);
}

.progress-content {
  text-align: center;
}

.progress-bar-container {
  width: 100%;
  height: 12px;
  background: var(--color-bg-tertiary);
  border-radius: var(--border-radius-base);
  overflow: hidden;
  margin-bottom: var(--spacing-xl);
  position: relative;
  border: 1px solid var(--color-border-primary);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(135deg, var(--color-primary), var(--brand-secondary));
  border-radius: var(--border-radius-base);
  transition: width 0.8s ease;
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
  animation: progressShimmer 1.5s infinite;
}

.progress-step {
  font-size: var(--font-size-lg);
  color: var(--color-text-primary);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-xs);
}

.progress-percentage {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
}

@keyframes progressOverlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes progressModalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-30px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes progressShimmer {
  0% { transform: translateX(-20px); }
  100% { transform: translateX(100px); }
}

.utility-icon {
  font-size: var(--font-size-base);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--spacing-3xl) var(--spacing-xl);
  background: var(--color-bg-secondary);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-base);
  border: 1px solid var(--color-border-primary);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: var(--spacing-base);
}

.empty-state h3 {
  margin: 0 0 var(--spacing-sm) 0;
  color: var(--color-text-primary);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
}

.empty-state p {
  margin: 0 0 var(--spacing-xl) 0;
  color: var(--color-text-secondary);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* Advanced Preview Section - Progressive Disclosure */
.advanced-section {
  margin-top: var(--spacing-xl);
  background: var(--color-bg-secondary);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-base);
  overflow: hidden;
  border: 1px solid var(--color-border-primary);
}

/* Cluster-based organization */
.cluster-section {
  margin-bottom: var(--spacing-2xl);
  border: 2px solid var(--color-border-primary);
  border-radius: var(--border-radius-lg);
  background: var(--color-bg-secondary);
  overflow: hidden;
  box-shadow: var(--shadow-base);
}

.cluster-header {
  background: linear-gradient(135deg, var(--color-primary), var(--brand-secondary));
  color: var(--color-text-primary);
  padding: var(--spacing-xl) var(--spacing-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cluster-header h4 {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
}

.cluster-stats {
  background: rgba(255, 255, 255, 0.25);
  padding: var(--spacing-xs) var(--spacing-base);
  border-radius: var(--border-radius-full);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
}

/* Cluster overview plot section */
.cluster-plot-section {
  padding: var(--spacing-xl);
  background: var(--color-bg-tertiary);
  border-bottom: 1px solid var(--color-border-primary);
}

.cluster-plot-card {
  background: var(--color-bg-primary);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-base);
  border: 1px solid var(--color-border-primary);
}

.cluster-plot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-base);
}

.cluster-plot-header h5 {
  margin: 0;
  color: var(--color-text-primary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.plot-description {
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
  font-style: italic;
}

.cluster-plot {
  border-radius: var(--border-radius-base);
  overflow: hidden;
  background: var(--color-bg-tertiary);
  max-width: 600px;
  margin: 0 auto;
}

.cluster-plot img {
  width: 100%;
  height: auto;
  display: block;
}

/* Individual drones section */
.individual-drones-section {
  padding: var(--spacing-xl);
}

.section-title {
  margin: 0 0 var(--spacing-xl) 0;
  color: var(--color-text-primary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.drones-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-xl);
}

/* Updated drone preview cards */
.drone-preview-card {
  background: var(--color-bg-primary);
  border: 2px solid var(--color-border-primary);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-base);
  transition: var(--transition-all);
  box-shadow: var(--shadow-base);
}

.drone-preview-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
}

.preview-header h6 {
  margin: 0;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.delete-drone-btn {
  background: var(--color-danger-light);
  border: 1px solid var(--color-danger-border);
  border-radius: var(--border-radius-base);
  padding: var(--spacing-xs) var(--spacing-xs);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: var(--transition-all);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
}

.delete-drone-btn:hover {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: var(--color-text-primary);
  transform: scale(1.1);
}

.delete-drone-btn:active {
  transform: scale(0.95);
}

.drone-type-badge.leader {
  background: var(--color-primary);
  color: var(--color-text-primary);
}

.drone-type-badge.follower {
  background: var(--color-success);
  color: var(--color-text-primary);
}

.drone-type-badge {
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Clickable plot styling */
.preview-plot.clickable,
.cluster-plot.clickable {
  position: relative;
  cursor: pointer;
  transition: var(--transition-base);
}

.preview-plot.clickable:hover,
.cluster-plot.clickable:hover {
  transform: scale(1.02);
}

.zoom-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition-all);
  color: var(--color-text-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--border-radius-base);
}

.preview-plot.clickable:hover .zoom-overlay,
.cluster-plot.clickable:hover .zoom-overlay {
  opacity: 1;
}

.zoom-icon {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--spacing-xs);
}

/* Professional Lightbox */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  animation: lightboxFadeIn 0.3s ease;
}

.lightbox-container {
  background: var(--color-bg-primary);
  border-radius: var(--border-radius-lg);
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-dark-lg);
  border: 1px solid var(--color-border-primary);
  animation: lightboxSlideIn 0.3s ease;
}

.lightbox-header {
  padding: var(--spacing-base) var(--spacing-xl);
  border-bottom: 1px solid var(--color-border-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--color-bg-secondary);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.lightbox-header h3 {
  margin: 0;
  color: var(--color-text-primary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.lightbox-close {
  background: var(--color-danger-light);
  border: 1px solid var(--color-danger-border);
  border-radius: var(--border-radius-base);
  padding: var(--spacing-xs) var(--spacing-sm);
  cursor: pointer;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  transition: var(--transition-all);
  color: var(--color-danger);
}

.lightbox-close:hover {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: var(--color-text-primary);
  transform: scale(1.05);
}

.lightbox-content {
  padding: var(--spacing-xl);
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: calc(90vh - 120px);
  overflow: auto;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--border-radius-base);
  box-shadow: var(--shadow-base);
}

.lightbox-footer {
  padding: var(--spacing-sm) var(--spacing-xl);
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border-primary);
  text-align: center;
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.lightbox-hint {
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
  font-style: italic;
}

@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lightboxSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.trajectory-preview {
  border: none;
}

.preview-toggle {
  padding: var(--spacing-xl) var(--spacing-xl);
  cursor: pointer;
  background: linear-gradient(135deg, var(--color-bg-tertiary), var(--color-bg-quaternary));
  border: none;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  transition: var(--transition-all);
  list-style: none;
}

.preview-toggle::-webkit-details-marker {
  display: none;
}

.preview-toggle:hover {
  background: linear-gradient(135deg, var(--color-bg-quaternary), var(--color-bg-secondary));
}

.toggle-icon {
  font-size: var(--font-size-xl);
}

.toggle-hint {
  margin-left: auto;
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-normal);
}

.preview-content {
  padding: var(--spacing-xl);
  background: var(--color-bg-primary);
  border-top: 1px solid var(--color-border-primary);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--spacing-xl);
}

.preview-plot {
  margin-bottom: var(--spacing-sm);
  border-radius: var(--border-radius-base);
  overflow: hidden;
  background: var(--color-bg-tertiary);
  aspect-ratio: 4/3;
}

.preview-plot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition-all);
}

.preview-plot img:hover {
  opacity: 0.9;
}

.preview-actions {
  display: flex;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-sm);
}

.preview-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  border: none;
  border-radius: var(--border-radius-base);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-family-primary);
  cursor: pointer;
  transition: var(--transition-all);
}

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

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

.preview-btn.kml {
  background: var(--color-success);
  color: var(--color-text-primary);
}

.preview-btn.kml:hover {
  background: var(--color-success-hover);
}

.preview-btn.clear-single {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.preview-btn.clear-single:hover {
  background: var(--color-danger);
  color: var(--color-text-primary);
}

.btn-icon {
  font-size: var(--font-size-sm);
}

.follower-info {
  text-align: center;
  padding: var(--spacing-xs);
  background: var(--color-success-light);
  border-radius: var(--border-radius-base);
}

.follower-count-detail {
  font-size: var(--font-size-sm);
  color: var(--color-success-dark);
  font-weight: var(--font-weight-medium);
}

/* Mobile Responsive Design */
@media (max-width: 1200px) {
  .cluster-plot-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-sm);
  }

  .plot-header-actions {
    align-self: stretch;
  }

  .cluster-kml-btn {
    width: 100%;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-base);
  }

  .cluster-features {
    flex-direction: column;
    gap: var(--spacing-xs);
    align-items: center;
  }

  .feature-item {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .swarm-trajectory {
    padding: var(--spacing-base);
  }

  .header {
    flex-direction: column;
    gap: var(--spacing-base);
    text-align: center;
  }

  .guide-content {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-xs);
  }

  .guide-steps {
    font-size: var(--font-size-sm);
  }

  .status-metrics {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
  }

  .metric {
    padding: var(--spacing-sm);
  }

  .metric-value {
    font-size: var(--font-size-xl);
  }

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

  .processing-stats {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .utility-actions {
    flex-direction: column;
    align-items: center;
  }

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

  .preview-actions {
    flex-direction: column;
  }

  .preview-toggle {
    padding: var(--spacing-base);
    font-size: var(--font-size-sm);
  }

  .cluster-header {
    flex-direction: column;
    gap: var(--spacing-sm);
    text-align: center;
    padding: var(--spacing-base);
  }

  .cluster-plot-section {
    padding: var(--spacing-base);
  }

  .individual-drones-section {
    padding: var(--spacing-base);
  }

  .drones-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-base);
  }

  .btn-content {
    align-items: center;
    text-align: center;
  }

  .cluster-kml-btn .btn-icon {
    font-size: var(--font-size-xl);
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .process-option-btn,
  .cluster-kml-btn,
  .upload-btn,
  .remove-btn,
  .process-btn,
  .utility-btn,
  .preview-btn,
  .delete-drone-btn,
  .lightbox-close,
  .preview-plot.clickable,
  .cluster-plot.clickable,
  .drone-preview-card {
    transition: none;
    animation: none;
  }

  .process-option-btn:hover,
  .cluster-kml-btn:hover,
  .upload-btn:hover,
  .remove-btn:hover,
  .process-btn:hover,
  .utility-btn:hover,
  .preview-btn:hover,
  .delete-drone-btn:hover,
  .lightbox-close:hover,
  .preview-plot.clickable:hover,
  .cluster-plot.clickable:hover,
  .drone-preview-card:hover {
    transform: none;
  }
}

/* Focus states for accessibility */
.process-option-btn:focus-visible,
.cluster-kml-btn:focus-visible,
.upload-btn:focus-visible,
.remove-btn:focus-visible,
.process-btn:focus-visible,
.utility-btn:focus-visible,
.preview-btn:focus-visible,
.delete-drone-btn:focus-visible,
.lightbox-close:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .leader-card,
  .drone-preview-card,
  .cluster-section {
    border-width: 3px;
  }

  .upload-btn,
  .remove-btn,
  .process-btn,
  .utility-btn,
  .preview-btn {
    border: 2px solid var(--color-primary);
  }
}