/**
 * Zaryon.pk — AI Shopping Assistant Widget Styles
 * Ultra-premium, light theme, accessible, mobile-first responsive design.
 */

/* ── 1. Floating Trigger Button ── */
.zyr-ai-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1045;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #FF6A00 0%, #FF8533 100%);
  color: #FFFFFF !important;
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-family: var(--zyr-font-display, 'Montserrat', sans-serif);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(255, 106, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none !important;
}

.zyr-ai-trigger:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 32px rgba(255, 106, 0, 0.45), 0 4px 10px rgba(0, 0, 0, 0.12);
  color: #FFFFFF !important;
}

.zyr-ai-trigger:active {
  transform: translateY(0) scale(0.98);
}

.zyr-ai-trigger-sparkle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  animation: zyrAiPulse 2s infinite ease-in-out;
}

@keyframes zyrAiPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(255,255,255,0.6)); }
  50% { transform: scale(1.15) rotate(5deg); filter: drop-shadow(0 0 6px rgba(255,255,255,0.9)); }
}

.zyr-ai-trigger-label {
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.zyr-ai-trigger-badge {
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

/* ── 2. Dimmed Backdrop ── */
.zyr-ai-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-out;
}

.zyr-ai-backdrop.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* ── 3. Chat Drawer (Desktop: Right-Side Panel) ── */
.zyr-ai-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #FFFFFF;
  border-left: 1px solid #E2E8F0;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.15);
  z-index: 1055;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--zyr-font-body, 'Poppins', sans-serif);
}

.zyr-ai-drawer.is-open {
  transform: translateX(0);
}

/* ── 4. Drawer Header ── */
.zyr-ai-header {
  padding: 16px 20px;
  background: #FFFFFF;
  border-bottom: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.zyr-ai-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zyr-ai-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #FF6A00 0%, #FF8533 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(255, 106, 0, 0.25);
  flex-shrink: 0;
}

.zyr-ai-title-wrap {
  line-height: 1.25;
}

.zyr-ai-title {
  font-family: var(--zyr-font-display, 'Montserrat', sans-serif);
  font-size: 15px;
  font-weight: 800;
  color: #0F172A;
  margin: 0;
}

.zyr-ai-status {
  font-size: 11px;
  color: #16A34A;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}

.zyr-ai-status-dot {
  width: 7px;
  height: 7px;
  background: #16A34A;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(22, 163, 74, 0.6);
  animation: zyrAiBlink 2s infinite;
}

@keyframes zyrAiBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.zyr-ai-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.zyr-ai-control-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748B;
  cursor: pointer;
  transition: all 0.15s;
}

.zyr-ai-control-btn:hover {
  background: #F1F5F9;
  color: #0F172A;
}

/* ── 5. Messages Container ── */
.zyr-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #F8FAFC;
  scroll-behavior: smooth;
}

.zyr-ai-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: zyrAiSlideUp 0.25s ease-out;
}

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

.zyr-ai-msg-user {
  align-self: flex-end;
}

.zyr-ai-msg-assistant {
  align-self: flex-start;
}

.zyr-ai-bubble {
  padding: 12px 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.zyr-ai-msg-user .zyr-ai-bubble {
  background: linear-gradient(135deg, #FF6A00 0%, #FF8533 100%);
  color: #FFFFFF;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 14px rgba(255, 106, 0, 0.22);
}

.zyr-ai-msg-assistant .zyr-ai-bubble {
  background: #FFFFFF;
  color: #1E293B;
  border: 1px solid #E2E8F0;
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.zyr-ai-bubble p {
  margin-bottom: 8px;
}
.zyr-ai-bubble p:last-child {
  margin-bottom: 0;
}

.zyr-ai-bubble strong {
  font-weight: 700;
}

.zyr-ai-bubble a {
  color: #EA580C;
  font-weight: 700;
  text-decoration: underline;
}

.zyr-ai-time {
  font-size: 10px;
  color: #94A3B8;
  margin-top: 4px;
  padding: 0 4px;
}

.zyr-ai-msg-user .zyr-ai-time {
  text-align: right;
}

/* ── 6. Product Recommendation Cards inside Chat ── */
.zyr-ai-product-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  width: 100%;
}

.zyr-ai-pcard {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: transform 0.15s, border-color 0.15s;
}

.zyr-ai-pcard:hover {
  transform: translateY(-2px);
  border-color: #FF6A00;
}

.zyr-ai-pcard-img {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #F1F5F9;
  background: #F8FAFC;
  flex-shrink: 0;
}

.zyr-ai-pcard-body {
  flex: 1;
  min-width: 0;
}

.zyr-ai-pcard-title {
  font-size: 12px;
  font-weight: 700;
  color: #0F172A;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-decoration: none;
  line-height: 1.35;
}

.zyr-ai-pcard-title:hover {
  color: #FF6A00;
}

.zyr-ai-pcard-price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.zyr-ai-pcard-price {
  font-family: var(--zyr-font-display, 'Montserrat', sans-serif);
  font-size: 13px;
  font-weight: 800;
  color: #FF6A00;
}

.zyr-ai-pcard-old-price {
  font-size: 10px;
  color: #94A3B8;
  text-decoration: line-through;
}

.zyr-ai-pcard-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.zyr-ai-pcard-btn-view {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  background: #F1F5F9;
  color: #334155;
  text-decoration: none;
  border: 1px solid #E2E8F0;
  transition: all 0.15s;
}

.zyr-ai-pcard-btn-view:hover {
  background: #E2E8F0;
  color: #0F172A;
}

.zyr-ai-pcard-btn-cart {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  background: #FF6A00;
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.zyr-ai-pcard-btn-cart:hover {
  background: #E65C00;
}

/* ── 7. Suggested Prompts Chips ── */
.zyr-ai-suggested-wrap {
  padding: 8px 16px 12px;
  background: #FFFFFF;
  border-top: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  flex-shrink: 0;
}

.zyr-ai-suggested-wrap::-webkit-scrollbar {
  display: none;
}

.zyr-ai-chip {
  background: #FFF7ED;
  color: #EA580C;
  border: 1px solid #FFEDD5;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.zyr-ai-chip:hover {
  background: #FFEDD5;
  color: #C2410C;
  border-color: #FED7AA;
  transform: translateY(-1px);
}

/* ── 8. Typing Loading State ── */
.zyr-ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 10px 16px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.zyr-ai-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94A3B8;
  animation: zyrAiBounce 1.4s infinite ease-in-out both;
}

.zyr-ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.zyr-ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.zyr-ai-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes zyrAiBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; background: #FF6A00; }
}

/* ── 9. Error State & Retry ── */
.zyr-ai-error-banner {
  background: #FEF2F2;
  border: 1px solid #FEE2E2;
  color: #B91C1C;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.zyr-ai-retry-btn {
  background: #EF4444;
  color: #FFFFFF;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.zyr-ai-retry-btn:hover {
  background: #DC2626;
}

/* ── 10. Drawer Footer & Input Box ── */
.zyr-ai-footer {
  padding: 12px 16px;
  background: #FFFFFF;
  border-top: 1px solid #F1F5F9;
  flex-shrink: 0;
}

.zyr-ai-input-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 14px;
  padding: 6px 8px 6px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.zyr-ai-input-form:focus-within {
  border-color: #FF6A00;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(255, 106, 0, 0.12);
}

.zyr-ai-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  color: #0F172A;
  max-height: 100px;
  padding: 4px 0;
}

.zyr-ai-textarea::placeholder {
  color: #94A3B8;
}

.zyr-ai-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #FF6A00;
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.zyr-ai-send-btn:hover {
  background: #E65C00;
  transform: scale(1.04);
}

.zyr-ai-send-btn:disabled {
  background: #E2E8F0;
  color: #94A3B8;
  cursor: not-allowed;
  transform: none;
}

.zyr-ai-footer-disclaimer {
  font-size: 10.5px;
  color: #94A3B8;
  text-align: center;
  margin-top: 8px;
}

/* ── 11. Minimized Floating Pill Dock ── */
.zyr-ai-minimized-bar {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1045;
  background: #FFFFFF;
  border: 1.5px solid #FF6A00;
  border-radius: 999px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: all 0.2s;
  display: none;
}

.zyr-ai-minimized-bar.is-active {
  display: flex;
}

.zyr-ai-minimized-bar:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255, 106, 0, 0.25);
}

/* ── 12. Mobile Responsive Rules ── */
@media (max-width: 768px) {
  .zyr-ai-trigger {
    bottom: 74px; /* avoid overlapping mobile navbar if any */
    right: 16px;
    padding: 10px 16px;
    font-size: 13px;
  }
  
  .zyr-ai-drawer {
    width: 100%;
    max-width: 100vw;
    border-left: none;
  }

  .zyr-ai-minimized-bar {
    bottom: 74px;
    right: 16px;
  }
}

/* ── 13. Checkout Protection (Non-blocking) ── */
body.pm-checkout-page .zyr-ai-trigger,
body.pm-checkout-page .zyr-ai-minimized-bar {
  bottom: 90px;
  opacity: 0.85;
}
