/* 
 * Freeform Prompt Pills - Inline Editable Version
 * Direct pill editing with TAB navigation
 */

/* Container adaptation */
.message-input-container.freeform-prompt-mode {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(9, 11, 18, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 12px 32px rgba(8, 12, 24, 0.35);
}

/* Dark blue background for prompt pills container */
.message-input-container.freeform-prompt-mode .freeform-prompt-shell {
  background: rgba(30, 58, 138, 0.3);
  border-radius: 12px;
  padding: 8px;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.message-input-container.freeform-prompt-mode .plus-menu-container {
  order: 1;
  align-self: center;
  display: flex;
  align-items: center;
  margin-bottom: 0;
  max-width: 32px !important; /* Limit plus button width */
  max-height: 32px !important; /* Limit plus button height */
}

.message-input-container.freeform-prompt-mode .message-input {
  order: 2;
  flex: 1 1 auto;
  min-width: 0; /* allow shrinking without overlapping */
}

.message-input-container.freeform-prompt-mode .freeform-prompt-shell {
  order: 3;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  gap: 8px;
  flex-wrap: wrap;
}

/* Desktop: dynamic space via CSS variables (defaults 60/40, can be overridden) */
@media (min-width: 769px) {
  .message-input-container.freeform-prompt-mode {
    --pills-width: 60%;
    --input-width: 40%;
  }
  .message-input-container.freeform-prompt-mode .message-input {
    flex: 0 1 var(--input-width);
  }
  .message-input-container.freeform-prompt-mode .freeform-prompt-shell {
    flex: 0 1 var(--pills-width);
  }
}

/* Hide the textarea */
/* Keep natural textarea visible for natural prompting */
.message-input-container.freeform-prompt-mode .message-input {
  display: block !important;
}

/* Pills builder - horizontal row, more compact */
.message-input-container.freeform-prompt-mode .freeform-prompt-builder {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  flex-wrap: wrap;
}

.freeform-prompt-builder .freeform-prompt-track {
  display: flex;
  align-items: flex-start; /* align to top to prevent pushing down ADD CUES */
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
  overflow-y: visible; /* Prevent vertical clipping of hover shadows */
  min-height: 32px; /* ensure minimum height for ADD CUES button */
  padding-right: 80px; /* reserve space for ADD CUES button - tighter */
  box-sizing: border-box;
}

/* Prompt tools container (right side of pills) */
.freeform-prompt-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
}

.freeform-prompt-tool {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 35, 50, 0.6);
  color: #e5e7eb;
  border-radius: 6px;
  padding: 4px 6px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.freeform-prompt-tool:hover {
  background: rgba(40, 45, 60, 0.9);
  border-color: rgba(148, 163, 184, 0.4);
}

.freeform-prompt-tool:active {
  transform: translateY(1px);
}

.freeform-prompt-tool .icon {
  width: 14px;
  height: 14px;
  display: block;
}

/* Lasso dedicated styling */
.freeform-prompt-lasso-btn {
  min-width: 24px;
}

.freeform-prompt-lasso-btn.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.85), rgba(29, 78, 216, 0.85));
  border-color: rgba(37, 99, 235, 0.8);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

/* Desktop: allow pills to expand wider when space is available */
@media (min-width: 769px) {
  .freeform-prompt-pill {
    flex-grow: 1; /* Allow pills to grow to fill available space */
    max-width: 400px; /* Reasonable max width for desktop */
  }
  
  /* Allow longer text in inputs on desktop */
  .freeform-pill-input {
    max-width: none; /* No width limit on desktop */
  }
}

/* Mobile: horizontal scrolling for pills */
@media (max-width: 768px) {
  .freeform-prompt-builder .freeform-prompt-track {
    flex-wrap: nowrap; /* Force single row on mobile */
    overflow-x: auto; /* Enable horizontal scrolling */
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
    padding-bottom: 4px; /* Space for scrollbar */
    touch-action: pan-x; /* Allow horizontal scrolling only */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  }
  
  .freeform-prompt-track::-webkit-scrollbar {
    height: 4px;
  }
  
  .freeform-prompt-track::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .freeform-prompt-track::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 2px;
  }
  
  .freeform-prompt-track::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
  }
  
  /* Ensure pills don't shrink on mobile */
  .freeform-prompt-pill {
    flex-shrink: 0; /* Prevent pills from shrinking */
    min-width: fit-content;
  }
}

/* Individual pill - compact inline style, 20% smaller - DEFAULT DARK GREY */
.freeform-prompt-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between; /* Push X button to the right edge */
  gap: 2.1px; /* +5% */
  padding: 4.2px 5.25px; /* +5% */
  border-radius: 11.55px; /* +5% */
  background: rgba(30, 35, 50, 1) !important; /* Dark grey FULLY OPAQUE - FORCE DEFAULT */
  border: 1px solid rgba(148, 163, 184, 0.5) !important; /* Light grey outline - FORCE DEFAULT */
  box-shadow: 0 1px 4px rgba(8, 12, 24, 0.2) !important;
  transition: all 0.5s ease-in-out; /* Smooth 0.5s transition */
  flex-shrink: 0; /* Don't shrink */
  flex-grow: 0; /* DON'T expand - stay natural width */
  max-width: none;
  width: fit-content; /* Natural width based on content */
  min-width: fit-content; /* Minimum width based on content */
  opacity: 1;
  min-height: 23.1px; /* +5% */
  top: 2px; /* Nudge pills down for vertical alignment */
  overflow: visible; /* Avoid trimming inner content by the capsule mask */
}

/* Accessory assistant pill */
.freeform-prompt-pill.assistant-accessory {
  background: rgba(30, 58, 138, 0.8) !important;
  border: 1px solid rgba(59, 130, 246, 0.4) !important;
  cursor: pointer;
  transition: all 0.3s ease;
}
.freeform-prompt-pill.assistant-accessory:hover {
  background: rgba(30, 58, 138, 0.95) !important;
  border-color: rgba(59, 130, 246, 0.8) !important;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.6), 0 0 40px rgba(59, 130, 246, 0.3);
  transform: scale(1.05);
}
.freeform-prompt-pill .freeform-pill-add {
  appearance: none;
  -webkit-appearance: none;
  border: 0.5px solid rgba(148, 163, 184, 0.3);
  background: rgba(148, 163, 184, 0.2);
  color: #e5e7eb;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
}
.freeform-prompt-pill .freeform-pill-add:hover {
  background: rgba(148, 163, 184, 0.35);
}

/* REMOVED - No automatic pill expansion */
/* Pills now size based on content only via JavaScript auto-resize */

/* Inactive pills - slightly dimmed when another is being edited */
.freeform-prompt-pill.freeform-pill-inactive {
  opacity: 0.6;
}

.freeform-prompt-pill.freeform-pill-inactive .freeform-pill-label-inline {
  font-size: 7px;
}

.freeform-prompt-pill.freeform-pill-inactive .freeform-pill-input {
  font-size: 8px; /* 20% smaller */
}

.freeform-prompt-pill:hover {
  transform: translateY(-1px);
  background: rgba(40, 45, 60, 1) !important; /* Slightly lighter on hover - FULLY OPAQUE */
  border-color: rgba(148, 163, 184, 0.7) !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4), 0 4px 12px rgba(59, 130, 246, 0.3) !important; /* Visible blue glow */
  transition: all 0.3s ease-in-out;
}

/* Red glow when hovering over remove button */
.freeform-prompt-pill:has(.freeform-pill-remove:hover) {
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.5), 0 4px 16px rgba(239, 68, 68, 0.4) !important; /* Red glow */
  border-color: rgba(239, 68, 68, 0.6) !important;
}

/* Empty pills - maintain default dark grey state */
.freeform-prompt-pill.freeform-pill-empty {
  background: rgba(30, 35, 50, 0.5) !important; /* Ensure dark grey default */
  border: 1px dashed rgba(148, 163, 184, 0.3) !important; /* Light grey dashed outline */
  transition: all 0.5s ease-in-out;
  flex-grow: 0 !important; /* Don't expand empty pills */
  flex-shrink: 0 !important; /* Don't shrink either */
  flex-basis: auto !important; /* Auto basis, no flex distribution */
  max-width: 80px !important; /* TIGHTER max width - 80px max */
  width: fit-content !important; /* Fit to actual content */
  padding: 4px 5px !important; /* Even tighter padding */
}

/* Empty pill content wrapper - minimize */
.freeform-prompt-pill.freeform-pill-empty .freeform-pill-content {
  gap: 2px !important; /* Minimal gap */
  flex: 0 0 auto !important; /* Don't grow */
}

/* Empty pill label - keep compact */
.freeform-prompt-pill.freeform-pill-empty .freeform-pill-label-inline {
  padding-right: 1px !important; /* Minimal padding */
}

/* Empty pill input - hide completely when not editing */
.freeform-prompt-pill.freeform-pill-empty:not(.freeform-pill-editing-active) .freeform-pill-input {
  flex: 0 0 auto !important; /* Don't grow or shrink, auto width */
  min-width: 0 !important; /* No width */
  max-width: 0 !important; /* No width */
  width: 0 !important; /* No width */
  overflow: hidden !important; /* Hide any overflow */
  text-overflow: clip !important; /* No ellipsis for empty */
  padding: 0 !important; /* No padding */
  opacity: 0 !important; /* Completely hidden */
  font-size: 0 !important; /* No font size */
}

.freeform-prompt-pill.freeform-pill-empty:hover {
  background: rgba(40, 45, 60, 0.7) !important;
  border-color: rgba(148, 163, 184, 0.5) !important;
  transition: all 0.5s ease-in-out;
}

/* REMOVED - No blue overrides, keep default dark grey for all pills */

/* Active editing pill - dark blue highlight (only when actively focused) */
.freeform-prompt-pill.freeform-pill-editing-active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.9), rgba(29, 78, 216, 0.9)) !important;
  border: 1px solid rgba(37, 99, 235, 0.8) !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.4), 0 4px 12px rgba(29, 78, 216, 0.3);
}

/* Text selection in orange active pill - light grey background, dark grey text */
.freeform-prompt-pill.freeform-pill-editing-active .freeform-pill-input::selection {
  background: rgba(226, 232, 240, 0.9);
  color: rgba(51, 65, 85, 1);
}

.freeform-prompt-pill.freeform-pill-editing-active .freeform-pill-input::-moz-selection {
  background: rgba(226, 232, 240, 0.9);
  color: rgba(51, 65, 85, 1);
}

/* Wrapper for label and input to keep them together on the left */
.freeform-pill-content {
  display: flex;
  align-items: center;
  gap: 3px; /* Reduced gap between label and input */
  flex: 1; /* Take up available space */
  min-width: 0; /* Allow shrinking */
}

/* Inline label - compact, 20% smaller, draggable */
.freeform-pill-label-inline {
  font-size: 8.4px; /* +5% */
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.21px; /* +5% */
  opacity: 1; /* Fully opaque text */
  color: #ffffff; /* Pure white text */
  flex-shrink: 0;
  white-space: nowrap;
  display: flex;
  align-items: center; /* Vertically center label text */
  height: 14.7px; /* +5% */
  user-select: none; /* Non-selectable */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  cursor: grab; /* Hand icon for dragging */
  padding-right: 2.1px; /* +5% */
  margin-left: 2.1px; /* +5% */
}

/* Pill title styling - light blue */
.pill-title {
  color: rgba(96, 165, 250, 0.9) !important; /* Light blue */
  font-weight: 700;
}

/* Pill content styling - white */
.pill-content {
  color: #ffffff !important; /* Pure white */
  font-weight: 500;
}

.freeform-pill-label-inline:active {
  cursor: grabbing; /* Grabbing cursor when dragging */
}

/* Inline input - adaptive width, 20% smaller */
.freeform-pill-input {
  border: none;
  outline: none;
  background: transparent;
  color: #ffffff;
  font-size: 7.35px; /* +5% */
  font-weight: 500;
  padding: 0;
  margin: 0;
  flex: 1; /* Take remaining space in content wrapper */
  min-width: 0; /* Allow shrinking to zero when collapsed */
  max-width: none; /* Allow expansion beyond default limits */
  font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  resize: none;
  overflow: hidden;
  line-height: 1.26; /* +5% */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  text-overflow: ellipsis;
  display: flex;
  align-items: center; /* Vertically center text */
  justify-content: flex-start; /* Align text to left */
  min-height: 14.7px; /* +5% */
  height: 14.7px; /* +5% */
  vertical-align: middle; /* Extra centering */
}

/* Collapsed state uses input (not textarea): force perfect single-line centering */
.freeform-pill-input:not([data-key]) {
  line-height: 18px !important; /* Match element height */
  height: 18px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  display: inline-block !important; /* Inputs center via line-height, not flex */
}

/* When textarea (vs input), allow proper text wrapping */
.freeform-pill-input[data-key] {
  /* Textarea-specific styles when needed */
  resize: none;
  overflow-y: auto;
  white-space: normal !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.3 !important; /* Comfortable line height for readability */
  padding: 2px 0 !important; /* Small padding for better vertical centering */
  max-width: none !important; /* Allow expansion beyond default max */
  max-height: none !important; /* Allow height expansion */
  display: flex !important; /* Flex for perfect vertical centering */
  align-items: center !important; /* Center text vertically */
  transition: width 0.18s ease, height 0.18s ease, line-height 0.18s ease, padding 0.18s ease;
  will-change: width, height, line-height, padding;
}

/* Collapsed textarea state: keep single-line vertical centering when not editing */
.freeform-prompt-pill:not(.freeform-pill-editing-active) .freeform-pill-input[data-key] {
  line-height: 18px !important;
  padding: 0 !important;
}

/* Hide input text completely - pills are read-only, editing only through menu */
.freeform-pill-input {
  width: 0 !important;
  max-width: 0 !important;
  min-width: 0 !important;
  opacity: 0 !important;
  overflow: hidden !important;
  font-size: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  position: absolute !important;
  left: -9999px !important; /* Move off-screen to prevent any interaction */
  pointer-events: none !important; /* Disable all interaction */
  user-select: none !important; /* Disable text selection */
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  cursor: default !important; /* No text cursor */
  background: transparent !important;
  border: none !important;
  outline: none !important;
}

/* Keep layout stable while editing: no wrapping */
.freeform-prompt-builder .freeform-prompt-track.editing-active {
  flex-wrap: wrap; /* Allow multiple lines on desktop while editing */
  overflow-x: hidden; /* No horizontal scroll on desktop */
  overflow-y: visible; /* Allow hover elevate and shadows */
}

/* Allow horizontal scroll only on mobile when editing */
@media (max-width: 768px) {
  .freeform-prompt-builder .freeform-prompt-track.editing-active {
    flex-wrap: nowrap; /* Single row on mobile */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    overflow-y: hidden; /* Mobile keeps compact vertical layout */
  }
}

/* No editing states needed - pills are always read-only */

.freeform-pill-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
  font-style: italic;
  font-weight: 400;
  font-size: 7px; /* Smaller placeholder text */
}

.freeform-pill-input:focus {
  outline: none;
  color: #ffffff;
}

/* Empty pill input styling */
.freeform-pill-empty .freeform-pill-label-inline {
  color: rgba(203, 213, 225, 1); /* Fully opaque */
}

.freeform-pill-empty .freeform-pill-input {
  color: rgba(203, 213, 225, 1); /* Fully opaque */
}

.freeform-pill-empty .freeform-pill-input::placeholder {
  color: rgba(203, 213, 225, 0.7); /* Slightly transparent placeholder is okay */
}

/* Remove button - compact */
.freeform-pill-remove {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.freeform-pill-remove:hover {
  background: rgba(239, 68, 68, 0.8);
  color: rgba(255, 255, 255, 1);
  transform: scale(1.15);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

/* Ghost pills (hidden, can be added back) */
.freeform-pill-ghost {
  background: transparent;
  border: 1px dashed rgba(148, 163, 184, 0.25);
}

.freeform-pill-ghost .freeform-pill-main {
  background: transparent;
  border: 1px dashed rgba(148, 163, 184, 0.25);
  color: rgba(148, 163, 184, 0.7);
  font-weight: 500;
}

.freeform-pill-ghost:hover .freeform-pill-main {
  border-color: rgba(148, 163, 184, 0.5);
  color: rgba(203, 213, 225, 0.9);
  background: rgba(148, 163, 184, 0.1);
}

/* Send button positioning */
.message-input-container.freeform-prompt-mode .send-button {
  order: 5;
  align-self: center;
  margin-left: auto;
  flex-shrink: 0;
}

/* Ensure the assistant accessory pill sits at the far right before the send button */
.message-input-container.freeform-prompt-mode .freeform-prompt-shell .freeform-prompt-builder {
  width: 100%;
  display: flex;
  position: relative; /* enable absolute positioning for ADD CUES button */
}
.message-input-container.freeform-prompt-mode .freeform-prompt-track {
  flex: 1 1 auto;
}
.message-input-container.freeform-prompt-mode .freeform-prompt-track .assistant-accessory {
  position: absolute; /* position absolutely in reserved space */
  right: 8px; /* position with small margin from edge */
  top: 50%; /* center vertically */
  transform: translateY(-50%); /* center vertically */
  z-index: 10; /* ensure it stays on top */
  flex-shrink: 0; /* prevent shrinking */
}

/* Hide command pills only when explicitly requested */
.message-input-container.freeform-hide-commands .command-pills-container {
  display: none !important;
}

/* Hide preview element */
.freeform-prompt-preview {
  display: none !important;
}

/* Template Menu - Floating pill selector */
.freeform-template-menu {
  position: fixed;
  min-width: 224px; /* 20% smaller: 280px * 0.8 */
  max-width: 320px; /* 20% smaller: 400px * 0.8 */
  background: rgba(71, 85, 105, 0.4);
  /* reduce blur to ease GPU cost during menu animations */
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 16px; /* 20% smaller: 20px * 0.8 */
  padding: 10px; /* 20% smaller: 12px * 0.8 */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 100000 !important; /* Force above everything */
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              top 0.15s ease-out,
              left 0.15s ease-out;
  pointer-events: none;
  will-change: top, left; /* Optimize for smooth repositioning */
}

.freeform-template-menu.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header for suggestions */
.freeform-template-header {
  font-size: 8px; /* 20% smaller: 10px * 0.8 */
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px; /* 20% smaller: 0.8px * 0.8 */
  color: rgba(71, 85, 105, 0.9);
  margin-bottom: 8px; /* 20% smaller: 10px * 0.8 */
  padding: 0 3px 0 8px; /* 20% smaller: 4px * 0.8, +5px left padding */
  font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.freeform-template-scroll {
  max-height: calc(6 * 32px + 5 * 6px); /* 6 items * min-height + 5 gaps (20% smaller) */
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px; /* 20% smaller: 7px * 0.8 */
  padding: 2px;
  padding-right: 5px; /* 20% smaller: 6px * 0.8 */
}

/* Only apply gradient mask to scroll containers that have custom input */
.freeform-template-scroll-with-custom {
  mask: linear-gradient(to bottom, black 0%, black 70%, transparent 100%);
  -webkit-mask: linear-gradient(to bottom, black 0%, black 70%, transparent 100%);
}

/* Custom scrollbar - minimal */
.freeform-template-scroll::-webkit-scrollbar {
  width: 4px;
}

.freeform-template-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.freeform-template-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 2px;
}

.freeform-template-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}

/* Template option pills - darker, more sophisticated */
.freeform-template-option {
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 13px; /* 20% smaller: 16px * 0.8 */
  color: rgba(241, 245, 249, 0.95);
  padding: 8px 11px; /* 20% smaller: 10px 14px * 0.8 */
  text-align: left;
  font-size: 11.5px; /* +15% from 10px */
  font-weight: 600; /* slightly stronger with size */
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.45; /* slight bump for readability */
  min-height: 34px; /* scale with font size */
  display: flex;
  align-items: center;
  font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  outline: none;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.freeform-template-option:hover {
  background: rgba(51, 65, 85, 0.85);
  border-color: rgba(148, 163, 184, 0.4);
  color: #ffffff;
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.freeform-template-option:active {
  transform: scale(0.98);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.8), rgba(37, 99, 235, 0.8));
  color: #ffffff;
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
}

/* Custom option styling - looks like normal preset but with input and tick */
.freeform-custom-option {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.3) !important;
  border: 1px solid rgba(148, 163, 184, 0.2) !important;
  font-weight: 600 !important;
  color: rgba(96, 165, 250, 0.95) !important;
  margin-top: 6px;
  border-radius: 16px;
  padding: 8px 11px;
  min-height: 32px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.freeform-custom-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-size: 11.5px; /* +15% */
  font-weight: 500;
  padding: 0;
  outline: none;
  font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-shadow: none;
  border-radius: 0;
}

.freeform-custom-input::placeholder {
  color: rgba(148, 163, 184, 0.5);
}

.freeform-custom-tick {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: rgba(96, 165, 250, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 50%;
  color: rgba(96, 165, 250, 0.8);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.freeform-custom-tick:hover {
  background: rgba(96, 165, 250, 0.3);
  border-color: rgba(96, 165, 250, 0.6);
  color: rgba(96, 165, 250, 1);
  transform: scale(1.1);
}

.freeform-custom-tick:active {
  background: rgba(96, 165, 250, 0.4);
  transform: scale(0.95);
}

.freeform-custom-option:hover {
  background: rgba(51, 65, 85, 0.9) !important;
  border-color: rgba(96, 165, 250, 0.6) !important;
  color: rgba(96, 165, 250, 1) !important;
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(96, 165, 250, 0.2);
}

/* Multi-select cue options */
.freeform-cue-option {
  background: rgba(30, 41, 59, 0.4) !important;
  border: 1px solid rgba(148, 163, 184, 0.15) !important;
  transition: all 0.2s ease;
}

.freeform-cue-option.selected {
  background: rgba(30, 41, 59, 0.85) !important;
  border-color: rgba(59, 130, 246, 0.6) !important;
  color: rgba(59, 130, 246, 1) !important;
  font-weight: 600 !important;
}

.freeform-cue-option:hover {
  background: rgba(30, 41, 59, 0.6) !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
}

.freeform-cue-option.selected:hover {
  background: rgba(30, 41, 59, 0.95) !important;
  border-color: rgba(59, 130, 246, 0.8) !important;
}

/* Apply button styling */
.freeform-apply-cues {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.8), rgba(37, 99, 235, 0.8)) !important;
  border: 1px solid rgba(59, 130, 246, 0.6) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  margin-top: 8px;
}

.freeform-apply-cues:hover {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.9), rgba(59, 130, 246, 0.9)) !important;
  border-color: rgba(59, 130, 246, 0.8) !important;
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .message-input-container.freeform-prompt-mode {
    padding: 8px;
    flex-direction: row; /* Keep plus and pills in same row */
    align-items: center; /* Center align items */
    gap: 8px;
  }

  /* Keep plus button aligned with pills */
  .message-input-container.freeform-prompt-mode .plus-menu-container {
    flex-shrink: 0; /* Don't shrink the plus button */
    align-self: center; /* Center align with pills */
  }

  .freeform-prompt-pill {
    flex-shrink: 0; /* Prevent pills from shrinking */
    min-width: fit-content;
    max-width: 180px; /* Limit width on mobile to show more pills */
    overflow: hidden; /* Hide overflow text */
    cursor: default; /* Default cursor on pill body */
    pointer-events: auto; /* Allow pill interaction */
  }
  
  .freeform-prompt-pill:active {
    cursor: grabbing; /* Show grabbing cursor when dragging */
  }
  
  /* Mobile text editing - allow editing when tapping input */
  .freeform-pill-input {
    max-width: 120px; /* Limit input width on mobile */
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    cursor: text; /* Show text cursor for editing */
    pointer-events: auto; /* Allow text editing on mobile */
    touch-action: manipulation; /* Optimize for touch editing */
    user-select: text; /* Allow text selection for editing */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
  }
  
  /* Hide input on mobile when not editing */
  .freeform-prompt-pill:not(.freeform-pill-editing-active) .freeform-pill-input {
    width: 0 !important;
    max-width: 0 !important;
    min-width: 0 !important;
    opacity: 0 !important;
    font-size: 0 !important;
  }
  
  /* Make pill content interactive for editing */
  .freeform-pill-content {
    pointer-events: auto; /* Allow interaction with content */
  }
  
  /* Enable text interaction on mobile */
  .freeform-pill-content .freeform-pill-input {
    pointer-events: auto; /* Enable input interaction on mobile */
  }
  
  /* Make labels more compact on mobile */
  .freeform-pill-label-inline {
    font-size: 6px; /* Even smaller on mobile */
    padding-right: 2px; /* Reduce padding */
  }

  .freeform-template-menu {
    left: 8px !important;
    right: 8px !important;
    max-width: calc(100vw - 16px);
    width: auto;
    min-width: 180px; /* 20% smaller for mobile: 224px * 0.8 */
  }
}
