/* static/css/components/whatsapp-popup.css */
/* WhatsApp Popup Component with SISCOM Brand Colors */

/* Configuration Variables */
:root {
  --whatsapp-phone: "+254745666660"; /* Change this number as needed */
  
  /* SISCOM Brand Colors */
  --siscom-primary: #040825;      /* SISCOM dark blue */
  --siscom-accent: #EB1260;       /* SISCOM magenta */
  --siscom-text: #E3E1EB;         /* SISCOM light text */
  --siscom-bg-secondary: #080C2D; /* Slightly lighter blue */
  --siscom-bg-tertiary: #0A0F35;  /* Even lighter blue */
  
  /* WhatsApp specific with SISCOM branding */
  --whatsapp-green: var(--siscom-accent);      /* Use SISCOM accent instead of green */
  --whatsapp-green-dark: #C7105B;              /* Darker version of SISCOM accent */
  --whatsapp-green-light: #F8E8F0;             /* Light version of SISCOM accent */
  --whatsapp-bg: var(--siscom-bg-secondary);   /* SISCOM background */
  --whatsapp-white: #ffffff;
  --whatsapp-gray: var(--siscom-text);
  --whatsapp-dark: var(--siscom-primary);
}

/* Widget Container */
.whatsapp-widget {
  position: fixed;
  bottom: clamp(1rem, 4vw, 2rem);
  right: clamp(1rem, 4vw, 2rem);
  z-index: 1000;
  font-family: var(--font-family);
}

/* Floating Button */
.whatsapp-button {
  width: clamp(3.5rem, 8vw, 4rem);
  height: clamp(3.5rem, 8vw, 4rem);
  background: linear-gradient(135deg, var(--siscom-accent) 0%, #C7105B 100%);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(235, 18, 96, 0.4);
  transition: all var(--transition-base);
  position: relative;
}

.whatsapp-button:hover {
  background: linear-gradient(135deg, #C7105B 0%, var(--siscom-accent) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(235, 18, 96, 0.6);
}

.whatsapp-button__icon {
  width: clamp(1.5rem, 4vw, 2rem);
  height: clamp(1.5rem, 4vw, 2rem);
  color: white;
}

/* Notification Badge */
.whatsapp-button__notification {
  position: absolute;
  top: -2px;
  right: -2px;
  width: clamp(0.75rem, 2vw, 1rem);
  height: clamp(0.75rem, 2vw, 1rem);
  background: var(--accent-secondary);
  border: 2px solid var(--siscom-primary);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.whatsapp-button__notification.hidden {
  display: none;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

/* Chat Window */
.whatsapp-chat {
  position: absolute;
  bottom: clamp(4.5rem, 10vw, 5.5rem);
  right: 0;
  width: clamp(280px, 90vw, 380px);
  max-height: clamp(400px, 70vh, 600px);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: clamp(0.75rem, 2vw, 1rem);
  box-shadow: 0 8px 24px rgba(4, 8, 37, 0.3);
  overflow: hidden;
  transform: scale(0.8) translateY(20px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
}

.whatsapp-chat.show {
  transform: scale(1) translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Chat Header */
.whatsapp-chat__header {
  background: linear-gradient(135deg, var(--siscom-primary) 0%, var(--siscom-bg-secondary) 100%);
  color: var(--siscom-text);
  padding: clamp(1rem, 3vw, 1.25rem);
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1rem);
  position: relative;
  border-bottom: 1px solid var(--border-primary);
}

.whatsapp-chat__avatar {
  width: clamp(2.5rem, 6vw, 3rem);
  height: clamp(2.5rem, 6vw, 3rem);
  background: var(--bg-primary);
  border: 2px solid var(--siscom-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.whatsapp-chat__logo {
  width: clamp(1.75rem, 4vw, 2.25rem);
  height: clamp(1.75rem, 4vw, 2.25rem);
  object-fit: contain;
}

.whatsapp-chat__info {
  flex: 1;
}

.whatsapp-chat__title {
  font-size: clamp(1rem, 3vw, 1.125rem);
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
  color: var(--text-primary);
}

.whatsapp-chat__subtitle {
  font-size: clamp(0.75rem, 2.5vw, 0.875rem);
  opacity: 0.8;
  margin: 0;
  line-height: 1.3;
  color: var(--text-secondary);
}

.whatsapp-chat__close {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: clamp(0.25rem, 1vw, 0.5rem);
  border-radius: 50%;
  transition: all var(--transition-fast);
  position: absolute;
  top: clamp(0.75rem, 2vw, 1rem);
  right: clamp(0.75rem, 2vw, 1rem);
}

.whatsapp-chat__close:hover {
  background: rgba(235, 18, 96, 0.1);
  color: var(--siscom-accent);
}

/* Chat Content */
.whatsapp-chat__content {
  background: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 20% 80%, rgba(235, 18, 96, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(4, 8, 37, 0.1) 0%, transparent 50%);
  padding: clamp(1rem, 3vw, 1.25rem);
  flex: 1;
  overflow-y: auto;
  min-height: 200px;
  max-height: 400px;
}

/* Loading Animation */
.whatsapp-chat__loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100px;
}

.whatsapp-chat__typing {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  padding: clamp(0.75rem, 2vw, 1rem);
  border-radius: clamp(0.5rem, 1.5vw, 0.75rem);
  border-radius: 1rem 1rem 1rem 0.25rem;
  box-shadow: 0 2px 8px rgba(4, 8, 37, 0.1);
}

.whatsapp-chat__dots {
  display: flex;
  gap: 0.25rem;
}

.whatsapp-chat__dots span {
  width: 0.5rem;
  height: 0.5rem;
  background: var(--siscom-accent);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.whatsapp-chat__dots span:nth-child(1) { animation-delay: 0s; }
.whatsapp-chat__dots span:nth-child(2) { animation-delay: 0.2s; }
.whatsapp-chat__dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: scale(1); opacity: 0.5; }
  30% { transform: scale(1.2); opacity: 1; }
}

/* Messages */
.whatsapp-chat__messages {
  animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.whatsapp-chat__time {
  text-align: center;
  margin-bottom: clamp(0.75rem, 2vw, 1rem);
}

.whatsapp-chat__time span {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: clamp(0.625rem, 2vw, 0.75rem);
  color: var(--text-secondary);
}

.whatsapp-chat__message {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  padding: clamp(0.75rem, 2.5vw, 1rem);
  border-radius: 1rem 1rem 1rem 0.25rem;
  box-shadow: 0 2px 8px rgba(4, 8, 37, 0.1);
  position: relative;
}

.whatsapp-chat__message::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -8px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-right-color: var(--bg-secondary);
  border-bottom-color: var(--bg-secondary);
  border-left: none;
  border-top: none;
}

.whatsapp-chat__text {
  font-size: clamp(0.875rem, 2.5vw, 0.9375rem);
  line-height: 1.4;
  margin: 0 0 clamp(0.5rem, 1.5vw, 0.75rem) 0;
  color: var(--text-primary);
}

.whatsapp-chat__text:last-child {
  margin-bottom: 0;
}

.whatsapp-chat__text strong {
  color: var(--siscom-accent);
}

.whatsapp-chat__benefits {
  margin: clamp(0.75rem, 2vw, 1rem) 0;
  padding: clamp(0.75rem, 2vw, 1rem);
  background: rgba(235, 18, 96, 0.05);
  border: 1px solid rgba(235, 18, 96, 0.1);
  border-radius: clamp(0.5rem, 1.5vw, 0.75rem);
}

.whatsapp-chat__list {
  margin: clamp(0.5rem, 1.5vw, 0.75rem) 0;
  padding-left: clamp(1rem, 3vw, 1.25rem);
}

.whatsapp-chat__list li {
  font-size: clamp(0.8125rem, 2.5vw, 0.875rem);
  line-height: 1.4;
  margin-bottom: clamp(0.25rem, 1vw, 0.5rem);
  color: var(--text-secondary);
}

/* Chat Footer */
.whatsapp-chat__footer {
  padding: clamp(1rem, 3vw, 1.25rem);
  border-top: 1px solid var(--border-primary);
  background: var(--bg-secondary);
}

.whatsapp-chat__cta {
  width: 100%;
  background: linear-gradient(135deg, var(--siscom-accent) 0%, #C7105B 100%);
  color: white;
  border: none;
  padding: clamp(0.75rem, 2.5vw, 1rem);
  border-radius: clamp(1.5rem, 3vw, 2rem);
  font-size: clamp(0.875rem, 2.5vw, 0.9375rem);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.5rem, 1.5vw, 0.75rem);
  box-shadow: 0 4px 12px rgba(235, 18, 96, 0.3);
}

.whatsapp-chat__cta:hover {
  background: linear-gradient(135deg, #C7105B 0%, var(--siscom-accent) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(235, 18, 96, 0.4);
}

.whatsapp-chat__cta-icon {
  width: clamp(1.125rem, 3vw, 1.25rem);
  height: clamp(1.125rem, 3vw, 1.25rem);
}

/* Mobile Optimizations */
@media (max-width: 480px) {
  .whatsapp-chat {
    width: calc(100vw - 2rem);
    max-height: 70vh;
  }
  
  .whatsapp-chat__content {
    max-height: 300px;
  }
}

/* Responsive adjustments */
@media (min-width: 1024px) {
  .whatsapp-widget {
    bottom: 2rem;
    right: 2rem;
  }
  
  .whatsapp-button {
    width: 4rem;
    height: 4rem;
  }
  
  .whatsapp-button__icon {
    width: 2rem;
    height: 2rem;
  }
}

/* Dark theme support */
[data-theme="light"] .whatsapp-chat {
  background: var(--light-bg-secondary);
  border-color: var(--light-border-primary);
}

[data-theme="light"] .whatsapp-chat__header {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  color: var(--light-text-primary);
  border-bottom-color: var(--light-border-primary);
}

[data-theme="light"] .whatsapp-chat__content {
  background: var(--light-bg-primary);
}

[data-theme="light"] .whatsapp-chat__message {
  background: var(--light-bg-secondary);
  border-color: var(--light-border-primary);
}

[data-theme="light"] .whatsapp-chat__message::before {
  border-right-color: var(--light-bg-secondary);
  border-bottom-color: var(--light-bg-secondary);
}

[data-theme="light"] .whatsapp-chat__text,
[data-theme="light"] .whatsapp-chat__list li {
  color: var(--light-text-primary);
}

[data-theme="light"] .whatsapp-chat__footer {
  background: var(--light-bg-secondary);
  border-top-color: var(--light-border-primary);
}