/* =========================
   Global Base
========================= */

html, body {
  margin: 0;
  padding-top: clamp(40px, 14vh, 40px);
  height: 100%;
  background: #FFFFFF;
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue",
               Arial, sans-serif;
  color: #222;
  background-color: #d6f3f3; 
  font-size: clamp(14px, 1.6vw, 18px);
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
}
  /*
  html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;

  background-color: #d6f3f3;

  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue",
               Arial, sans-serif;

  font-weight: 400;
  font-size: clamp(15px, 1.2vw, 18px);
  line-height: 1.6;
  color: #1f2933;

  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}
*/

/* =========================
   Fixed Top Bar
========================= */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  background-color: #003a80;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0.75rem 4vw;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  z-index: 1000;
  padding-left: clamp(20px, 3.5vw, 0.75in);
  padding-right: clamp(20px, 3.5vw, 0.75in);
}

.logo {
  height: 80%;          /* fills most of the topbar height */
  max-height: 100%;     /* never taller than the bar */
  width: auto;          /* preserve aspect ratio */
  margin-right: auto;
}

.tagline {
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 800;
  letter-spacing: 0.4px;
}
/* =========================
   Container / Page Layout
========================= */

/*
.container {
  background: #fff;
  background-color: #d6f3f3; 
  width: min(99%, 2240px);
  max-width: 2240px;
  margin: clamp(100px, 10vh, 150px) auto 2rem auto;
  padding: 2rem 2.5vw 8rem 2.5vw;
  box-sizing: border-box;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  text-align: center;
}
*/

.container {
  background-color: #d6f3f3;

  /* mobile-first elastic column with guaranteed side gutters */
  width: min(calc(100% - 2rem), 2240px);
  margin: clamp(84px, 10vh, 140px) auto 2rem auto;

  /* padding that behaves on small + huge screens */
  padding: clamp(1rem, 2.5vw, 2.5rem) clamp(1rem, 2.5vw, 2.5rem) 8rem;

  box-sizing: border-box;
  border-radius: 12px;

  display: flex;
  flex-direction: column;

  /* mobile-first: allow children to fill available width */
  align-items: stretch;

  gap: clamp(1rem, 2vw, 2rem);

  /* mobile-first readability */
  text-align: left;
}



/* =========================
   Headings
========================= */
h1 {
  color: #c62715;
  font-size: clamp(1.5rem, 3vw, 2.25rem); /* ~25% smaller */
  margin-bottom: 0.25rem;
  font-weight: 800;
  white-space: nowrap;
  text-align: center;
}

h2 {
  color: #003a80;
  font-weight: 700;
  font-size: clamp(1rem, 1.8vw, 1.5rem); /* ~25% smaller */
  margin-top: 0;
  margin-bottom: .25rem;
  text-align: center;
  white-space: nowrap;
}

/* =========================
   Hero Image
========================= */
/*
.hero-image {
  width: clamp(160px, 25vw, 300px);
  border-radius: 12px;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
*/
.hero-image {
  display: block;                    /* required for margin centering */
  width: clamp(160px, 25vw, 300px);
  height: auto;

  margin: 0 auto 1.25rem auto;       /* centers horizontally */

  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.hipaa-image {
  display: block;                    /* required for margin centering */
  width: clamp(160px, 25vw, 300px);
  height: auto;

  margin: 0 auto 1.25rem auto;       /* centers horizontally */

  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}


/* =========================
   Upload Section
========================= */
.upload-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.file-label {
  background-color: #24CC56;
  color: white;
  padding: 1rem 2rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  transition: background 0.2s ease, transform 0.1s ease;
}
.file-label:hover {
  background-color: #20b34d;
  transform: translateY(-1px);
}

input[type="file"] {
  display: none !important;
}

/* =========================
   Buttons
========================= */
.button-row {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

button {
  background-color: #24CC56;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 1rem 2rem;
  font-size: clamp(1rem, 1.8vw, 1.3rem);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}
button:hover {
  background-color: #20b34d;
  transform: translateY(-1px);
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
/*
.logout-btn {
  margin-left: auto;
}

.help-btn {
  background-color: #E53935;
  margin-left: clamp(10rem, 1vw, 1.5rem);
}
  */
  .help-btn {
  background-color: #E53935;
}

.logout-btn {
  margin-left: 0.75rem;
}

/* =========================
   Spinner
========================= */
.spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #24CC56;
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  animation: spin 1s linear infinite;
  margin: 1rem auto;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* =========================
   Flowchart + Outputs
========================= */
#questions-output,
#answers-output,
#flowchart-output {
  background: #FFFFFF;
  border-radius: 10px;
  padding: 1.5rem;
  margin-top: 2rem;
  text-align: left;
  box-shadow: none;
  background-color: #d6f3f3; 
}

/* Flowchart layout from existing version */
#flowchart-container {
  display: flex;
  flex-direction: column;
  gap: 4rem;
  width: 100%;
  margin-top: 1rem;   /* reduces space between summary and flowchart */
}

.flowchart-group {
  width: 100%;
  padding: 1rem 0;
  border-top: 3px solid #eee;
}

.flowchart-group h2 {
  margin-bottom: 1rem;
  text-align: center;
  font-size: 1.3rem;
  color: #333;
}

.flow-table {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  position: relative;
  width: 100%;
}

.flow-row {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  align-items: flex-start;
  position: relative;
  background: #fff;
  border: 3px solid #333;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  padding: 1rem 1.5rem;
}
.flow-row::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 0;
  height: 2.5rem;
  border-left: 3px solid #333;
}
.flow-row::before {
  content: "";
  position: absolute;
  left: calc(50% - 5px);
  bottom: -2.5rem;
  border: 6px solid transparent;
  border-top: 8px solid #333;
}
.flow-row:last-child::after,
.flow-row:last-child::before {
  display: none;
}

.cell {
  flex: 1;
  word-wrap: break-word;
  color: #222;
}
.cell.id, .cell.next {
  flex: 0 0 3rem;
  text-align: center;
  font-weight: bold;
  color: #333;
}
.cell.label {
  flex: 0 0 10rem;
  font-weight: 600;
  color: #444;
}
.cell.content {
  flex: 1;
  line-height: 1.4;
}

/* Color tints per step */
.flow-row:nth-child(1)  { background:#e0f7fa; border-color:#00acc1; }
.flow-row:nth-child(2)  { background:#e8f5e9; border-color:#43a047; }
.flow-row:nth-child(3)  { background:#fff3e0; border-color:#fb8c00; }
.flow-row:nth-child(4)  { background:#f3e5f5; border-color:#8e24aa; }
.flow-row:nth-child(5)  { background:#e8eaf6; border-color:#3949ab; }
.flow-row:nth-child(6)  { background:#fce4ec; border-color:#d81b60; }
.flow-row:nth-child(7)  { background:#f1f8e9; border-color:#7cb342; }

.flow-row:hover {
  filter: brightness(0.97);
  transform: translateY(-2px);
  transition: all 0.15s ease;
}

/* =========================
   Responsive
========================= */
@media (max-width: 600px) {
  .container { padding: 1.5rem 5vw; }
  .button-row { flex-direction: column; align-items: stretch; }
  button { width: 100%; }
  h1 { white-space: normal; }
  .hero-image { width: 70%; }
}

/* =========================
   Footer (self-contained full-width mirror)
========================= */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #003a80;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.1rem 4vw;          /* reduced top/bottom padding */
  box-shadow: 0 -2px 6px rgba(0,0,0,0.15);
  z-index: 900;
}

.footer-logo {
   height: 70px;                 /* taller for legibility */
  width: auto;
}

.footer-tagline {
  font-size: clamp(12px, 2vw, 16px);
  font-weight: 800;
  letter-spacing: 0.4px;
}

.footer a, 
.footer a:visited, 
.footer a:hover, 
.footer a:active {
  color: #fff;
  text-decoration: none; /* Standard for footers, or 'none' for a cleaner look */
}


/* =========================
   Authentication Specifics
   (Fixed the #message visibility issue here)
========================= */

/* The #message element is no longer hidden by default. 
   It will appear once JavaScript adds text content. */
#message { 
    margin-top: 15px; 
    padding: 10px; 
    border-radius: 4px; 
    background-color: #f0f0f0; 
}

/* The .visible class is now redundant, but kept here for safety 
   in case another rule has higher specificity. */
#message.visible {
    display: block !important; 
}

input[type="email"] { width: 100%; padding: 10px; margin-bottom: 15px; box-sizing: border-box; }

#flowchart-container { margin-top: 1rem !important; }
#questions-container,
#flowchart-container {
  margin-top: 0 !important;
  padding-top: 0 !important;
}
#answers-container {
  display: none !important;
}
#answers-output {
  display: none !important;
}
.container {
  margin-top: 3px !important;
  gap: 1rem !important;
}