/* ============================================================================
   NARI NIKETAN — Agentic AI Concierge & Personal Stylist Styles
   ============================================================================ */

/* ── Floating Capsule Trigger ─────────────────────────────────────────────── */
.nari-ai-capsule {
  position: fixed;
  bottom: 24px;
  right: 24px;
  /* Respect iOS home indicator bar */
  bottom: max(24px, calc(16px + env(safe-area-inset-bottom, 0px)));
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #8B1A4A 0%, #D4AF37 100%);
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: 50px;
  box-shadow: 0 8px 24px rgba(139, 26, 74, 0.35), 0 2px 6px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.nari-ai-capsule:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 30px rgba(139, 26, 74, 0.45);
}

.nari-ai-capsule-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  animation: nariSparkle 2.5s infinite ease-in-out;
}

.nari-ai-badge-pulse {
  width: 8px;
  height: 8px;
  background: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10B981;
  animation: nariPulse 2s infinite ease-in-out;
}

@keyframes nariSparkle {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.2) rotate(15deg); }
}

@keyframes nariPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.7; }
}

/* ── AI Drawer Overlay ────────────────────────────────────────────────────── */
.nari-agent-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.nari-agent-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── AI Drawer Container ──────────────────────────────────────────────────── */
.nari-agent-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 440px;
  background: #FFFFFF;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.25);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Inter', sans-serif;
}

.nari-agent-overlay.active .nari-agent-drawer {
  transform: translateX(0);
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.nari-agent-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #8B1A4A 0%, #5B1030 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nari-agent-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nari-agent-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D4AF37 0%, #FFE082 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nari-agent-info h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.nari-agent-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #E2E8F0;
}

.nari-status-dot {
  width: 8px;
  height: 8px;
  background: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10B981;
}

.nari-agent-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nari-agent-btn-icon {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #FFFFFF;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s ease;
}

.nari-agent-btn-icon:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ── Chat Messages Body ───────────────────────────────────────────────────── */
.nari-agent-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #F8FAFC;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.nari-agent-body::-webkit-scrollbar {
  width: 5px;
}

.nari-agent-body::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 10px;
}

/* ── Message Bubbles ──────────────────────────────────────────────────────── */
.nari-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  gap: 6px;
  animation: fadeInMsg 0.25s ease forwards;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.nari-msg.nari-agent {
  align-self: flex-start;
}

.nari-msg.nari-user {
  align-self: flex-end;
}

.nari-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.5;
  word-break: break-word;
}

.nari-msg.nari-agent .nari-bubble {
  background: #FFFFFF;
  color: #1E293B;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid #E2E8F0;
}

.nari-msg.nari-user .nari-bubble {
  background: linear-gradient(135deg, #8B1A4A 0%, #A31E57 100%);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(139, 26, 74, 0.2);
}

.nari-msg-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.nari-btn-listen {
  background: transparent;
  border: 1px solid #E2E8F0;
  color: #64748B;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nari-btn-listen:hover {
  background: #F1F5F9;
  border-color: #8B1A4A;
  color: #8B1A4A;
}

.nari-typing-dot {
  width: 6px;
  height: 6px;
  background: #8B1A4A;
  border-radius: 50%;
  animation: typingBounce 1s infinite alternate;
}

@keyframes typingBounce {
  from { transform: translateY(0); }
  to { transform: translateY(-4px); }
}

/* ── Quick Suggestion Chips ───────────────────────────────────────────────── */
.nari-quick-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 8px 0;
  scrollbar-width: none;
}

.nari-quick-chips::-webkit-scrollbar {
  display: none;
}

.nari-chip {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.nari-chip:hover {
  background: #F1F5F9;
  border-color: #8B1A4A;
  color: #8B1A4A;
}

/* ── Interactive Action Cards ─────────────────────────────────────────────── */

/* 1. Product Carousel in Chat */
.nari-card-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.nari-product-mini-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease;
  cursor: pointer;
}

.nari-product-mini-card:hover {
  transform: translateY(-2px);
  border-color: #8B1A4A;
}

.nari-mini-card-img {
  aspect-ratio: 3/4;
  width: 100%;
  background: #F5ECD8;
  overflow: hidden;
}

.nari-mini-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nari-mini-card-body {
  padding: 8px;
}

.nari-mini-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #0F172A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 4px 0;
}

.nari-mini-card-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: #8B1A4A;
  margin: 0 0 6px 0;
}

.nari-mini-card-btn {
  width: 100%;
  padding: 6px 0;
  background: #FDF2F8;
  color: #8B1A4A;
  border: 1px solid #FBCFE8;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nari-mini-card-btn:hover {
  background: #8B1A4A;
  color: #FFFFFF;
}

/* 2. Order Tracking Card in Chat */
.nari-order-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 14px;
  margin-top: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.nari-order-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #F1F5F9;
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.nari-order-id {
  font-weight: 700;
  font-size: 0.9rem;
  color: #0F172A;
}

.nari-order-status-badge {
  background: #DEF7EC;
  color: #03543F;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

.nari-order-otp-box {
  background: #FEF3C7;
  border: 1px dashed #D97706;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nari-order-otp-code {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: #92400E;
}

/* 3. Coupon Card in Chat */
.nari-promo-card {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1px dashed #F59E0B;
  border-radius: 10px;
  padding: 12px;
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nari-promo-code {
  font-weight: 800;
  font-size: 0.95rem;
  color: #92400E;
}

.nari-promo-btn {
  background: #D97706;
  color: #FFFFFF;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

/* ── Footer Input Area ────────────────────────────────────────────────────── */
.nari-agent-footer {
  padding: 12px 16px;
  background: #FFFFFF;
  border-top: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nari-input-box {
  flex: 1;
  display: flex;
  align-items: center;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  border-radius: 24px;
  padding: 6px 14px;
  transition: border-color 0.2s ease;
}

.nari-input-box:focus-within {
  border-color: #8B1A4A;
  background: #FFFFFF;
}

.nari-input-field {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.92rem;
  color: #0F172A;
  padding: 6px 0;
  font-family: inherit;
}

.nari-btn-mic {
  background: transparent;
  border: none;
  color: #64748B;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.nari-btn-mic.listening {
  color: #EF4444;
  animation: pulseMic 1s infinite;
}

@keyframes pulseMic {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

.nari-btn-send {
  background: #8B1A4A;
  color: #FFFFFF;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.nari-btn-send:hover {
  background: #6D143A;
  transform: scale(1.05);
}

.nari-btn-send:disabled {
  background: #CBD5E1;
  cursor: not-allowed;
  transform: none;
}

/* ── Mobile Optimization ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  .nari-ai-capsule {
    /* Position: right-aligned, above iOS home indicator */
    bottom: 16px;
    bottom: max(16px, calc(12px + env(safe-area-inset-bottom, 0px)));
    right: 12px;
    /* Smaller on mobile — icon + short label only */
    padding: 9px 14px;
    font-size: 0.82rem;
    gap: 7px;
    /* Reduce shadow on mobile for perf */
    box-shadow: 0 4px 16px rgba(139, 26, 74, 0.3);
  }
  .nari-agent-drawer {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
  }
}

/* ── Very small phones (≤380px) ── */
@media (max-width: 380px) {
  .nari-ai-capsule {
    /* Show only icon on very narrow screens to save horizontal space */
    padding: 10px 12px;
    font-size: 0;
    /* Hide text but keep icon — use .nari-ai-capsule-icon which is still visible */
    gap: 0;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    justify-content: center;
  }
  .nari-ai-capsule-icon {
    font-size: 1.3rem;
  }
  .nari-ai-badge-pulse {
    position: absolute;
    top: 2px;
    right: 2px;
  }
}
