/**
 * Floating Consultation Widget Styles
 * Dr. Yıldız Digital Ecosystem
 * 
 * Requirements: 31.1, 31.2, 31.3, 31.4, 31.5
 * 
 * Elegant, warm and luxurious design
 */

/* ============================================
 * BASE WIDGET CONTAINER
 * ============================================ */

.floating-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  font-family: var(--font-body, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
  /* FOUC prevention - starts hidden via critical CSS, shown when .is-ready added */
  opacity: 0;
  visibility: hidden;
}

.floating-widget.is-ready {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

@media (min-width: 768px) {
  .floating-widget {
    bottom: 32px;
    right: 32px;
  }
}

/* ============================================
 * TRIGGER BUTTON - Soft & Elegant
 * ============================================ */

.floating-widget__trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  padding: 0;
  background: linear-gradient(145deg, #f03167 0%, #d42a58 100%);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 
    0 8px 32px rgba(240, 49, 103, 0.35),
    0 4px 12px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
}

.floating-widget__trigger:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 
    0 12px 40px rgba(240, 49, 103, 0.45),
    0 6px 16px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.floating-widget__trigger:focus-visible {
  outline: 3px solid rgba(240, 49, 103, 0.5);
  outline-offset: 4px;
}

.floating-widget__trigger:active {
  transform: scale(1.02);
}

/* Trigger Icons */
.floating-widget__trigger-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-widget__trigger-icon--open {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.floating-widget__trigger-icon--close {
  position: absolute;
  opacity: 0;
  transform: scale(0.5) rotate(-90deg);
}

.floating-widget.is-expanded .floating-widget__trigger-icon--open,
.floating-widget.is-open .floating-widget__trigger-icon--open {
  opacity: 0;
  transform: scale(0.5) rotate(90deg);
}

.floating-widget.is-expanded .floating-widget__trigger-icon--close,
.floating-widget.is-open .floating-widget__trigger-icon--close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* Pulse Animation - Soft & Inviting */
.floating-widget__pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(232, 164, 184, 0.5);
  animation: floatingPulse 2.8s ease-out infinite;
  pointer-events: none;
}

@keyframes floatingPulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    opacity: 0.3;
  }
  100% {
    transform: scale(1.7);
    opacity: 0;
  }
}

.floating-widget.is-expanded .floating-widget__pulse,
.floating-widget.is-open .floating-widget__pulse {
  animation: none;
  opacity: 0;
}

/* ============================================
 * PANEL - Warm & Luxurious Card
 * ============================================ */

.floating-widget__panel {
  position: absolute;
  bottom: calc(100% + 16px);
  right: 0;
  width: 340px;
  background: #fff;
  border-radius: 28px;
  box-shadow: 
    0 25px 80px rgba(0, 0, 0, 0.12),
    0 10px 30px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.02);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.92);
  transform-origin: bottom right;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.floating-widget.is-expanded .floating-widget__panel,
.floating-widget.is-open .floating-widget__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Decorative Background Element */
.floating-widget__panel-decor {
  position: absolute;
  top: -80px;
  right: -80px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(232, 164, 184, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

/* Panel Header - Warm & Friendly */
.floating-widget__panel-header {
  padding: 32px 28px 24px;
  text-align: center;
  position: relative;
  background: linear-gradient(180deg, rgba(253, 248, 249, 0.8) 0%, transparent 100%);
}

.floating-widget__panel-emoji {
  display: inline-block;
  font-size: 2.25rem;
  margin-bottom: 12px;
  animation: emojiWave 2.5s ease-in-out infinite;
}

@keyframes emojiWave {
  0%, 100% { transform: rotate(0deg) scale(1); }
  15% { transform: rotate(14deg) scale(1.1); }
  30% { transform: rotate(-8deg) scale(1.05); }
  45% { transform: rotate(10deg) scale(1.08); }
  60% { transform: rotate(-4deg) scale(1.02); }
  75% { transform: rotate(6deg) scale(1.04); }
}

.floating-widget__panel-title {
  margin: 0 0 6px 0;
  font-family: var(--font-heading, Georgia, serif);
  font-size: 1.625rem;
  font-weight: 500;
  color: #2d2d2d;
  letter-spacing: -0.01em;
}

.floating-widget__panel-subtitle {
  margin: 0;
  font-size: 0.9375rem;
  color: #888;
  font-weight: 400;
}

/* Panel Options */
.floating-widget__panel-options {
  padding: 8px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Individual Option - Soft & Touchable */
.floating-widget__option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: #fafafa;
  border: 1px solid transparent;
  border-radius: 18px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-widget__option:hover {
  background: #fff;
  border-color: rgba(232, 164, 184, 0.25);
  box-shadow: 
    0 8px 24px rgba(232, 164, 184, 0.15),
    0 2px 8px rgba(0, 0, 0, 0.04);
  transform: translateX(6px);
}

.floating-widget__option:focus-visible {
  outline: 2px solid #d4849a;
  outline-offset: 2px;
}

.floating-widget__option:active {
  transform: translateX(3px) scale(0.99);
}

/* Option Icons - Rounded & Soft */
.floating-widget__option-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-widget__option:hover .floating-widget__option-icon {
  transform: scale(1.1) rotate(-3deg);
}

/* WhatsApp - Fresh Green */
.floating-widget__option--whatsapp .floating-widget__option-icon {
  background: linear-gradient(145deg, #25D366 0%, #128C7E 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

/* Phone - Warm Rose */
.floating-widget__option--phone .floating-widget__option-icon {
  background: linear-gradient(145deg, #e8a4b8 0%, #d4849a 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(212, 132, 154, 0.3);
}

/* Form - Soft Blush */
.floating-widget__option--form .floating-widget__option-icon {
  background: linear-gradient(145deg, #f8eff2 0%, #f0dde3 100%);
  color: #c9707d;
  box-shadow: 0 4px 12px rgba(201, 112, 125, 0.15);
}

/* Option Content */
.floating-widget__option-content {
  flex: 1;
  min-width: 0;
}

.floating-widget__option-title {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: #2d2d2d;
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}

.floating-widget__option-desc {
  display: block;
  font-size: 0.8125rem;
  color: #999;
}

/* Option Arrow */
.floating-widget__option-arrow {
  font-size: 1.125rem;
  font-weight: 300;
  color: #ccc;
  transition: all 0.3s ease;
}

.floating-widget__option:hover .floating-widget__option-arrow {
  color: #d4849a;
  transform: translateX(4px);
}

/* Panel Footer */
.floating-widget__panel-footer {
  padding: 14px 28px 18px;
  text-align: center;
  background: linear-gradient(180deg, transparent 0%, rgba(250, 250, 250, 0.8) 100%);
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.floating-widget__panel-footer p {
  font-size: 0.75rem;
  color: #aaa;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.floating-widget__panel-footer strong {
  color: #25D366;
  font-weight: 600;
}

/* Online indicator dot */
.floating-widget__panel-footer p::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #25D366;
  border-radius: 50%;
  animation: onlinePulse 2s ease-in-out infinite;
}

@keyframes onlinePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

/* ============================================
 * OVERLAY
 * ============================================ */

.floating-widget__overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.35s ease;
  z-index: -1;
}

.floating-widget.is-expanded .floating-widget__overlay,
.floating-widget.is-open .floating-widget__overlay {
  opacity: 1;
  visibility: visible;
}

/* ============================================
 * MOBILE BOTTOM SHEET
 * ============================================ */

@media (max-width: 480px) {
  .floating-widget {
    bottom: 20px;
    right: 20px;
  }
  
  .floating-widget__trigger {
    width: 58px;
    height: 58px;
  }
  
  .floating-widget__panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 85vh;
    border-radius: 28px 28px 0 0;
    transform: translateY(100%);
    transform-origin: bottom center;
  }
  
  .floating-widget.is-expanded .floating-widget__panel,
  .floating-widget.is-open .floating-widget__panel {
    transform: translateY(0);
  }
  
  /* Bottom sheet handle */
  .floating-widget__panel::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 4px;
  }
  
  .floating-widget__panel-header {
    padding-top: 36px;
  }
  
  .floating-widget__panel-options {
    padding: 8px 24px 28px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }
  
  .floating-widget__option {
    padding: 18px 20px;
  }
  
  .floating-widget__option-icon {
    width: 52px;
    height: 52px;
  }
}

/* ============================================
 * REDUCED MOTION
 * ============================================ */

@media (prefers-reduced-motion: reduce) {
  .floating-widget__pulse,
  .floating-widget__panel-emoji {
    animation: none;
  }
  
  .floating-widget__panel-footer p::before {
    animation: none;
  }
  
  .floating-widget__trigger,
  .floating-widget__trigger-icon,
  .floating-widget__panel,
  .floating-widget__option,
  .floating-widget__option-icon,
  .floating-widget__option-arrow,
  .floating-widget__overlay {
    transition: none;
  }
}

/* ============================================
 * PRINT STYLES
 * ============================================ */

@media print {
  .floating-widget {
    display: none;
  }
}
