/* ============================================================
   BCA STORE - LIVE CHAT ENGINE STYLES (WhatsApp-Inspired)
   Mobile-First, Edge-to-Edge Responsive Realtime Chat System
   ============================================================ */

:root {
  --lc-bg: #0b0f19;
  --lc-surface: #111827;
  --lc-surface-glass: rgba(17, 24, 39, 0.85);
  --lc-border: rgba(255, 255, 255, 0.08);
  --lc-border-glow: rgba(99, 102, 241, 0.3);
  --lc-text: #f9fafb;
  --lc-text-muted: #94a3b8;
  --lc-primary: #10b981;
  --lc-primary-rgb: 16, 185, 129;
  --lc-primary-glow: rgba(16, 185, 129, 0.35);
  --lc-accent: #6366f1;
  --lc-accent-glow: rgba(99, 102, 241, 0.3);
  --lc-self-bubble: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --lc-other-bubble: rgba(30, 41, 59, 0.85);
  --lc-other-border: rgba(255, 255, 255, 0.08);
  --lc-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  --lc-radius-bubble: 18px;
  --lc-ease: cubic-bezier(0.25, 1, 0.5, 1);
}

[data-theme="light"] {
  --lc-bg: #f8fafc;
  --lc-surface: #ffffff;
  --lc-surface-glass: rgba(255, 255, 255, 0.9);
  --lc-border: rgba(15, 23, 42, 0.08);
  --lc-border-glow: rgba(79, 70, 229, 0.25);
  --lc-text: #0f172a;
  --lc-text-muted: #64748b;
  --lc-primary: #059669;
  --lc-primary-glow: rgba(5, 150, 105, 0.2);
  --lc-accent: #4f46e5;
  --lc-self-bubble: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --lc-other-bubble: #ffffff;
  --lc-other-border: rgba(15, 23, 42, 0.08);
  --lc-shadow: 0 15px 35px -10px rgba(15, 23, 42, 0.12);
}

/* CONTAINER & LAYOUT */
.lc-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 520px;
  max-height: 100vh;
  width: 100%;
  background: var(--lc-bg);
  border-radius: 24px;
  border: 1px solid var(--lc-border);
  overflow: hidden;
  box-shadow: var(--lc-shadow);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  transition: background 0.3s var(--lc-ease), border-color 0.3s var(--lc-ease);
}

/* Standalone Fullscreen Page mode */
.lc-fullscreen {
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border: none !important;
}

/* OFFLINE BANNER */
.lc-offline-bar {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  z-index: 10;
  animation: lcSlideDown 0.3s var(--lc-ease);
}
.lc-offline-bar.show {
  display: flex;
}

/* STICKY CHAT HEADER */
.lc-header {
  position: sticky;
  top: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--lc-surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--lc-border);
  gap: 12px;
}

.lc-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lc-avatar-main {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lc-accent), var(--lc-primary));
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px var(--lc-primary-glow);
  position: relative;
  overflow: hidden;
}

.lc-avatar-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lc-avatar-status-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid var(--lc-surface);
}

.lc-header-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lc-header-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--lc-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lc-header-sub {
  font-size: 0.78rem;
  color: var(--lc-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lc-online-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #10b981;
  font-size: 0.72rem;
  font-weight: 700;
}

.lc-online-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: lcPulse 2s infinite;
}

.lc-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lc-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--lc-border);
  color: var(--lc-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s var(--lc-ease);
}
.lc-icon-btn:hover {
  background: rgba(var(--lc-primary-rgb), 0.15);
  border-color: var(--lc-primary);
  color: var(--lc-primary);
  transform: scale(1.06);
}

/* SEARCH BAR OVERLAY IN HEADER */
.lc-search-bar {
  display: none;
  align-items: center;
  gap: 8px;
  position: absolute;
  inset: 0;
  background: var(--lc-surface);
  padding: 10px 16px;
  z-index: 10;
  animation: lcFadeIn 0.2s ease;
}
.lc-search-bar.show {
  display: flex;
}
.lc-search-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--lc-border);
  border-radius: 100px;
  padding: 8px 16px;
  color: var(--lc-text);
  font-size: 0.85rem;
  outline: none;
}
.lc-search-input:focus {
  border-color: var(--lc-primary);
}

/* MESSAGES CONVERSATION AREA */
.lc-messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  position: relative;
  background: radial-gradient(circle at 50% 20%, rgba(99, 102, 241, 0.04) 0%, transparent 60%);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.lc-messages-area::-webkit-scrollbar {
  width: 5px;
}
.lc-messages-area::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

/* DATE DIVIDERS */
.lc-date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0;
  position: relative;
}
.lc-date-divider span {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--lc-border);
  color: var(--lc-text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 100px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .lc-date-divider span {
  background: rgba(255, 255, 255, 0.85);
  color: #64748b;
}

/* MESSAGE CARD ROW */
.lc-msg {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 82%;
  position: relative;
  animation: lcSlideUp 0.25s var(--lc-ease);
}
@media (max-width: 640px) {
  .lc-msg {
    max-width: 90%;
  }
}

.lc-msg.self {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.lc-msg.other {
  align-self: flex-start;
}

/* USER AVATAR ON MESSAGE */
.lc-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  border: 1px solid var(--lc-border);
}
.lc-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* MESSAGE BUBBLE */
.lc-msg-content {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lc-msg-bubble {
  position: relative;
  padding: 10px 14px;
  border-radius: var(--lc-radius-bubble);
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: break-word;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s var(--lc-ease);
}

.lc-msg.self .lc-msg-bubble {
  background: var(--lc-self-bubble);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 20px var(--lc-primary-glow);
}

.lc-msg.other .lc-msg-bubble {
  background: var(--lc-other-bubble);
  color: var(--lc-text);
  border: 1px solid var(--lc-other-border);
  border-bottom-left-radius: 4px;
}

/* PENDING OPTIMISTIC STATE */
.lc-msg.pending .lc-msg-bubble {
  opacity: 0.75;
}

/* SENDER NAME & BADGE */
.lc-msg-sender {
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.lc-msg-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 100px;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  font-weight: 700;
}
.lc-verified-icon {
  color: #38bdf8;
  font-size: 0.75rem;
}

/* QUOTED REPLY INSIDE BUBBLE */
.lc-quote-box {
  background: rgba(0, 0, 0, 0.15);
  border-left: 3px solid var(--lc-primary);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 6px;
  font-size: 0.78rem;
  cursor: pointer;
}
[data-theme="light"] .lc-msg.other .lc-quote-box {
  background: rgba(0, 0, 0, 0.05);
}
.lc-quote-author {
  font-weight: 800;
  color: var(--lc-primary);
  margin-bottom: 2px;
}
.lc-quote-snippet {
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.lc-msg.other .lc-quote-snippet {
  color: var(--lc-text-muted);
}

/* REACTION REPO BADGES ON BUBBLE */
.lc-reactions-row {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.lc-react-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--lc-border);
  padding: 2px 7px;
  border-radius: 100px;
  font-size: 0.72rem;
  color: var(--lc-text);
  cursor: pointer;
  backdrop-filter: blur(8px);
}

/* MESSAGE FOOTER TIME & TICKS */
.lc-msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 3px;
  user-select: none;
}
.lc-msg.other .lc-msg-meta {
  color: var(--lc-text-muted);
}

.lc-tick {
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}
.lc-tick.sending { color: rgba(255, 255, 255, 0.6); }
.lc-tick.sent { color: rgba(255, 255, 255, 0.85); }
.lc-tick.delivered { color: #60a5fa; }

/* HOVER QUICK ACTIONS BAR */
.lc-hover-actions {
  position: absolute;
  top: -14px;
  display: none;
  align-items: center;
  gap: 4px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--lc-border);
  border-radius: 100px;
  padding: 3px 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  z-index: 5;
  animation: lcPopIn 0.2s var(--lc-ease);
}
.lc-msg.self .lc-hover-actions { left: 8px; }
.lc-msg.other .lc-hover-actions { right: 8px; }

.lc-msg-content:hover .lc-hover-actions {
  display: flex;
}

.lc-hover-btn {
  background: transparent;
  border: none;
  color: var(--lc-text-muted);
  font-size: 0.85rem;
  padding: 3px;
  cursor: pointer;
  border-radius: 50%;
  transition: color 0.15s, transform 0.15s;
}
.lc-hover-btn:hover {
  color: var(--lc-primary);
  transform: scale(1.25);
}

/* TYPING INDICATOR */
.lc-typing-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  background: transparent;
  font-size: 0.78rem;
  color: var(--lc-text-muted);
}
.lc-typing-bar.show {
  display: flex;
}

.lc-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}
.lc-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lc-primary);
  animation: lcBounce 1.4s infinite ease-in-out both;
}
.lc-dots span:nth-child(1) { animation-delay: -0.32s; }
.lc-dots span:nth-child(2) { animation-delay: -0.16s; }

/* FLOATING SCROLL TO BOTTOM FAB */
.lc-scroll-fab {
  position: absolute;
  bottom: 80px;
  right: 20px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--lc-surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--lc-border);
  color: var(--lc-text);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 8;
  transition: all 0.2s var(--lc-ease);
}
.lc-scroll-fab:hover {
  background: var(--lc-primary);
  color: #ffffff;
  transform: translateY(-2px);
}
.lc-scroll-fab.show {
  display: flex;
}

/* REPLIES PREVIEW BAR ABOVE COMPOSER */
.lc-reply-target-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(16, 185, 129, 0.08);
  border-top: 1px solid rgba(16, 185, 129, 0.2);
  border-left: 4px solid var(--lc-primary);
  font-size: 0.8rem;
}
.lc-reply-target-bar.show {
  display: flex;
}
.lc-reply-info strong {
  color: var(--lc-primary);
  display: block;
}
.lc-reply-info p {
  color: var(--lc-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
  margin: 0;
}
.lc-reply-close {
  background: transparent;
  border: none;
  color: var(--lc-text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}
.lc-reply-close:hover {
  color: #ef4444;
}

/* BOTTOM FIXED MESSAGE COMPOSER */
.lc-composer {
  position: relative;
  z-index: 9;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  background: var(--lc-surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--lc-border);
}

.lc-input-wrapper {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--lc-border);
  border-radius: 24px;
  padding: 8px 14px;
  transition: border-color 0.2s var(--lc-ease), background 0.2s var(--lc-ease);
}
.lc-input-wrapper:focus-within {
  border-color: var(--lc-primary);
  background: rgba(255, 255, 255, 0.08);
}

.lc-composer-btn {
  background: transparent;
  border: none;
  color: var(--lc-text-muted);
  font-size: 1.2rem;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.lc-composer-btn:hover {
  color: var(--lc-primary);
  transform: scale(1.15);
}

/* AUTO-GROWING TEXTAREA */
.lc-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--lc-text);
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.4;
  resize: none;
  max-height: 120px;
  min-height: 24px;
  padding: 2px 0;
}
.lc-textarea::placeholder {
  color: var(--lc-text-muted);
}

/* SEND BUTTON */
.lc-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lc-primary), #059669);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--lc-primary-glow);
  transition: transform 0.2s var(--lc-ease), box-shadow 0.2s var(--lc-ease), background 0.2s var(--lc-ease);
  flex-shrink: 0;
}
.lc-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px var(--lc-primary-glow);
}
.lc-send-btn:active {
  transform: scale(0.94);
}
.lc-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* EMOJI PICKER POPOVER */
.lc-emoji-picker {
  display: none;
  position: absolute;
  bottom: 74px;
  left: 16px;
  background: var(--lc-surface);
  border: 1px solid var(--lc-border);
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  z-index: 20;
  width: 300px;
  max-height: 240px;
  overflow-y: auto;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  animation: lcPopIn 0.2s var(--lc-ease);
}
.lc-emoji-picker.show {
  display: grid;
}
.lc-emoji-item {
  font-size: 1.3rem;
  padding: 6px;
  text-align: center;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s, transform 0.15s;
}
.lc-emoji-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.25);
}

/* EMPTY STATE */
.lc-empty-state {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--lc-text-muted);
}
.lc-empty-state .icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  animation: lcFloat 3s infinite ease-in-out;
}
.lc-empty-state h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  color: var(--lc-text);
  margin-bottom: 6px;
}
.lc-empty-state p {
  font-size: 0.85rem;
  max-width: 280px;
  line-height: 1.5;
}

/* SKELETON LOADER */
.lc-skeleton-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 0;
}
.lc-skel-msg {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.lc-skel-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  animation: lcShimmer 1.5s infinite;
}
.lc-skel-bubble {
  height: 48px;
  width: 60%;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  animation: lcShimmer 1.5s infinite;
}

/* ANIMATIONS */
@keyframes lcSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes lcSlideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}
@keyframes lcPopIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes lcFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes lcBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}
@keyframes lcPulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@keyframes lcFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes lcShimmer {
  0% { opacity: 0.4; }
  50% { opacity: 0.8; }
  100% { opacity: 0.4; }
}
