/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   📍 FLOATING ACTION BUTTON STYLES
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.floating-button {
  position: fixed;
  bottom: 90px; /* เหนือ bottom navigation */
  right: 20px;
  z-index: 9999;
  
  /* Size & Shape */
  min-width: 60px;
  height: 60px;
  border-radius: 30px;
  padding: 16px 20px;
  
  /* Layout */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  
  /* Style */
  border: none;
  color: white;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  
  /* Shadow & Effects */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  
  /* Animation */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(0);
  opacity: 0;
  
  /* Typography */
  font-family: 'Inter', 'Segoe UI', sans-serif;
  white-space: nowrap;
  
  /* Accessibility */
  outline: none;
}

.floating-button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   🎨 STATE VARIATIONS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.floating-button.visible {
  transform: scale(1);
  opacity: 1;
}

.floating-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.floating-button:active {
  transform: scale(0.95);
  transition-duration: 0.1s;
}

.floating-button:focus-visible {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(255, 255, 255, 0.5);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   🌈 COLOR THEMES (Page-specific gradients)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.floating-button.theme-home {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.floating-button.theme-voices {
  background: linear-gradient(135deg, #4299e1, #3182ce);
}

.floating-button.theme-solutions {
  background: linear-gradient(135deg, #48bb78, #38a169);
}

.floating-button.theme-vibes {
  background: linear-gradient(135deg, #9f7aea, #805ad5);
}

.floating-button.theme-businesses {
  background: linear-gradient(135deg, #ed8936, #dd6b20);
}

/* When button has mascot, remove background and show only mascot */
.floating-button.theme-mascot {
  background: transparent;
  width: 150px;
  height: 150px;
  min-width: 150px;
  border-radius: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  backdrop-filter: none;
}

.floating-button.theme-mascot:hover {
  background: transparent;
  transform: scale(1.1);
  box-shadow: none;
  backdrop-filter: none;
}

/* Hide text when using mascot */
.floating-button.theme-mascot .fab-text {
  display: none;
}

.floating-button.theme-mascot .fab-mascot {
  margin: 0;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
  mix-blend-mode: multiply;
}

.floating-button.theme-mascot:hover .fab-mascot {
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.4));
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   📋 CONTENT SELECTOR MODAL
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.content-selector-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.content-selector-modal.show {
  opacity: 1;
  visibility: visible;
}

.selector-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(17, 24, 39, 0.5);
  backdrop-filter: blur(2px);
}

.selector-container {
  position: absolute;
  top: 200px;
  right: 20px;
  width: 300px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  transform: translateY(-20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-selector-modal.show .selector-container {
  transform: translateY(0) scale(1);
}

.selector-header {
  background: linear-gradient(135deg, #3b82f6, #1e40af);
  color: white;
  padding: 20px;
  position: relative;
}

.selector-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.selector-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.selector-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.selector-options {
  padding: 8px;
}

.selector-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  text-decoration: none;
  color: #374151;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.selector-option:hover {
  background: #f8fafc;
  border-color: #e5e7eb;
  transform: translateX(2px);
}

.option-icon {
  font-size: 24px;
  min-width: 32px;
  text-align: center;
}

.option-content {
  flex: 1;
}

.option-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.option-desc {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.3;
}

/* Category-specific hover colors */
.selector-option.voices:hover {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-color: #3b82f6;
}

.selector-option.solutions:hover {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-color: #10b981;
}

.selector-option.vibes:hover {
  background: linear-gradient(135deg, #faf5ff, #f3e8ff);
  border-color: #8b5cf6;
}

.selector-option.businesses:hover {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border-color: #f59e0b;
}

.selector-option.properties:hover {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border-color: #10b981;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .selector-container {
    bottom: 80px;
    right: 10px;
    left: 10px;
    width: auto;
  }
  
  .selector-options {
    padding: 12px;
  }
  
  .selector-option {
    padding: 16px;
  }
  
  .option-icon {
    font-size: 28px;
    min-width: 36px;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   📱 RESPONSIVE DESIGN
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Desktop: Show icon + text */
@media (min-width: 768px) {
  .floating-button {
    padding: 16px 20px;
  }
  
  .floating-button .fab-text {
    display: block;
    margin-left: 8px;
  }
}

/* Mobile: Show icon only */
@media (max-width: 767px) {
  .floating-button {
    width: 60px;
    height: 60px;
    padding: 0;
    border-radius: 50%;
  }
  
  .floating-button .fab-text {
    display: none;
  }
  
  .floating-button .fab-icon {
    font-size: 24px;
  }
}

/* Tablet adjustments */
@media (max-width: 1024px) and (min-width: 768px) {
  .floating-button {
    right: 16px;
    bottom: 80px;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ✨ ANIMATIONS & EFFECTS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Pulse animation (every 5 seconds) */
.floating-button.pulse {
  animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  }
  100% {
    transform: scale(1);
  }
}

/* Fade in animation */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.floating-button.fade-in {
  animation: fadeInScale 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Page transition animation */
.floating-button.updating {
  transform: scale(0.8);
  opacity: 0.6;
  transition-duration: 0.2s;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   📝 TOOLTIP (Mobile hover effect)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.floating-button::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 8px;
  
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.2s ease;
  pointer-events: none;
  
  /* Arrow */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.floating-button::before {
  content: '';
  position: absolute;
  bottom: 100%;
  right: 20px;
  margin-bottom: 2px;
  
  border: 4px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.8);
  
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

/* Show tooltip on mobile hover/focus */
@media (max-width: 767px) {
  .floating-button:hover::after,
  .floating-button:focus::after {
    opacity: 1;
    transform: translateY(0);
  }
  
  .floating-button:hover::before,
  .floating-button:focus::before {
    opacity: 1;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   🎯 ACCESSIBILITY IMPROVEMENTS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.floating-button:focus {
  outline: none;
}

.floating-button:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .floating-button {
    border: 2px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .floating-button {
    transition: none;
  }
  
  .floating-button.pulse {
    animation: none;
  }
  
  .floating-button:hover {
    transform: none;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   📐 LAYOUT ADJUSTMENTS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Avoid conflict with bottom navigation */
.bottom-nav ~ .floating-button {
  bottom: 90px;
}

/* Adjust for very small screens */
@media (max-height: 600px) {
  .floating-button {
    bottom: 70px;
  }
}

/* Safe area adjustments for mobile devices with notches */
@supports (padding: max(0px)) {
  .floating-button {
    bottom: max(90px, env(safe-area-inset-bottom) + 90px);
    right: max(20px, env(safe-area-inset-right) + 20px);
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   🌙 DARK MODE SUPPORT
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

@media (prefers-color-scheme: dark) {
  .floating-button::after {
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .floating-button::before {
    border-top-color: rgba(20, 20, 20, 0.9);
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   🔧 COMPONENT ELEMENTS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.fab-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.fab-mascot {
  width: 140px;
  height: 140px;
  object-fit: contain;
  flex-shrink: 0;
  pointer-events: none;
}

.fab-text {
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

/* Adjust mascot size on mobile */
@media (max-width: 767px) {
  .floating-button.theme-mascot {
    width: 110px;
    height: 110px;
    min-width: 110px;
    padding: 0;
  }

  .floating-button .fab-mascot {
    width: 105px;
    height: 105px;
  }
}