/**
 * JonesMandel Brand Theme for Beacon
 *
 * Features:
 * - Professional brand colors (Navy #21435e, Teal #13a89e)
 * - Typography: DM Serif Display (article titles), DM Sans (UI), Space Grotesk (logo)
 * - Neutral gray surfaces (warm reserved for article reading view)
 * - Light/Dark mode support
 * - DaisyUI component overrides
 */

/* ========================================
   GOOGLE FONTS IMPORT
   ======================================== */
/* Fonts loaded via HTML <link> in app.py to avoid duplicate requests */

/* ========================================
   LIGHT MODE (DEFAULT)
   ======================================== */
:root,
[data-theme="light"] {
  /* JonesMandel Brand Colors */
  --jm-brand-navy: #21435e;
  --jm-highlight-teal: #13a89e;
  --jm-warm-surface: #f8eadc;
  --jm-text-primary: #36302c;
  --jm-text-secondary: #5a544f;

  /* DaisyUI Color Overrides */
  --p: 191 67% 36%;  /* Primary: Teal #13a89e */
  --pf: 191 67% 30%; /* Primary focus */
  --pc: 0 0% 100%;   /* Primary content (white text on teal) */

  --s: 205 49% 25%;  /* Secondary: Navy #21435e */
  --sf: 205 49% 20%; /* Secondary focus */
  --sc: 0 0% 100%;   /* Secondary content (white text on navy) */

  --a: 191 67% 36%;  /* Accent: Teal */
  --af: 191 67% 30%; /* Accent focus */

  --n: 25 13% 21%;   /* Neutral: Dark warm */
  --nf: 25 13% 15%;  /* Neutral focus */
  --nc: 30 14% 95%;  /* Neutral content */

  --b1: 0 0% 100%;       /* Base 100: White background */
  --b2: 220 14% 96%;     /* Base 200: Neutral gray #f3f4f6 */
  --b3: 220 13% 91%;     /* Base 300: Darker neutral #e5e7eb */
  --bc: 25 13% 21%;      /* Base content: Dark text */

  --in: 198 93% 60%;     /* Info */
  --su: 158 64% 52%;     /* Success */
  --wa: 43 96% 56%;      /* Warning */
  --er: 0 72% 51%;       /* Error */

  /* Custom surface colors */
  --surface-primary: #ffffff;
  --surface-secondary: #f8f9fb;
  --surface-tertiary: #f1f3f5;
  --surface-warm: #faf6f1;  /* article reading view only */

  /* Gradients */
  --gradient-nav: linear-gradient(135deg, var(--jm-brand-navy) 0%, var(--jm-navy-gradient-end) 100%);
  --gradient-hero: linear-gradient(135deg, #21435e 0%, #13a89e 100%);

  /* Typography */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-ui: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-logo: 'Space Grotesk', sans-serif;

  /* Gradient Colors */
  --jm-navy-gradient-end: #2d5a8c;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.10);
}

/* ========================================
   DARK MODE
   ======================================== */
[data-theme="dark"] {
  /* JonesMandel Brand Colors (Adjusted for Dark) */
  --jm-brand-navy: #2d5976;
  --jm-highlight-teal: #1fc2b5;
  --jm-warm-surface: #2a2520;
  --jm-text-primary: #e8e3df;
  --jm-text-secondary: #c7c2bd;

  /* DaisyUI Color Overrides */
  --p: 177 72% 44%;  /* Primary: Brighter Teal #1fc2b5 */
  --pf: 177 72% 38%; /* Primary focus */
  --pc: 0 0% 10%;    /* Primary content (dark text on teal) */

  --s: 204 46% 33%;  /* Secondary: Lighter Navy #2d5976 */
  --sf: 204 46% 28%; /* Secondary focus */
  --sc: 0 0% 95%;    /* Secondary content (light text on navy) */

  --a: 177 72% 44%;  /* Accent: Brighter Teal */
  --af: 177 72% 38%; /* Accent focus */

  --n: 30 14% 15%;   /* Neutral: Very dark warm */
  --nf: 30 14% 10%;  /* Neutral focus */
  --nc: 30 14% 90%;  /* Neutral content */

  --b1: 240 6% 10%;      /* Base 100: Dark charcoal #1a1a1f */
  --b2: 240 5% 15%;      /* Base 200: Dark neutral #222228 */
  --b3: 240 5% 19%;      /* Base 300: Lighter neutral #2a2a30 */
  --bc: 30 14% 90%;      /* Base content: Warm off-white */

  --in: 198 93% 60%;     /* Info */
  --su: 158 64% 52%;     /* Success */
  --wa: 43 96% 66%;      /* Warning (brighter for dark mode) */
  --er: 0 72% 61%;       /* Error (brighter for dark mode) */

  /* Custom surface colors */
  --surface-primary: #1a1a1f;
  --surface-secondary: #222228;
  --surface-tertiary: #2a2a30;
  --surface-warm: #252320;

  /* Gradients */
  --gradient-nav: linear-gradient(135deg, #1a1713 0%, #2a2520 100%);
  --gradient-hero: linear-gradient(135deg, #2d5976 0%, #1fc2b5 100%);

  /* Typography (inherits from :root, but included for completeness) */
  --font-logo: 'Space Grotesk', sans-serif;

  /* Gradient Colors */
  --jm-navy-gradient-end: #2a2520;

  /* Shadows (lighter for dark mode) */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
}

/* ========================================
   GLOBAL TYPOGRAPHY
   ======================================== */
body {
  font-family: var(--font-ui);
  font-weight: 400;
  line-height: 1.6;
  color: var(--jm-text-primary);
  background-color: var(--surface-primary);
}

/* Headlines (DM Sans) */
h1, h2, h3, h4, h5, h6,
.headline {
  font-family: var(--font-ui);
  font-weight: 700;
  line-height: 1.2;
  color: var(--jm-brand-navy);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] .headline {
  color: var(--jm-text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

/* Quotes */
blockquote,
.quote,
.bullet-body {
  font-family: var(--font-ui);
  line-height: 1.65;
  font-size: 1.1rem;
  color: var(--jm-text-secondary);
  border-left: 3px solid var(--jm-highlight-teal);
  padding-left: 1rem;
  margin: 1rem 0;
}

[data-theme="dark"] blockquote,
[data-theme="dark"] .quote,
[data-theme="dark"] .bullet-body {
  color: var(--jm-text-secondary);
}

/* Body text weights */
.text-light { font-weight: 300; }
.text-regular { font-weight: 400; }
.text-medium { font-weight: 500; }
.text-semibold { font-weight: 600; }

/* ========================================
   NAVIGATION
   ======================================== */
.navbar {
  background: var(--gradient-nav);
  box-shadow: var(--shadow-md);
  border-radius: 0;
  padding: 0.75rem 1rem;
}

.navbar a {
  color: rgba(255, 255, 255, 0.9);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar a:hover {
  color: var(--jm-highlight-teal);
}

.navbar .text-xl {
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
}

/* ========================================
   CARDS
   ======================================== */
.card {
  background-color: var(--surface-primary);
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-title {
  font-family: var(--font-ui);
  font-size: 1.25rem;
  color: var(--jm-brand-navy);
}

[data-theme="dark"] .card-title {
  color: var(--jm-text-primary);
}

.card-body {
  padding: 1.5rem;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  border-radius: 4px;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  box-shadow: var(--shadow-md);
  opacity: 0.9;
}

.btn-primary {
  background-color: hsl(var(--p));
  color: hsl(var(--pc));
  border: none;
}

.btn-primary:hover {
  background-color: hsl(var(--pf));
}

.btn-secondary {
  background-color: hsl(var(--s));
  color: hsl(var(--sc));
  border: none;
}

.btn-secondary:hover {
  background-color: hsl(var(--sf));
}

.btn-ghost {
  background-color: transparent;
  box-shadow: none;
}

.btn-ghost:hover {
  background-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
  transform: none;
}

/* ========================================
   BADGES
   ======================================== */
.badge {
  border-radius: 9999px;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.75rem;
}

/* Status badges */
.badge-success {
  background-color: hsl(var(--su));
  color: white;
}

.badge-warning {
  background-color: hsl(var(--wa));
  color: hsl(25 13% 21%);
}

[data-theme="dark"] .badge-warning {
  color: hsl(30 14% 15%);
}

.badge-error {
  background-color: hsl(var(--er));
  color: white;
}

.badge-info {
  background-color: hsl(var(--in));
  color: white;
}

/* ========================================
   FORMS
   ======================================== */
.input,
.textarea,
.select {
  border-radius: 4px;
  border: 1px solid hsl(var(--b3));
  background-color: var(--surface-primary);
  font-family: var(--font-ui);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: hsl(var(--p));
  box-shadow: 0 0 0 3px hsla(var(--p), 0.1);
}

.label {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--jm-text-secondary);
}

/* ========================================
   TABLES
   ======================================== */
.table {
  font-family: var(--font-ui);
}

.table thead {
  background-color: var(--surface-secondary);
  font-family: var(--font-ui);
  font-size: 0.75rem;
}

.table tbody tr {
  transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.table tbody tr:hover {
  background-color: var(--surface-tertiary);
}

/* Clickable table row styling (sandbox pattern) */
.table tbody tr.cursor-pointer:hover {
  background-color: rgba(19, 168, 158, 0.05);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

/* ========================================
   UTILITIES
   ======================================== */

/* Sharp corners for professional look */
.rounded-sharp {
  border-radius: 2px;
}

/* Warm surface background */
.bg-warm {
  background-color: var(--surface-secondary);
}

/* Gradient text */
.text-gradient {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Brand color utilities */
.text-navy {
  color: var(--jm-brand-navy);
}

.text-teal {
  color: var(--jm-highlight-teal);
}

.bg-navy {
  background-color: var(--jm-brand-navy);
}

.bg-teal {
  background-color: var(--jm-highlight-teal);
}

/* Typography utilities */
.font-logo {
  font-family: var(--font-logo);
}

/* Display font for article titles */
.font-display { font-family: var(--font-display); }

/* Article title specific styling */
.article-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--jm-brand-navy);
}

[data-theme="dark"] .article-title {
  color: var(--jm-text-primary);
}

/* Warm background — article reading only */
.bg-article-reading {
  background-color: var(--surface-warm);
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Beacon Logo: Organic Particle Attraction */
@keyframes attractTop {
  0% { transform: translate(0, -8px) scale(0.6); opacity: 0.2; }
  60% { transform: translate(0, 6px) scale(1.1); opacity: 1; }
  100% { transform: translate(0, 0) scale(1); opacity: 0.8; }
}

@keyframes attractTopRight {
  0% { transform: translate(6px, -6px) scale(0.6); opacity: 0.2; }
  60% { transform: translate(-8px, 5px) scale(1.1); opacity: 1; }
  100% { transform: translate(0, 0) scale(1); opacity: 0.8; }
}

@keyframes attractBottomRight {
  0% { transform: translate(6px, 6px) scale(0.6); opacity: 0.2; }
  60% { transform: translate(-8px, -5px) scale(1.1); opacity: 1; }
  100% { transform: translate(0, 0) scale(1); opacity: 0.8; }
}

@keyframes attractBottom {
  0% { transform: translate(0, 8px) scale(0.6); opacity: 0.2; }
  60% { transform: translate(0, -6px) scale(1.1); opacity: 1; }
  100% { transform: translate(0, 0) scale(1); opacity: 0.8; }
}

@keyframes attractBottomLeft {
  0% { transform: translate(-6px, 6px) scale(0.6); opacity: 0.2; }
  60% { transform: translate(8px, -5px) scale(1.1); opacity: 1; }
  100% { transform: translate(0, 0) scale(1); opacity: 0.8; }
}

@keyframes attractTopLeft {
  0% { transform: translate(-6px, -6px) scale(0.6); opacity: 0.2; }
  60% { transform: translate(8px, 5px) scale(1.1); opacity: 1; }
  100% { transform: translate(0, 0) scale(1); opacity: 0.8; }
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    opacity: 0.95;
    transform: scale(1.15);
    filter: brightness(1.3);
  }
}

/* Apply animations with staggered delays for organic feel */
.particle-top {
  animation: attractTop 3.5s ease-out infinite;
  animation-delay: 0s;
}

.particle-top-right {
  animation: attractTopRight 3.8s ease-out infinite;
  animation-delay: 0.5s;
}

.particle-bottom-right {
  animation: attractBottomRight 3.2s ease-out infinite;
  animation-delay: 1s;
}

.particle-bottom {
  animation: attractBottom 3.6s ease-out infinite;
  animation-delay: 1.5s;
}

.particle-bottom-left {
  animation: attractBottomLeft 4s ease-out infinite;
  animation-delay: 2s;
}

.particle-top-left {
  animation: attractTopLeft 3.4s ease-out infinite;
  animation-delay: 2.5s;
}

.center-glow {
  animation: pulse 2.5s ease-in-out infinite;
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
  /* Force light mode for printing */
  :root {
    --jm-text-primary: #36302c;
    --surface-primary: #ffffff;
    --surface-secondary: #f8f9fb;
  }

  .navbar,
  .btn,
  .theme-toggle {
    display: none;
  }

  .card {
    box-shadow: none;
    border: 1px solid #e0e0e0;
  }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus indicators */
*:focus-visible {
  outline: 2px solid hsl(var(--p));
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   ACCESSIBILITY UTILITIES
   ======================================== */
/* Screen reader only - visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ========================================
   TWO-LEVEL NAVIGATION SYSTEM
   ======================================== */

/* Global Navigation Bar (Level 1) - Always Present */
.navbar.bg-gradient-to-r {
  background: linear-gradient(135deg, var(--jm-brand-navy), var(--jm-highlight-teal)) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.navbar.sticky {
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Teal hover utility */
.hover\:text-teal:hover {
  color: var(--jm-highlight-teal) !important;
}

/* Sticky positioning utilities */
.sticky-top {
  position: sticky;
  top: 0;
  z-index: 50;
}

.sticky-below {
  position: sticky;
  top: 48px;
  z-index: 40;
}

/* Beacon brand link styling in global nav */
.navbar.bg-gradient-to-r .btn-ghost {
  color: white !important;
  font-size: 1.5rem;
  letter-spacing: 0.05em;
}

.navbar.bg-gradient-to-r .btn-ghost:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Theme toggle and admin buttons in global nav */
.navbar.bg-gradient-to-r .swap,
.navbar.bg-gradient-to-r a:not(.btn-ghost:first-child) {
  color: white;
}

/* Subject Context Bar (Level 2) - Conditional */
.navbar.bg-base-200 {
  background-color: var(--fallback-b2, oklch(var(--b2)));
  border-bottom: 1px solid var(--fallback-bc, oklch(var(--bc) / 0.2));
  min-height: 3rem;
}

/* Subject name styling */
.navbar.bg-base-200 .font-semibold {
  color: var(--jm-brand-navy);
}

/* Subject context in dark mode */
[data-theme="dark"] .navbar.bg-base-200 .font-semibold {
  color: var(--jm-highlight-teal);
}

/* Subject navigation links */
.navbar.bg-base-200 .btn-sm {
  font-size: 0.875rem;
}

/* Mobile: Hamburger menu for Level 2 nav */
@media (max-width: 640px) {
  /* Hide nav links by default on mobile */
  .navbar[data-mobile-menu="true"] .navbar-end {
    display: none;
  }

  /* Show nav links when menu is open */
  .navbar[data-mobile-menu="true"].menu-open .navbar-end {
    display: flex;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--fallback-b2, oklch(var(--b2)));
    padding: 1rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    flex-direction: column;
    gap: 0.5rem;
    z-index: 40;
    min-width: 200px;
  }

  /* Hamburger toggle button */
  .navbar[data-mobile-menu="true"]::after {
    content: "☰";
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: auto;
    padding: 0.5rem;
  }

  /* Change icon when menu is open */
  .navbar[data-mobile-menu="true"].menu-open::after {
    content: "✕";
  }
}

/* Ensure main content doesn't overlap with sticky nav */
body {
  padding-top: 0;
}

/* Smooth transitions for navigation interactions */
.navbar {
  transition: all 0.3s ease;
}

.navbar .btn {
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.navbar .btn:hover {
  opacity: 0.9;
}

.navbar .btn:active {
  transform: translateY(0);
}

/* ========================================
   ARTICLE DETAIL PAGE
   ======================================== */

/* Article text styling - optimized for reading */
.article-content {
  font-family: var(--font-ui);
  font-size: 18px;
  line-height: 1.8;
  color: #1a1a1a;
  max-width: 720px;
  margin: 0 auto;
}

[data-theme="dark"] .article-content {
  color: #e8e3df;
}

.article-content p {
  margin-bottom: 1.5rem;
}

/* Article section headings: title case, not ALL CAPS (overrides global h1-h6 uppercase) */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
  text-transform: none;
  font-family: var(--font-ui);
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid hsl(var(--b3));
}

/* Industry-standard bullet formatting */
.bullet-header {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
}

.bullet-text {
  font-family: var(--font-ui);
  font-size: 11pt;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.intro-phrase {
  font-style: normal;
  font-weight: 400;
  text-transform: none !important;
}

.quote-text {
  font-style: italic;
}

.citation {
  font-style: italic;
  color: #757575;
}

[data-theme="dark"] .citation {
  color: #a0a0a0;
}

/* ========================================
   BULLET MODAL V3D - TWO-COLUMN SIDEBAR
   ======================================== */

/* Status color variables */
:root {
  --status-ai: #8b5cf6;
  --status-ai-bg: rgba(139, 92, 246, 0.08);
  --status-draft: #eab308;
  --status-draft-bg: rgba(234, 179, 8, 0.08);
  --status-approved: #22c55e;
  --status-approved-bg: rgba(34, 197, 94, 0.08);
  --status-rejected: #ef4444;
  --status-rejected-bg: rgba(239, 68, 68, 0.08);
}

/* Two-column grid layout */
.bullet-modal-grid {
  display: grid;
  grid-template-columns: 1fr 210px;
}

/* Left column: main content */
.bullet-modal-main {
  padding: 2rem;
}

/* Headline - Title Case preserved (no text-transform) */
.bullet-modal-headline {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.2px;
  color: var(--jm-brand-navy);
  line-height: 1.55;
  margin-bottom: 1.5rem;
  text-transform: none !important;
}

/* Quote panel with status border */
.quote-wrapper {
  background: var(--surface-secondary);
  border-radius: 3px;
  padding: 1.25rem 1.5rem;
  border-left: 3px solid var(--jm-highlight-teal);
  margin-bottom: 1.5rem;
}

.quote-wrapper .quote-body {
  font-family: var(--font-ui);
  font-size: 1.05rem;
  line-height: 1.7;
  color: #1f2937;
  text-transform: none !important;
}

[data-theme="dark"] .quote-wrapper {
  background: hsl(var(--b2));
}

[data-theme="dark"] .quote-wrapper .quote-body {
  color: hsl(var(--bc));
}

/* Status-colored quote border (overrides default teal) */
.quote-wrapper.accent-ai { border-left-color: var(--status-ai); }
.quote-wrapper.accent-draft { border-left-color: var(--status-draft); }
.quote-wrapper.accent-approved { border-left-color: var(--status-approved); }
.quote-wrapper.accent-rejected { border-left-color: var(--status-rejected); }

/* Citation link */
.citation-link {
  color: var(--jm-highlight-teal);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.82rem;
}
.citation-link:hover {
  text-decoration: underline;
}
.citation-line {
  font-size: 0.82rem;
  color: #6b7280;
}

/* Right column: sidebar */
.bullet-modal-sidebar {
  background: #f8f9fb;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .bullet-modal-sidebar {
  background: hsl(var(--b2));
}

/* Status-colored accent line */
.bullet-modal-sidebar.accent-ai { border-left: 4px solid var(--status-ai); }
.bullet-modal-sidebar.accent-draft { border-left: 4px solid var(--status-draft); }
.bullet-modal-sidebar.accent-approved { border-left: 4px solid var(--status-approved); }
.bullet-modal-sidebar.accent-rejected { border-left: 4px solid var(--status-rejected); }

/* Sidebar inner layout */
.sidebar-body {
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  flex: 1;
}
.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.sidebar-label {
  font-family: var(--font-ui);
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #9ca3af;
}
.sidebar-value {
  font-size: 0.8rem;
  color: #374151;
  line-height: 1.4;
}

[data-theme="dark"] .sidebar-value {
  color: hsl(var(--bc) / 0.7);
}

.sidebar-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 0;
}

[data-theme="dark"] .sidebar-divider {
  border-top-color: hsl(var(--bc) / 0.1);
}

/* V3d outlined status badges (tinted bg + thin border) */
.status-v3d {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-ui);
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.22rem 0.6rem;
  border-radius: 9999px;
  width: fit-content;
}
.status-v3d-ai {
  color: var(--status-ai);
  background: var(--status-ai-bg);
  border: 1px solid rgba(139, 92, 246, 0.2);
}
.status-v3d-draft {
  color: #a16207;
  background: var(--status-draft-bg);
  border: 1px solid rgba(234, 179, 8, 0.25);
}
.status-v3d-approved {
  color: #16a34a;
  background: var(--status-approved-bg);
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.status-v3d-rejected {
  color: var(--status-rejected);
  background: var(--status-rejected-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Category badge (teal outline) */
.category-v3d {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--jm-highlight-teal);
  border: 1px solid rgba(19, 168, 158, 0.3);
  padding: 0.22rem 0.6rem;
  border-radius: 9999px;
  width: fit-content;
}

/* Formatting issues indicator with hover tooltip */
.formatting-indicator {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: default;
}
.formatting-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  flex-shrink: 0;
}
.formatting-label {
  font-size: 0.75rem;
  color: #b45309;
}
.formatting-none {
  font-size: 0.75rem;
  color: #9ca3af;
}
.formatting-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: #1f2937;
  color: white;
  font-size: 0.72rem;
  line-height: 1.5;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.formatting-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 12px;
  border: 5px solid transparent;
  border-top-color: #1f2937;
}
.formatting-indicator:hover .formatting-tooltip {
  display: block;
}

/* Edit button in sidebar */
.edit-btn-v3d {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
  background: var(--jm-brand-navy);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  margin-top: auto;
  text-align: center;
}
.edit-btn-v3d:hover {
  background: #2d5976;
}

/* Wider tabs for better UX */
.tabs .tab {
  min-width: 160px;
  padding: 1rem 2rem;
  font-size: 16px;
  font-weight: 600;
}

/* ========================================
   TEXT TRUNCATION UTILITIES
   ======================================== */

/* Line clamping for multi-line text truncation */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

/* Single-line truncation with ellipsis */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================
   TOM SELECT - DaisyUI THEME OVERRIDES
   ======================================== */

/* Match DaisyUI input styling */
.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
  background-color: var(--surface-primary);
  border: 1px solid hsl(var(--b3));
  border-radius: 4px;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  min-height: 2rem;
  padding: 0.25rem 0.5rem;
}

.ts-wrapper.single .ts-control:focus,
.ts-wrapper.multi .ts-control:focus,
.ts-wrapper.focus .ts-control {
  border-color: hsl(var(--p));
  box-shadow: 0 0 0 3px hsla(var(--p), 0.1);
  outline: none;
}

/* Dropdown styling */
.ts-dropdown {
  background-color: var(--surface-primary);
  border: 1px solid hsl(var(--b3));
  border-radius: 4px;
  box-shadow: var(--shadow-md);
  font-family: var(--font-ui);
  font-size: 0.875rem;
}

.ts-dropdown .option {
  padding: 0.4rem 0.75rem;
}

.ts-dropdown .option:hover,
.ts-dropdown .active {
  background-color: hsl(var(--p) / 0.1);
  color: hsl(var(--p));
}

/* Selected item tags (multi-select) */
.ts-wrapper.multi .ts-control > .item {
  background-color: hsl(var(--p) / 0.1);
  border: 1px solid hsl(var(--p) / 0.3);
  color: hsl(var(--p));
  border-radius: 2px;
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  margin: 0.1rem 0.2rem;
}

/* Remove button on tags */
.ts-wrapper.multi .ts-control > .item .remove {
  color: hsl(var(--p));
  border-left: 1px solid hsl(var(--p) / 0.2);
}

.ts-wrapper.multi .ts-control > .item .remove:hover {
  color: hsl(var(--er));
  background: transparent;
}

/* Dark mode overrides */
[data-theme="dark"] .ts-wrapper .ts-control {
  background-color: var(--surface-primary);
  border-color: hsl(var(--b3));
  color: hsl(var(--bc));
}

[data-theme="dark"] .ts-dropdown {
  background-color: var(--surface-secondary);
  border-color: hsl(var(--b3));
  color: hsl(var(--bc));
}

[data-theme="dark"] .ts-dropdown .option:hover,
[data-theme="dark"] .ts-dropdown .active {
  background-color: hsl(var(--p) / 0.15);
}

/* ========================================
   FLATPICKR - DaisyUI THEME OVERRIDES
   ======================================== */

.flatpickr-calendar {
  font-family: var(--font-ui);
  border-radius: 4px;
  box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .flatpickr-calendar {
  background: var(--surface-secondary);
  border-color: hsl(var(--b3));
}

[data-theme="dark"] .flatpickr-day {
  color: hsl(var(--bc));
}

[data-theme="dark"] .flatpickr-day:hover {
  background: hsl(var(--b3));
}

.flatpickr-day.selected {
  background: hsl(var(--p)) !important;
  border-color: hsl(var(--p)) !important;
}

/* ========================================
   BULLET FILTER CHIPS
   ======================================== */

/* Filter chip hover effect */
.badge-outline:has(.hover\:text-error:hover) {
  border-color: hsl(var(--er) / 0.5);
}

/* Smooth filter transitions */
#bullet-results {
  transition: opacity 0.15s ease;
}

/* HTMX loading indicator on bullet results */
#bullet-results.htmx-request {
  opacity: 0.6;
  pointer-events: none;
}

/* ========================================
   TABS-LIFTED BORDER FIX
   ======================================== */

/* Fix DaisyUI tabs-lifted border cutting through inactive tab labels */
.tabs-lifted .tab:not(.tab-active) {
  position: relative;
  z-index: 1;
  padding-bottom: 0.75rem;
}

/* Ensure the bottom border sits below the inactive tab text */
.tabs-lifted::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: hsl(var(--bc) / 0.2);
  z-index: 0;
}
