/* GPT AI Chat - styles */
.gpt-ai-chat-wrapper {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  position: fixed;
  z-index: 999999;
  width: 340px;
  max-width: calc(100% - 32px);
  box-shadow: 0 12px 40px rgba(21,32,83,0.08);
  border-radius: 12px;
  overflow: hidden;
  transition: transform .22s ease, opacity .18s ease;
  background: transparent;
}
.gpt-ai-chat-wrapper.bottom-right { right: 20px; bottom: 20px; }
.gpt-ai-chat-wrapper.bottom-left { left: 20px; bottom: 20px; }
.gpt-ai-chat-wrapper .gpt-toggle {
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px 14px;
  background: linear-gradient(90deg, rgba(255,255,255,1), rgba(250,250,250,1));
  cursor:pointer;
  color: #111827;
  border-radius:12px;
}
.gpt-ai-chat-wrapper .gpt-toggle .gpt-title {
  font-weight:600;
  font-size:15px;
}
.gpt-ai-chat-wrapper .gpt-toggle .gpt-badge {
  margin-left:auto;
  padding:5px 8px;
  border-radius:8px;
  color:#fff;
  font-weight:700;
  font-size:11px;
}
.gpt-ai-chat-wrapper .gpt-body {
  background:#ffffff;
  border-top: 1px solid rgba(0,0,0,0.04);
  padding:12px;
  display:block;
}
.gpt-ai-chat-wrapper.gpt-collapsed .gpt-body { display:none; }
.gpt-messages {
  max-height:260px;
  overflow:auto;
  padding:6px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.gpt-message {
  max-width:85%;
  padding:10px 12px;
  border-radius:10px;
  line-height:1.4;
  box-shadow: 0 6px 18px rgba(13,18,40,0.04);
  font-size:14px;
}
.gpt-message.user { align-self:flex-end; background: #e6f0ff; color: #0b1222; border-bottom-right-radius:4px; }
.gpt-message.assistant { align-self:flex-start; background:#f7fafc; color:#06102c; border-bottom-left-radius:4px; }
.gpt-controls { display:flex; gap:8px; align-items:center; margin-top:8px; }
.gpt-input {
  flex:1;
  resize:none;
  padding:10px;
  border-radius:8px;
  border:1px solid #ececec;
  min-height:48px;
  font-size:14px;
}
.gpt-send {
  background: #2b8cff;
  color:#fff;
  border:none;
  padding:9px 12px;
  border-radius:8px;
  cursor:pointer;
  font-weight:600;
}
.gpt-send[disabled] { opacity:.6; cursor:not-allowed; }
.gpt-history-wrapper { margin-top:10px; font-size:13px; }
.gpt-history-actions { display:flex; gap:8px; margin-bottom:8px; }
.gpt-history-list { max-height:120px; overflow:auto; border-radius:8px; padding:8px; background:#fbfbfb; border:1px solid #f0f0f0; }
.gpt-history-item { padding:6px; border-bottom:1px dashed #eee; font-size:13px; }
.gpt-history-note { color:#666; padding:6px; background:#f9f9f9; border-radius:6px; }
@media (max-width:600px) {
  .gpt-ai-chat-wrapper { width:94%; left:3%; right:3%; bottom:16px; }
}










/* ==== WP-Rocket-style Floating Chat ==== */
.gpt-ai-chat-wrapper {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  position: fixed;
  z-index: 999999;
}
.gpt-ai-chat-wrapper.bottom-right { right: 24px; bottom: 24px; }
.gpt-ai-chat-wrapper.bottom-left  { left: 24px;  bottom: 24px; }

/* === Compact pill button when collapsed (fixed width issue) === */
.gpt-ai-chat-wrapper.gpt-collapsed {
  width: auto !important;
  height: auto !important;
  background: transparent !important;
  box-shadow: none !important;
}

.gpt-ai-chat-wrapper.gpt-collapsed .gpt-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #00a8e8;
  color: #fff;
  border-radius: 28px;
  padding: 8px 14px; /* Perfect width balance */
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  width: auto;
  min-width: 0;
}

/*.gpt-ai-chat-wrapper.gpt-collapsed .gpt-toggle:hover {
  background: #0095d1;
  transform: translateY(-2px);
}*/

/* Fix transparent container click area */
.gpt-ai-chat-wrapper.gpt-collapsed {
  display: inline-block;
}

/* Adjust position */
.gpt-ai-chat-wrapper.bottom-right.gpt-collapsed {
  right: 24px;
  bottom: 24px;
  position: fixed;
}

@media (max-width: 600px) {
  .gpt-ai-chat-wrapper.gpt-collapsed .gpt-toggle {
    padding: 7px 12px;
    font-size: 14px;
  }
}

.gpt-ai-chat-wrapper.gpt-collapsed .gpt-toggle:hover { 
    background: #0095d1; 
    /*transform: translateY(-2px);*/
}

.gpt-toggle-icon {
  font-size: 18px;
  line-height: 1;
}
.gpt-toggle-text {
  font-size: 15px;
}

/* === Chat card when expanded === */
.gpt-ai-chat-wrapper:not(.gpt-collapsed) {
  width: 360px;
  max-width: calc(100% - 32px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.2);
  overflow: hidden;
  transition: all 0.25s ease;
}
.gpt-ai-chat-wrapper:not(.gpt-collapsed) .gpt-toggle {
  display: none;
}
.gpt-ai-chat-wrapper:not(.gpt-collapsed) .gpt-body {
  display: block;
  animation: gptSlideUp 0.25s ease;
}
@keyframes gptSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* === Header === */
.gpt-ai-chat-wrapper .gpt-body .gpt-header {
  background: #00a8e8;
  color: #fff;
  padding: 12px 16px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.gpt-ai-chat-wrapper .gpt-body .gpt-header button {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

/* === Responsive === */
@media (max-width:600px) {
  .gpt-ai-chat-wrapper:not(.gpt-collapsed) {
    left: 5%;
    right: 5%;
    width: 90%;
    bottom: 80px;
  }
}



/* ==== Chat Window Styling (Instant-Answers look) ==== */
.gpt-body {
  display: flex;
  flex-direction: column;
  width: 380px;
  max-height: 540px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  overflow: hidden;
}

/* ==== Full-width, edge-to-edge header bar ==== */
.gpt-header {
  position: relative;
  background: #00a8e8;
  color: #fff;
  font-weight: 600;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;

  /* Ensure complete fill */
  width: calc(100% + 2px);
  margin: -1px -1px 0 -1px;
  border-radius: 12px 12px 0 0;
  box-sizing: border-box;
}

.gpt-collapse-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.gpt-collapse-btn:hover { opacity: 0.8; }

/* Messages area */
.gpt-messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  background: #f9fafc;
  font-size: 15px;
}

/* Chat bubbles */
.gpt-message.user {
  background: #00a8e8;
  color: #fff;
  padding: 10px 12px;
  border-radius: 10px 10px 0 10px;
  margin: 6px 0 6px 40px;
  align-self: flex-end;
}
.gpt-message.assistant {
  background: #e9ecef;
  color: #222;
  padding: 10px 12px;
  border-radius: 10px 10px 10px 0;
  margin: 6px 40px 6px 0;
  align-self: flex-start;
}

/* Input area */
.gpt-controls {
  display: flex;
  padding: 10px;
  border-top: 1px solid #ddd;
  background: #fff;
}
.gpt-input {
  flex: 1;
  resize: none;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
}
.gpt-send {
  background: #00a8e8;
  border: none;
  color: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  margin-left: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.3s;
}
.gpt-send:hover { background: #0095d1; }

/* Scrollbar */
.gpt-messages::-webkit-scrollbar { width: 6px; }
.gpt-messages::-webkit-scrollbar-thumb {
  background: #cfd4da;
  border-radius: 3px;
}

/* Responsive */
@media (max-width:600px){
  .gpt-body { width: calc(100vw - 40px); max-height: 70vh; }
}






/* ==== Header 3-dot menu ==== */
.gpt-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.gpt-menu-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.gpt-menu-btn:hover { opacity: 0.8; }

/* Dropdown menu styling */
.gpt-menu-dropdown {
  position: absolute;
  top: 50px;
  right: 14px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  display: none;
  flex-direction: column;
  min-width: 160px;
  overflow: hidden;
  z-index: 100000;
}
.gpt-menu-dropdown button {
  background: none;
  border: none;
  text-align: left;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  color: #333;
  width: 100%;
}
.gpt-menu-dropdown button:hover {
  background: #f1f3f5;
}
.gpt-menu-dropdown.show {
  display: flex;
  animation: gptSlideDown 0.2s ease forwards;
  transform-origin: top right;
}

/* Animation keyframes */
@keyframes gptSlideDown {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}



/* ==== FIX: Mobile positioning for compact button ==== */

/* Base positioning */
.gpt-ai-chat-wrapper.gpt-collapsed {
  position: fixed !important;
  z-index: 999999;
}

/* Right corner */
.gpt-ai-chat-wrapper.bottom-right.gpt-collapsed {
  right: 20px !important;
  bottom: 20px !important;
  left: auto !important;
}

/* Left corner */
.gpt-ai-chat-wrapper.bottom-left.gpt-collapsed {
  left: 20px !important;
  bottom: 20px !important;
  right: auto !important;
}

/* Top-right (if you add it later) */
.gpt-ai-chat-wrapper.top-right.gpt-collapsed {
  top: 20px !important;
  right: 20px !important;
  bottom: auto !important;
}

/* Top-left (if you add it later) */
.gpt-ai-chat-wrapper.top-left.gpt-collapsed {
  top: 20px !important;
  left: 20px !important;
  bottom: auto !important;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
  .gpt-ai-chat-wrapper.bottom-right.gpt-collapsed {
    right: 16px !important;
    bottom: 16px !important;
  }
  .gpt-ai-chat-wrapper.bottom-left.gpt-collapsed {
    left: 16px !important;
    bottom: 16px !important;
  }
}

.gpt-message mjx-container {
  background: #f9f9fb;
  border-radius: 6px;
  padding: 4px 8px;
  margin: 4px 0;
  display: inline-block;
  line-height: 1.6;
}




/* === Collapsible History Styling === */
.gpt-history-day {
  border: 1px solid #e1e1e1;
  border-radius: 6px;
  margin-bottom: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.gpt-history-day-header {
  background: #f2f5fa;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: #333;
}

.gpt-history-toggle {
  font-size: 14px;
  transition: transform 0.3s ease;
}

.gpt-history-day-body {
  padding: 8px 12px;
  background: #fafbfd;
  display: none;
}

.gpt-history-item {
  padding: 6px 0;
  border-bottom: 1px dashed #ddd;
}

.gpt-history-item:last-child {
  border-bottom: none;
}

.gpt-history-time {
  font-size: 11px;
  color: #777;
  margin-top: 3px;
}

.gpt-history-item mjx-container {
  background: #f9f9fb;
  border-radius: 4px;
  padding: 2px 5px;
  margin: 2px 0;
}






