/* Basic resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Colour palette variables */
:root {
  /* Merrick Global brand palette
     primary – bright turquoise drawn from the logo
     hover – slightly darker for interactive states
     background – soft off‑white to lighten the page
     card – white panels on the off‑white background
     text – deep navy for headlines and dark grey for secondary text
  */
  --primary-color: #00a7ce;
  --primary-hover: #008db5;
  --background: #f7fafd;
  --card-background: #ffffff;
  --text-primary: #003a5d;
  --text-secondary: #546a7b;
  --border-radius: 12px;
  --shadow-color: rgba(0, 0, 0, 0.05);
}

body {
  font-family: 'Inter', sans-serif;
  line-height: 1.5;
  background: var(--background);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header.app-header {
  background: var(--card-background);
  color: var(--text-primary);
  padding: 2rem 1rem;
  text-align: center;
  border-bottom: 1px solid #e5e7eb;
}

/* Logo styling within the header */
header.app-header img.logo {
  max-width: 320px;
  width: 60%;
  height: auto;
  display: block;
  margin: 0 auto 1rem auto;
}

header.app-header h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

header.app-header .subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
}

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

.card {
  background: var(--card-background);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px var(--shadow-color);
  padding: 2rem;
  margin-bottom: 2rem;
}

/* Analytics table styling */
.analytics-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}
.analytics-table th,
.analytics-table td {
  padding: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.analytics-table th {
  background: var(--background);
  color: var(--text-primary);
  font-weight: 600;
}

.card h2 {
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.5rem;
}

.form-row label,
.form-row .label {
  flex: 0 0 220px;
  font-weight: 500;
  margin-right: 0.75rem;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.form-row select,
.form-row input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  background: #fff;
  color: var(--text-primary);
}

.form-row select:focus,
.form-row input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
  border-color: var(--primary-color);
}

.checkbox-group {
  flex: 1;
  /* Arrange qualification checkboxes in a responsive grid for better alignment */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.checkbox-group input {
  width: 1rem;
  height: 1rem;
}

/* Styles for multi‑select qualification list */
.multi-select {
  flex: 1;
  min-height: 6rem;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 1rem;
  color: var(--text-primary);
}
/* Ensure multi-select options have consistent line height */
.multi-select option {
  padding: 0.25rem 0.5rem;
  font-size: 0.95rem;
}

/*
  Generic button styles. All call-to-action buttons use the same
  palette and interactions so they feel consistent across the app.
  To add another button, simply use the `.button` class in your
  markup. Primary buttons can override the palette if needed.
*/
.button {
  background: var(--primary-color);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: inline-block;
  text-align: center;
  line-height: 1;
}
.button:hover {
  background: var(--primary-hover);
}
.button:active {
  transform: translateY(1px);
}

#result-section h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.step {
  background: var(--background);
  border-left: 4px solid var(--primary-color);
  border-radius: var(--border-radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

.step-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
  font-size: 1rem;
}

.step-details {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.note {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 1.5rem;
}

footer.footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: #f1f5f9;
  border-top: 1px solid #e5e7eb;
}

/* Info card for user guidance. Collapsible via <details> element. */
details.info-card {
  background: var(--card-background);
  border-left: 4px solid var(--primary-color);
  padding: 1rem;
  margin-bottom: 2rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 4px var(--shadow-color);
}
details.info-card summary {
  font-weight: 600;
  color: var(--primary-color);
  cursor: pointer;
  font-size: 1rem;
  outline: none;
}
details.info-card p {
  margin-top: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.4;
}

/* Bar chart styling for analytics */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.bar-label {
  flex: 0 0 45%;
  font-size: 0.85rem;
  color: var(--text-primary);
  word-break: break-word;
}
.bar {
  flex: 1;
  height: 0.75rem;
  border-radius: 4px;
  background-color: var(--primary-color);
  cursor: pointer;
  position: relative;
}
.bar.highlight {
  background-color: var(--primary-hover);
}

/* Heatmap grid styling */
.heatmap {
  display: inline-block;
  margin-top: 1.5rem;
  border-collapse: collapse;
  overflow-x: auto;
}
.heatmap-row {
  display: flex;
  width: 100%;
}
.heatmap-cell {
  flex: 1;
  padding: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-primary);
  min-width: 60px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
}
.heatmap-cell.header {
  font-weight: 600;
  background: var(--background);
  color: var(--text-primary);
  cursor: default;
}
.heatmap-cell.origin-label {
  background: var(--background);
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 1px solid #e5e7eb;
}
.heatmap-cell.selected {
  outline: 2px solid var(--primary-color);
}

/* Info area under analytics charts */
#analytics-info {
  margin-top: 1rem;
  padding: 0.5rem;
  background: var(--background);
  border-left: 4px solid var(--primary-color);
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Responsive styles */
@media (max-width: 700px) {
  .form-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .form-row label,
  .form-row .label {
    flex: none;
    margin-bottom: 0.5rem;
  }
  .checkbox-group {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
  .button {
    width: 100%;
    margin-bottom: 0.75rem;
  }
  .bar-label {
    flex: 0 0 60%;
  }
}