/* ------------ 1. BASE LAYOUT ------------ */
:root {
  --brand: #17479d;
  --brand-light: #588eee;
  --accent: #ee6823;
  --gap: 5px;
  --radius: 12px;
  --bg-overlay: rgba(255, 255, 255, 0.85);
  --shadow: 0 0 12px rgba(0, 0, 0, 0.15);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 20px 0;                          /* ✅ NEW */
  font-family: Arial, sans-serif;
  background:
    linear-gradient(var(--bg-overlay), var(--bg-overlay)),
    url('https://channel.mediacdn.vn/428462621602512896/2023/8/8/huflitclean-16914696561351904203768.jpg')
      center/cover no-repeat fixed;
  display: flex;
  justify-content: center;
  align-items: center; 
  min-height: 100vh;
  color: #000;
}

#chat-container {
  width: 95%;
  max-width: 900px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 25px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ------------ 2. HEADER ------------ */
.greeting-message {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-align: center;
  padding: 15px;
  border-radius: 10px;
  font-size: clamp(1rem, 2.5vw, 1.3rem);   /* responsive text */
}

/* ------------ 3. FORM ROW ------------ */
.form-row {
  display: flex;
  flex-wrap: wrap;            /* allow wrap on narrow screens */
  gap: var(--gap);
}

.form-group {
  flex: 1 1 30%;              /* basis 30%, grow/shrink for space */
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 700;
  margin-bottom: 4px;
  padding-left: 5px;
  text-align: left;
}

.form-row select {
  width: 100%;
  padding: 8px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* ------------ 4. BUTTONS ------------ */
#button-wrapper {
  display: flex;
  gap: var(--gap);
}

button {
  flex: 1;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 10px 12px;
  transition: background .3s;
}

button:hover { background: var(--brand-light); }

/* ------------ 5. CHAT AREA ------------ */
#reply {
  border-left: 4px solid var(--brand);
  background: #f0f4ff;
  padding: 14px;
  border-radius: 6px;
  min-height: 80px;
  white-space: pre-wrap;
}

#spinner { font-style: italic; color: #666; }

audio { width: 100%; margin-top: 10px; }

/* ------------ 6. MEDIA QUERIES ------------ */

/* < 600 px: allow vertical scroll and adjust padding */
@media (max-width: 599px) {
  body {
    align-items: flex-start;
  }

  #chat-container {
    margin: 0;
    padding: 18px;
  }
}

/* < 768 px: improve mobile layout and button accessibility */
@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
  }

  .form-group {
    flex: 1 1 100%;
  }

  #button-wrapper {
    flex-direction: column;
  }

  #button-wrapper button {
    width: 100%;
    padding: 16px 0;     /* Taller buttons */
    font-size: 18px;     /* Larger, easier-to-tap text */
  }
}


#stopBtn.recording {
  background-color: red;
}

#debugLog {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: 30vh;
  padding: 10px;
  font-family: monospace;
  font-size: 13px;
  resize: none;
  background: #f9f9f9;
  border-top: 2px solid #ccc;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}
/* Make buttons taller on mobile screens */
@media (max-width: 768px) {
  #button-wrapper {
    flex-direction: column;     /* Stack buttons vertically */
    gap: 16px;                  /* Add space between stacked buttons */
  }

  #button-wrapper button {
    padding: 16px 12px;
    font-size: 18px;
  }
}
