@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* FLOP Palette Defaults (Dark Theme) */
  --bg-app: #030712;
  --bg-surface: #070d1a;
  --bg-surface-translucent: rgba(7, 13, 26, 0.82);
  --bg-header: rgba(3, 7, 18, 0.92);
  --bg-elevated: #0f1a30;
  --bg-message-box: rgba(2, 6, 15, 0.75);
  --border-app: #132238;
  --border-focus: #00c2ff;
  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --scrollbar-thumb: #1e324d;
  --scrollbar-hover: #00c2ff;
  --card-shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.6);
  --glow-color: rgba(0, 194, 255, 0.22);
  --flop-cyan: #00c2ff;
  --flop-cyan-glow: rgba(0, 194, 255, 0.4);
}

html.light {
  --bg-app: #f4f8fb;
  --bg-surface: #ffffff;
  --bg-surface-translucent: rgba(255, 255, 255, 0.92);
  --bg-header: rgba(244, 248, 251, 0.95);
  --bg-elevated: #e6f4fa;
  --bg-message-box: #f8fcff;
  --border-app: #d0e4f2;
  --border-focus: #0096c7;
  --text-main: #071526;
  --text-secondary: #334e68;
  --text-muted: #627d98;
  --scrollbar-thumb: #b8d4e8;
  --scrollbar-hover: #0096c7;
  --card-shadow: 0 4px 20px -2px rgba(0, 150, 199, 0.08);
  --glow-color: rgba(0, 150, 199, 0.15);
  --flop-cyan: #0096c7;
  --flop-cyan-glow: rgba(0, 150, 199, 0.25);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 15.5px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  font-size: 1rem;
  line-height: 1.6;
  transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.font-mono {
  font-family: var(--font-mono);
}

/* Glass Panels with FLOP border highlights */
.glass-panel {
  background: var(--bg-surface-translucent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-app);
  box-shadow: var(--card-shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.glass-header {
  background: var(--bg-header);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-app);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-bar {
  background: var(--bg-header);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-app);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 8px);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-hover);
}

.sidebar-scroll {
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

/* Micro-Interactions & Animations */
.btn-interactive {
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.btn-interactive:active {
  transform: scale(0.95);
}

/* Message Card Hover & Entrance */
.message-card {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  animation: messageSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (hover: hover) {
  .message-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 194, 255, 0.4);
    box-shadow: 0 8px 24px -4px var(--glow-color), var(--card-shadow);
  }
}

@keyframes messageSlideIn {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Smooth New Arrival Animation on Polling (FLOP Cyan Pulse) */
@keyframes newArrivalSlideDown {
  0% {
    opacity: 0;
    transform: translateY(-14px) scale(0.98);
    background-color: rgba(0, 194, 255, 0.18);
    border-color: rgba(0, 194, 255, 0.8);
    box-shadow: 0 0 20px rgba(0, 194, 255, 0.4);
  }
  70% {
    background-color: rgba(0, 194, 255, 0.08);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.new-arrival-anim {
  animation: newArrivalSlideDown 0.65s cubic-bezier(0.16, 1, 0.3, 1) both !important;
}

/* Live Pulse Animation */
@keyframes livePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(0, 194, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(0, 194, 255, 0);
  }
}

.glow-live {
  animation: livePulse 2.5s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

/* Modal Animation (Center Scale) */
.modal-enter {
  animation: modalEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Bottom Sheet Slide Up Animation (Mobile) */
.sheet-enter {
  animation: sheetSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes sheetSlideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Drawer Slide Right Animation */
.drawer-enter {
  animation: drawerSlideLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes drawerSlideLeft {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Toast Slide Up */
.toast-slide-up {
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Theme Toggle Button Rotation */
.theme-icon-rotate {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-icon-rotate:hover {
  transform: rotate(25deg);
}

/* FLOP Grid Pattern Accent */
.flop-grid-bg {
  background-image: radial-gradient(rgba(0, 194, 255, 0.12) 1px, transparent 0);
  background-size: 24px 24px;
}

/* Touch targets */
.touch-target {
  min-height: 44px;
  min-width: 44px;
}
