/**
 * GIWS CTA Buttons v2.1
 * Core Styling
 */

:root {
  --giws-wa: #25D366;
  --giws-call: #2F6FB1;
  --giws-text: #ffffff;
  --giws-bar-bg-transparent: rgba(255, 255, 255, 0);
  --giws-bar-bg-solid: rgba(255, 255, 255, 0.98);
  --giws-shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --giws-shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --giws-shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
  --giws-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --giws-font: 'Cairo', system-ui, -apple-system, sans-serif;
}

/* Base Styles */
.giws-cta-floating {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: var(--giws-font);
}

.giws-position-right {
  left: auto !important;
  right: 24px !important;
}

/* Adjust floating buttons if bar is active to avoid overlap */
.giws-bar-active .giws-cta-floating {
  bottom: calc(24px + 80px); /* Adjust based on bar height */
}

@media (max-width: 768px) {
  .giws-bar-active .giws-cta-floating {
    bottom: calc(16px + 70px);
  }
}

/* Button Base */
.giws-cta-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--giws-text) !important;
  box-shadow: var(--giws-shadow-md);
  transition: var(--giws-transition);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  padding: 0;
  margin: 0;
  border: none;
}

.giws-cta-btn:focus-visible {
  box-shadow: 0 0 0 4px rgba(47, 111, 177, 0.4);
}

.giws-cta-btn--call { background: var(--giws-call) !important; }
.giws-cta-btn--wa { background: var(--giws-wa) !important; }

/* Sizes */
.giws-cta-btn--small { width: 48px; height: 48px; }
.giws-cta-btn--medium { width: 60px; height: 60px; }
.giws-cta-btn--large { width: 72px; height: 72px; }

/* Shapes */
.giws-cta-btn--round { border-radius: 50% !important; }
.giws-cta-btn--soft-square { border-radius: 12px !important; }
.giws-cta-btn--capsule { border-radius: 30px !important; }

.giws-cta-icon {
  width: 45%;
  height: 45%;
  fill: currentColor;
  display: block;
}

/* Hover Effects */
.giws-cta-btn:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: var(--giws-shadow-lg);
}

/* Animations */
@keyframes giwsPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(47, 111, 177, 0.4); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(47, 111, 177, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(47, 111, 177, 0); }
}

.giws-animate.giws-cta-btn--call { animation: giwsPulse 3s infinite; }

/* Tooltip */
.giws-cta-tooltip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  background: rgba(0, 0, 0, 0.85);
  color: #fff !important;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--giws-transition);
  box-shadow: var(--giws-shadow-sm);
  z-index: 9999;
}

.giws-cta-tooltip::after {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: rgba(0, 0, 0, 0.85);
}

.giws-cta-btn:hover .giws-cta-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Tooltip Right Position */
.giws-position-right .giws-cta-tooltip {
  right: auto !important;
  left: calc(100% + 12px) !important;
  transform: translateY(-50%) translateX(-10px);
}

.giws-position-right .giws-cta-tooltip::after {
  left: auto !important;
  right: 100% !important;
  border-left-color: transparent !important;
  border-right-color: rgba(0, 0, 0, 0.85) !important;
}

/* Bar Style */
.giws-cta-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9997;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 24px);
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
  font-family: inherit;
  transition: var(--giws-transition);
  pointer-events: none;
}

.giws-cta-bar-btn {
  flex: 1 1 0;
  max-width: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 17px;
  color: var(--giws-text) !important;
  pointer-events: auto;
  transition: var(--giws-transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.giws-cta-bar-text {
  white-space: nowrap;
}

.giws-cta-bar-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
  flex-shrink: 0;
}

/* --- Modern Bar Design --- */
.giws-cta-bar.giws-bar-modern {
  background: var(--giws-bar-bg-solid);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
}

.giws-bar-modern .giws-cta-bar-btn--call { background: var(--giws-call) !important; }
.giws-bar-modern .giws-cta-bar-btn--wa { background: var(--giws-wa) !important; }

/* --- Classic Bar Design (Exact Old Version) --- */
.giws-cta-bar.giws-bar-classic {
  background: rgba(255, 255, 255, 0) !important;
  backdrop-filter: blur(0px);
  border-top: 1px solid transparent;
  box-shadow: none;
}

.giws-cta-bar.giws-bar-classic.giws-near-footer {
  background: rgba(255, 255, 255, 0.98) !important;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08) !important;
  border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
  backdrop-filter: blur(10px) !important;
}

.giws-bar-classic .giws-cta-bar-btn {
  border-radius: 20px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
  padding: 16px 24px !important;
  gap: 12px !important;
}

.giws-bar-classic .giws-cta-bar-btn--call {
  background: linear-gradient(135deg, #2F6FB1 0%, #1E5A8E 100%) !important;
}

.giws-bar-classic .giws-cta-bar-btn--wa {
  background: linear-gradient(135deg, #25D366 0%, #1EBE4F 100%) !important;
}

.giws-bar-classic .giws-cta-bar-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2) !important;
}

.giws-bar-classic .giws-cta-bar-text {
  color: #fff !important;
  font-weight: 800 !important;
  font-size: 18px !important;
  font-family: 'Cairo', sans-serif !important;
}

.giws-bar-classic .giws-cta-bar-icon {
  width: 24px !important;
  height: 24px !important;
  fill: #fff !important;
  order: 2 !important;
}

/* Responsive */

/* Responsive */

/* Responsive */
@media (max-width: 768px) {
  .giws-cta-floating { left: 16px; bottom: 16px; }
  .giws-position-right { right: 16px !important; }
  
  .giws-cta-bar {
    gap: 12px;
    padding: 14px 12px;
  }
  
  .giws-cta-bar-btn { 
    font-size: 16px; 
    padding: 14px 20px; 
    gap: 8px;
  }
}

/* Accessibility - Scoped */
@media (prefers-reduced-motion: reduce) {
  .giws-cta-floating *, .giws-cta-bar * { 
    animation-duration: 0.01ms !important; 
    transition-duration: 0.01ms !important; 
  }
}