/* style.css */

/* CSS Variables & Reset */
:root {
  --bg: #fafafa;
  --text: #333333;
  --primary: #006aff;
  --secondary: #f2f2f2;
  --user-bubble: #e4f0ff;
  --assistant-bubble: #ffffff;
}
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
}
body {
  /* push all content below the fixed header */
  padding-top: 56px;
}

/* ─── Fixed Header ─────────────────────────────────────────────────────────── */
.pmt-header {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 56px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
}
.pmt-header .logo img {
  height: 32px;
}
.header-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}
.pmt-header nav {
  display: flex;
  gap: 12px;
}
.pmt-header nav a {
  color: #fff;
  text-decoration: none;
  font-size: 0.95em;
}

/* Mobile: hide nav, show hamburger, stack menu */
@media (max-width: 600px) {
  .header-toggle {
    display: block;
  }
  .pmt-header nav {
    display: none;
    flex-direction: column;
    background: var(--primary);
    position: absolute;
    top: 56px; left: 0;
    width: 100%;
    padding: 8px 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  .pmt-header nav.open {
    display: flex;
  }
}

/* ─── Layout ───────────────────────────────────────────────────────────────── */
#container {
  display: flex;
  height: calc(100% - 56px); /* fill below header */
}
#chat-root {
  width: 100%;
  height: auto;
}

/* Sidebar */
/* Sidebar hidden by default (off-canvas) */
#sidebar {
  position: fixed;
  top: 56px;               /* just under the header */
  left: 0;
  width: 250px;
  height: calc(100% - 56px);
  background: var(--secondary);
  padding: 20px;
  box-shadow: 2px 0 5px rgba(0,0,0,0.1);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 1000;
}

/* When we add .open, it slides into view */
#sidebar.open {
  transform: translateX(0);
}

#main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: calc(100% - 250px);
}

/* Chat-sidebar toggle (mobile) */
.menu-toggle { display: none; }
@media (max-width: 600px) {
  #sidebar {
    position: absolute;
    top: 56px;
    left: 0; bottom: 0;
    transform: translateX(-100%);
    z-index: 999;
  }
  #menu-toggle {
    display: block;
    position: absolute;
    top: 12px; left: 12px;
    background: var(--secondary);
    border: none;
    border-radius: 4px;
    padding: 8px;
    cursor: pointer;
    z-index: 1001;
  }
}

/* ─── Top Bar ──────────────────────────────────────────────────────────────── */
#top-bar {
  flex: 0 0 auto;
  background: white;
  border-bottom: 1px solid #ddd;
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
#top-bar select,
#top-bar input,
#top-bar button {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 0.9em;
  background: white;
}
#top-bar button {
  background: var(--primary);
  color: white;
  cursor: pointer;
}
#top-bar button:hover {
  background: #0051cc;
}

/* ─── Messages ────────────────────────────────────────────────────────────── */
#message-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 5%;
  /*display: flex;*/
  flex-direction: column;
  gap: 14px;
}
.message {
  position: relative;
  max-width: 100%;
  padding: 12px 16px;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  overflow-wrap: break-word;
}
#message-list .user {
  align-self: flex-end;
  background: var(--user-bubble);
}
#message-list .assistant {
  align-self: flex-start;
  background: var(--assistant-bubble);
}
#message-list .system {
  align-self: center;
  background: #e0e0e0;
  color: #444;
  font-size: 0.85em;
  padding: 6px 12px;
  border-radius: 12px;
}
.control-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1em;
  color: #888;
}
.control-delete:hover {
  color: #555;
}

/* ─── Cost Info ───────────────────────────────────────────────────────────── */
#cost-info {
  flex: 0 0 auto;
  padding: 10px 20px;
  font-size: 0.85em;
  color: #555;
  background: white;
  border-top: 1px solid #ddd;
}

/* ─── Input Area ──────────────────────────────────────────────────────────── */
#input-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: white;
  border-top: 1px solid #ddd;
  padding: 14px;
  position: sticky;
  bottom: 0;
}
#file-input {
  order: 0;
}
#input-box {
  order: 1;
  width: 100%;
  min-height: 40px;
  max-height: 50vh;        /* limit to 60% of viewport height */
  padding: 10px 14px;
  border: 1px solid #ccc;
  border-radius: 20px;
  font-size: 0.95em;
  resize: vertical;
  overflow-y: auto;        /* scroll once past max-height */
}
#send-btn {
  order: 2;
  align-self: flex-end;
  padding: 10px 18px;
  font-size: 0.9em;
  border: none;
  border-radius: 20px;
  background: var(--primary);
  color: white;
  cursor: pointer;
}
#send-btn:hover {
  background: #0051cc;
}

/* Desktop Input Area */
@media (min-width: 601px) {
  #input-area {
    flex-direction: row;
    align-items: center;
  }
  #file-input,
  #input-box,
  #send-btn {
    order: initial;
    margin: 0;
  }
  #file-input {
    flex: 0 0 auto;
    margin-right: 8px;
    width: auto;
  }
  #input-box {
    flex: 1 1 200px;
  }
}
/* ─── Sidebar Toggle (left) ───────────────────────────────────────────────── */
#menu-toggle {
  display: block;               /* always show */
  position: fixed;
  top: 12px;
  left: 12px;
  background: none;
  border: none;
  font-size: 1.5rem;
  z-index: 1001;                /* above sidebar/header content */
  cursor: pointer;
}

/* ─── Header Nav Toggle (right) ───────────────────────────────────────────── */
.header-toggle {
  display: block;               /* always show */
  position: fixed;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.5rem;
  z-index: 1001;                /* above header content */
  cursor: pointer;
}

/* Adjust your header padding so the two icons don’t collide with the logo/text */
.pmt-header {
  padding: 0 48px;              /* leave room on left & right for toggles */
}

/* Make sure your header still sits on top */
.pmt-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  z-index: 1000;
}

/* Push the rest of the page down so header & toggles never cover content */
body {
  padding-top: 56px;
}
.faq-section {
  position: relative;    /* ensure it participates normally in flow */
  clear: both;           /* push below any floated elements */
  z-index: auto;         /* let it sit above no one */
  margin: 2em auto;      /* vertical gap from chat & footer */
  padding: 1.5em;
  background: #f9f9f9;
  border-radius: 4px;
  max-width: 800px;
}

.faq-section h2 {
  margin-top: 0;
}

.faq-section dl {
  margin: 0;
}

.faq-section dt {
  font-weight: bold;
  margin-top: 1em;
}

.faq-section dd {
  margin-left: 1em;
}
.message span {
  /* preserve all spaces and line breaks */
  white-space: pre-wrap;
}
