/* ═══════════════════════════════════════════════════
   Upgrades - Chat, Lightbox, Slider, Transitions,
   Cookie Consent, Commission Tracker, Carousel
   ═══════════════════════════════════════════════════ */

/* ═══ FLOATING CHAT WIDGET ════════════════════════ */
.chat-widget {
  position: fixed;
  bottom: var(--space-xl);
  right: calc(var(--space-xl) + 60px);
  z-index: var(--z-modal);
}

.chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow-strong);
  cursor: pointer;
  border: none;
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: var(--z-modal);
  transition: all var(--transition-base);
}

.chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 0 40px rgba(108, 92, 231, 0.6);
}

.chat-toggle.active {
  background: var(--bg-tertiary);
  box-shadow: var(--shadow-md);
}

.chat-toggle .chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--fw-bold);
  border: 2px solid var(--bg-primary);
}

.chat-panel {
  position: fixed;
  bottom: calc(var(--space-xl) + 70px);
  right: var(--space-xl);
  width: 360px;
  max-height: 500px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all var(--transition-base);
}

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

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  background: var(--gradient-primary);
  color: white;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
}

.chat-header-info div strong {
  display: block;
  font-size: var(--fs-sm);
}

.chat-header-info div span {
  font-size: var(--fs-xs);
  opacity: 0.8;
}

.chat-close {
  color: white;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}

.chat-close:hover {
  opacity: 1;
}

.chat-messages {
  flex: 1;
  padding: var(--space-lg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-height: 300px;
}

.chat-bubble {
  max-width: 85%;
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  animation: chatBubbleIn 0.3s ease;
}

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

.chat-bot {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-user {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-bubble a {
  color: var(--primary-light);
  text-decoration: underline;
}

.chat-user a {
  color: rgba(255, 255, 255, 0.9);
}

.chat-time {
  display: block;
  font-size: 10px;
  opacity: 0.5;
  margin-top: 4px;
}

.chat-form {
  display: flex;
  padding: var(--space-md);
  gap: var(--space-sm);
  border-top: 1px solid var(--border-color);
}

.chat-form input {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--fs-sm);
}

.chat-form input:focus {
  outline: none;
  border-color: var(--primary);
}

.chat-form button {
  padding: var(--space-sm) var(--space-md);
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.chat-form button:hover {
  transform: scale(1.05);
}

/* ═══ PORTFOLIO LIGHTBOX ═════════════════════════ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transform: scale(0.9);
  transition: transform var(--transition-base);
}

.lightbox.open .lightbox-content {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: var(--space-xl);
  right: var(--space-xl);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: background var(--transition-fast);
  z-index: 1;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-media {
  aspect-ratio: 16/9;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Uploaded portfolio image / video — `contain` (not cover) so the
   client sees the whole asset without cropping at this enlarged size. */
.lightbox-media img,
.lightbox-media video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox-media video {
  background: #000;
}

.lightbox-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  gap: var(--space-md);
  color: var(--text-tertiary);
  background:
    radial-gradient(at top right, rgba(108, 92, 231, 0.15), transparent 60%),
    radial-gradient(at bottom left, rgba(236, 72, 153, 0.12), transparent 60%);
}

.lightbox-placeholder i {
  width: 64px;
  height: 64px;
  padding: 16px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  opacity: 1;
  box-shadow: 0 8px 24px rgba(108, 92, 231, 0.3);
}

.lightbox-info {
  padding: var(--space-2xl);
}

.lightbox-info h2 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-md);
}

.lightbox-info p {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.lightbox-tags {
  display: flex;
  gap: var(--space-sm);
}

/* ═══ BEFORE/AFTER IMAGE SLIDER ═════════════════ */
.ba-showcase-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
}

.ba-showcase-item {
  padding: var(--space-lg);
  overflow: hidden;
}

.ba-showcase-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.ba-showcase-label i {
  color: var(--primary);
}

.ba-showcase-label h3 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  margin: 0;
}

.before-after-slider {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  cursor: ew-resize;
  user-select: none;
  aspect-ratio: 16/10;
  background: var(--bg-tertiary);
}

.ba-before, .ba-after {
  position: absolute;
  inset: 0;
}

.ba-after {
  z-index: 1;
}

.ba-after img,
.ba-after video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ba-before {
  width: 50%;
  overflow: hidden;
  z-index: 2;
}

.ba-before img,
.ba-before video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* Keep media at full slider width so it doesn't squish */
  min-width: 0;
}

.ba-label {
  position: absolute;
  top: var(--space-md);
  padding: 4px 14px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  color: white;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  border-radius: var(--radius-full);
  z-index: 5;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ba-before .ba-label {
  left: var(--space-md);
}

.ba-after .ba-label {
  right: var(--space-md);
}

.ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: white;
  z-index: 10;
  cursor: ew-resize;
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

.ba-handle-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), 0 0 20px rgba(108, 92, 231, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-primary);
}

.ba-handle-icon i {
  width: 16px;
  height: 16px;
  color: #1a1a2e;
}

@media (max-width: 768px) {
  .ba-showcase-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .ba-showcase-item {
    padding: var(--space-md);
  }

  .ba-handle-icon {
    width: 32px;
    height: 32px;
  }
}

/* ═══ TESTIMONIALS CAROUSEL ENHANCEMENTS ═════════ */
.testimonials-carousel {
  position: relative;
  padding: 0 50px;
}

.testimonials-carousel.is-dragging .testimonial-track {
  transition: none;
  cursor: grabbing;
}

.testimonials-carousel .testimonial-track {
  cursor: grab;
}

.carousel-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
}

.carousel-dot.active {
  background: var(--primary);
  border-color: var(--primary);
  width: 28px;
  border-radius: var(--radius-full);
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-60%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 2;
}

.carousel-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: var(--shadow-glow);
}

.carousel-prev { left: 0; }
.carousel-next { right: 0; }

/* ═══ COOKIE CONSENT BANNER ═════════════════════ */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: var(--space-lg) var(--space-xl);
  z-index: var(--z-modal);
  transform: translateY(100%);
  transition: transform var(--transition-slow);
}

.cookie-banner.visible {
  transform: translateY(0);
}

.cookie-content {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
}

.cookie-text {
  flex: 1;
}

.cookie-text p {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.cookie-text a {
  color: var(--primary-light);
  text-decoration: underline;
}

.cookie-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* ═══ PAGE TRANSITION ═══════════════════════════ */
.page-transition {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: var(--z-preloader);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.page-transition.loaded {
  opacity: 0;
}

.page-transition.exiting {
  opacity: 1;
  pointer-events: all;
}

/* ═══ COMMISSION TRACKER ════════════════════════ */
.tracker-card {
  padding: var(--space-2xl);
}

.tracker-search {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.tracker-search input {
  flex: 1;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: var(--fs-sm);
}

.tracker-search input:focus {
  outline: none;
  border-color: var(--primary);
}

.tracker-status {
  animation: fadeInUp 0.4s ease;
}

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

.tracker-progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-xl);
}

.tracker-progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width 1s ease;
}

.tracker-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.tracker-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  position: relative;
}

.step-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
}

.tracker-step.completed .step-dot {
  background: var(--success);
  border-color: var(--success);
}

.tracker-step.active .step-dot {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(108, 92, 231, 0.5);
  animation: pulse 2s infinite;
}

.tracker-step.completed span,
.tracker-step.active span {
  color: var(--text-primary);
  font-weight: var(--fw-medium);
}

.tracker-note {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  padding: var(--space-md);
  background: rgba(108, 92, 231, 0.05);
  border-radius: var(--radius-md);
  border: 1px solid rgba(108, 92, 231, 0.1);
}

/* ═══ RESPONSIVE FOR ALL UPGRADES ════════════════ */
@media (max-width: 768px) {
  .chat-panel {
    width: calc(100vw - var(--space-2xl));
    right: var(--space-md);
    bottom: calc(var(--space-xl) + 65px);
  }

  .cookie-content {
    flex-direction: column;
    text-align: center;
  }

  .testimonials-carousel {
    padding: 0;
  }

  .carousel-btn {
    display: none;
  }

  .tracker-steps {
    gap: var(--space-xs);
  }

  .tracker-step span {
    font-size: 9px;
  }
}

@media (max-width: 1024px) and (min-width: 769px) {
  .testimonials-carousel {
    padding: 0 44px;
  }
}
