/* 
 * Quillopreneur Polish Mode V2 - Phase 1: Design Tokens & Typography
 * 
 * Extracted from Elevate Quillopreneur Dashboard UI (Figma)
 * Safe, toggleable upgrade with no layout changes - only visual polish
 * 
 * Enable: Set POLISH_V2=1 in environment variables
 * Disable: Set POLISH_V2=0 or remove the variable
 */

/* ============================================
   TYPOGRAPHY - Premium Serif Fonts
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap');

/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
  /* Primary Gradient Colors (from React UI) */
  --qp-primary-1: #2B45FF;  /* Deep royal blue */
  --qp-primary-2: #3B82F6;  /* Medium blue */
  --qp-primary-3: #38BDF8;  /* Sky blue */
  
  /* Text Colors */
  --qp-fg: #0F172A;         /* Primary text */
  --qp-muted: #64748B;      /* Secondary text */
  --qp-light: #CBD5E1;      /* Tertiary text */
  
  /* Background & Surfaces */
  --qp-card-bg: #FFFFFF;
  --qp-bg-gradient: linear-gradient(to bottom right, #F8FAFC, #E2E8F0, #F1F5F9);
  
  /* Borders & Dividers */
  --qp-border: rgba(0, 0, 0, 0.08);
  --qp-border-light: rgba(255, 255, 255, 0.2);
  
  /* Shadows */
  --qp-shadow-sm: 0 4px 24px rgba(15, 23, 42, 0.08);
  --qp-shadow-md: 0 8px 30px rgba(15, 23, 42, 0.1);
  --qp-shadow-lg: 0 8px 32px rgba(43, 69, 255, 0.2);
  --qp-shadow-glow: 0 0 20px rgba(43, 69, 255, 0.3);
  
  /* Border Radius */
  --qp-radius-sm: 10px;
  --qp-radius-md: 12px;
  --qp-radius-lg: 16px;
  --qp-radius-xl: 20px;
  --qp-radius-2xl: 26px;
  
  /* Glass Effect */
  --qp-glass-bg: rgba(255, 255, 255, 0.20);
  --qp-glass-blur: blur(24px);
}

/* ============================================
   TYPOGRAPHY POLISH
   ============================================ */

/* Body: Smooth rendering */
body {
  color: var(--qp-fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings: Elegant serif */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  letter-spacing: -0.01em;
  font-weight: 600;
}

/* Body text: Professional serif-sans hybrid */
p, label, input, button, span, div {
  font-family: 'Cormorant Garamond', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Logo text: Special treatment */
.qp-brand-link {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  letter-spacing: -0.02em;
}

/* Brand text with beautiful black-to-silver gradient */
.qp-brand-text {
  background: linear-gradient(135deg, #000000 0%, #2C2C2C 25%, #5A5A5A 50%, #8E8E8E 75%, #C0C6CF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-fill-color: transparent;
  filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.4));
  /* Subtle white shadow for legibility on blue gradient backgrounds */
}

/* Fallback color for unsupported browsers */
@supports not (background-clip: text) {
  .qp-brand-text {
    color: #0F172A;
  }
}

/* Icon with dark color - subtle and elegant */
.qp-brand-icon {
  color: #2C2C2C;
  stroke: #2C2C2C;
  opacity: 0.9;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

/* ============================================
   COMPONENT POLISH - Non-destructive
   ============================================ */

/* Primary Buttons: Gradient with glow - Figma 220ms transitions */
.btn, 
.button, 
.qp-btn-primary,
.btn-primary {
  border-radius: var(--qp-radius-md);
  background: linear-gradient(135deg, var(--qp-primary-1) 0%, var(--qp-primary-2) 60%, var(--qp-primary-3) 100%);
  color: #FFFFFF !important;
  border: 0;
  box-shadow: var(--qp-shadow-lg);
  transition: all 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover, 
.button:hover, 
.qp-btn-primary:hover,
.btn-primary:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 10px 40px rgba(43, 69, 255, 0.35);
}

.btn:active, 
.button:active, 
.qp-btn-primary:active,
.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

/* Glass Cards: Soft depth */
.card, 
.qp-card, 
.glass, 
.panel, 
.widget,
.glass-card {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--qp-border);
  border-radius: var(--qp-radius-lg);
  box-shadow: var(--qp-shadow-sm);
}

/* Sidebar: Figma exact specs - very transparent glass */
aside.sidebar,
nav.sidebar,
.sidebar-nav,
#app-sidebar {
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  transition: all 300ms ease;
}

/* Sidebar scrollbar styling - subtle and elegant */
#app-sidebar::-webkit-scrollbar {
  width: 6px;
}

#app-sidebar::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.02);
  border-radius: 10px;
}

#app-sidebar::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.3);
  border-radius: 10px;
  transition: background 0.2s ease;
}

#app-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.5);
}

/* Firefox scrollbar */
#app-sidebar {
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 130, 246, 0.3) rgba(0, 0, 0, 0.02);
}

/* Sidebar nav items - Figma specs with 220ms transitions */
#app-sidebar .nav-item {
  transition: all 220ms cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  padding: 0.625rem 1rem;
  border-radius: 12px;
}

#app-sidebar .nav-item:hover:not(.nav-pill-active) {
  background: rgba(255, 255, 255, 0.4);
  transform: translateX(2px);
}

/* Active Dashboard button - Figma blue gradient with glow */
#app-sidebar .nav-pill-active {
  background: linear-gradient(to right, #2B45FF, #3B82F6) !important;
  color: white !important;
  box-shadow: 0 0 20px rgba(43, 69, 255, 0.3);
  border: none;
}

#app-sidebar .nav-pill-active:hover {
  box-shadow: 0 0 30px rgba(43, 69, 255, 0.4);
  transform: translateX(2px);
}

#app-sidebar .nav-pill-active svg {
  color: white !important;
  stroke: white !important;
}

/* Icon spacing: Consistent sizing */
.nav-icon, 
.qp-icon {
  width: 20px;
  height: 20px;
  vertical-align: middle;
}

.qp-fab-icon,
.fab-icon {
  width: 24px;
  height: 24px;
}

/* Badge: Modern rounded style */
.badge,
.qp-badge {
  border-radius: var(--qp-radius-sm);
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* PRO Badge: Gradient background */
.badge-pro,
.qp-badge-pro {
  background: linear-gradient(135deg, var(--qp-primary-1), var(--qp-primary-2));
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(43, 69, 255, 0.25);
}

/* Input Fields: Clean modern borders */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  border-radius: var(--qp-radius-md);
  border: 1px solid var(--qp-border);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  border-color: var(--qp-primary-2);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  outline: none;
}

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

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .btn, 
  .button, 
  .qp-btn-primary,
  .btn-primary,
  input,
  textarea,
  select {
    transition: none !important;
  }
}

/* Focus indicators: Visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--qp-primary-2);
  outline-offset: 2px;
}

/* ============================================
   PHASE 2: HERO SECTION & DASHBOARD COMPONENTS
   ============================================ */

/* Hero Banner - Gradient background with glass effects */
.qp-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--qp-radius-2xl);
  background: linear-gradient(135deg, var(--qp-primary-1) 0%, var(--qp-primary-2) 50%, var(--qp-primary-3) 100%);
  padding: 2.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--qp-shadow-lg);
}

/* Hero overlay gradient for depth */
.qp-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

/* Hero radial glow (top right) */
.qp-hero::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 24rem;
  height: 24rem;
  background: var(--qp-primary-3);
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}

/* Hero content layer */
.qp-hero-content {
  position: relative;
  z-index: 10;
}

/* Hero headings in white */
.qp-hero h1,
.qp-hero h2,
.qp-hero p {
  color: white;
}

.qp-hero h1 {
  font-size: clamp(1.75rem, 2.6vw, 2.75rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.qp-hero p {
  opacity: 0.9;
}

/* Glass cards inside hero */
.qp-glass-card {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--qp-radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: all 0.22s ease;
}

.qp-glass-card:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Streak badge */
.qp-streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--qp-radius-xl);
  padding: 0.875rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.qp-streak-icon {
  color: #FED7AA;
  flex-shrink: 0;
}

/* Quills badge */
.qp-quills-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(56, 189, 248, 0.3);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--qp-radius-xl);
  padding: 0.875rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  color: white;
  font-weight: 500;
}

/* Runs counter (in hero) */
.qp-runs-counter {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.875rem;
}

.qp-runs-count {
  padding: 0.375rem 0.875rem;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 0.5rem;
  min-width: 2.5rem;
  text-align: center;
  font-weight: 600;
  color: white;
}

/* ============================================
   ANALYTICS CARDS
   ============================================ */

.qp-analytics-card {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--qp-radius-xl);
  border: 1px solid var(--qp-border-light);
  padding: 1.25rem;
  box-shadow: var(--qp-shadow-sm);
  transition: all 0.22s ease;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.qp-analytics-card:hover {
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.08);
}

.qp-analytics-label {
  color: var(--qp-muted);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.qp-analytics-value {
  color: var(--qp-fg);
  font-size: clamp(1.75rem, 2vw, 2.5rem);
  font-weight: 700;
  line-height: 1;
  font-family: 'Playfair Display', serif;
}

.qp-analytics-subtitle {
  color: var(--qp-muted);
  font-size: 0.75rem;
  margin-top: 0.5rem;
  line-height: 1.4;
}

/* Progress bar in analytics cards */
.qp-progress-bar {
  height: 0.5rem;
  background: #E2E8F0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.75rem;
}

.qp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--qp-primary-1), var(--qp-primary-2));
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* ============================================
   FLOATING ACTION BUTTON (FAB)
   ============================================ */

.qp-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--qp-primary-1), var(--qp-primary-2));
  color: white;
  border: none;
  box-shadow: 0 8px 32px rgba(43, 69, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.22s ease;
  z-index: 1000;
}

.qp-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(43, 69, 255, 0.4);
}

.qp-fab:active {
  transform: scale(1.05);
}

.qp-fab svg,
.qp-fab img {
  width: 1.75rem;
  height: 1.75rem;
  transition: transform 0.22s ease;
}

.qp-fab:hover svg,
.qp-fab:hover img {
  transform: rotate(12deg) scale(1.1);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
  .qp-hero {
    padding: 1.5rem;
    border-radius: var(--qp-radius-xl);
  }
  
  .qp-hero h1 {
    font-size: 1.5rem;
  }
  
  .qp-fab {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
  }
  
  .qp-glass-card {
    padding: 1rem;
  }
}

/* ============================================
   PHASE 3: TIMELINE & MICRO-INTERACTIONS
   ============================================ */

/* Timeline Container */
.qp-timeline {
  position: relative;
  padding-left: 2rem;
}

.qp-timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--qp-primary-1), var(--qp-primary-3));
  opacity: 0.2;
}

/* Timeline Item */
.qp-timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
  animation: qp-fade-in-up 0.4s ease-out backwards;
}

.qp-timeline-item:nth-child(1) { animation-delay: 0.05s; }
.qp-timeline-item:nth-child(2) { animation-delay: 0.1s; }
.qp-timeline-item:nth-child(3) { animation-delay: 0.15s; }
.qp-timeline-item:nth-child(4) { animation-delay: 0.2s; }
.qp-timeline-item:nth-child(5) { animation-delay: 0.25s; }

/* Timeline Dot */
.qp-timeline-dot {
  position: absolute;
  left: -1.5rem;
  top: 0.75rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--qp-primary-2);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  transition: all 0.3s ease;
}

.qp-timeline-item:hover .qp-timeline-dot {
  transform: scale(1.3);
  box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.15);
}

/* Timeline Card */
.qp-timeline-card {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  border-radius: var(--qp-radius-lg);
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 1.25rem;
  box-shadow: var(--qp-shadow-sm);
  transition: all 0.3s ease;
  cursor: pointer;
}

.qp-timeline-card:hover {
  transform: translateX(4px);
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.12);
  border-color: var(--qp-primary-2);
}

/* Tool Icon Badge */
.qp-tool-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qp-tool-icon.response {
  background: linear-gradient(135deg, rgba(43, 69, 255, 0.1), rgba(43, 69, 255, 0.05));
  color: var(--qp-primary-1);
}

.qp-tool-icon.rewrite {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05));
  color: var(--qp-primary-2);
}

.qp-tool-icon.argue {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
  color: #F59E0B;
}

.qp-tool-icon.clarity {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
  color: #10B981;
}

/* Empty State */
.qp-empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.02), rgba(56, 189, 248, 0.02));
  border-radius: var(--qp-radius-xl);
  border: 2px dashed rgba(59, 130, 246, 0.2);
}

.qp-empty-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(56, 189, 248, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--qp-primary-2);
  animation: qp-float 3s ease-in-out infinite;
}

.qp-empty-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--qp-fg);
  margin-bottom: 0.5rem;
  font-family: 'Playfair Display', serif;
}

.qp-empty-subtitle {
  color: var(--qp-muted);
  margin-bottom: 1.5rem;
}

/* Enhanced Quick Start Animations */
.qp-qs-card {
  position: relative;
  overflow: hidden;
}

.qp-qs-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.qp-qs-card:hover::after {
  transform: translateX(100%);
}

/* Micro-interactions - Pulse animation */
.qp-pulse {
  animation: qp-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes qp-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Fade in up animation */
@keyframes qp-fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Float animation for empty state */
@keyframes qp-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Action buttons */
.qp-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.qp-action-btn-primary {
  background: linear-gradient(135deg, var(--qp-primary-1), var(--qp-primary-2));
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
  min-height: 44px;  /* WCAG touch target minimum */
}

.qp-action-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.qp-action-btn-ghost {
  color: var(--qp-muted);
  border-color: var(--qp-border);
}

.qp-action-btn-ghost:hover {
  color: var(--qp-fg);
  border-color: var(--qp-primary-2);
  background: rgba(59, 130, 246, 0.05);
}

/* ============================================
   UNIFIED TIER PILL - Consistent Badge Styling
   ============================================ */
/* Unified tier pill for Pro and Pro+ features */
.qp-tier-pill {
  font-size: 0.675rem;
  line-height: 1rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  color: white;
  font-weight: 600;
  backdrop-filter: saturate(140%);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
  flex-shrink: 0;
}

/* Tier variants - using existing color tokens */
.qp-tier-pill[data-tier="pro"] {
  background: linear-gradient(135deg, var(--qp-primary-1), var(--qp-primary-3));
}

.qp-tier-pill[data-tier="pro_plus"] {
  background: linear-gradient(135deg, #7c3aed, #06b6d4); /* indigo → cyan pop for premium tier */
}

/* Accessibility - Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .qp-timeline-item,
  .qp-empty-icon,
  .qp-qs-card::after {
    animation: none;
  }

  .qp-timeline-card:hover,
  .qp-action-btn-primary:hover {
    transform: none;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .qp-timeline {
    padding-left: 1.5rem;
  }
  
  .qp-timeline-dot {
    left: -1.25rem;
  }
  
  .qp-empty-state {
    padding: 3rem 1.5rem;
  }
}

/* ============================================
   PHASE 3 COMPLETE
   ============================================ */

/*
 * Phase 3 includes:
 * ✅ Timeline-style recent activity
 * ✅ Tool icon badges with gradients
 * ✅ Empty states with animations
 * ✅ Enhanced micro-interactions
 * ✅ Smooth fade-in animations
 * ✅ Hover effects and transitions
 */

/* ============================================
   NAV_V2 PREMIUM DRAWER POLISH
   ============================================ */

/* Premium drawer button icons */
#navv2-drawer .mobile-icon-btn {
  color: #fff;
  transition: transform 0.15s ease, background 0.15s ease;
}

#navv2-drawer .mobile-icon-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Navigation links with subtle backdrop saturation */
#navv2-drawer a {
  backdrop-filter: saturate(140%);
  transition: all 0.15s ease;
}

#navv2-drawer a:hover {
  transform: translateX(4px);
}

/* Scrim overlay performance optimization */
#navv2-scrim {
  will-change: opacity;
}

/* Header V2 glass effect enhancement (MOBILE ONLY) */
#navv2-header.fixed {
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

/* Premium drawer active state glow */
#navv2-drawer a[class*="bg-sky-300"] {
  box-shadow: 0 2px 12px rgba(14, 165, 233, 0.3);
}

/* Drawer section titles */
#navv2-drawer .text-xs.uppercase {
  letter-spacing: 0.1em;
  font-weight: 600;
}

/* Smooth drawer panel animation */
#navv2-drawer {
  will-change: transform;
}

/* ============================================
   PROFILE PAGE - Zero Header Effects
   ============================================ */
/* Profile page must have zero header/nav effects */
.page-profile { 
  padding-top: 0 !important; 
}

.page-profile header, 
.page-profile .topbar, 
.page-profile .nav-shadow { 
  display: none !important; 
}

.page-profile .page-content, 
.page-profile main { 
  margin-top: 0 !important; 
}

/* Brand logo visibility rules */
.page-profile .qp-brand-link {
  display: none !important;   /* never on profile */
}

.page-dashboard .qp-brand-link {
  display: inline-flex;       /* visible on dashboard */
}

/* ============================================
   BRAND LOGO - Fixed Top-Left Position
   ============================================ */
/* Brand logo container - fixed top-left, above sidebar */
.qp-brand-logo-container {
  position: fixed;
  top: 2rem;
  left: 1.25rem;  /* Nudged left from 2rem */
  z-index: 60;  /* Above sidebar (z-45) but below modals */
  display: none; /* Hidden by default */
  pointer-events: auto;  /* Ensure clickable */
}

/* Show only on dashboard pages */
.page-dashboard .qp-brand-logo-container {
  display: block;
}

/* Hide on profile pages */
.page-profile .qp-brand-logo-container {
  display: none !important;
}

/* Mobile: completely hide logo */
@media (max-width: 768px) {
  .qp-brand-logo-container {
    display: none !important;
  }
}

/* Elegant brand logo - minimal, non-intrusive styling */
.page-dashboard .qp-brand-link {
  background: transparent;
  padding: 0.375rem 0.5rem;
  border-radius: 0.5rem;
  box-shadow: none;
  backdrop-filter: none;
  border: none;
  transition: opacity 0.22s ease;
  text-decoration: none;
  /* Subtle text shadow for better visibility on blue gradient */
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.3);
  /* Prevent text selection and drag ghost */
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -webkit-user-drag: none;
}

.page-dashboard .qp-brand-link * {
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: auto;  /* Keep click-through on the link itself */
}

.page-dashboard .qp-brand-link:hover {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
  transform: none;
  opacity: 1;
}

.page-dashboard .qp-brand-link:active {
  background: rgba(255, 255, 255, 0.12);
}

/* ============================================
   UPGRADE-TO-PRO MODAL - Premium UI
   ============================================ */
.ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pro-modal{position:fixed;inset:0;display:grid;place-items:center;z-index:120;opacity:0;pointer-events:none;transition:opacity.16s}
.pro-modal[aria-hidden="false"]{opacity:1;pointer-events:auto}
.pro-scrim{position:absolute;inset:0;background:rgba(2,6,23,.54);opacity:0;transition:opacity.16s}
.pro-modal[aria-hidden="false"] .pro-scrim{opacity:1}
.pro-panel{position:relative;width:min(560px,92vw);padding:1.25rem;border-radius:1.25rem;background:linear-gradient(180deg,rgba(255,255,255,.86),rgba(255,255,255,.9));backdrop-filter:blur(18px);box-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 10px 10px -5px rgba(0,0,0,.04)}
.pro-x{position:absolute;top:1rem;right:1rem;background:transparent;border:none;font-size:1.5rem;cursor:pointer;color:#475569;transition:color .15s}
.pro-x:hover{color:#0f172a}
.pro-badge{display:inline-block;background:linear-gradient(120deg,var(--royal),var(--sky));color:#fff;padding:.25rem .6rem;border-radius:.6rem;font-weight:700;font-size:.75rem;text-transform:uppercase}
.pro-head h2{font-weight:900;font-size:1.35rem;color:#0f172a;margin:.5rem 0 .25rem}
.pro-sub{color:#475569;font-size:.875rem}
.pro-list{margin:1rem 0;padding-left:1.2rem;color:#0f172a;list-style:disc}
.pro-list li{margin:.4rem 0}
.pro-price{text-align:center;margin:1rem 0;padding:1rem;background:rgba(67,56,202,.05);border-radius:.75rem}
.pro-amt{font-size:2rem;font-weight:900;color:var(--royal)}
.pro-amt span{font-size:1.25rem;font-weight:600;color:#64748b}
.pro-cta{display:flex;flex-direction:column;gap:.6rem;padding-top:.5rem}
.btn-pro{background:linear-gradient(90deg,var(--royal),var(--sky));color:#fff;border:none;border-radius:.9rem;padding:.8rem 1.2rem;font-weight:800;cursor:pointer;transition:all .2s;min-height:44px;text-align:center;text-decoration:none;display:inline-block}
.btn-pro:hover{transform:translateY(-1px);box-shadow:0 10px 15px -3px rgba(67,56,202,.3)}
.btn-pro:disabled{opacity:.6;cursor:not-allowed;transform:none}
.btn-outline{border:2px solid var(--royal);background:transparent;color:var(--royal);border-radius:.9rem;padding:.8rem 1.1rem;font-weight:700;cursor:pointer;transition:all .2s;min-height:44px}
.btn-outline:hover{background:var(--royal);color:#fff}
.btn-ghost{border:1px solid rgba(0,0,0,.08);background:transparent;color:#64748b;border-radius:.9rem;padding:.8rem 1.1rem;font-weight:600;cursor:pointer;transition:all .2s;min-height:44px}
.btn-ghost:hover{background:rgba(0,0,0,.02)}

/* --- Pro Benefits Grid --- */
.pro-benefits{margin:.35rem 0 .25rem}
.pro-benefits-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:.4rem}
.pro-benefits-head h3{font-weight:800;font-size:.95rem;color:#0f172a;margin:0}
.pro-grid{display:grid;grid-template-columns:1fr 1fr;gap:.55rem;list-style:none;padding:0;margin:0}
@media (max-width: 440px){.pro-grid{grid-template-columns:1fr}}
.pro-item{display:flex;gap:.55rem;align-items:flex-start;background:rgba(15,23,42,.04);border:1px solid rgba(2,6,23,.06);border-radius:.9rem;padding:.6rem .7rem}
.pro-ic{width:1.6rem;height:1.6rem;display:grid;place-items:center;border-radius:.5rem;background:linear-gradient(135deg,var(--royal),var(--sky));color:white;font-size:.9rem;flex:0 0 auto}
.pro-item-title{font-weight:700;color:#0f172a;line-height:1.15}
.pro-item-sub{font-size:.83rem;color:#475569;line-height:1.25}

/* ============================================
   MOBILE DRAWER - Edge Swipe Navigation
   ============================================ */
/* Drawer panel polish */
#drawer-panel {
  will-change: transform;
}

#drawer-scrim {
  will-change: opacity;
}

#drawer-scrim.on {
  opacity: 1;
  pointer-events: auto;
}

/* Ensure sidebar inside drawer fills height and scrolls gracefully */
#drawer-panel #drawer-sidebar {
  height: 100%;
  display: flex;
  flex-direction: column;
}

#drawer-panel nav {
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); /* extra space for last items */
}

/* Reduce line-height a bit for mobile density */
#drawer-panel .nav-item {
  line-height: 1.25rem;
}

/* Edge grabber — subtle and slim */
#drawer-grabber {
  will-change: transform, opacity;
}

#drawer-grabber:active {
  transform: translateY(-50%) scale(0.98);
}

/* Reduce accidental taps very near corners on small phones */
@media (max-width: 380px) {
  #drawer-grabber {
    top: 48%;
  }
}

/* Optional: Grabber subtle pulse on first visit */
@keyframes grabberPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

#drawer-grabber[data-hint="on"] {
  animation: grabberPulse 2s ease-in-out 3;
}


/* ============================================
   QUILLS REWARDS FAB (polished with badge, tooltip, animations)
   ============================================ */
.qp-rewards-fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 1050;
  border-radius: 9999px;
  transition: transform .18s ease, opacity .18s ease, bottom .22s ease;
}
.qp-rewards-fab:hover {
  transform: scale(1.05);
}

/* Count badge */
.qp-rewards-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  background: #10b981;
  color: #fff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transform: scale(0.9);
  opacity: 0.95;
}
.qp-rewards-badge.flash {
  animation: qpPulse 0.6s ease;
}
@keyframes qpPulse {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.12); }
  100% { transform: scale(0.9); }
}

/* Tooltip */
.qp-tt {
  position: fixed;
  right: 28px;
  bottom: 88px;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 1050;
}
.qp-tt.show {
  opacity: 1;
  transform: translateY(0);
}

/* Raise button when drawer is open */
.qp-rewards-fab--raised {
  bottom: 88px;
}

/* Drawer show/hide animation (right-side panel) */
#qp-rewards-drawer {
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
#qp-rewards-drawer.is-open {
  transform: translateY(0);
  opacity: 1;
}

/* Mobile offset */
@media (max-width: 480px) {
  .qp-rewards-fab {
    right: 18px;
    bottom: 18px;
  }
  .qp-rewards-fab--raised {
    bottom: 76px;
  }
  .qp-tt {
    right: 18px;
    bottom: 76px;
  }
}

/* ============================================
   ANIMATED GRADIENT UTILITIES
   ============================================ */

/* Animated gradient background for premium buttons */
.bg-size-200 {
  background-size: 200% 100%;
}

.bg-pos-0 {
  background-position: 0% 50%;
}

.bg-pos-100 {
  background-position: 100% 50%;
}

/* ============================================
   CONTEXT ACCORDION - Premium Glassmorphism Design
   ============================================ */
/* Context Accordion - Premium Glassmorphism Design */
.qc-context-accordion {
  position: relative;
  border-radius: 0.875rem;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.15);
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.04),
    0 10px 30px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

.qc-context-accordion:hover {
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.06),
    0 12px 36px rgba(15, 23, 42, 0.09);
  border-color: rgba(148, 163, 184, 0.22);
}

.qc-context-toggle {
  position: relative;
  width: 100%;
  text-align: left;
  padding: 0.875rem 1.125rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 0.875rem;
  transition: background-color 0.15s ease;
}

.qc-context-toggle:hover {
  background: rgba(148, 163, 184, 0.06);
}

.qc-context-toggle:focus {
  outline: 2px solid rgba(37, 99, 235, 0.5);
  outline-offset: 2px;
}

.qc-context-toggle-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-right: 2rem;
}

.qc-context-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.25;
}

.qc-context-subtitle {
  font-size: 0.8125rem;
  color: rgba(15, 23, 42, 0.58);
  line-height: 1.3;
}

.qc-context-chevron {
  position: absolute;
  right: 1.125rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: rgba(15, 23, 42, 0.5);
  transition: transform 0.2s ease, color 0.2s ease;
  pointer-events: none;
}

.qc-context-toggle:hover .qc-context-chevron {
  color: rgba(15, 23, 42, 0.7);
}

.qc-context-toggle[aria-expanded="true"] .qc-context-chevron {
  transform: translateY(-50%) rotate(180deg);
}

.qc-context-panel {
  overflow: hidden;
  transition:
    max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.22s ease,
    padding 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.qc-context-panel-collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0 1.125rem 0;
}

.qc-context-panel-expanded {
  max-height: 280px;
  opacity: 1;
  padding: 0 1.125rem 1rem;
}

.qc-context-textarea {
  min-height: 90px;
  max-height: 200px;
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
  .qc-context-accordion {
    border-radius: 0.75rem;
  }

  .qc-context-toggle {
    padding: 0.75rem 1rem;
  }

  .qc-context-toggle-row {
    padding-right: 1.75rem;
  }

  .qc-context-chevron {
    right: 1rem;
  }

  .qc-context-panel-collapsed {
    padding: 0 1rem 0;
  }

  .qc-context-panel-expanded {
    padding: 0 1rem 0.875rem;
  }
}

/* ============================================================================
   Workflow Toggle Styles
   ============================================================================
   Styles for the "Use detailed workflow" toggle that switches between
   Quick Outcome mode and Detailed workflow mode.
   ============================================================================ */

/* Subtle context - default state (slightly muted) */
.subtle-context {
    opacity: 0.85;
    transition: opacity 0.2s ease-in-out;
}

/* Active context - detailed workflow enabled */
.subtle-context--active {
    opacity: 1;
}

/* Disabled context - workflow toggle off */
.subtle-context--disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Quick outcome disabled state */
.quick-outcome-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f8fafc;
}

.quick-outcome-disabled:hover {
    background-color: #f8fafc;
}
