/* Basic Reset & Body */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  /* background-color: #f4f6fa; lighter, more modern */
  background-color: #cceef93d;
  color: #222;
  line-height: 1.6;
}
.carattere-regular {
  font-family: "Carattere", serif;
  font-weight: 400;
  font-style: normal;
}

/* Page wrapper layout */
#pageWrapper {
  display: block;
  width: 100%;
}

.main-content {
  flex: 1;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
  background: #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
  border-radius: 18px;
  margin-top: 1.2rem;
  margin-bottom: 2.5rem;
  width: 98%;
  max-width: none;
  margin-left: 1%;
  margin-right: 1%;
}

.main-content.constrained-width {
  width: 70%;
  margin-left: 15%;
  margin-right: 15%;
}
.container {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 2.5rem 2rem 2rem 2rem;
}

/* Top Single Line & Lock Icon */
.lock-icon-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.75rem;
  cursor: pointer;
  opacity: 0.5;
}

.lock-icon-container:hover {
  opacity: 1;
}

.lock-icon-container svg {
  width: 20px;
  height: 20px;
  opacity: 0.99;
  color: steelblue;;
}
.lock-tooltip {
  display: none;
  position: absolute;
  background-color: #000;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  top: 50%;
  left: 105%;
  transform: translateY(-50%);
  white-space: nowrap;
  z-index: 999;
}
.lock-icon-container:hover .lock-tooltip {
  display: block;
}
.top-single-line-wrapper {
  display: flex;
  /* align-items: center; */
  margin-bottom: 1.5rem;
  width: 98%;
  height: 1rem;
}

#topSingleLine {
  flex: 1;
  width: 90%;
  height: auto;
  padding-bottom: 8px;
  background-color: transparent;
  border: none;
  border-bottom: 2px solid #e1e1e1;
  font-weight: 500;
  font-size: 0.9rem;
  outline: none;
  resize: none;
  font-family: inherit;
  overflow: hidden;
  /* line-height: 1rem; */
}


#topSingleLine:focus {
  border-bottom-color: #b3b3b3;
}
#topSingleLine:empty:before {
  content: attr(data-placeholder);
  color: #aaa;
}

/* Freeform Notes & Toolbar */
.freeform-wrapper {
  position: relative;
  /* margin-bottom: 1.5rem; */
}
#freeFormNotes {
  width: 100%;
  min-height: 300px;
  height: auto;
  background-color: #fff;
  border: 1px solid #e1e1e1;
  border-radius: 8px;
  padding: 1rem;
  padding-top: calc(1rem + 35px);
  outline: none;
  font-size: 0.85em;
  box-sizing: border-box;
  resize: vertical;
  font-family: inherit;
  overflow: hidden;
}
#freeFormNotes:focus {
  border-color: #b3b3b3;
}
#freeFormNotes:empty:before {
  content: attr(aria-placeholder);
  color: #aaa;
  position: absolute;
  left: 1rem;
  top: calc(1rem + 35px);
  pointer-events: none;
  width: calc(100% - 2rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.freeform-toolbar {
  position: absolute;
  top: 10px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0; /* Standardized vertical padding */
}
.toolbar-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  opacity: 0.8;
  background-color: #e6e6e6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: background-color 0.2s;
}
.toolbar-btn:hover {
  background-color: #d4d4d4;
}
.toolbar-btn img {
  width: 18px;
  height: 18px;
}

#problemlistSuggestions {
  opacity: 0.7;
  display: none;
  margin-bottom: 1.5rem;
  flex-direction: column;
  gap: 10px;
  border: 1px solid #e1e1e1;
  border-radius: 6px;
  padding: 1rem;
  background-color: #fff;
  overflow-x: auto;
  overflow-y: hidden;
}

#problemlistSuggestions.collapsed {
  height: 24px !important;
  min-height: 0 !important;
  max-height: 24px !important;
  padding: 0 1rem !important;
  overflow: hidden !important;
  opacity: 0.7;
  display: flex !important;
  align-items: center;
  border-radius: 6px;
}
#problemlistSuggestions.collapsed .suggested-problems-header > *:not(#collapseProblemsBtn):not(b) {
  display: none !important;
}
#problemlistSuggestions.collapsed .suggested-problems-header {
  margin-bottom: 0;
}
.collapse-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1em;
  color: #888;
  display: flex;
  align-items: center;
  padding: 0 4px;
  border-radius: 4px;
  transition: background 0.2s;
}
.collapse-btn:hover {
  background: #f0f0f0;
  color: #333;
}

.suggestion-box {
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  margin: 5px 0;
  width: 200px;
  font-size: 0.85em;
  padding: 5px;
  flex-shrink: 0;
  /* background-color: #f9f9f9; */ /* Removed grey background */
}

/* 1) Header flex layout & spacing */
.suggested-problems-header {
  display: flex;
  align-items: center;
  justify-content: flex-start; /* caret + text stay on the left */
  gap: 8px;                    /* space between caret and label */
  width: 100%;                 /* span full container */
  margin-bottom: 0.5rem;
}

/* 2) Push reload button to the far right */
.suggested-problems-header .magic-brush-btn {
  margin-left: auto;
}

/* 3) Collapsed panel tweaks (row-layout, hide items, spacing, style) */
#problemlistSuggestions.collapsed {
  display: flex !important;            /* ensure flex container */
  flex-direction: row !important;      /* horizontal layout */
  justify-content: flex-start !important;
  padding: 1.6rem 1rem 1.75rem 1rem !important; /* restore top padding */
  color: grey;
  opacity: 0.5;
}

/* 4) Hide the suggestion cards when it's collapsed */
#problemlistSuggestions.collapsed #suggestionsRow {
  display: none !important;
}
/* Problem Table Section */
.table-section {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  background-color: #fff;
  border: 1px solid #e1e1e1;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 2rem;
  font-size: 0.85em;
  box-sizing: border-box;
  position: relative;
}
#problemTable {
  border-collapse: collapse;
  width: auto;
  table-layout: auto;
}
#problemTable tr {
  vertical-align: top;
  text-align: left;
}
#problemTable td {
  position: relative;
  padding: 0.75rem;
  width: 400px;
  min-width: 400px;
  max-width: none;
  border: none;
  border-right: 1px solid #f0f0f0;
}
#problemTable td div.contenteditable-input {
  width: 100%;
  min-height: 100px;
  height: auto;
  background-color: transparent;
  border: none;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
  resize: vertical;
  outline: none;
  display: block;
  box-sizing: border-box;
  /* border-bottom: 1.0px dotted #e1e1e1; */
}
#problemTable tr:first-child td div.contenteditable-input {
  font-weight: bold;
  min-height: 2.5em;
  resize: vertical;
}
#problemTable td:empty:not(.trash-icon-cell)::before {
  content: attr(data-placeholder);
  color: #aaa;
}
#problemTable tr td:last-child {
  border-right: none;
}

/* Problem Toolbar */
.problem-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  margin-top: -5px;
  position: sticky;
  left: 0;
  right: 0;
  background: #fff;
  z-index: 2;
  padding-right: 0;
}
.add-problem-btn {
  padding: 0.5rem 1rem;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background-color 0.2s;
}
.add-problem-btn:hover {
  background-color: #f7f7f7;
}
.problem-actions {
  display: flex; /* Standardized to flex */
  gap: 8px;
  align-items: center;
  position: sticky;
  right: 0;
  background: #fff;
  z-index: 2;
  padding: 4px 0; /* Standardized vertical padding */
}
.problem-btn {
  display: flex; /* Standardized to flex */
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  opacity: 0.8;
  border: none;
  border-radius: 4px; /* Standardized to match toolbar-btn */
  background-color: #e6e6e6;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1); /* Added to match toolbar-btn */
  transition: background-color 0.2s;
}
.problem-btn:hover {
  background-color: #d4d4d4;
}
.problem-btn img {
  width: 18px;
  height: 18px;
}

/* AP Controls */
.ap-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid #ccc;
  opacity: 0.8;
  border-radius: 4px;
  background-color: #f9f9f9;
  cursor: pointer;
  margin-right: 8px;
  transition: background-color 0.2s;
}
.icon-button:hover {
  background-color: #eaeaea;
}
.icon-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.trash-button {
  background-color: #fef1dc;
  border-color: #f9ce8f;
  margin-right: 0;
}
.trash-button:hover {
  background-color: #fde0b8;
}
.trash-button img {
  width: 18px;
  height: 18px;
}

/* Footer Buttons */
.button-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  width: 100%;
}
.button-row-left {
  display: flex;
  gap: 0.4rem;
}
#clearAllBtn,
#exportBtn,
#aiSuggestBtn {
  display: inline-block;
  padding: 0.28rem 0.7rem;
  margin: 0;
  border: 1px solid #e0e0e0;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 500;
  background-color: #f7fafd;
  color: #333;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: all 0.16s cubic-bezier(.4,0,.2,1);
  min-width: 100px;
  min-height: 28px;
  vertical-align: middle;
}
#clearAllBtn:hover,
#exportBtn:hover,
#aiSuggestBtn:hover {
  background-color: #e9f1fa;
  color: #111;
  border-color: #b3b3b3;
}
#clearAllBtn {
  color: #b23c3c;
  border-color: #f3d6d6;
  background: #f9f6f6;
}
#clearAllBtn:hover {
  background: #fbeaea;
  color: #a11a1a;
  border-color: #e0bcbc;
}
#exportBtn {
  color: #1b7e5a;
  border-color: #d2f2e3;
  background: #f6fbf9;
}
#exportBtn:hover {
  background: #e6f7ef;
  color: #146c4a;
  border-color: #b7e5d1;
}
#aiSuggestBtn {
  color: #2a5d9f;
  border-color: #dbeafe;
  background: #f7fafd;
}
#aiSuggestBtn:hover {
  background: #e9f1fa;
  color: #1a3d6f;
  border-color: #b3c7e6;
}

#aiSuggestBtn:disabled,
#aiSuggestBtn:disabled:hover {
  background-color: #e9eff5; /* Dull background */
  color: #8c9bab;           /* Muted text color */
  border-color: #c9d3dd;     /* Muted border color */
  cursor: not-allowed;
  opacity: 0.75;
  box-shadow: none;           /* Remove shadow */
  transition: none;           /* No transitions when disabled */
}

/* Footer */
footer {
  margin-top: 1.5rem;
  text-align: center;
  margin-bottom: 1rem;
}
footer a {
  text-decoration: none;
  color: #555;
  transition: color 0.2s;
}
footer a:hover {
  color: #111;
}

/* Start of Selection */
.footer-quote {
  font-size: .8em;
  color: grey;
  opacity: 0.5;
  font-family: 'Cinzel', serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  margin-top: -.5em;
  transition: color 0.5s ease;
}

.footer-quote:hover {
  color: rgb(53, 60, 90);
}
/* End of Selection */

.quote-container {
  text-align: center;
  padding: 5px 0;
  margin-bottom: 0.5rem;
}

/* AI Sidebar */
.ai-sidebar {
  position: fixed;
  top: 0;
  right: -500px;
  width: 500px;
  height: 100vh;
  background-color: #fff;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.ai-sidebar.visible {
  right: 0;
}

.ai-sidebar-close {
  cursor: pointer;
  position: absolute;
  top: 15px;
  right: 15px;
}

.ai-sidebar-header {
  padding: 15px 35px;
  background-color: #f0f0f0;
  border-bottom: 1px solid #ddd;
  font-weight: bold;
  display: flex; /* Added to allow easy spacing of children */
  justify-content: space-between; /* Pushes title to left, buttons to right */
  align-items: center; /* Vertically align items */
}

.ai-sidebar-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.ai-sidebar-body.loading {
  opacity: 0.7;
  pointer-events: none;
}

.ai-sidebar-tab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 62px;
  height: 62px;
  background-color: #e9f1fa;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  z-index: 999;
  border: 1px solid #dbeafe;
  transition: transform 0.2s ease-in-out;
}
.ai-sidebar-tab:hover {
  transform: scale(1.15);
}
.ai-sidebar-tab img {
  width: 56px;
  height: 56px;
}

/* AI Chat specific styles */
.ai-chat-sidebar {
  right: -500px;
}

.ai-chat-tab {
  bottom: 90px;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.ai-chat-message {
  padding: 12px 15px;
  border-radius: 18px;
  max-width: 80%;
  word-wrap: break-word;
  font-size: 0.8em;
}

/* Chat bubbles: more neutral, modern look */
.ai-chat-user-message {
  align-self: flex-end;
  background-color: #e9f1fa;
  border-bottom-right-radius: 10px;
  border-radius: 18px 18px 10px 18px;
  color: #222;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  /* font-size: .8em; */
  padding: 14px 18px;
  display: table;
}
.ai-chat-ai-message {
  align-self: flex-start;
  background-color: #f6f7f9;
  border-bottom-left-radius: 10px;
  border-radius: 18px 18px 18px 10px;
  color: #222;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  /* font-size: .8em; */
  padding: 14px 18px;
  display: table;
}

/* Markdown content styling */
.markdown-content {
  line-height: 1.5;
}

.markdown-content h1, 
.markdown-content h2, 
.markdown-content h3, 
.markdown-content h4, 
.markdown-content h5, 
.markdown-content h6 {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}
.markdown-content h3 {
  font-size: 1.1em;
}

.markdown-content p {
  margin-top: 0;
  margin-bottom: 0.75em;
}

.markdown-content ul, 
.markdown-content ol {
  margin-top: 0;
  margin-bottom: 0.75em;
  padding-left: 1.5em;
}

.markdown-content li {
  margin-bottom: 0.25em;
}

.markdown-content a {
  color: #0366d6;
  text-decoration: none;
}

.markdown-content a:hover {
  text-decoration: underline;
}

.markdown-content code {
  font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  padding: 0.2em 0.4em;
  background-color: rgba(27, 31, 35, 0.05);
  border-radius: 3px;
  font-size: 85%;
}

.markdown-content pre {
  font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  padding: 0.8em;
  overflow: auto;
  font-size: 85%;
  line-height: 1.45;
  background-color: #f6f8fa;
  border-radius: 3px;
  margin-top: 0;
  margin-bottom: 1em;
}

.markdown-content pre code {
  background: transparent;
  padding: 0;
}

.ai-chat-input-container {
  display: flex;
  padding: 15px;
  border-top: 1px solid #eee;
  gap: 10px;
  flex-direction: column; /* Make the main container a column */
}

/* NEW: Style for the row containing input and send button */
.ai-chat-input-row {
    display: flex;
    gap: 10px;
    width: 100%; /* Ensure it takes full width */
}

.ai-chat-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  margin: 5px 0;
  width: 200px;
  font-size: 0.85em;
  padding: 5px;
  flex-shrink: 0;
  font-family: 'Inter', sans-serif;
}

.ai-chat-send-btn {
  background-color: transparent;
  border: none;
  border-radius: 0;
  width: auto;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: filter 0.2s ease-in-out;
  padding: 0px; /* Control icon size/padding */
  margin-left: 4px;
}

.ai-chat-send-btn:hover {
  filter: brightness(85%);
}

.ai-chat-send-btn img {
  width: 54px;
  height: 54px;
}

/* NEW: Styles for Sample Questions */
#aiChatSampleQuestionsContainer {
    display: flex;
    gap: 8px;
    margin-bottom: 10px; /* Space below the buttons */
    flex-wrap: wrap; /* Allow buttons to wrap if space is tight */
}

.sample-chat-btn {
    padding: 8px 12px;
    border: 1px solid #a0d8a0; /* Lighter green border */
    border-radius: 15px; /* More rounded */
    background-color: #c8e6c9; /* Light green background */
    color: #1b5e20; /* Dark green text */
    font-size: 0.78rem; /* Slightly smaller font */
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, opacity 0.2s;
    opacity: 0.7; /* Decreased opacity */
}

.sample-chat-btn:hover {
    background-color: #a5d6a7; /* Slightly darker green on hover */
    border-color: #81c784; /* Darker border on hover */
    opacity: 0.9; /* Adjusted hover opacity to be less than 1 but more than normal state */
}

/* Inline spinner */
.inline-spinner {
  width: 20px;
  height: 20px;
  display: inline-block;
}

/* Freeform suggestions div */
#freeformSuggestionsDiv {
  font-style: italic;
  color: rgb(94, 147, 167);
  /* background-color: rgba(247, 247, 247, 0.9); */
  border-radius: 4px;
  padding: 0.5rem;
  font-size: 0.8rem;
}

.phi-warning {
  font-size: 0.75rem;
  color: darkred;
  text-align: left;
  padding-top: 5px;
  opacity: 0.5;
  transition: opacity 0.5s ease;
}

.phi-warning:hover {
  opacity: 0.75;
}


/* Magic brush style for problem list refine */
.magic-brush-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background-color: rgb(139, 222, 254);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: background-color 0.2s;
  position: relative;
  opacity: 0.8;
}
.magic-brush-btn img {
  width: 18px;
  height: 18px;
}
.magic-brush-btn:hover {
  background-color: skyblue;
}
.magic-brush-tooltip {
  display: none;
  position: absolute;
  background-color: #000;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  top: 50%;
  right: 105%;
  transform: translateY(-50%);
  white-space: nowrap;
  z-index: 999;
}
.magic-brush-btn:hover .magic-brush-tooltip {
  display: block;
}

/* Loading overlay & spinner */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1003; /* Higher than demo overlay (1000) and demo tooltip (1002) */
}
.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* App Title and Subtitle */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: -1em; /* Adjust as needed for spacing with title */
}

.title-container {
  text-align: center;
}

.app-title {
  margin-top: -0.8em;
  font-family: 'Carattere', serif;
  font-size: 2.5rem;
  cursor: default;
}
.app-subtitle {
  font-size: 0.85rem;
  padding-right: 0;
  margin-top: 0;
  color: grey;
  cursor: default;
  text-align: right;
  opacity: 0.7;
}
.subtitle-link {
  cursor: pointer;
  color: grey;
  transition: color 0.2s;
  padding: 0 10px;
  border-radius: 6px;
  font-weight: 500;
  text-decoration: none;
}
.subtitle-link.overview:hover {
  color: teal;
  background: #e9f1fa;
}
.subtitle-link.faq:hover {
  color: lightcoral;
  background: #fbeaea;
}
.subtitle-link.feedback:hover {
  color: goldenrod;
  background: #fffbe6;
}

/* Intro Popup Styles */
#introPopup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 60vw;
  max-width: 60vw;
  height: 70vh;
  background: #fff;
  box-shadow: 0px 4px 24px rgba(0, 0, 0, 0.18);
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  z-index: 1002;
  opacity: 0;
  transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
  display: flex;
  flex-direction: column;
}
#introPopup.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
#introPopupHeader {
  background: #e9f1fa;
  color: #222;
  padding: 18px 24px 18px 24px;
  font-size: 1.2rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#introPopupCloseBtn {
  border: none;
  background: transparent;
  color: #888;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}
#introPopupCloseBtn:hover {
  background: #f0f0f0;
  color: #222;
}
#introPopup iframe {
  width: 100%;
  height: 60%;
  border: none;
  display: block;
}
#welcomeMessage {
  padding: 20px 24px;
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
#welcomeMessage h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #222;
  margin-bottom: 12px;
}
#welcomeMessage p {
  font-size: 1rem;
  color: #666;
  margin-bottom: 8px;
  line-height: 1.5;
}
#introPopupNextBtn {
  margin: 16px 24px 24px 24px;
  padding: 12px 24px;
  background: #4a90e2;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}
#introPopupNextBtn:hover {
  background: #357abd;
}
#introOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1001;
}

/* Mobile Popup Styles */
#mobilePopup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 70vw;
  max-width: 70vw;
  height: 70vh;
  background: #fff;
  box-shadow: 0px 4px 24px rgba(0, 0, 0, 0.18);
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  z-index: 1002;
  opacity: 0;
  transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
  display: flex;
  flex-direction: column;
}
#mobilePopup.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
#mobilePopupHeader {
  background: #e9f1fa;
  color: #222;
  padding: 18px 24px 18px 24px;
  font-size: 1.2rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#mobilePopupCloseBtn {
  border: none;
  background: transparent;
  color: #888;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}
#mobilePopupCloseBtn:hover {
  background: #f0f0f0;
  color: #222;
}
#mobilePopupMessage {
  padding: 16px 24px;
  font-size: 1rem;
}
#mobilePopup iframe {
  width: 100%;
  height: 100%;
  border: none;
  flex: 1;
  display: block;
}
#mobileOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1001;
}

.ai-suggestion-box {
  border: 1px solid #e0e7ef;
  border-radius: 12px;
  background-color: #f6f7fa;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  cursor: pointer;
  margin: 8px 0;
  min-width: 220px;
  width: auto;
  font-size: 1em;
  line-height: 1.5;
  padding: 14px 18px 10px 18px;
  transition: box-shadow 0.16s, background 0.16s;
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}
.ai-suggestion-box:hover {
  background: #e9f1fa;
  box-shadow: 0 4px 16px rgba(0,0,0,0.09);
}
.ai-suggestion-action-text {
  font-size: 1.04em;
  font-weight: 500;
  color: #2a5d9f;
  margin-bottom: 0.2em;
}

footer {
  padding-bottom: 20px;
  font-size: 0.8em;
}

.ai-sidebar-clear-chat-btn {
  /* width: 80px; */
  height: 25px;
  cursor: pointer;
  margin-left: auto; /* Push it to the right, before the X */
  margin-right: 5%;
  transition: opacity 0.2s ease;
}

.ai-sidebar-clear-chat-btn:hover {
  opacity: 0.7;
}

/* Styles for contenteditable divs to emulate placeholders */
.contenteditable-input:empty:before {
    content: attr(aria-placeholder);
    color: #aaa;
    display: inline-block; /* Or block, depending on desired layout */
    pointer-events: none; /* Important to allow click-through for focusing */
}

/* Style for the autocomplete suggestion span */
.autocomplete-suggestion {
    color: lightgrey;
    /* Optionally, add other styles like a subtle background or italic font */
}

/* Header toggles container */
.header-toggles {
  display: flex;
  gap: 20px;
  align-items: center;
}

/* Toggle for enabling/disabling autocomplete */
.autocomplete-toggle {
  display: inline-flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.autocomplete-toggle:hover {
  opacity: 1.0;
}

/* Toggle for enabling/disabling full width */
.fullwidth-toggle {
  display: inline-flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.fullwidth-toggle:hover {
  opacity: 1.0;
}

/* iOS-style Toggle Switch */
.ios-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.ios-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.ios-toggle-slider {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px; /* Reduced from 24px */
  background-color: #e4e4e4;
  border-radius: 20px; /* Adjusted to match new height */
  transition: all 0.3s ease;
  margin-right: 8px;
}

.ios-toggle-slider:before {
  content: "";
  position: absolute;
  height: 16px; /* Reduced from 20px */
  width: 16px;  /* Reduced from 20px */
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.ios-toggle input:checked + .ios-toggle-slider {
  background-color: #34c759;
}

.ios-toggle input:checked + .ios-toggle-slider:before {
  transform: translateX(20px);
}

.ios-toggle-label {
  font-size: 13px;
  color: grey;
  font-weight: 500;
}

.ios-toggle:hover .ios-toggle-slider:before {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Style for <ACTION> buttons rendered in chat */
.apply-edit-btn {
  margin: 0 4px;
  padding: 4px 12px;
  margin-bottom: 20px;
  border: none;
  border-radius: 16px;
  background-color: #48aaff;
  color: white;
  cursor: pointer;
  font-size: 0.85rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s, transform 0.2s;
}

.apply-edit-btn:hover {
  background-color: #64bcff;
  transform: translateY(-1px);
}

.apply-edit-btn.loading {
  background-color: #a8d4ff;
}

.apply-edit-btn.applied {
  background-color: #4cd964;
}

/* Demo Walkthrough Styles */
#demoOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.demo-highlight {
  position: relative;
  z-index: 1002;
  box-shadow: 0 0 0 3px #ff9800;
}

/* Special handling for fixed-position elements */
.demo-highlight.ai-sidebar-tab {
  position: fixed !important;
}

#demoTooltip {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  padding: 20px 24px;
  border-radius: 12px;
  z-index: 1002;
  max-width: 70vw;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  text-align: center;
  border: 1px solid #e1e8f0;
}

#demoTooltip p {
  margin: 0 0 16px 0;
  font-size: 1rem;
  line-height: 1.5;
  color: #333;
}

.demo-nav {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

#demoTooltip button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  min-width: 80px;
}

#demoPrev {
  background: #f8f9fa;
  color: #666;
  border: 1px solid #e1e8f0;
}

#demoPrev:hover:not(:disabled) {
  background: #e9ecef;
  color: #333;
}

#demoPrev:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#demoNext {
  background: #4a90e2;
  color: white;
}

#demoNext:hover {
  background: #357abd;
  transform: translateY(-1px);
}

#demoClose {
  background: transparent;
  color: #888;
  border: 1px solid #ddd;
}

#demoClose:hover {
  background: #f8f9fa;
  color: #333;
}
