/* static/css/styles.css */

/* ---------- Global reset ---------- */
* {
  box-sizing: border-box;
}

/* ---------- Base typography ---------- */
html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
}

/* ---------- Navigation ---------- */
.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 0.75em;
  background: #f4f4f4;
  border-bottom: 1px solid #ccc;
}

.nav a {
  text-decoration: none;
  font-weight: bold;
  color: #000;
}

/* Right-aligned user area (replaces float) */
.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Logout form/button */
.logout-form {
  display: inline;
}

.logout-button {
  background: none;
  border: none;
  padding: 0;
  font-weight: bold;
  color: #0066cc;
  cursor: pointer;
}

/* ---------- Layout ---------- */
.main {
  padding: 1rem;
}

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

/* ---------- Forms ---------- */
form {
  max-width: 420px;
  margin: 2rem auto;
}

input,
select,
textarea,
button {
  width: 100%;
  padding: 0.6rem;
  margin-top: 0.4rem;
}

/* ---------- Images ---------- */
img {
  max-width: 100%;
  height: auto;
}

/* ---------- Questionnaire Radio Buttons ---------- */
fieldset.question{
  margin-bottom: 20px;
}

.radio-choice input[type="radio"] {
  position: relative;
  top: 2em;
}

/* ---------- Progress Bar ---------- */

.progress-wrapper {
  max-width: 420px;
  margin: 1rem auto;
}

.progress-bar {
  height: 10px;
  background: #e0e0e0;
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #4caf50;
  transition: width 0.3s ease;
}

.progress-text {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  text-align: right;
  color: #555;
}

/* ---------- Preferences Page ---------- */

/* Preferences should use most of the page width */
.pref-group {
  max-width: 1200px;  
  width: 100%;
  margin: 1.5rem auto;
}

.pref-section {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-size: 1.4rem;
  font-weight: 600;
  border-bottom: 2px solid #ddd;
  padding-bottom: 0.25rem;
}

.pref-item {
  margin-bottom: 1.75rem;
}

.pref-label {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Lay out preference radios horizontally */
.pref-options > div {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  width: 100%;
}

.pref-options > div > div {
  display: flex;
  align-items: center;
  white-space: normal;   /* allow wrapping if screen is too narrow */
}

.pref-options label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Override narrow form width for Preferences page */
.pref-group,
.pref-group ~ button,
.pref-section {
  max-width: none;
}

.pref-group {
  width: 100%;
}

/* Only widen forms on the Preferences page */
.preferences-page form {
  max-width: 100%;
}

#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  font-family: system-ui, sans-serif;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid #ccc;
  border-top-color: #2a6df4;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

/* Preferences page: keep Save button compact */
.preferences-page button[type="submit"] {
  width: auto;
  min-width: 140px;
  padding: 0.6rem 1.25rem;
}



/* -------------------------------- */
/* ---------- Responsive ---------- */
/* -------------------------------- */


/* Tablets */
@media (max-width: 900px) {
  .container {
    padding: 0.75rem;
  }
}

/* Phones */
@media (max-width: 600px) {
  .nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-right {
    margin-left: 0;
  }

  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.3rem;
  }

 .pref-options > div {
    flex-direction: column;
    gap: 0.5rem;
  }

  img {
    max-width: 100%;
  }

}