/* WhatsBot custom styles */

/* Smooth transitions for status indicators */
.status-dot {
  transition: background-color 0.3s ease;
}

/* QR code image styling */
.qr-image {
  image-rendering: pixelated;
}

/* Pulse animation for loading states */
@keyframes pulse-slow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-pulse-slow {
  animation: pulse-slow 2s ease-in-out infinite;
}

/* ── WhatsApp Web replica styles ──────────────────────────────── */

/* Incoming message tail (left, white) */
.msg-tail-in {
  position: relative;
}
.msg-tail-in::before {
  content: '';
  position: absolute;
  top: 0;
  left: -8px;
  width: 0;
  height: 0;
  border-top: 8px solid #ffffff;
  border-left: 8px solid transparent;
}

/* Outgoing message tail (right, light green) */
.msg-tail-out {
  position: relative;
}
.msg-tail-out::before {
  content: '';
  position: absolute;
  top: 0;
  right: -8px;
  width: 0;
  height: 0;
  border-top: 8px solid #d9fdd3;
  border-right: 8px solid transparent;
}

/* Thin scrollbar like WhatsApp */
.wa-scrollbar::-webkit-scrollbar {
  width: 6px;
}
.wa-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.wa-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}
.wa-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* Contact row hover transition */
.wa-contact-row {
  transition: background-color 0.15s ease;
}

/* WhatsApp chat doodle background pattern */
.wa-chat-pattern {
  background-color: #efeae2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'%3E%3Cg fill='%23c8c3ba' fill-opacity='0.2'%3E%3Cpath d='M20 15a5 5 0 110 10 5 5 0 010-10zm0 2a3 3 0 100 6 3 3 0 000-6z'/%3E%3Cpath d='M80 45l-4 8h8l-4-8zm0 2l2.5 5h-5l2.5-5z'/%3E%3Crect x='140' y='15' width='8' height='10' rx='1' fill='none' stroke='%23c8c3ba' stroke-opacity='0.2'/%3E%3Ccircle cx='200' cy='20' r='4' fill='none' stroke='%23c8c3ba' stroke-opacity='0.2'/%3E%3Cpath d='M258 15l6 5-6 5V15zm1 1.8v6.4l4.3-3.2-4.3-3.2z'/%3E%3Cpath d='M20 75a6 6 0 014 2l-1 1a4.8 4.8 0 00-7 0l-1-1a6 6 0 014-2z'/%3E%3Cpath d='M78 80h4v1h-4v3h-1v-3h-4v-1h4v-4h1v4z'/%3E%3Cpath d='M135 75h10v1h-10v-1zm0 4h7v1h-7v-1z'/%3E%3Ccircle cx='200' cy='80' r='5' fill='none' stroke='%23c8c3ba' stroke-opacity='0.2'/%3E%3Cpath d='M195 78l3 2 3-2v5l-3 2-3-2v-5z' fill='none' stroke='%23c8c3ba' stroke-opacity='0.15'/%3E%3Cpath d='M260 75c2 0 4 2 4 4s-2 4-4 4-4-2-4-4 2-4 4-4zm0 1.5c-1.4 0-2.5 1.1-2.5 2.5s1.1 2.5 2.5 2.5 2.5-1.1 2.5-2.5-1.1-2.5-2.5-2.5z'/%3E%3Cpath d='M17 135h6l-3 6-3-6zm3 1.5l-1.8 3.5h3.6l-1.8-3.5z'/%3E%3Cpath d='M80 135a4 4 0 110 8 4 4 0 010-8zm0 1.5a2.5 2.5 0 100 5 2.5 2.5 0 000-5z'/%3E%3Cpath d='M140 138h3v-3h1v3h3v1h-3v3h-1v-3h-3v-1z'/%3E%3Cpath d='M195 135h10v8h-10v-8zm1 1v6h8v-6h-8z'/%3E%3Ccircle cx='260' cy='140' r='3'/%3E%3Cpath d='M20 200l4-3v6l-4-3zm1 0l2 1.5v-3l-2 1.5z'/%3E%3Cpath d='M75 195h10v1h-10v-1zm2 3h6v1h-6v-1z'/%3E%3Cpath d='M140 197a3 3 0 110 6 3 3 0 010-6z'/%3E%3Cpath d='M197 195l3 5 3-5h-6zm3 1.5l1.8 3h-3.6l1.8-3z'/%3E%3Cpath d='M258 197c1.7 0 3 1.3 3 3s-1.3 3-3 3-3-1.3-3-3 1.3-3 3-3z' fill='none' stroke='%23c8c3ba' stroke-opacity='0.2'/%3E%3Cpath d='M18 260h4v4h-4v-4zm.8.8v2.4h2.4v-2.4h-2.4z'/%3E%3Ccircle cx='80' cy='262' r='3.5' fill='none' stroke='%23c8c3ba' stroke-opacity='0.2'/%3E%3Cpath d='M138 258l4 4 4-4' fill='none' stroke='%23c8c3ba' stroke-opacity='0.2' stroke-width='1.2'/%3E%3Cpath d='M198 260a2 2 0 012 2c0 1.1-.9 2-2 2s-2-.9-2-2a2 2 0 012-2z'/%3E%3Cpath d='M256 258h8v6h-8v-6zm1 1v4h6v-4h-6z'/%3E%3C/g%3E%3C/svg%3E");
}

/* WhatsApp bubble shadow */
.wa-bubble {
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Empty state background (WhatsApp's darker panel) */
.wa-empty-bg {
  background-color: #f0f2f5;
  border-left: 1px solid #e9edef;
}

/* Flixly 3D interactive skin */
.flixly-3d-shell {
  position: relative;
  isolation: isolate;
  perspective: 1200px;
  --fx-mx: 0.5;
  --fx-my: 0.5;
  --fx-tilt-x: calc((var(--fx-my) - 0.5) * -7deg);
  --fx-tilt-y: calc((var(--fx-mx) - 0.5) * 9deg);
}

.flixly-3d-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(50% 45% at 8% 15%, rgba(16, 185, 129, 0.18), transparent 70%),
    radial-gradient(45% 40% at 90% 85%, rgba(59, 130, 246, 0.14), transparent 72%),
    linear-gradient(120deg, #f3f7fb 0%, #edf5f2 45%, #eef3f9 100%);
  animation: flixly-atmo-shift 12s ease-in-out infinite alternate;
}

.flixly-3d-shell::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.22;
  animation: flixly-grid-float 18s linear infinite;
}

@keyframes flixly-grid-float {
  0% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-12px, -8px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

@keyframes flixly-atmo-shift {
  0% {
    filter: saturate(1) hue-rotate(0deg);
    transform: scale(1);
  }
  100% {
    filter: saturate(1.12) hue-rotate(8deg);
    transform: scale(1.03);
  }
}

.flixly-3d-sidebar,
.flixly-3d-main,
.flixly-3d-list,
.flixly-3d-detail {
  position: relative;
  transform-style: preserve-3d;
}

.flixly-3d-sidebar {
  backdrop-filter: blur(12px);
  box-shadow: 10px 0 24px rgba(15, 23, 42, 0.08);
  transform: translateZ(36px) rotateX(var(--fx-tilt-x));
  transition: transform 0.18s ease-out;
}

.flixly-3d-main {
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.28);
  transform: translateZ(12px) rotateY(calc(var(--fx-tilt-y) * 0.45));
  transition: transform 0.18s ease-out;
}

.flixly-3d-header {
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.12);
}

.flixly-3d-header::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.14), transparent 40%, rgba(255, 255, 255, 0.08));
  animation: flixly-sheen 7s ease-in-out infinite;
}

@keyframes flixly-sheen {
  0% { transform: translateX(-5%); opacity: 0.4; }
  50% { transform: translateX(4%); opacity: 0.75; }
  100% { transform: translateX(-5%); opacity: 0.4; }
}

.flixly-3d-search {
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow:
    0 4px 12px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transform: translateZ(16px);
}

.flixly-3d-card {
  transform: translateZ(0);
  transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.18s ease;
}

.flixly-3d-card:hover {
  transform: translate3d(8px, -3px, 28px) rotateX(2.8deg) rotateY(-2.2deg);
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.18);
}

.flixly-3d-card.bg-wa-selected {
  box-shadow:
    inset 2px 0 0 rgba(16, 185, 129, 0.72),
    0 8px 20px rgba(15, 23, 42, 0.12);
}

.flixly-3d-topbar {
  backdrop-filter: blur(8px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 8px 24px rgba(15, 23, 42, 0.16);
}

.flixly-3d-canvas {
  position: relative;
  transform: translateZ(10px);
}

.flixly-3d-canvas::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(55% 45% at 5% 10%, rgba(255, 255, 255, 0.14), transparent 62%),
    radial-gradient(50% 45% at 98% 96%, rgba(16, 185, 129, 0.08), transparent 68%);
  animation: flixly-canvas-glow 10s ease-in-out infinite alternate;
}

@keyframes flixly-canvas-glow {
  0% { opacity: 0.35; transform: translate3d(-2px, -2px, 0) scale(1); }
  100% { opacity: 0.82; transform: translate3d(3px, 2px, 0) scale(1.04); }
}

.flixly-3d-bubble {
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.flixly-3d-bubble:hover {
  transform: translate3d(0, -3px, 20px) scale(1.008);
  box-shadow: 0 14px 30px rgba(10, 20, 28, 0.24);
  filter: saturate(1.06);
}

.flixly-3d-composer {
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
}

/* Slide-in from right animation for contact info panel */
@keyframes slide-in-right {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.animate-slide-in-right {
  animation: slide-in-right 0.25s ease-out;
}

/* Theme: dark */
html.dark {
  color-scheme: dark;
}

html.dark .bg-wa-bg { background-color: #111b21 !important; }
html.dark .bg-wa-panel { background-color: #202c33 !important; }
html.dark .bg-wa-hover { background-color: #2a3942 !important; }
html.dark .bg-wa-selected { background-color: #2a3942 !important; }
html.dark .bg-wa-inputBg { background-color: #2a3942 !important; }
html.dark .border-wa-border { border-color: #2a3942 !important; }
html.dark .text-wa-text { color: #e9edef !important; }
html.dark .text-wa-secondary { color: #8696a0 !important; }

html.dark .wa-chat-pattern {
  background-color: #0b141a;
}

html.dark .flixly-3d-shell::before {
  background:
    radial-gradient(55% 48% at 6% 10%, rgba(16, 185, 129, 0.13), transparent 68%),
    radial-gradient(50% 45% at 95% 92%, rgba(59, 130, 246, 0.1), transparent 70%),
    linear-gradient(130deg, #071018 0%, #0c1a24 45%, #10212f 100%);
}

html.dark .flixly-3d-shell::after {
  opacity: 0.16;
  background-image:
    linear-gradient(90deg, rgba(148, 163, 184, 0.14) 1px, transparent 1px),
    linear-gradient(rgba(148, 163, 184, 0.1) 1px, transparent 1px);
}

html.dark .flixly-3d-sidebar {
  box-shadow: 8px 0 30px rgba(2, 10, 18, 0.55);
}

html.dark .flixly-3d-main {
  box-shadow: inset 1px 0 0 rgba(148, 163, 184, 0.18);
}

html.dark .flixly-3d-search {
  border-color: rgba(71, 85, 105, 0.55);
  box-shadow:
    0 8px 18px rgba(2, 10, 18, 0.35),
    inset 0 1px 0 rgba(148, 163, 184, 0.12);
}

html.dark .flixly-3d-card:hover {
  box-shadow: 0 18px 32px rgba(2, 10, 18, 0.56);
}

html.dark .flixly-3d-card.bg-wa-selected {
  box-shadow:
    inset 2px 0 0 rgba(52, 211, 153, 0.85),
    0 12px 24px rgba(2, 10, 18, 0.48);
}

html.dark .flixly-3d-canvas::before {
  background:
    radial-gradient(60% 50% at 4% 8%, rgba(15, 23, 42, 0.2), transparent 68%),
    radial-gradient(55% 48% at 96% 94%, rgba(5, 150, 105, 0.13), transparent 70%);
}

html.dark .flixly-3d-bubble:hover {
  box-shadow: 0 16px 30px rgba(2, 10, 18, 0.68);
}

html.dark .flixly-3d-composer {
  border-top-color: rgba(71, 85, 105, 0.5);
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.08);
}

/* Chat bubble contrast in dark mode */
html.dark .bg-wa-incoming {
  background-color: #202c33 !important;
}

html.dark .bg-wa-outgoing {
  background-color: #005c4b !important;
}

html.dark .msg-tail-in::before {
  border-top-color: #202c33 !important;
}

html.dark .msg-tail-out::before {
  border-top-color: #005c4b !important;
}

html.dark .wa-empty-bg {
  background-color: #222e35;
  border-left-color: #2a3942;
}

html.dark .bg-white {
  background-color: #202c33 !important;
}

html.dark .bg-green-50 {
  background-color: #123229 !important;
}

html.dark .border-green-200 {
  border-color: #1f5f4a !important;
}

html.dark .text-green-700 {
  color: #8fe5bf !important;
}

html.dark .bg-red-50 {
  background-color: #3a1f24 !important;
}

html.dark .border-red-200 {
  border-color: #6f2f3a !important;
}

html.dark .text-red-700 {
  color: #ff9eab !important;
}

html.dark .bg-gray-100 {
  background-color: #22323c !important;
}

html.dark .hover\:bg-gray-200:hover {
  background-color: #2c404d !important;
}

@media (hover: none), (pointer: coarse) {
  .flixly-3d-sidebar,
  .flixly-3d-main,
  .flixly-3d-card,
  .flixly-3d-bubble {
    transform: none !important;
  }
  .flixly-3d-shell::after {
    animation-duration: 26s;
  }
}
