body {
  font-family: sans-serif;
  background: #f0f2f5;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  height: 100%;
  margin: 0;
  padding: 0;
}

.container {
  background: white;
  padding: 4rem;
  border-radius: 8px;
  width: 90vw;
  max-width: 600px;
  text-align: center;
  box-sizing: border-box;
  
}
textarea {
  height: 100px; /* Increase height */
  font-size: 12px; /* Bigger text */
  padding: 14px 50px 14px 14px;
  width: 100%; /* Makes the box span full width */
  box-sizing: border-box;
}
form label {
  display: block;
  margin-top: 1rem;
  font-weight: bold;
}

form select,
form input {
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  margin-bottom: 12px;
  box-sizing: border-box;
}
#sentence.transcribe-text {
  font-family: monospace;
  text-align: left;
  background-color: #fffbe6;
  padding: 12px;
  border-left: 4px solid #ffa500;
  margin: 10px 0;
}

#sentence.speech-task {
  background-color: #fffbe6;
  border-left: 4px solid #ffa500;
}


.message {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 8px;
  line-height: 1.4;
  word-wrap: break-word;
  font-size: 14px;
  display: inline-block;
  margin: 6px 0;
  clear: both;
}

.message.user {
  background-color: #dcf8c6; /* light green */
  border-bottom-right-radius: 0;
  float: right;
  text-align: left;
  color: black;
}

.message.other {
  background-color: #ffffff;
  border-bottom-left-radius: 0;
  float: left;
  text-align: left;
  color: black;
}

.chat-input {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  background: white;
  flex-shrink: 0;
  border-top: 1px solid #ddd;
}


.chat-input input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #ccc;
  border-radius: 25px;
  font-size: 14px;
}

.chat-input button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #075e54;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  color: white;
  font-size: 18px;
  border: none;
}

.chat-input svg {
  width: 20px;
  height: 20px;
}


.chat-next{
  text-align: center;
  margin-top: 15px;
}

.chat-next button {
  padding: 10px 20px;
  font-size: 16px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.chat-next button:hover {
  background-color: #0056b3;
}
.chat-next button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

button {
  padding: 12px 24px;       /* Medium padding */
  font-size: 1em;            /* Medium font size */
  border: none;
  border-radius: 8px;
  background-color: #007bff;
  color: white;
  cursor: pointer;
  margin: 10px;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: #0056b3;
}

#next:disabled {
  background-color: #cccccc; /* grey background */
  color: #666666;           /* lighter text */
  cursor: not-allowed;      /* "blocked" cursor */
  opacity: 0.7;             /* slightly faded */
}

#next {
  background-color: #007bff; /* your normal blue */
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 5px;
  font-size: 1em;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#next:hover:enabled {
  background-color: #0056b3; /* darker blue on hover */
}

#context-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
  padding: 40px;
  text-align: center;
}

#start-chat-btn {
  margin-top: 20px;
  padding: 10px 24px;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  background-color: #28a745;
  color: white;
  cursor: pointer;
}
#name-input-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px;
  width: 90vw;
  max-width: 500px;
  margin: auto;
}

#close-name-input {
  width: 100%;
  max-width: 300px;
  padding: 12px;
  font-size: 16px;
  margin-bottom: 16px;
  box-sizing: border-box;
}

#close-name-submit {
  padding: 10px 20px;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  background-color: #007bff;
  color: white;
  cursor: pointer;
}
input, select, textarea, button {
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .container {
    padding: 2rem 1rem;
  }

  textarea {
    font-size: 16px;
    padding: 12px;
  }

  button {
    width: 100%;
    font-size: 1em;
    padding: 12px;
  }

  #name-input-screen {
    padding: 20px;
  }

  #context-screen {
    padding: 20px;
  }
 
  .chat-input {
    flex-direction: row;
    gap: 0px;
  }
   form label {
    font-size: 1rem;
    margin-top: 1.5rem;
  }

  form select, form input {
    font-size: 1rem;
  }

  button[type="submit"] {
    width: 100%;
  }
}
*{
  box-sizing: border-box;
}
.likert-group {
  display: flex;
  justify-content: space-between;
  max-width: 600px;
  margin-bottom: 1em;
}

.likert-group label {
  flex: 1;
  text-align: center;
  cursor: pointer;
  user-select: none;
  font-weight: normal;
}

.likert-group input[type="radio"] {
  display: block;
  margin: 0 auto 5px;
}
.page {
    display: none;
    text-align: left;
  }
  .page.active {
    display: block;
  }
  .nav-buttons {
    margin-top: 20px;
    text-align: center;
  }
  .nav-buttons button {
    margin: 0 10px;
  }
  h2 {
    margin-top: 0;
  }
  label {
    margin: 0.3em 0 0.6em 0;
    display: block;
  }
  .rating-group label {
    display: inline-block;
    margin-right: 15px;
    font-weight: normal;
  }
  /* Likert Table Styling */
.likert-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.95rem;
  background-color: white;
}

.likert-table thead {
  background-color: #f7f7f7;
}

.likert-table th,
.likert-table td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: center;
  vertical-align: middle;
}

.likert-table th:first-child,
.likert-table td:first-child {
  text-align: left;
  font-weight: 500;
  padding-left: 10px;
}

.likert-table input[type="radio"] {
  transform: scale(1.2);
  cursor: pointer;
}

.likert-table small {
  font-weight: normal;
  font-size: 0.8rem;
  color: #666;
}

/* Hover highlight row */
.likert-table tbody tr:hover {
  background-color: #f9f9f9;
}

/* Mobile-friendly adjustments */
@media (max-width: 768px) {
  .likert-table th, 
  .likert-table td {
    font-size: 0.85rem;
    padding: 6px;
  }
  .likert-table input[type="radio"] {
    transform: scale(1.1);
  }

}
.modal {
      display: none; 
      position: fixed; 
      z-index: 1000; 
      left: 0; top: 0;
      width: 100%; height: 100%; 
      background: rgba(0,0,0,0.5);
    }
    .modal-content {
      background: white;
      margin: 10% auto;
      padding: 20px;
      border-radius: 8px;
      width: 80%;
      max-width: 700px;
      max-height: 80%;
      overflow-y: auto;
    }
    .modal h2 { margin-top: 0; }
    .modal button {
      margin: 10px;
      padding: 8px 16px;
    }
    .required-star {
  color: red;
  font-size: 0.8em;
  vertical-align: super;
}
/* Audio preview container styling */
#audio-preview {
  text-align: center;
  margin-top: 8px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* Style for the inline preview with controls + buttons */
#audio-preview > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 360px;
  gap: 8px;
  flex-wrap: nowrap;
}

/* Make the audio player responsive */
#audio-preview audio {
  flex-grow: 1;
  width: 100%;
  max-width: 280px;
  height: 36px;
}

/* Keep buttons visible and accessible */
#audio-preview button {
  font-size: 1.2em;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

/* Adjust for small screens */
@media (max-width: 480px) {
  #audio-preview > div {
    flex-direction: column;
    align-items: stretch;
    max-width: 100%;
  }

  #audio-preview audio {
    width: 100%;
    max-width: none;
  }

  #audio-preview button {
    font-size: 1.5em;
  }
}
/* Hide the mute (volume) button in Chrome/Edge */
audio::-webkit-media-controls-mute-button {
  display: none !important;
}

/* Hide the volume slider (just in case) */
audio::-webkit-media-controls-volume-slider {
  display: none !important;
}
/* Keep Back and Next buttons side by side on mobile */
@media (max-width: 768px) {
  .nav-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
  }

  .nav-buttons button {
    width: auto !important;
    flex: 1 1 auto;
    min-width: 100px;
  }

  /* Make Submit button also centered and not full width */
  #submitBtn {
    width: auto !important;
  }
}
#ite-methods {
  text-align: left;
  margin-left: 0;
  margin-top: 12px;
}

#ite-methods label {
  display: flex;
  align-items: center;
  font-weight: normal;
  margin-bottom: 10px;
  font-size: 1.05em;
  gap: 10px;
}

#ite-methods input[type="checkbox"] {
  margin: 0 10px 0 0;
  width: 1.2em;
  height: 1.2em;
}


.chat-container {
  height: 100%; 
  width: 90vw; 
  width: 400px; 
  margin: 30px auto; 
  border: 1px solid #ccc; 
  border-radius: 10px; 
  overflow: hidden; 
  font-family: sans-serif;
}

.chat-header {
  background-color: #075e54;
  color: white;
  padding: 10px;
  font-size: 18px;
}

.chat-window {
 height: 325px; 
 padding: 10px; 
 overflow-y: auto; 
 background-color: #ece5dd;
}
/*******************************
  CHAT PAGE ONLY (safe)
*******************************/
.chat-page {
  display: block !important;
  justify-content: initial !important;
  align-items: initial !important;
  min-height: 100dvh;
  background: #f0f2f5;
  overflow: hidden;
  height: 100%;
  position: fixed;
  inset: 0;
}

/* Ensure WhatsApp-style layout */
.chat-page .chat-container {
  width: 100%;
  max-width: 450px;
  height: 100dvh;                /* full viewport height */
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  border: none;
  background: #ece5dd;
}

/* WhatsApp-style header */
.chat-page .chat-header {
  flex-shrink: 0;
}

/* WhatsApp-style chat window */
.chat-page .chat-window {
  flex: 1;                       /* fill remaining space */
  min-height: 0;                 /* prevents layout breaking */
  overflow-y: auto;
  padding: 12px;
  background-color: #ece5dd;
}

/* Input area stays fixed at bottom */
.chat-page .chat-input {
  flex-shrink: 0;
  background: white;
  padding: 10px;
}

/* Prevent input zoom (iOS fix) */
.chat-page .chat-input input[type="text"] {
  font-size: 16px !important;
}

/* Fix UI disappearing when keyboard opens */
@supports (height: 100svh) {
  .chat-page .chat-container {
    height: 100svh;
  }
}

/* Android keyboard fix */
.chat-page .chat-window {
  overscroll-behavior: contain;
}
/************************************
  CHAT PAGE STABILITY FIX
************************************/

/* 1. Prevent jump on keyboard */

/* Keep chat container fixed */
.chat-page .chat-container {
  height: 100dvh;
  max-width: 450px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: white !important; /* WhatsApp beige removed here */
}

/* Chat messages area */
.chat-page .chat-window {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #ece5dd !important; /* WhatsApp beige only here */
}

/* Input stays fixed at bottom */
.chat-page .chat-input {
  position: sticky;
  bottom: 0;
  background: white;
  z-index: 20;
}

/* Stable viewport height (iOS fix) */
@supports (height: 100svh) {
  .chat-page .chat-container {
    height: 100svh !important;
  }
}

/* Prevent iOS zoom on input */
.chat-page input[type="text"] {
  font-size: 16px !important;
}
.chat-input textarea {
  flex: 1;
  min-height: 38px;              /* WhatsApp base height */
  max-height: 110px;             /* prevent huge expansion */
  padding: 10px 12px;
  font-size: 16px;
  line-height: 20px;
  border: 1px solid #ccc;
  border-radius: 18px;
  resize: none;
  overflow-y: auto;
}
/* When recording, hide textarea and show audio preview */
.chat-input.recording #user-input {
    display: none !important;
}

.chat-input.recording #audio-preview {
    display: flex !important;
    width: 100%;
}

#audio-preview {
    display: none;
    flex: 1;
    align-items: center;
    gap: 10px;
}

#audio-preview audio {
    width: 100%;
    height: 36px;
}

#audio-preview button {
    font-size: 1.4em;
}
/* Recording indicator container */
.recording-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    color: #d32f2f;
    font-weight: 600;
}

/* Pulsing red dot */
.pulse-dot {
    width: 12px;
    height: 12px;
    background-color: #d32f2f;
    border-radius: 50%;
    animation: pulse 1.2s infinite ease-in-out;
}

/* Pulse animation */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.4; }
    100% { transform: scale(1); opacity: 1; }
}
.cancel-btn {
    background: red;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3em;
    cursor: pointer;
}
