/* ============================
   SteveAI — Full Modern Chat UI
   Fixed CSS (Aligned with chat.js module)
   ============================ */

/* -------- GLOBAL -------- */
body {
  margin: 0;
  background: #0d0d0d;
  color: #fff;
  font-family: 'Inter', sans-serif;
  overflow: hidden; /* Prevents body scroll */
  transition: background 0.3s, color 0.3s;
}

body.light {
  background: #fafafa;
  color: #111;
}

/* -------- HEADER -------- */
#header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #111;
  color: #fff;
  border-bottom: 1px solid #333;
}
body.light #header {
  background: #fff;
  border-bottom: 1px solid #ccc;
  color: #000;
}

/* LOGO */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2em;
  font-weight: 600;
  user-select: none;
}

.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
  background: #1a1a1a;
  border: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.light .logo-icon {
  background: #e6e6e6;
  border: 1px solid #ccc;
}

/* HEADER BUTTONS */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-btn {
  background: #1f1f1f;
  border: 1px solid #333;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.2s;
  font-size: 1em; /* Ensures emoji/text buttons are legible */
}

.action-btn:hover {
  background: #333;
}

body.light .action-btn {
  background: #f1f1f1;
  color: #111;
  border: 1px solid #bbb;
}

/* MODE SELECT */
#modeSelect {
  background: #1f1f1f;
  color: #fff;
  border: 1px solid #333;
  padding: 6px;
  border-radius: 6px;
  appearance: none; /* Custom styling for dropdown */
}

body.light #modeSelect {
  background: #e6e6e6;
  border: 1px solid #ccc;
  color: #000;
}

/* -------- CHAT AREA -------- */
#chat {
  /* Adjusted height to accommodate the fixed header/input */
  height: calc(100vh - 150px); 
  overflow-y: auto;
  padding: 20px;
  scroll-behavior: smooth;
}

/* Scrollbar */
#chat::-webkit-scrollbar {
  width: 6px;
}

#chat::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 10px;
}
body.light #chat::-webkit-scrollbar-thumb {
  background: #bbb;
}

/* -------- MESSAGE BUBBLES (MODERN STRUCTURE) -------- */

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

.bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 18px;
  line-height: 1.45;
  font-size: 0.95em;
  word-wrap: break-word;
}

.bubble-content p:first-child {
  margin-top: 0;
}
.bubble-content p:last-child {
  margin-bottom: 0;
}

/* USER STYLES */
.message-container.user {
  justify-content: flex-end; 
}

.bubble.user {
  background: #4e42ff;
  color: #fff;
  border-bottom-right-radius: 4px; 
}

body.light .bubble.user {
  background: #6a5bff;
}

/* BOT (AI) STYLES */
.message-container.bot {
  justify-content: flex-start; 
}

.bubble.bot {
  background: #1a1a1a;
  color: #fff;
  border: 1px solid #333;
  border-bottom-left-radius: 4px;
}

body.light .bubble.bot {
  background: #fff;
  border: 1px solid #ccc;
  color: #000;
}

/* --- THINKING/REASONING STYLES --- */
.thinking-details {
    /* Resets default <details> margin */
    margin: 0 0 10px 0; 
    border-radius: 8px;
    padding: 0 10px 0 0; 
    background: rgba(255, 255, 255, 0.05); /* Subtle dark background */
}

.bubble.bot.light .thinking-details {
    background: rgba(0, 0, 0, 0.05); /* Subtle light background */
}

.thinking-details summary {
    cursor: pointer;
    padding: 8px 10px;
    font-weight: 600;
    list-style: none; /* Hide default arrow */
    outline: none;
    user-select: none;
}
/* Custom arrow style */
.thinking-details summary::before {
    content: "▶️";
    display: inline-block;
    margin-right: 5px;
    transition: transform 0.2s;
}
.thinking-details[open] summary::before {
    content: "🔽";
}

.thinking-content {
    padding: 5px 10px 10px 10px;
    border-top: 1px dashed #333;
}
.bubble.bot.light .thinking-content {
    border-top: 1px dashed #ccc;
}

.thinking-content p:last-child {
    margin-bottom: 0;
}

.thinking-divider {
    border: none;
    border-top: 1px solid #333;
    margin: 10px 0;
}
.bubble.bot.light .thinking-divider {
    border-top: 1px solid #ccc;
}


/* MESSAGE ACTIONS (Copy/Resend/Speak buttons) */
.message-actions {
  display: flex;
  gap: 5px;
  position: absolute;
  top: -10px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 10;
}

.message-container:hover .message-actions {
  visibility: visible;
  opacity: 1;
}

.message-container.user .message-actions {
  right: calc(85% + 10px); 
}

.message-container.bot .message-actions {
  left: calc(85% + 10px); 
}

/* Actions button styling inside messages */
.message-actions .action-btn {
    padding: 2px 5px;
    font-size: 0.8em;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    line-height: 1;
}
.message-actions .action-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}
body.light .message-actions .action-btn {
    background: rgba(255, 255, 255, 0.8);
    color: #111;
    border: 1px solid #ccc;
}
body.light .message-actions .action-btn:hover {
    background: rgba(255, 255, 255, 1);
}


/* -------- TYPING INDICATOR -------- */
.typing {
  display: flex;
  gap: 5px;
  margin-bottom: 12px;
  padding: 10px 14px; 
}

.typing span {
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
  animation: blink 0.8s infinite alternate;
}
body.light .typing span {
    background: #111;
}

.typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes blink {
  to {
    opacity: 0.25;
    transform: scale(0.7);
  }
}

/* -------- COMMAND HINTS -------- */
#commandHints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  background: #181818;
  padding: 6px 0;
  font-size: 0.9em;
  border-top: 1px solid #222;
}

#commandHints span {
  background: #222;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: 0.2s;
}

#commandHints span:hover {
  background: #333;
}

body.light #commandHints {
  background: #f0f0f0;
  border-top: 1px solid #ccc;
}

body.light #commandHints span {
  background: #e6e6e6;
  color: #000;
}

/* -------- INPUT AREA -------- */
#inputContainer {
  padding: 10px;
  border-top: 1px solid #333;
  background: #111;
  display: flex;
  justify-content: center;
  position: fixed; 
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

body.light #inputContainer {
  background: #fff;
  border-top: 1px solid #ccc;
}

/* FORM/INPUT FLEX LAYOUT */
#inputForm {
    display: flex;
    width: 100%;
    max-width: 800px;
    gap: 10px;
}

/* TEXTBOX */
textarea {
  flex-grow: 1; 
  resize: none;
  background: #1a1a1a;
  color: #fff;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 10px;
  font-size: 1em;
  outline: none;
  transition: 0.2s;
}

textarea:focus {
  border-color: #4e42ff;
}

body.light textarea {
  background: #fff;
  color: #000;
  border: 1px solid #ccc;
}

/* SEND BUTTON */
#sendBtn {
  background: #4e42ff;
  color: white;
  width: 40px; 
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 10px;
  font-size: 1.5em;
  line-height: 1;
  cursor: pointer;
  transition: 0.2s;
}

#sendBtn:hover {
  background: #6a5bff;
}

body.light #sendBtn {
  background: #6a5bff;
  color: #fff;
}
