/* 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;
}

/* Chat background: solid colors (light/dark) */
.wa-chat-pattern {
  background-color: #FDF5E6;
}

/* 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: #4F4F4F !important;
}

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;
  }
}

/* Bitmap-inspired rounded 3D frame */
.flixly-3d-shell {
  gap: 10px;
  padding: 8px 10px 10px;
}

.flixly-3d-sidebar {
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(61, 76, 94, 0.65);
  box-shadow:
    0 18px 34px rgba(6, 10, 17, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(5, 10, 18, 0.32);
}

.flixly-3d-main {
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(58, 74, 96, 0.58);
  background-color: #FDF5E6;
  box-shadow:
    0 22px 44px rgba(2, 8, 14, 0.48),
    inset 0 1px 0 rgba(139, 172, 207, 0.14),
    inset 0 -1px 0 rgba(6, 12, 20, 0.45);
}

.flixly-3d-header {
  border-radius: 0 0 14px 14px;
}

.flixly-3d-search {
  border-radius: 14px;
}

.flixly-3d-card {
  margin: 6px 8px;
  border-radius: 14px;
  border: 1px solid rgba(65, 89, 112, 0.32);
  background-color: #ffffff;
  box-shadow:
    0 8px 16px rgba(4, 9, 17, 0.28),
    inset 0 1px 0 rgba(145, 188, 219, 0.1);
}

.flixly-3d-card:hover {
  background-color: #f5f6f6;
}

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

html.dark .flixly-3d-card {
  background-color: #4F4F4F;
}

html.dark .flixly-3d-card:hover {
  background-color: #585858;
}

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

.flixly-3d-card > div {
  border-bottom-color: transparent !important;
}

.flixly-3d-canvas {
  margin: 10px 14px 8px;
  border-radius: 24px;
  border: 2px solid rgba(55, 64, 80, 0.88);
  background-color: #FDF5E6;
  background-image: none;
  background-size: 420px auto;
  background-position: center;
  background-repeat: repeat;
  box-shadow:
    0 18px 34px rgba(4, 8, 12, 0.5),
    inset 0 2px 0 rgba(146, 170, 199, 0.15),
    inset 0 -2px 0 rgba(2, 4, 8, 0.68);
}

.flixly-3d-composer {
  margin: 0 14px 12px;
  border-radius: 999px;
  border: 1px solid rgba(72, 93, 117, 0.8);
  background-color: #FDF5E6;
  box-shadow:
    0 14px 28px rgba(3, 8, 14, 0.4),
    inset 0 1px 0 rgba(163, 190, 218, 0.16),
    inset 0 -1px 0 rgba(2, 5, 10, 0.52);
}

html.dark .flixly-3d-sidebar {
  border-color: rgba(66, 84, 107, 0.74);
  background: linear-gradient(170deg, rgba(6, 18, 29, 0.96), rgba(5, 15, 24, 0.96));
}

html.dark .flixly-3d-main {
  border-color: rgba(69, 90, 120, 0.78);
  background: linear-gradient(165deg, rgba(9, 20, 31, 0.96), rgba(7, 15, 24, 0.96));
}

html.dark .flixly-3d-card {
  border-color: rgba(72, 101, 127, 0.45);
  background-color: #4F4F4F;
}

html.dark .flixly-3d-canvas {
  border-color: rgba(61, 74, 95, 0.92);
  background-color: #4F4F4F;
  background-image: none;
}

@media (max-width: 1023px) {
  .flixly-3d-shell {
    gap: 0;
    padding: 0;
  }
  .flixly-3d-main,
  .flixly-3d-sidebar,
  .flixly-3d-canvas,
  .flixly-3d-composer {
    border-radius: 0;
    margin: 0;
    border-left: 0;
    border-right: 0;
  }
}
