/* === FLOATING MENU: Modern Design === */
.floating-menu {
  position: fixed;
  bottom: 20px;
  right: 20px; /* Mobile positioning - right side */
  z-index: 9997; /* Lower than chatbox */
  width: 60px;        /* was 200px */
  height: 60px;       /* was 200px */
  overflow: visible;  /* allow fan items to extend */
  pointer-events: none;
}

/* ADDED: Base style (was missing) */
.fab-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg,#06b6d4 0%,#0891b2 100%);
  color:#fff;
  border:none;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:20px;
  position:absolute;
  bottom:0;
  right:0;
  z-index:2;
  pointer-events:auto;
  box-shadow:0 8px 25px rgba(6,182,212,.4);
  transition:background .3s,transform .25s, box-shadow .3s;
  animation:floatingPulse 2s infinite;
  cursor:grab;
  touch-action:none; /* enable smooth drag */
  -webkit-tap-highlight-color:transparent;
}

.fab-toggle.dragging {
  transform:scale(1.05);
  cursor:grabbing;
  box-shadow:0 10px 30px rgba(6,182,212,.55);
}

.fab-toggle:active:not(.dragging) {
  transform:scale(.92);
}

.fab-toggle:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 35px rgba(6, 182, 212, 0.6);
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
}

@keyframes floatingPulse {
  0% { box-shadow: 0 8px 25px rgba(6, 182, 212, 0.4); }
  50% { box-shadow: 0 8px 25px rgba(6, 182, 212, 0.6), 0 0 0 10px rgba(6, 182, 212, 0.1); }
  100% { box-shadow: 0 8px 25px rgba(6, 182, 212, 0.4); }
}

.hidden {
  display: none !important;
}

/* ADJUST: Make fab-items absolute so it always follows toggle inside container box */
.fab-items {
  position: absolute;
  bottom: 70px; /* Position above the toggle button */
  right: 0;
  display: flex;
  flex-direction: column-reverse; /* Stack items vertically from bottom to top */
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  z-index: 1;
  width: 60px; /* Same width as toggle button */
}

.fab-items button,
.fab-items a {
  position: relative;
  width: 52px;
  min-width: 52px;
  height: 52px;
  min-height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 2px solid rgba(6, 182, 212, 0.2);
  color: #0891b2;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  font-size: 20px;
  text-decoration: none;
  backdrop-filter: blur(10px);
  transform: translateY(20px) scale(0);
  opacity: 0;
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
}

.fab-items button:hover,
.fab-items a:hover {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: white;
  transform: translateY(0) scale(1.1) !important;
  box-shadow: 0 8px 25px rgba(6, 182, 212, 0.4);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Background Glow When Open - adjusted for right positioning */
.floating-menu.expanded::before {
  content: '';
  position: absolute;
  bottom: 30px;
  right: 30px; /* Right positioning for mobile */
  width: 250px;
  height: 250px;
  transform: translate(50%, 50%); /* Adjust transform for right-side */
  border-radius: 50%;
  background: conic-gradient(from 0deg, #06b6d4, #0891b2, #0e7490, #06b6d4);
  animation: spinFloatingNeon 8s linear infinite;
  filter: blur(15px) brightness(1.2);
  z-index: 0;
  opacity: 0.2;
}

/* Toggle visibility animations */
.fab-items button,
.fab-items a {
  /* Vertical layout animations */
  pointer-events: none;
  transition:
    opacity .3s ease,
    transform .3s cubic-bezier(.175,.885,.32,1.275),
    background .2s ease,
    box-shadow .2s ease;
}

.floating-menu.expanded .fab-items button,
.floating-menu.expanded .fab-items a {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Staggered animation delays for vertical layout */
.fab-items > *:nth-child(1) { transition-delay: .02s; }
.fab-items > *:nth-child(2) { transition-delay: .06s; }
.fab-items > *:nth-child(3) { transition-delay: .10s; }
.fab-items > *:nth-child(4) { transition-delay: .14s; }
.fab-items > *:nth-child(5) { transition-delay: .18s; }

/* Closing animation delays */
.floating-menu:not(.expanded) .fab-items > *:nth-child(5) { transition-delay: 0.02s; }
.floating-menu:not(.expanded) .fab-items > *:nth-child(4) { transition-delay: 0.06s; }
.floating-menu:not(.expanded) .fab-items > *:nth-child(3) { transition-delay: 0.10s; }
.floating-menu:not(.expanded) .fab-items > *:nth-child(2) { transition-delay: 0.14s; }
.floating-menu:not(.expanded) .fab-items > *:nth-child(1) { transition-delay: 0.18s; }

@keyframes fabPop {
  0% { transform: scale(0); opacity:0; }
  60% { transform: scale(1.15); opacity:1; }
  100% { transform: scale(1); opacity:1; }
}

/* When collapsed ensure instantly hidden (no residual scale) */
.floating-menu:not(.expanded) .fab-items button,
.floating-menu:not(.expanded) .fab-items a {
  opacity: 0;
  transform: translateY(20px) scale(0);
  pointer-events: none;
}

@keyframes spinFloatingNeon {
  0% { transform: translate(50%, 50%) rotate(0deg); } /* Adjust for right-side */
  100% { transform: translate(50%, 50%) rotate(360deg); }
}

/* Toggle icon animation */
.fab-toggle i {
  transition: transform 0.3s ease;
}

.floating-menu.expanded .fab-toggle i {
  transform: rotate(45deg);
}

/* Fixed: Desktop floating buttons - positioned on right side */
.fixed-desktop-buttons {
  position: fixed;
  right: 20px; /* Fixed: Back to right side */
  bottom: 200px; /* Adjusted to avoid chatbox */
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 9997;
}

.fab-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: white;
  border: none;
  outline: none;
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-decoration: none;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.fab-btn:hover {
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
  transform: translateX(-5px) scale(1.1); /* Fixed: Hover moves left (away from edge) */
  box-shadow: 0 10px 30px rgba(6, 182, 212, 0.5);
  border-color: rgba(255, 255, 255, 0.2);
}

.fab-btn i {
  width: 24px;
  height: 24px;
}

/* New: Scroll-to-top button visibility */
.scroll-to-top {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

/* Report Modal Improvements */
#reportModal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 99998;
}

.report-form {
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 20px;
  padding: 30px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  animation: modalSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes modalSlideIn {
  from { 
    opacity: 0; 
    transform: translateY(-30px) scale(0.95); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
  }
}

.report-form h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.report-form input,
.report-form select,
.report-form textarea {
  width: 100%;
  padding: 14px 18px;
  font-size: 15px;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  background: white;
  color: #1e293b;
  resize: vertical;
  transition: all 0.3s ease;
  font-family: inherit;
}

.report-form input:focus,
.report-form select:focus,
.report-form textarea:focus {
  border-color: #06b6d4;
  outline: none;
  background: #f0fdff;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1rem;
}

.report-actions .btn {
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-size: 15px;
  min-width: 80px;
}

.btn.cancel {
  background: #f1f5f9;
  color: #64748b;
  border: 2px solid #e2e8f0;
}
.btn.cancel:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.btn.send {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}
.btn.send:hover {
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
  .floating-menu {
    display: block; /* Show on mobile */
    bottom: 100px; /* Avoid conflict with mobile chatbox */
    right: 20px; /* Right side positioning */
  }
  
  .fab-toggle {
    width: 56px;
    height: 56px;
  }
  
  .fab-items button,
  .fab-items a {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }
  
  .fixed-desktop-buttons {
    display: none; /* Hide desktop buttons on mobile */
  }
  
  .report-form {
    margin: 20px;
    padding: 25px;
  }
}

@media (min-width: 769px) {
  .floating-menu {
    display: block; /* Show on desktop too */
    bottom: 30px;
    right: 30px;
  }
  
  .fab-toggle {
    display: flex; /* Show on desktop */
  }
}

/* Dark theme support */
html[data-theme="dark"] .fab-toggle,
html[data-theme="dark"] .fab-btn {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .fab-items button,
html[data-theme="dark"] .fab-items a {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #06b6d4;
  border-color: rgba(6, 182, 212, 0.3);
}

html[data-theme="dark"] .fab-items button:hover,
html[data-theme="dark"] .fab-items a:hover {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: white;
}

html[data-theme="dark"] .report-form {
  background: linear-gradient(145deg, #1e293b 0%, #334155 100%);
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .report-form h3 {
  -webkit-text-fill-color: #06b6d4;
}

html[data-theme="dark"] .report-form input,
html[data-theme="dark"] .report-form select,
html[data-theme="dark"] .report-form textarea {
  background: rgba(255, 255, 255, 0.05);
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.2);
}

html[data-theme="dark"] .report-form input:focus,
html[data-theme="dark"] .report-form select:focus,
html[data-theme="dark"] .report-form textarea:focus {
  border-color: #06b6d4;
  background: rgba(6, 182, 212, 0.1);
}

html[data-theme="dark"] .btn.cancel {
  background: #374151;
  color: #d1d5db;
  border-color: #4b5563;
}
html[data-theme="dark"] .btn.cancel:hover {
  background: #4b5563;
}