/* Modern, Clean UI Styles */

:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  --bg-color: #f9fafb;
  --surface-color: #ffffff;
  --text-color: #111827;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}

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

.container.wide {
  max-width: 1200px;
}

/* Header */
.header {
  background-color: var(--surface-color);
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  padding: 1.5rem 0;
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-color);
  text-align: center;
}

.header p {
  text-align: center;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* Card */
.card {
  background-color: var(--surface-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

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

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

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  transition: all 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

select.form-control {
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  text-align: center;
}

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

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

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

.btn-secondary:hover {
  background-color: #4b5563;
}

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

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

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

.btn-block {
  width: 100%;
}

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

/* Messages */
#error-message, #success-message {
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  display: none;
}

#error-message {
  background-color: #fee2e2;
  border: 1px solid var(--error-color);
  color: #991b1b;
}

#success-message {
  background-color: #d1fae5;
  border: 1px solid var(--success-color);
  color: #065f46;
}

/* Loading */
#loading {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f4f6;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Yes/No Questions */
.question-group {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background-color: var(--bg-color);
  border-radius: 6px;
}

.question-text {
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.radio-group {
  display: flex;
  gap: 2rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.radio-label input[type="radio"] {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
}

/* Dynamic Rows (Stage 2) */
.dynamic-rows {
  margin-bottom: 1.5rem;
}

.row-item {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr auto;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
  padding: 1rem;
  background-color: var(--bg-color);
  border-radius: 6px;
}

.row-item .form-group {
  margin-bottom: 0;
}

.btn-remove {
  padding: 0.75rem 1rem;
  background-color: var(--error-color);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.btn-add {
  margin-top: 0.5rem;
}

.weight-sum {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background-color: #fef3c7;
  border-radius: 6px;
  font-weight: 600;
  text-align: center;
}

.weight-sum.valid {
  background-color: #d1fae5;
  color: #065f46;
}

.weight-sum.invalid {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Rating Display */
.rating-display {
  text-align: center;
  padding: 2rem;
  margin: 2rem 0;
  background: linear-gradient(135deg, var(--primary-color), #6366f1);
  color: white;
  border-radius: 12px;
}

.rating-display h2 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.rating-display p {
  font-size: 1.125rem;
  opacity: 0.9;
}

/* Dashboard Table */
.table-container {
  overflow-x: auto;
  margin-top: 1.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--surface-color);
}

thead {
  background-color: var(--bg-color);
}

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

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

tbody tr:hover {
  background-color: var(--bg-color);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
}

.badge-success {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background-color: #fef3c7;
  color: #92400e;
}

.badge-info {
  background-color: #dbeafe;
  color: #1e40af;
}

/* Search Bar */
.search-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.search-bar input {
  flex: 1;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

.pagination button {
  padding: 0.5rem 1rem;
}

.pagination span {
  color: var(--text-secondary);
}

/* Navigation */
.nav-links {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
}

.progress-indicator {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.progress-step {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  background-color: var(--border-color);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
}

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

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

/* Summary View */
.summary-section {
  margin-bottom: 2rem;
}

.summary-section h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.data-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.data-label {
  font-weight: 600;
  color: var(--text-secondary);
}

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

  .row-item {
    grid-template-columns: 1fr;
  }

  .search-bar {
    flex-direction: column;
  }

  .nav-links {
    flex-direction: column;
    gap: 1rem;
  }

  .table-container {
    font-size: 0.875rem;
  }

  th, td {
    padding: 0.5rem;
  }
}
