/* =============================================
   WIDGETS - Toasts, Timer, Chat, Cookie, BackToTop
   ============================================= */

/* --- 1. Live Order Feed Toast --- */
.order-toast {
  position: fixed;
  bottom: 100px;
  left: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 900;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  transform: translateX(-120%);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 340px;
  pointer-events: none;
}

.order-toast.show {
  transform: translateX(0);
}

.order-toast-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.2rem;
}

.order-toast-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.order-toast-text strong {
  color: #fff;
  font-weight: 600;
}

.order-toast-text .toast-package {
  color: var(--accent-pink);
  font-weight: 600;
}

.order-toast-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.6;
  margin-top: 2px;
}

/* --- 2. Countdown Sale Timer Banner --- */
.sale-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  background: linear-gradient(135deg, #1a0a2e, #0d1117);
  border-bottom: 1px solid rgba(255, 45, 120, 0.3);
  padding: 10px 0;
  text-align: center;
  transform: translateY(-100%);
  transition: transform 0.4s ease;
}

.sale-banner.show {
  transform: translateY(0);
}

.sale-banner-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 0 24px;
}

.sale-banner-text {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}

.sale-banner-text .sale-highlight {
  color: var(--accent-gold);
  font-weight: 700;
}

.sale-banner-region {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.8;
}

.countdown {
  display: flex;
  gap: 6px;
  align-items: center;
}

.countdown-block {
  background: rgba(255, 45, 120, 0.15);
  border: 1px solid rgba(255, 45, 120, 0.25);
  border-radius: 6px;
  padding: 4px 8px;
  min-width: 42px;
  text-align: center;
}

.countdown-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.2rem;
  color: #fff;
  line-height: 1;
}

.countdown-label {
  font-size: 0.55rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.countdown-sep {
  color: var(--accent-pink);
  font-weight: 700;
  font-size: 1.1rem;
  opacity: 0.6;
}

.sale-banner-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  transition: color 0.2s;
}

.sale-banner-close:hover {
  color: #fff;
}

.sale-banner-cta {
  background: var(--gradient-pink);
  color: #fff;
  border: none;
  padding: 6px 18px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.sale-banner-cta:hover {
  box-shadow: 0 2px 12px rgba(255, 45, 120, 0.4);
}

/* Push navbar down when banner is visible */
body.sale-active .navbar {
  top: 46px;
}

body.sale-active .filters-bar {
  top: 106px;
}

body.sale-active .hero,
body.sale-active .reviews-hero {
  padding-top: 180px;
}

/* --- 3. Live Chat Widget --- */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 950;
}

.chat-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient-pink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255, 45, 120, 0.4);
  transition: var(--transition);
  position: relative;
  border: none;
}

.chat-bubble:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(255, 45, 120, 0.5);
}

.chat-bubble svg {
  color: #fff;
  transition: var(--transition);
}

.chat-bubble .chat-close-icon {
  display: none;
}

.chat-widget.open .chat-bubble .chat-open-icon { display: none; }
.chat-widget.open .chat-bubble .chat-close-icon { display: block; }

.chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: var(--accent-cyan);
  border-radius: 50%;
  border: 2px solid var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: #000;
}

.chat-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  height: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  transform: scale(0.8) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: bottom right;
}

.chat-widget.open .chat-window {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.chat-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(255, 45, 120, 0.1), rgba(168, 85, 247, 0.05));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-agent-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  position: relative;
}

.chat-agent-avatar::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #10b981;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

.chat-agent-info h4 {
  font-size: 0.9rem;
  color: #fff;
  font-weight: 600;
}

.chat-agent-info span {
  font-size: 0.75rem;
  color: #10b981;
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  animation: msgIn 0.3s ease;
}

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

.chat-msg.agent {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-msg.user {
  background: var(--accent-pink);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-msg.typing {
  background: rgba(255, 255, 255, 0.06);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 4px;
  padding: 14px 18px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.chat-input:focus {
  border-color: var(--accent-pink);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--gradient-pink);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: var(--transition);
  flex-shrink: 0;
}

.chat-send:hover {
  box-shadow: 0 2px 12px rgba(255, 45, 120, 0.4);
}

/* --- 5. Cookie Consent --- */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1050;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  transform: translateY(100%);
  transition: transform 0.4s ease;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
}

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

.cookie-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 600px;
}

.cookie-text a {
  color: var(--accent-pink);
  text-decoration: underline;
}

.cookie-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.cookie-accept {
  background: var(--gradient-pink);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}

.cookie-decline {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 20px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}

.cookie-decline:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

/* --- 6. Back to Top --- */
.back-to-top {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.3s ease;
  color: var(--text-muted);
}

.back-to-top.show {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: var(--accent-pink);
  color: var(--accent-pink);
  box-shadow: 0 4px 15px rgba(255, 45, 120, 0.2);
}

/* --- 7. Cart Sidebar --- */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.cart-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-dark);
  border-left: 1px solid var(--border);
  z-index: 1201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-sidebar.show {
  transform: translateX(0);
}

.cart-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-header h3 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.6rem;
  color: #fff;
  letter-spacing: 1px;
}

.cart-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.cart-close:hover {
  color: #fff;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.cart-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.cart-empty svg {
  opacity: 0.3;
  margin-bottom: 16px;
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  animation: msgIn 0.3s ease;
}

.cart-item-info h4 {
  font-size: 0.95rem;
  color: #fff;
  font-weight: 600;
}

.cart-item-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.cart-item-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cart-item-price {
  font-weight: 700;
  color: #fff;
}

.cart-item-price .original-price {
  text-decoration: line-through;
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.8rem;
  margin-right: 6px;
}

.cart-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.cart-item-remove:hover {
  color: #f43f5e;
}

.cart-footer {
  padding: 24px;
  border-top: 1px solid var(--border);
}

.cart-discount {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.cart-discount input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}

.cart-discount input:focus {
  border-color: var(--accent-pink);
}

.cart-discount button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
  white-space: nowrap;
}

.cart-discount button:hover {
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.cart-discount-applied {
  font-size: 0.8rem;
  color: #10b981;
  margin-bottom: 12px;
  display: none;
}

.cart-totals {
  margin-bottom: 16px;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.cart-total-row.total {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.cart-total-row .discount-amount {
  color: #10b981;
}

.cart-checkout-btn {
  width: 100%;
  padding: 14px;
  background: var(--gradient-pink);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}

.cart-checkout-btn:hover {
  box-shadow: 0 4px 20px rgba(255, 45, 120, 0.4);
  transform: translateY(-1px);
}

.cart-checkout-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Cart count badge on nav */
.nav-cart-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  transition: color 0.2s;
}

.nav-cart-btn:hover {
  color: #fff;
}

.nav-cart-count {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: var(--accent-pink);
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  display: none;
}

.nav-cart-count.has-items {
  display: flex;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .order-toast {
    left: 12px;
    right: 12px;
    max-width: none;
    bottom: 90px;
  }

  .chat-window {
    width: calc(100vw - 48px);
    height: 400px;
  }

  .sale-banner-inner {
    gap: 8px;
    font-size: 0.8rem;
  }

  .cookie-banner {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  .back-to-top {
    bottom: 90px;
    right: 12px;
  }
}
