/* css/styles.css */
body {
    font-family: 'Outfit', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    min-height: 100vh;
    width: 100vw;
    box-sizing: border-box;
}

.app-container {
    width: 95vw;
    max-width: 600px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 70vh;
    margin: 0 auto;
}

.chat-window {
    flex: 1;
    padding: 4vw 3vw;
    overflow-y: auto;
    background-color: #f9f9f9;
    min-height: 200px;
}

.input-container {
    display: flex;
    padding: 2vw 3vw;
    border-top: 1px solid #eee;
    background-color: white;
    gap: 1vw;
}

#userInput {
    flex: 1;
    padding: 0.8em 1em;
    border: 1px solid #ddd;
    border-radius: 20px;
    margin-right: 0.5em;
    outline: none;
    font-size: 1em;
    min-width: 0;
}

button {
    padding: 0.7em 1.2em;
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1em;
    min-width: 44px;
    min-height: 44px;
}

button:hover {
    background-color: #3367d6;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.message {
    margin-bottom: 15px;
    display: flex;
}

.message.user {
    justify-content: flex-end;
}

.message.ai {
    justify-content: flex-start;
}

.message.system {
    justify-content: center;
    opacity: 0.7;
}

.bubble {
    padding: 0.7em 1.1em;
    border-radius: 18px;
    max-width: 80vw;
    word-wrap: break-word;
    font-size: 1em;
}

.user .bubble {
    background-color: #4285f4;
    color: white;
}

.ai .bubble {
    background-color: #e9e9e9;
    color: black;
}

.system .bubble {
    background-color: #f0f0f0;
    color: #666;
    font-style: italic;
}

.welcome-message {
    text-align: center;
    padding: 20px;
}

.welcome-message h2 {
    margin-top: 0;
    color: #4285f4;
}

.welcome-message input {
    width: 100%;
    padding: 0.7em 1em;
    margin: 1em 0;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.welcome-message button {
    margin-top: 10px;
}

.choice-buttons {
    display: flex;
    justify-content: center;
    gap: 2vw;
    margin-top: 1em;
}

#speakBtn.active {
    background-color: #ea4335;
}

.stress-level-container {
    margin: 2em 0;
}

.stress-level-options {
    display: flex;
    justify-content: space-between;
    gap: 2vw;
}

.stress-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1em 0.7em;
    border-radius: 8px;
    border: 1px solid #ddd;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 0;
}

.stress-button:hover {
    background-color: #f0f0f0;
}

.stress-button.selected {
    background-color: #4285f4;
    color: white;
    border-color: #4285f4;
}

.stress-button span {
    font-size: 0.9em;
    margin-top: 0.3em;
}

/* Responsive breakpoints */
@media (max-width: 1200px) {
  .app-container {
    max-width: 90vw;
  }
}

@media (max-width: 768px) {
  .app-container {
    max-width: 98vw;
    min-height: 60vh;
    border-radius: 6px;
  }
  .chat-window {
    padding: 3vw 2vw;
  }
  .input-container {
    padding: 2vw 2vw;
    gap: 2vw;
  }
  .bubble {
    font-size: 0.95em;
  }
  button {
    font-size: 0.95em;
    min-width: 40px;
    min-height: 40px;
  }
}

@media (max-width: 480px) {
  .app-container {
    max-width: 100vw;
    min-height: 50vh;
    border-radius: 0;
  }
  .chat-window {
    padding: 2vw 1vw;
  }
  .input-container {
    padding: 2vw 1vw;
    gap: 1vw;
  }
  .bubble {
    font-size: 0.9em;
  }
  button {
    font-size: 0.9em;
    min-width: 36px;
    min-height: 36px;
  }
}

/* ============================================
   SHARED BACK BUTTON STYLES
   ============================================ */

.back-button {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  
  /* Button styling */
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #000000;
  border-radius: 50px;
  padding: 12px 24px;
  
  /* Typography */
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: #000000;
  text-decoration: none;
  
  /* Layout */
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  
  /* Backdrop filter for glass effect */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  
  /* Ensure button stays above content */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Special positioning for app page to avoid input overlap */
.app-container .back-button {
  position: fixed;
  top: 20px;
  left: 20px;
  bottom: auto;
  transform: none;
  border-radius: 40px;
  padding: 10px 20px;
  font-size: 14px;
  z-index: 1001; /* Higher than logo */
}

.back-button:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* App page specific hover (no transform since no center positioning) */
.app-container .back-button:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.back-button:active {
  transform: translateX(-50%) translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* App page specific active state */
.app-container .back-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.back-button svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ============================================
   RESPONSIVE BACK BUTTON STYLES
   ============================================ */

/* Extra Small Mobile (Portrait): 320px – 480px */
@media (min-width: 320px) and (max-width: 480px) {
  .back-button {
    bottom: 30px;
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 40px;
  }
  
  /* App page specific - top left positioning */
  .app-container .back-button {
    top: 15px;
    left: 15px;
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 30px;
  }
  
  .back-button svg {
    width: 18px;
    height: 18px;
  }
  
  .app-container .back-button svg {
    width: 16px;
    height: 16px;
  }
}

/* Small Mobile (Landscape): 481px – 600px */
@media (min-width: 481px) and (max-width: 600px) {
  .back-button {
    bottom: 35px;
    padding: 11px 22px;
    font-size: 15px;
  }
  
  .app-container .back-button {
    top: 18px;
    left: 18px;
    padding: 9px 18px;
    font-size: 14px;
  }
  
  .back-button svg {
    width: 19px;
    height: 19px;
  }
  
  .app-container .back-button svg {
    width: 17px;
    height: 17px;
  }
}

/* Small Tablets (Portrait): 601px – 768px */
@media (min-width: 601px) and (max-width: 768px) {
  .back-button {
    bottom: 45px;
    padding: 14px 28px;
    font-size: 17px;
  }
  
  .app-container .back-button {
    top: 22px;
    left: 22px;
    padding: 12px 22px;
    font-size: 15px;
  }
  
  .back-button svg {
    width: 22px;
    height: 22px;
  }
  
  .app-container .back-button svg {
    width: 19px;
    height: 19px;
  }
}

/* Large Tablets (Landscape): 769px – 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
  .back-button {
    bottom: 50px;
    padding: 16px 32px;
    font-size: 18px;
  }
  
  .app-container .back-button {
    top: 25px;
    left: 25px;
    padding: 14px 24px;
    font-size: 16px;
  }
  
  .back-button svg {
    width: 24px;
    height: 24px;
  }
  
  .app-container .back-button svg {
    width: 20px;
    height: 20px;
  }
}

/* Desktop and larger */
@media (min-width: 1025px) {
  .back-button {
    bottom: 60px;
    padding: 16px 32px;
    font-size: 18px;
  }
  
  .app-container .back-button {
    top: 30px;
    left: 30px;
    padding: 14px 24px;
    font-size: 16px;
  }
  
  .back-button svg {
    width: 24px;
    height: 24px;
  }
  
  .app-container .back-button svg {
    width: 20px;
    height: 20px;
  }
}

/* iPhone specific adjustments */
@media (width: 390px) and (height: 844px) {
  .back-button {
    bottom: 40px; /* Account for home indicator */
  }
}

@media (width: 393px) and (height: 873px) {
  .back-button {
    bottom: 40px; /* Account for home indicator */
  }
}