/* ============================================================
   FLOATING CONTACT WIDGET & SCROLL TO TOP — MAS
   File: css/components/floating-widget.css
   ============================================================ */

/* Scroll to top */
.scroll-to-top {
  position: fixed;
  bottom: 15px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: var(--mas-blue, #3981d6);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 9998;
}

.scroll-to-top.show {
  opacity: 1;
  visibility: visible;
}

/* Floating Widget Base */
.floating-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
}

/* Widget Icons Container */
.widget-icons {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  margin-bottom: 10px;
  gap: 8px;
  width: 100%;
}

/* Widget Items */
.widget-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border-radius: 25px;
  box-shadow: 0 4px 10px rgba(0,0,0,.2);
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
  transition: box-shadow 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
  text-decoration: none;
  position: relative;
  white-space: nowrap;
  margin-left: auto;
}

/* Icon Circle */
.widget-icon-circle {
  width: 50px;
  height: 50px;
  min-width: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  order: 2;
}

/* Label Text */
.widget-label {
  font-size: 14px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  order: 1;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.widget-item.show .widget-label {
  opacity: 1;
  transform: translateX(0);
  transition-delay: 0.1s;
}

.widget-item svg {
  width: 26px;
  height: 26px;
  display: block;
}

/* Colors */
.widget-item.whatsapp.primary { background: rgba(255, 255, 255, 0.98); }
.widget-item.whatsapp.primary .widget-icon-circle { background: #25D366; color: #fff; }
.widget-item.whatsapp.primary .widget-label { color: #25D366; }

.widget-item.whatsapp.info { background: rgba(255, 255, 255, 0.98); }
.widget-item.whatsapp.info .widget-icon-circle { background: #fff; color: #25D366; box-shadow: inset 0 0 0 2px #25D366; }
.widget-item.whatsapp.info .widget-label { color: #25D366; }

.widget-item.whatsapp.cs { background: rgba(255, 255, 255, 0.98); }
.widget-item.whatsapp.cs .widget-icon-circle { background: #7dd4a0; color: #fff; }
.widget-item.whatsapp.cs .widget-label { color: #7dd4a0; }

.widget-item.whatsapp.backup { background: rgba(255, 255, 255, 0.98); }
.widget-item.whatsapp.backup .widget-icon-circle { background: #fff; color: #7dd4a0; box-shadow: inset 0 0 0 2px #7dd4a0; }
.widget-item.whatsapp.backup .widget-label { color: #7dd4a0; }

.widget-item.phone { background: rgba(255, 255, 255, 0.98); }
.widget-item.phone .widget-icon-circle { background: #fff; color: #1E88E5; box-shadow: inset 0 0 0 2px #1E88E5; }
.widget-item.phone .widget-label { color: #1E88E5; }

/* Hover Animation */
.widget-item:hover {
  transform: scale(1.15);
  animation: widget-bounce 0.5s;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

@keyframes widget-bounce {
  0%, 100% { transform: scale(1.15) translateY(0); }
  50% { transform: scale(1.2) translateY(-5px); }
}

.widget-item.show { animation: widget-slideIn 0.4s forwards; }
.widget-item.hide { animation: widget-slideOut 0.3s forwards; }

@keyframes widget-slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes widget-slideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

/* Widget Button */
.widget-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  box-shadow: 0 6px 14px rgba(0,0,0,.25);
  transition: transform 0.4s ease, box-shadow 0.3s ease;
  pointer-events: auto;
}

.widget-button img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: block;
  transition: transform 0.4s ease;
}

.widget-button.active img { transform: rotate(180deg) scale(1.1); }
.widget-button:hover { box-shadow: 0 8px 16px rgba(0,0,0,0.3); }
.widget-button:hover img { transform: scale(1.05); }

/* Responsive */
@media (max-width: 768px) {
  .floating-widget { bottom: 15px; right: 15px; }
  .widget-button img { width: 45px; height: 45px; }
  .widget-item { padding: 6px 10px 6px 6px; gap: 8px; }
  .widget-icon-circle { width: 45px; height: 45px; min-width: 45px; }
  .widget-item svg { width: 22px; height: 22px; }
  .widget-label { font-size: 13px; }
}

@media (max-width: 480px) {
  .floating-widget { bottom: 10px; right: 10px; }
  .widget-button img { width: 40px; height: 40px; }
  .widget-item { padding: 5px 8px 5px 5px; gap: 6px; }
  .widget-icon-circle { width: 40px; height: 40px; min-width: 40px; }
  .widget-item svg { width: 20px; height: 20px; }
  .widget-label { font-size: 12px; }
}