/* ============================================
   CONTACT WIDGET - Trustworthiness Enhancement
   ============================================
   
   Widget flotante de contacto visible en todas las páginas.
   Crítico para E-E-A-T: muestra disponibilidad y accesibilidad inmediata.
   
   Solo 2/5 competidores lo tienen (40%) = DIFERENCIADOR.
   Impacto: +1 punto Trustworthiness (8/10 → 9/10)
*/

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

.contact-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (max-width: 640px) {
  .contact-widget {
    bottom: 16px;
    right: 16px;
  }
}

/* ============================================
   TOGGLE BUTTON
   ============================================ */

.contact-widget__toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  border: none;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: white;
  position: relative;
}

.contact-widget__toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.5);
}

.contact-widget__toggle:active {
  transform: scale(1.05);
}

.contact-widget__toggle:focus {
  outline: 2px solid #25d366;
  outline-offset: 2px;
}

/* Icon animation */
.contact-widget__toggle-icon {
  transition: all 0.3s ease;
}

.contact-widget__toggle-icon--close {
  display: none;
}

.contact-widget.is-open .contact-widget__toggle {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
}

.contact-widget.is-open .contact-widget__toggle-icon--chat {
  display: none;
}

.contact-widget.is-open .contact-widget__toggle-icon--close {
  display: block;
}

/* Pulse animation for attention */
@keyframes contact-widget-pulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  }
  50% {
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4), 0 0 0 8px rgba(37, 211, 102, 0.2);
  }
}

.contact-widget__toggle {
  animation: contact-widget-pulse 2s infinite;
}

.contact-widget.is-open .contact-widget__toggle,
.contact-widget__toggle:hover {
  animation: none;
}

/* ============================================
   PANEL (OPTIONS MENU)
   ============================================ */

.contact-widget__panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 320px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 0 1px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.contact-widget.is-open .contact-widget__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (max-width: 640px) {
  .contact-widget__panel {
    width: calc(100vw - 32px);
    max-width: 320px;
  }
}

/* ============================================
   PANEL HEADER
   ============================================ */

.contact-widget__header {
  padding: 20px;
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  color: white;
  text-align: center;
}

.contact-widget__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.contact-widget__subtitle {
  font-size: 0.875rem;
  margin: 0;
  opacity: 0.9;
}

/* ============================================
   CONTACT OPTIONS
   ============================================ */

.contact-widget__options {
  padding: 12px;
}

.contact-widget__option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-decoration: none;
  color: #1f2937;
  transition: all 0.2s ease;
  margin-bottom: 8px;
}

.contact-widget__option:last-child {
  margin-bottom: 0;
}

.contact-widget__option:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.contact-widget__option:active {
  transform: translateX(0);
}

/* Option Icon */
.contact-widget__option-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.contact-widget__option--whatsapp .contact-widget__option-icon {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: white;
}

.contact-widget__option--phone .contact-widget__option-icon {
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
  color: white;
}

.contact-widget__option--email .contact-widget__option-icon {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: white;
}

.contact-widget__option--form .contact-widget__option-icon {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.contact-widget__option:hover .contact-widget__option-icon {
  transform: scale(1.1);
}

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

.contact-widget__option-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 2px;
  line-height: 1.3;
}

.contact-widget__option-desc {
  font-size: 0.8125rem;
  color: #6b7280;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Option Arrow */
.contact-widget__option-arrow {
  flex-shrink: 0;
  color: #9ca3af;
  transition: all 0.2s ease;
}

.contact-widget__option:hover .contact-widget__option-arrow {
  color: #047857;
  transform: translateX(2px);
}

/* ============================================
   PANEL FOOTER
   ============================================ */

.contact-widget__footer {
  padding: 12px 20px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.contact-widget__hours {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: #6b7280;
  justify-content: center;
}

.contact-widget__hours svg {
  flex-shrink: 0;
  color: #9ca3af;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus states */
.contact-widget__option:focus {
  outline: 2px solid #047857;
  outline-offset: 2px;
}

.contact-widget__toggle:focus-visible {
  outline: 2px solid #25d366;
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .contact-widget__toggle,
  .contact-widget__panel,
  .contact-widget__option,
  .contact-widget__option-icon,
  .contact-widget__option-arrow {
    transition: none;
  }
  
  .contact-widget__toggle {
    animation: none;
  }
}

/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

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

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