/* ============================================
   FANNIE AI ASSISTANT - STYLES
   Mzansi Varsity Finder
   ============================================ */

/* ============================================
   CHAT TOGGLE BUTTON — Eye-catching Pill
   ============================================ */

.fannie-toggle {
  position: fixed;
  bottom: 25px;
  right: 25px;
  height: 62px;
  padding: 0 22px 0 8px;
  border-radius: 40px;
  background: linear-gradient(135deg, #1565c0 0%, #1976d2 50%, #00a86b 100%);
  background-size: 200% 200%;
  border: none;
  cursor: pointer;
  z-index: 9998;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  box-shadow: 0 8px 25px rgba(21, 101, 192, 0.45),
              0 3px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s ease,
              border-radius 0.4s ease,
              padding 0.4s ease,
              width 0.4s ease,
              background 0.3s ease;
  animation: fannieBgShift 6s ease infinite,
             fannieBounce 3s ease-in-out infinite;
  outline: none;
  color: #fff;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  touch-action: none; /* needed for drag on touch devices */
}

.fannie-toggle:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 14px 35px rgba(21, 101, 192, 0.6),
              0 5px 15px rgba(0, 168, 107, 0.3);
  animation: fannieBgShift 6s ease infinite;
}

.fannie-toggle:not(.active):not(.dragging):hover {
  cursor: grab;
}

.fannie-toggle:active {
  transform: translateY(-1px) scale(0.98);
}

/* Avatar inside toggle button */
.fannie-toggle-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  pointer-events: none; /* allow drag through avatar */
}

.fannie-toggle-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  pointer-events: none;
}

.fannie-toggle-avatar .toggle-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: onlinePulse 2s ease infinite;
}

/* Text wrapper */
.fannie-toggle-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
  transition: opacity 0.25s ease, max-width 0.4s ease;
  overflow: hidden;
  max-width: 200px;
  pointer-events: none;
}

.fannie-toggle-label {
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
}

.fannie-toggle-subtext {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  margin-top: 1px;
}

/* Close X icon — hidden by default */
.fannie-close {
  display: none;
  font-size: 22px;
  color: #fff;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  pointer-events: none;
}

/* ACTIVE state — collapse to red circle with X */
.fannie-toggle.active {
  width: 60px;
  padding: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  animation: none;
  gap: 0;
}

.fannie-toggle.active .fannie-toggle-avatar,
.fannie-toggle.active .fannie-toggle-text {
  display: none;
}

.fannie-toggle.active .fannie-close {
  display: inline-flex;
  width: 60px;
  height: 60px;
}

/* Notification badge */
.fannie-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 24px;
  height: 24px;
  background: #ef4444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  border: 2.5px solid #fff;
  animation: badgeBounce 0.5s ease forwards,
             badgePulse 1.5s ease infinite 0.5s;
  z-index: 3;
  pointer-events: none;
}

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

@keyframes fannieBgShift {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}

@keyframes fannieBounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

@keyframes badgeBounce {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  50%       { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

@keyframes onlinePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.7; transform: scale(0.9); }
}

/* ============================================
   PROACTIVE POPUP MESSAGES
   ============================================ */

.fannie-popup-msg {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  background: #fff;
  color: #1e293b;
  padding: 12px 38px 12px 16px;
  border-radius: 18px;
  border-bottom-right-radius: 4px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15),
              0 3px 10px rgba(21, 101, 192, 0.15);
  border: 1.5px solid rgba(21, 101, 192, 0.1);
  cursor: pointer;
  opacity: 0;
  transform: translateY(15px) scale(0.85);
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
  z-index: 10000;
  max-width: 280px;
  user-select: none;
}

.fannie-popup-msg.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: popupGentleBounce 2.5s ease-in-out infinite;
  animation-delay: 0.6s;
}

.fannie-popup-msg.hide {
  opacity: 0;
  transform: translateY(-10px) scale(0.9);
  animation: none;
}

/* Speech bubble tail pointing down to button */
.fannie-popup-msg::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 24px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-right: 1.5px solid rgba(21, 101, 192, 0.1);
  border-bottom: 1.5px solid rgba(21, 101, 192, 0.1);
  transform: rotate(45deg);
}

.fannie-popup-text {
  display: inline-block;
  pointer-events: none;
  line-height: 1.4;
}

/* Close button on popup */
.fannie-popup-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  color: #64748b;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  z-index: 2;
}

.fannie-popup-close:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  transform: scale(1.15);
}

/* Hover effect on popup itself */
.fannie-popup-msg:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2),
              0 5px 15px rgba(21, 101, 192, 0.25);
  animation: none;
}

/* Gentle bouncing animation while visible */
@keyframes popupGentleBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-4px) scale(1.01); }
}

/* Hide popup while button is being dragged */
.fannie-toggle.dragging .fannie-popup-msg {
  opacity: 0 !important;
  pointer-events: none !important;
  animation: none !important;
}

/* Hide popup when toggle is in active (chat-open) state */
.fannie-toggle.active .fannie-popup-msg {
  display: none !important;
}

/* ============================================
   CHAT WINDOW — Smart sizing that NEVER cuts off
   ============================================ */

.fannie-chat {
  position: fixed;
  bottom: 100px;
  right: 25px;
  width: 400px;
  max-width: calc(100vw - 50px);
  height: 580px;
  max-height: calc(100vh - 130px);

  background: #fff;
  border-radius: 20px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.18),
              0 2px 10px rgba(0, 0, 0, 0.08);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.85) translateY(20px);
  pointer-events: none;
  transform-origin: bottom right;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(0, 0, 0, 0.07);
  will-change: transform, opacity;
}

.fannie-chat.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

/* Tablet/laptop heights — shrink chat to leave breathing room above */
@media (max-height: 750px) and (min-width: 481px) {
  .fannie-chat {
    height: calc(100vh - 130px);
    bottom: 95px;
  }
}

@media (max-height: 600px) and (min-width: 481px) {
  .fannie-chat {
    height: calc(100vh - 110px);
    bottom: 90px;
  }
}

/* ============================================
   HEADER (Drag handle for chat window)
   ============================================ */

.fannie-header {
  background: linear-gradient(135deg, #1565c0, #0d47a1);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  position: relative;
  touch-action: none;
}

.fannie-header:active {
  cursor: grabbing;
}

/* Subtle drag indicator dots on header */
.fannie-header::before {
  content: '⋮⋮';
  position: absolute;
  left: 50%;
  top: 4px;
  transform: translateX(-50%) rotate(90deg);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: -2px;
  pointer-events: none;
  font-weight: 700;
}

.fannie-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  flex-shrink: 0;
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.5);
  overflow: hidden;
}

.fannie-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.fannie-avatar .online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: onlinePulse 2s ease infinite;
  z-index: 2;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  margin-right: 4px;
  animation: onlinePulse 2s ease infinite;
  vertical-align: middle;
}

.fannie-header-info {
  flex: 1;
  min-width: 0;
  pointer-events: none; /* let drag work over text */
}

.fannie-header-info h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fannie-header-info p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.fannie-header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  cursor: default;
}

.fannie-header-actions button {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  outline: none;
}

.fannie-header-actions button:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ============================================
   DRAGGABLE STATES & VISUAL FEEDBACK
   ============================================ */

/* Toggle button being dragged */
.fannie-toggle.dragging {
  animation: none !important;
  transition: none !important;
  cursor: grabbing !important;
  transform: scale(1.05) !important;
  box-shadow: 0 15px 40px rgba(21, 101, 192, 0.7) !important;
  opacity: 0.95;
  z-index: 10000;
}

/* Chat window being dragged */
.fannie-chat.dragging {
  transition: none !important;
  cursor: grabbing;
  user-select: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
}

/* First-time drag hint tooltip */
.fannie-drag-hint {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.88);
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 10001;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.fannie-drag-hint::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.88);
}

.fannie-drag-hint.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-3px);
}

/* ============================================
   MESSAGES AREA
   ============================================ */

.fannie-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
  scroll-behavior: smooth;
}

.fannie-messages::-webkit-scrollbar { width: 4px; }
.fannie-messages::-webkit-scrollbar-track { background: transparent; }
.fannie-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.fannie-messages::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================
   MESSAGE BUBBLES
   ============================================ */

.fannie-msg {
  display: flex;
  gap: 8px;
  max-width: 90%;
  animation: msgSlideIn 0.3s ease forwards;
}

.fannie-msg.bot { align-self: flex-start; }
.fannie-msg.user { align-self: flex-end; flex-direction: row-reverse; }

@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fannie-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 4px;
  align-self: flex-end;
  overflow: hidden;
  background: #fff;
  border: 1.5px solid #e8edf3;
}

.fannie-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.fannie-msg.user .fannie-msg-avatar {
  background: #dde1e7;
  color: #475569;
  border: none;
}

.fannie-msg-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fannie-msg.user .fannie-msg-content { align-items: flex-end; }

.fannie-msg-bubble {
  padding: 11px 15px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.fannie-msg.bot .fannie-msg-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e8edf3;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.fannie-msg.user .fannie-msg-bubble {
  background: linear-gradient(135deg, #1565c0, #1976d2);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(21, 101, 192, 0.3);
}

.fannie-msg-time {
  font-size: 10px;
  color: #b0bec5;
  padding: 0 4px;
  margin-top: 2px;
}

.fannie-msg.user .fannie-msg-time { text-align: right; }

/* ============================================
   LINKS INSIDE MESSAGES
   ============================================ */

.fannie-msg-bubble a,
.fannie-msg-bubble .msg-link {
  color: #1565c0;
  text-decoration: underline;
  font-weight: 600;
  word-break: break-word;
  transition: color 0.2s ease;
}

.fannie-msg-bubble a:hover,
.fannie-msg-bubble .msg-link:hover {
  color: #0d47a1;
}

.fannie-msg.user .fannie-msg-bubble a,
.fannie-msg.user .fannie-msg-bubble .msg-link {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: underline;
}

.fannie-msg.bot .fannie-msg-bubble .msg-link {
  display: inline-block;
  background: #eff6ff;
  color: #1565c0;
  padding: 3px 10px;
  border-radius: 8px;
  margin: 3px 2px;
  font-size: 12.5px;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid #bfdbfe;
  transition: background 0.2s ease, color 0.2s ease;
}

.fannie-msg.bot .fannie-msg-bubble .msg-link:hover {
  background: #1565c0;
  color: #fff;
  border-color: #1565c0;
}

/* ============================================
   TYPING INDICATOR
   ============================================ */

.fannie-typing {
  display: flex;
  gap: 5px;
  padding: 13px 16px;
  align-items: center;
  background: #fff;
  border: 1px solid #e8edf3;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.fannie-typing span {
  width: 7px;
  height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  display: block;
  animation: typingDot 1.4s infinite ease;
}

.fannie-typing span:nth-child(2) { animation-delay: 0.2s; }
.fannie-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0);  opacity: 0.35; }
  30%           { transform: translateY(-6px); opacity: 1;    }
}

/* ============================================
   QUICK REPLY BUTTONS
   ============================================ */

.fannie-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
  max-width: 100%;
}

.fannie-quick-btn {
  background: #eff6ff;
  color: #1565c0;
  border: 1.5px solid #bfdbfe;
  padding: 6px 13px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Inter', sans-serif;
  outline: none;
}

.fannie-quick-btn:hover:not(:disabled) {
  background: #1565c0;
  color: #fff;
  border-color: #1565c0;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(21, 101, 192, 0.25);
}

.fannie-quick-btn:active:not(:disabled) { transform: translateY(0); }

.fannie-quick-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================
   INPUT AREA
   ============================================ */

.fannie-input-area {
  padding: 12px 14px;
  border-top: 1px solid #e8edf3;
  display: flex;
  gap: 9px;
  align-items: flex-end;
  background: #fff;
  flex-shrink: 0;
}

.fannie-input-wrap {
  flex: 1;
  background: #f1f5f9;
  border-radius: 22px;
  border: 1.5px solid #e2e8f0;
  padding: 8px 14px;
  transition: border-color 0.2s ease, background 0.2s ease;
  min-width: 0;
}

.fannie-input-wrap:focus-within {
  border-color: #1565c0;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.08);
}

.fannie-input-wrap textarea {
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  color: #1e293b;
  outline: none;
  max-height: 110px;
  min-height: 22px;
  line-height: 1.5;
  display: block;
  overflow-y: auto;
  box-sizing: border-box;
}

.fannie-input-wrap textarea::placeholder { color: #94a3b8; }
.fannie-input-wrap textarea::-webkit-scrollbar { width: 3px; }
.fannie-input-wrap textarea::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.fannie-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1565c0, #00a86b);
  border: none;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  flex-shrink: 0;
  outline: none;
  box-shadow: 0 2px 8px rgba(21, 101, 192, 0.3);
}

.fannie-send-btn:hover:not(:disabled) {
  transform: scale(1.08);
  box-shadow: 0 4px 14px rgba(21, 101, 192, 0.45);
}

.fannie-send-btn:active:not(:disabled) { transform: scale(0.95); }

.fannie-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ============================================
   FOOTER
   ============================================ */

.fannie-footer {
  text-align: center;
  padding: 7px 12px;
  font-size: 10.5px;
  color: #b0bec5;
  background: #fff;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
  line-height: 1.4;
}

.fannie-footer a {
  color: #1565c0;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.fannie-footer a:hover {
  color: #0d47a1;
  text-decoration: underline;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .fannie-toggle {
    bottom: 20px;
    right: 20px;
    height: 58px;
    padding: 0 20px 0 6px;
  }

  .fannie-toggle-avatar {
    width: 44px;
    height: 44px;
  }

  .fannie-toggle.active {
    width: 56px;
    padding: 0;
  }

  .fannie-toggle.active .fannie-close {
    width: 56px;
    height: 56px;
  }

  /* Popup scales down on tablets */
  .fannie-popup-msg {
    font-size: 13px;
    padding: 10px 34px 10px 14px;
    max-width: 260px;
  }
}

@media (max-width: 480px) {
  .fannie-toggle {
    bottom: 18px;
    right: 18px;
    height: 54px;
    padding: 0 18px 0 5px;
  }

  .fannie-toggle-avatar {
    width: 42px;
    height: 42px;
  }

  .fannie-toggle-label { font-size: 13.5px; }
  .fannie-toggle-subtext { font-size: 10px; }

  .fannie-toggle.active {
    width: 52px;
    padding: 0;
  }

  .fannie-toggle.active .fannie-close {
    width: 52px;
    height: 52px;
    font-size: 20px;
  }

  /* Mobile: Full screen chat — anchored to all edges */
  .fannie-chat {
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    transform-origin: bottom center;
  }

  .fannie-chat.open { border-radius: 0; }
  .fannie-messages { padding: 14px 12px; }
  .fannie-msg-bubble { font-size: 13px; }
  .fannie-quick-btn { font-size: 12px; padding: 5px 11px; }

  /* Disable drag handle cursor on mobile (chat is fullscreen anyway) */
  .fannie-header {
    cursor: default;
  }

  .fannie-header::before {
    display: none;
  }

  .fannie-toggle:not(.active):not(.dragging):hover {
    cursor: pointer;
  }

  /* Mobile popup — smaller and more compact */
  .fannie-popup-msg {
    font-size: 12.5px;
    padding: 10px 32px 10px 14px;
    max-width: 220px;
    bottom: calc(100% + 10px);
  }

  .fannie-popup-msg::after {
    right: 20px;
  }

  .fannie-popup-close {
    width: 20px;
    height: 20px;
    font-size: 14px;
  }
}

@media (max-width: 360px) {
  .fannie-toggle-text { max-width: 130px; }
  .fannie-toggle-label { font-size: 13px; }

  .fannie-popup-msg {
    font-size: 12px;
    max-width: 200px;
  }
}

/* ============================================
   ACCESSIBILITY — reduced motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .fannie-toggle,
  .fannie-badge,
  .fannie-chat,
  .fannie-msg,
  .fannie-typing span,
  .fannie-avatar .online-dot,
  .toggle-online-dot,
  .status-dot,
  .fannie-popup-msg,
  .fannie-popup-msg.show {
    animation: none !important;
    transition: opacity 0.2s ease !important;
  }

  .fannie-chat.open {
    opacity: 1;
    transform: none;
  }

  .fannie-popup-msg.show {
    opacity: 1;
    transform: none;
  }
}
/* ============================================
   EMAIL SUBSCRIPTION FORM
   ============================================ */

.fannie-email-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  width: 100%;
}

.fannie-email-form input {
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.fannie-email-form input:focus {
  border-color: #1565c0;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}

.fannie-email-form button {
  padding: 10px 16px;
  background: linear-gradient(135deg, #1565c0, #00a86b);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.fannie-email-form button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(21, 101, 192, 0.3);
}

.fannie-email-form button:disabled {
  opacity: 0.6;
  cursor: wait;
}