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

:root {
  --primary: #667eea;
  --primary-dark: #5568d3;
  --secondary: #764ba2;
  --success: #48bb78;
  --warning: #ed8936;
  --danger: #f56565;
  --info: #4299e1;
  --dark: #2d3748;
  --light: #f7fafc;
  --border: #e2e8f0;
  --text: #2d3748;
  --text-light: #718096;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  min-height: 100vh;
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.header {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo h1 {
  font-size: 2.5em;
  color: var(--primary);
  margin-bottom: 5px;
}

.logo p {
  color: var(--text-light);
  font-size: 1.1em;
}

.version {
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
}

/* Main Content */
.main-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  padding: 40px;
  margin-bottom: 20px;
  min-height: 500px;
}

/* Upload Section */
.upload-section {
  text-align: center;
}

.upload-area {
  border: 3px dashed var(--border);
  border-radius: 12px;
  padding: 60px 40px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.upload-area:hover {
  border-color: var(--primary);
  background: var(--light);
}

.upload-area.drag-over {
  border-color: var(--primary);
  background: var(--light);
  transform: scale(1.02);
}

.upload-icon {
  font-size: 4em;
  margin-bottom: 20px;
}

.upload-area h2 {
  color: var(--dark);
  margin-bottom: 10px;
}

.upload-area p {
  color: var(--text-light);
  margin-bottom: 20px;
}

#fileInput {
  display: none;
}

.supported-formats {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.supported-formats p {
  color: var(--text-light);
  font-size: 0.9em;
}

/* File List */
.file-list {
  margin-top: 30px;
  text-align: left;
  background: var(--light);
  padding: 20px;
  border-radius: 8px;
}

.file-list h3 {
  margin-bottom: 15px;
  color: var(--dark);
}

#fileListContent {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 15px;
}

.file-item {
  padding: 8px 12px;
  background: white;
  margin-bottom: 5px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-icon {
  font-size: 1.2em;
}

.file-name {
  flex: 1;
  font-size: 0.9em;
}

.file-size {
  color: var(--text-light);
  font-size: 0.85em;
}

/* Options Section */
.options-section h2 {
  margin-bottom: 30px;
  color: var(--dark);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.option-group {
  background: var(--light);
  padding: 20px;
  border-radius: 8px;
}

.option-group h3 {
  margin-bottom: 15px;
  color: var(--primary);
  font-size: 1.1em;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

.checkbox-label:hover {
  background: white;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

/* Threshold Settings */
.threshold-settings {
  background: var(--light);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
}

.threshold-settings h3 {
  margin-bottom: 15px;
  color: var(--primary);
}

.threshold-group {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.threshold-group label {
  display: flex;
  align-items: center;
  gap: 15px;
}

.threshold-group input[type="range"] {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
}

.threshold-group input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

.threshold-group span {
  min-width: 40px;
  text-align: center;
  font-weight: 600;
  color: var(--primary);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-export {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: var(--light);
  color: var(--text);
  border: 2px solid var(--border);
}

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

.btn-large {
  padding: 16px 40px;
  font-size: 1.2em;
}

.action-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
}

/* Progress Section */
.progress-section {
  text-align: center;
}

.progress-section h2 {
  margin-bottom: 30px;
  color: var(--dark);
}

.progress-bar {
  width: 100%;
  height: 30px;
  background: var(--light);
  border-radius: 15px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  width: 0%;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  color: white;
  font-weight: 600;
}

.progress-text {
  color: var(--text-light);
  font-size: 1.1em;
  margin-bottom: 20px;
}

.progress-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  max-width: 600px;
  margin: 0 auto;
}

.progress-step {
  padding: 12px 20px;
  background: var(--light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.progress-step.active {
  background: var(--primary);
  color: white;
}

.progress-step.completed {
  background: var(--success);
  color: white;
}

.step-icon {
  font-size: 1.5em;
}

/* Results Section */
.results-section h2 {
  margin-bottom: 30px;
  color: var(--dark);
}

.health-card {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 40px;
  border-radius: 12px;
  margin-bottom: 30px;
  display: flex;
  gap: 40px;
  align-items: center;
}

.health-score {
  display: flex;
  gap: 30px;
  align-items: center;
}

.score-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 5px solid rgba(255,255,255,0.3);
}

.score-value {
  font-size: 3em;
  font-weight: bold;
}

.score-label {
  font-size: 0.9em;
  opacity: 0.9;
}

.grade-badge {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: white;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5em;
  font-weight: bold;
}

.health-details {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
}

.health-metric {
  text-align: center;
}

.health-metric-value {
  font-size: 2em;
  font-weight: bold;
  margin-bottom: 5px;
}

.health-metric-label {
  font-size: 0.9em;
  opacity: 0.9;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.tab {
  padding: 12px 24px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
  color: var(--text-light);
  transition: all 0.3s;
}

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

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  min-height: 400px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s;
}

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

/* Export Section */
.export-section {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid var(--border);
}

.export-section h3 {
  margin-bottom: 20px;
  color: var(--dark);
}

.export-buttons {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.btn-export {
  background: var(--light);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-export:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Cards */
.card {
  background: var(--light);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.card h3 {
  margin-bottom: 15px;
  color: var(--primary);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.metric-item {
  background: white;
  padding: 15px;
  border-radius: 6px;
  text-align: center;
}

.metric-value {
  font-size: 2em;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 5px;
}

.metric-label {
  color: var(--text-light);
  font-size: 0.9em;
}

/* Issue List */
.issue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.issue-item {
  padding: 15px;
  border-left: 4px solid;
  border-radius: 4px;
  background: var(--light);
}

.issue-item.critical {
  border-color: var(--danger);
  background: #fff5f5;
}

.issue-item.high {
  border-color: var(--warning);
  background: #fffaf0;
}

.issue-item.medium {
  border-color: var(--info);
  background: #ebf8ff;
}

.issue-item.low {
  border-color: var(--success);
  background: #f0fff4;
}

.issue-title {
  font-weight: 600;
  margin-bottom: 5px;
}

.issue-description {
  color: var(--text-light);
  font-size: 0.9em;
}

/* Footer */
.footer {
  text-align: center;
  color: white;
  padding: 20px;
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }

  .logo h1 {
    font-size: 2em;
  }

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

  .health-card {
    flex-direction: column;
    text-align: center;
  }

  .tabs {
    overflow-x: auto;
  }

  .export-buttons {
    justify-content: center;
  }
}

/* Loading Animation */
.spinner {
  border: 4px solid var(--light);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

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