/* emza-dev.css
   Sigbash 2.0
   Dark navy theme with wizard styling
*/

/*------------------------------------------------
  1. ROOT VARIABLES & GLOBAL RESETS
------------------------------------------------*/
:root {
  --dark-navy: #1b1f3b;
  --accent-blue: #4a90e2;
  --white: #ffffff;
  --bg-darknavy: #0b0b13;
  --border-radius: 6px;
  --transition-speed: 0.3s;
  
  /* Enhanced Typography Scale */
  --heading-hero: 3.5rem;        /* Hero headlines (700 weight) */
  --heading-section: 2.5rem;     /* Section headings (600 weight) */
  --heading-card: 1.75rem;       /* Card titles (600 weight) */
  --heading-primary: 1.75rem;    /* Main section titles */
  --heading-secondary: 1.25rem;  /* Subsection titles */
  --body-lead: 1.25rem;          /* Lead paragraphs (400 weight) */
  --body-primary: 1rem;          /* Main content text (400 weight) */
  --body-secondary: 0.875rem;    /* Helper text, descriptions */
  --body-small: 0.75rem;         /* Metadata, counts */
  --line-height-tight: 1.2;      /* Headings */
  --line-height-normal: 1.6;     /* Body text */
  --line-height-relaxed: 1.7;    /* Long-form content */
  --letter-spacing-heading: 0.01em;  /* Heading letter-spacing */
  --letter-spacing-body: 0.005em;    /* Body letter-spacing */
  
  /* Consistent Spacing System - 8px Baseline Grid */
  --space-xs: 0.5rem;    /* 8px - Tight elements */
  --space-sm: 1rem;      /* 16px - Related items */
  --space-md: 1.5rem;    /* 24px - Card padding */
  --space-lg: 2rem;      /* 32px - Section elements */
  --space-xl: 3rem;      /* 48px - Between sections */
  --space-xxl: 4rem;     /* 64px - Major sections */

  /* Auto-save Status Colors */
  --success-green: #28a745;
  --warning-amber: #ffc107;
  --info-blue: #17a2b8;
  
  /* Enhanced Typography Scale - Refined */
  --font-display: 4rem;
  --font-h1: 3rem;
  --font-h2: 2.25rem;
  --font-h3: 1.75rem;
  --font-body-lg: 1.125rem;
  --font-body: 1rem;
  
  /* Weight System */
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  
  /* Enhanced Text Contrast */
  --text-primary: rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.75);
  --text-muted: rgba(255, 255, 255, 0.55);
  
  /* Spacing System - 8px baseline refined */
  --base: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 48px;
  --space-8: 64px;
  --space-10: 80px;
}

/* Ensure consistent margins & font usage */
html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--dark-navy);
  color: var(--text-primary);
  letter-spacing: var(--letter-spacing-body);
  line-height: var(--line-height-normal);
}

/* Global Typography Styles */
h1, .h1 {
  font-size: var(--heading-hero);
  font-weight: var(--weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-heading);
  margin-bottom: var(--space-md);
}

h2, .h2 {
  font-size: var(--heading-section);
  font-weight: var(--weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-heading);
  margin-bottom: var(--space-md);
}

h3, .h3 {
  font-size: var(--heading-card);
  font-weight: var(--weight-semibold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-heading);
  margin-bottom: var(--space-sm);
}

h4, .h4 {
  font-size: var(--heading-secondary);
  font-weight: var(--weight-semibold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-heading);
  margin-bottom: var(--space-sm);
}

h5, .h5, h6, .h6 {
  font-size: var(--body-primary);
  font-weight: 600;
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-heading);
  margin-bottom: var(--space-sm);
}

p {
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  font-weight: var(--weight-normal);
  line-height: var(--line-height-normal);
}

.lead {
  font-weight: var(--weight-normal);
  color: var(--text-secondary);
  font-size: var(--body-lead);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: var(--letter-spacing-body);
  margin-bottom: var(--space-md);
}

/*------------------------------------------------
  2. POLICY BUILDER TYPOGRAPHY & SPACING SYSTEM
------------------------------------------------*/

/* Policy Builder Container with Typography Variables */
.policy-builder-container {
  --heading-primary: 1.75rem;    /* Main section titles */
  --heading-secondary: 1.25rem;  /* Subsection titles */
  --body-primary: 1rem;          /* Main content text */
  --body-secondary: 0.875rem;    /* Helper text, descriptions */
  --body-small: 0.75rem;         /* Metadata, counts */
  --line-height-tight: 1.2;      /* Headings */
  --line-height-normal: 1.5;     /* Body text */
  --line-height-relaxed: 1.7;    /* Long-form content */
}

.policy-builder-title {
  font-size: var(--heading-primary);
  font-weight: 600;
  line-height: var(--line-height-tight);
  color: var(--white);
  margin-bottom: var(--space-sm);
}

.policy-section-title {
  font-size: var(--heading-secondary);
  font-weight: 500;
  line-height: var(--line-height-tight);
  color: var(--white);
  margin-bottom: var(--space-md);
}

.policy-description {
  font-size: var(--body-secondary);
  line-height: var(--line-height-relaxed);
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: var(--space-lg);
}

.policy-helper-text {
  font-size: var(--body-small);
  line-height: var(--line-height-normal);
  color: rgba(255, 255, 255, 0.6);
}

/* Consistent Spacing Classes */
.policy-builder-section {
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.policy-component-spacing {
  margin-bottom: var(--space-md);
}

.policy-component-spacing:last-child {
  margin-bottom: 0;
}

.policy-tight-spacing {
  margin-bottom: var(--space-sm);
}

/*------------------------------------------------
  2a. FEATURE CARDS & ICON STYLING
------------------------------------------------*/

/* Feature Card Base Styles */
.feature-card {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.02) 0%, 
    rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2),
              0 4px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: var(--space-5);
  border-radius: var(--border-radius);
}

.feature-card:hover {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25),
              0 12px 32px rgba(13, 110, 253, 0.15);
}

/* Feature Card Hover Effect */
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  background-color: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Hero Feature Card - Slightly Larger */
.feature-card-hero {
  transform: scale(1.03);
  border: 1px solid rgba(74, 144, 226, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2),
              0 8px 24px rgba(13, 110, 253, 0.2);
}

.feature-card-hero:hover {
  transform: scale(1.03) translateY(-6px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3),
              0 16px 40px rgba(13, 110, 253, 0.3);
}

/* Hero Card Hover (combines with base hover) */
.feature-card-hero:hover {
  transform: scale(1.05) translateY(-4px);
  box-shadow: 0 16px 40px rgba(13, 110, 253, 0.3);
}

/* Icon Wrapper with Gradient Background */
.icon-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0d6efd 0%, #4a90e2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
  transition: all 0.3s ease;
}

/* Icon Hover Animation */
.feature-card:hover .icon-wrapper {
  transform: scale(1.1);
  box-shadow: 0 8px 20px rgba(13, 110, 253, 0.5);
}

.icon-wrapper i {
  color: var(--white);
  transition: transform 0.3s ease;
}

/* Icon Rotation on Hover */
.feature-card:hover .icon-wrapper i {
  transform: rotate(5deg);
}

/* Feature Card Headings */
.feature-card h3 {
  font-size: var(--heading-card);
  font-weight: 600;
  line-height: var(--line-height-tight);
  color: var(--white);
}

/* Feature Card Text */
.feature-card p {
  font-size: var(--body-primary);
  line-height: var(--line-height-relaxed);
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0;
}

/*------------------------------------------------
  SPRINT 3: VISUAL DESIGN ENHANCEMENT
------------------------------------------------*/

/* Hero Section with Gradient Background */
.hero-section {
  padding: var(--space-xxl) 0;
  background: linear-gradient(135deg, rgba(13, 110, 253, 0.1) 0%, rgba(13, 110, 253, 0.05) 100%);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-xl);
}

/* Icon Color Coding by Feature Category */
/* Privacy Features - Blue Gradient (default, already set) */
.feature-card:nth-child(1) .icon-wrapper {
  background: linear-gradient(135deg, #0d6efd 0%, #4a90e2 100%);
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.feature-card:nth-child(1):hover .icon-wrapper {
  box-shadow: 0 8px 20px rgba(13, 110, 253, 0.5);
}

/* Security Features - Purple Gradient */
.feature-card:nth-child(2) .icon-wrapper,
.feature-card-hero .icon-wrapper {
  background: linear-gradient(135deg, #6f42c1 0%, #9b59b6 100%);
  box-shadow: 0 4px 12px rgba(111, 66, 193, 0.3);
}

.feature-card:nth-child(2):hover .icon-wrapper,
.feature-card-hero:hover .icon-wrapper {
  box-shadow: 0 8px 20px rgba(111, 66, 193, 0.5);
}

/* Bitcoin Integration - Orange Gradient */
.feature-card:nth-child(3) .icon-wrapper {
  background: linear-gradient(135deg, #f7931a 0%, #ff9500 100%);
  box-shadow: 0 4px 12px rgba(247, 147, 26, 0.3);
}

.feature-card:nth-child(3):hover .icon-wrapper {
  box-shadow: 0 8px 20px rgba(247, 147, 26, 0.5);
}

/* Elevation Shadow System */
.elevation-1 {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.elevation-2 {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.elevation-3 {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

/* Accent Color Variations */
:root {
  --primary: #0d6efd;
  --primary-light: #4a90e2;
  --primary-dark: #0a58ca;
}

/*------------------------------------------------
  SPRINT 4: POLISH & RESPONSIVE
------------------------------------------------*/

/* Tablet Optimization - Medium Breakpoint */






/*------------------------------------------------
  SECTION SPACING - Improved Layout Rhythm
------------------------------------------------*/
section {
  padding-top: var(--space-10);
  padding-bottom: var(--space-10);
}

.section-content {
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
}

/*------------------------------------------------
  ENHANCED NAVIGATION POLISH
------------------------------------------------*/
.navbar-nav .nav-link {
  position: relative;
  padding: 0.75rem 1rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-nav .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent-blue);
  transform: translateX(-50%);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-nav .nav-link:hover::after {
  width: 80%;
}

.navbar-nav .nav-link[data-section].active::after {
  width: 80%;
}

.dropdown-menu {
  animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/*------------------------------------------------
  TECH BADGES - Technical Credibility
------------------------------------------------*/
.tech-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  align-items: center;
}

.badge-tech {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, 
    rgba(74, 144, 226, 0.08) 0%, 
    rgba(74, 144, 226, 0.04) 100%);
  border: 1px solid rgba(74, 144, 226, 0.2);
  border-radius: 24px;
  font-size: 0.875rem;
  font-weight: var(--weight-medium);
  color: rgba(74, 144, 226, 0.95);
  letter-spacing: 0.02em;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.badge-tech:hover {
  background: linear-gradient(135deg, 
    rgba(74, 144, 226, 0.12) 0%, 
    rgba(74, 144, 226, 0.06) 100%);
  border-color: rgba(74, 144, 226, 0.35);
  transform: translateY(-1px);
}

@media (min-width: 768px) and (max-width: 1024px) {
  .hero-section h1,
  h1.display-3 {
    font-size: 2.75rem !important;
  }
  
  .feature-card {
    padding: var(--space-lg);
  }
  
  .container {
    max-width: 720px;
  }
  
  .icon-wrapper {
    width: 70px;
    height: 70px;
  }
}

/* Smooth Progress Bar Animation */
.progress-bar {
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus States for Keyboard Navigation */
a:focus,
button:focus,
.btn:focus,
.form-control:focus,
.form-select:focus {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

/* Focus visible for better UX */
a:focus-visible,
button:focus-visible,
.btn:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

/* Remove outline for mouse users */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
.btn:focus:not(:focus-visible) {
  outline: none;
}

/* Consistent Component Sizing */
.btn-lg {
  font-size: 1.125rem;
  padding: 0.75rem 2rem;
}

/* Modal Backdrop Blur Enhancement */
.modal-backdrop.show {
  backdrop-filter: blur(4px);
  background-color: rgba(0, 0, 0, 0.6);
}

/* WASM Overlay Fade-Out */
.wasm-loading-overlay.hidden {
  opacity: 0;
  transition: opacity 0.5s ease-out;
}


/*------------------------------------------------
  2b. BUTTON HOVER & INTERACTION STATES
------------------------------------------------*/

/* Primary Button Hover States */
.btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(13, 110, 253, 0.2),
              0 4px 12px rgba(13, 110, 253, 0);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(13, 110, 253, 0.2),
              0 8px 20px rgba(13, 110, 253, 0.3);
  background-color: #4a90e2;
  border-color: #4a90e2;
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(13, 110, 253, 0.3);
}

.btn:focus-visible {
  outline: 2px solid rgba(13, 110, 253, 0.5);
  outline-offset: 3px;
}

.btn-primary:focus {
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.5);
}

/* Secondary Button Hover States */
.btn-secondary {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

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

/* Link Hover States */
a {
  transition: color 0.2s ease;
}

.nav-link {
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--accent-blue) !important;
}

/*------------------------------------------------
  3. NAVBAR / BRANDING
------------------------------------------------*/
.navbar-dark.bg-darknavy {
  background-color: var(--bg-darknavy) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-right: 8px;
}

/*------------------------------------------------
  3. MAIN CONTAINER LAYOUT
------------------------------------------------*/
.main-container {
  padding: 2rem;
}

/*------------------------------------------------
  3a. CONDITION SELECTION MODAL STYLING - Dark Theme Fix
------------------------------------------------*/
/* Fix white background and white text issue in conditionSelectionModal */
#conditionSelectionModal .modal-content {
  background-color: var(--dark-navy) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white) !important;
}

#conditionSelectionModal .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background-color: var(--bg-darknavy);
}

#conditionSelectionModal .modal-body {
  background-color: var(--dark-navy);
  color: var(--white);
}

#conditionSelectionModal .modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background-color: var(--bg-darknavy);
}

/* Fix accordion styling in modal */
#conditionSelectionModal .accordion-item {
  background-color: var(--dark-navy);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#conditionSelectionModal .accordion-button {
  background-color: var(--bg-darknavy);
  color: var(--white);
  border: none;
}

#conditionSelectionModal .accordion-button:not(.collapsed) {
  background-color: var(--accent-blue);
  color: var(--white);
}

#conditionSelectionModal .accordion-body {
  background-color: var(--dark-navy);
  color: var(--white);
}

/* Fix condition cards in modal */
#conditionSelectionModal .condition-card {
  background-color: var(--bg-darknavy);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white);
}

#conditionSelectionModal .condition-card:hover {
  background-color: rgba(74, 144, 226, 0.1);
  border-color: var(--accent-blue);
}

/* Fix search input styling */
#conditionSelectionModal .form-control {
  background-color: var(--bg-darknavy);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--white);
}

#conditionSelectionModal .form-control:focus {
  background-color: var(--bg-darknavy);
  border-color: var(--accent-blue);
  color: var(--white);
  box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25);
}

/* Fix alert styling in modal */
#conditionSelectionModal .alert {
  background-color: var(--bg-darknavy);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white);
}

/*------------------------------------------------
  3b. PIN INPUT MODAL STYLING - Dark Theme Fix
------------------------------------------------*/
/* Apply dark theme to PIN modal */
#pinInputModal .modal-content {
  background-color: var(--dark-navy) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white) !important;
}

#pinInputModal .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background-color: var(--dark-navy);
}

#pinInputModal .modal-body {
  background-color: var(--dark-navy);
  color: var(--white);
}

#pinInputModal .modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background-color: var(--dark-navy);
}

/*------------------------------------------------
  3c. POLICY VALIDATION ERROR MODAL - Dark Theme
-------------------------------------------------*/
#policyValidationErrorModal .modal-content {
  background-color: var(--dark-navy) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white) !important;
}

#policyValidationErrorModal .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background-color: var(--dark-navy);
}

#policyValidationErrorModal .modal-body {
  background-color: var(--dark-navy);
  color: var(--white);
}

#policyValidationErrorModal .modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background-color: var(--dark-navy);
}

#policyValidationErrorModal .modal-title {
  color: var(--white);
}

/*------------------------------------------------
  3d. GENERIC ERROR MODAL - Dark Theme
-------------------------------------------------*/
#genericErrorModal .modal-content {
  background-color: var(--dark-navy) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white) !important;
}

#genericErrorModal .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background-color: var(--dark-navy);
}

#genericErrorModal .modal-body {
  background-color: var(--dark-navy);
  color: var(--white);
}

#genericErrorModal .modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background-color: var(--dark-navy);
}

#genericErrorModal .modal-title {
  color: var(--white);
}

/*------------------------------------------------
  3e. AUTHENTICATION ERROR MODAL - Dark Theme
-------------------------------------------------*/
#authenticationErrorModal .modal-content {
  background-color: var(--dark-navy) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white) !important;
}

#authenticationErrorModal .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background-color: var(--dark-navy);
}

#authenticationErrorModal .modal-body {
  background-color: var(--dark-navy);
  color: var(--white);
}

#authenticationErrorModal .modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background-color: var(--dark-navy);
}

#authenticationErrorModal .modal-title {
  color: var(--white);
}

#pinInputModal .form-control {
  background-color: var(--bg-darknavy);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--white);
}

#pinInputModal .form-control:focus {
  background-color: var(--bg-darknavy);
  border-color: var(--accent-blue);
  color: var(--white);
  box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25);
}

#pinInputModal .alert-warning {
  background-color: rgba(255, 193, 7, 0.1);
  border: 1px solid rgba(255, 193, 7, 0.3);
  color: #ffc107;
}

/* Each "section-content" is a page-like area. By default hidden. */
.section-content {
  display: none;
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
}

.section-content.active {
  display: block;
  animation: fadeIn 0.4s ease-in-out forwards;
}

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

/* Smooth Scroll Behavior */
html {
  scroll-behavior: smooth;
}

/*------------------------------------------------
  4. WIZARD PROGRESS BAR & STEPS
------------------------------------------------*/
.wizard-progress-container {
  margin-bottom: 1.5rem;
}

.wizard-progress {
  position: relative;
  width: 100%;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  margin-bottom: 0.75rem;
}

.wizard-progress-bar {
  position: absolute;
  left: 0;
  top: 0;
  height: 6px;
  width: 0%;
  background-color: var(--accent-blue);
  border-radius: 3px;
  transition: width var(--transition-speed) ease;
}

.wizard-steps {
  display: flex;
  justify-content: space-between;
}

.wizard-step {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.6;
  transition: opacity var(--transition-speed) ease;
}

.wizard-step.active {
  font-weight: bold;
  opacity: 1;
}

/*------------------------------------------------
  5. WIZARD FORM STYLING
------------------------------------------------*/
.wizard-form {
  background-color: #2f2f49;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Step content inside wizard, hidden unless active */
.wizard-step-content:not(.active) {
  display: none;
}

/* Buttons area */
.wizard-buttons {
  margin-top: 1.5rem;
}

.wizard-buttons .btn {
  margin-right: 1rem;
  text-transform: uppercase;
  font-weight: bold;
  letter-spacing: 0.5px;
}

/*------------------------------------------------
  6. FORMS & INPUTS
------------------------------------------------*/
.form-control,
.form-select {
  background-color: #1b1f3b; 
  color: var(--white);
  border: 1px solid #444;
  border-radius: var(--border-radius);
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.form-control:focus,
.form-select:focus {
  box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25);
  border-color: var(--accent-blue);
}

/* Key input row & condition row spacing */
.key-input-row,
.condition-row {
  margin-bottom: 0.5rem;
  gap: 0.5rem; /* Provide consistent spacing */
  width: 50%;
}

/* Inputs within rows */
.key-input-row input,
.key-input-row select,
.condition-row input,
.condition-row select {
  flex-grow: 0;
  flex-shrink: 1;
}

/* Buttons inside key/condition rows */
#add-key-btn,
#add-condition-btn,
.remove-key-btn,
.remove-condition-btn {
  text-transform: uppercase;
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
  white-space: nowrap;
}

/*------------------------------------------------
  7. ALERTS / MESSAGES
------------------------------------------------*/
/* Override default .alert background so it stands out on the dark background */
.alert {
  background-color: #f0f0f0 !important;
  color: #000 !important;
  border-radius: var(--border-radius) !important;
  margin-top: 1rem;
}

.alert p {
  color: inherit !important;
}

/*------------------------------------------------
  8. FAQ ACCORDION
------------------------------------------------*/
.accordion-button {
  color: #000;
}
.accordion-button:not(.collapsed) {
  background-color: #e8e8e8;
}
.accordion-body {
  background-color: #fafafa;
  color: #000;
}

/*------------------------------------------------
  9. QR CODE DISPLAY
------------------------------------------------*/
.qr-code-container {
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius);
  padding: 1rem;
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.qr-display {
  display: block;
  text-align: center;
}

#pubKeyQRCanvas,
#silentPayQRCanvas {
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  display: block;
}

/*------------------------------------------------
  10. RESPONSIVE TWEAKS
------------------------------------------------*/
@media (max-width: 768px) {
  .wizard-form {
    padding: 1rem;
  }
  .wizard-steps {
    flex-direction: column;
    gap: 0.5rem;
  }
  .wizard-step {
    text-align: left;
  }
  
  /* Improve mobile form layout */
  .form-select, 
  .form-control {
    width: 100%;
    min-width: 100% !important;
  }
  
  /* Stack row items properly on small screens */
  .key-input-row,
  .condition-row {
    flex-direction: column;
    align-items: flex-start !important;
  }
  
  /* Ensure buttons span full width on mobile */
  .key-input-row .btn,
  .condition-row .btn {
    width: 100%;
  }
  
  /* Container padding adjustment */
  .main-container {
    padding: 1rem;
  }
  
  /* QR code responsive fixes */
  .qr-code-container {
    margin-top: 1.5rem;
  }
  
  #pubKeyQRCanvas,
  #silentPayQRCanvas {
    max-width: 90%;
  }
}


/* Simple sidebar styles */
.sidebar {
  width: 250px;
  background: #f8f9fa;
  border-right: 1px solid #ddd;
  padding: 1rem;
  display: none;         /* hidden until login */
  flex-shrink: 0;
}
.sidebar.active { display: block; }
.sidebar h4 { margin-top: 0; }
.sidebar .nav-link { display: block; margin: .5rem 0; cursor: pointer; }
.content { flex: 1; overflow-y: auto; padding: 1rem; }

.card-header { background-color: #004080; color: #000; }
.list-group-item { cursor: pointer; }
.list-group-item:hover { background-color: #e9ecef; }

/* mobile bottom tab bar */
@media (max-width: 767px) {
  .navbar.fixed-bottom {
    border-top: 1px solid #ddd;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
  }
  .navbar.fixed-bottom .nav-link {
    padding: 0.4rem 0;
    font-size: 0.75rem;
  }
  .input-unit-wrapper {
    position: relative;
    display: block;
  }
  .unit-label {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #6c757d;
  }
}

/* Bootstrap Tab Styling */
.nav-tabs .nav-link:not(.active) {
  background-color: #f0f0f0;
  border-bottom: 1px solid #dee2e6;
}

.nav-tabs .nav-link:not(.active):hover {
  background-color: #e0e0e0;
  border-color: #e9ecef #e9ecef #dee2e6;
}

@media (min-width: 768px) {
  /* 1) Center & cap the width of forms & cards */
  /* Applies to both the Send form and the Verify-key card */
  #sendFunds form,
  #verifyResultContainer .card {
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
  }
  #requestMessageContainer .btn-group {
    display: inline-flex;      /* shrink-to-content */
    justify-content: center;    /* center within the card */
    gap: 0.5rem;                /* little breathing room */
  }
  #requestMessageContainer .btn-group .btn {
    flex: 1 1 auto;             /* equal widths, but not full-screen */
    max-width: 140px;           /* cap each toggle */
  }
  #requestMessageContainer .card {
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
  }
  #verifyResultContainer .btn-group {
    display: inline-flex;      /* shrink-to-content */
    justify-content: center;    /* center within the card */
    gap: 0.5rem;                /* little breathing room */
  }
  #verifyResultContainer .btn-group .btn {
    flex: 1 1 auto;             /* equal widths, but not full-screen */
    max-width: 140px;           /* cap each toggle */
  }
}

/* ——————————————————————————
   Toggle nav-items by login state
   —————————————————————————— */

.requires-login { display: none !important; }
.requires-logout { display: none !important; }

.logged-in  .requires-login  { display: block !important; }
.logged-out .requires-logout { display: block !important; }

/* Offcanvas link styling */
.offcanvas-link {
  display: block;
  padding: 0.5rem 0;
  color: var(--bs-body-color);
  text-decoration: none;
}
.offcanvas-link:hover {
  text-decoration: underline;
}

/* QR-card consistency (vanity ID + truncated text) */
.qr-card .vanity-id { 
  font-weight: bold;
  text-align: center;
}
.qr-card .qr-text {
  font-size: 0.85rem;
  text-align: center;
  color: #666;
  word-break: break-all;
}

/* Mobile bottom tabs */
.mobile-tab-bar .nav-link {
  padding: 0.5rem 0;
}

/* Condition field visibility classes */
.condition-field-hidden {
  display: none !important;
}

.condition-field-visible {
  display: block !important;
}

/*------------------------------------------------
  POET TREE VISUALIZATION COMPONENTS
------------------------------------------------*/

/* POET Tree Container */
.poet-tree-wrapper {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin: 1rem 0;
}

.poet-tree-container {
  position: relative;
}

/* Tree Controls */
.poet-tree-controls {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.poet-tree-controls .btn-outline-secondary {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  transition: all var(--transition-speed);
}

.poet-tree-controls .btn-outline-secondary:hover {
  background-color: var(--accent-blue);
  color: var(--white);
}

/* POET Node Base Styles */
.poet-node {
  margin-bottom: 0.75rem;
  position: relative;
}

.poet-node:last-child {
  margin-bottom: 0;
}

/* Level-based indentation */
.poet-node.level-0 { margin-left: 0; }
.poet-node.level-1 { margin-left: 1rem; }
.poet-node.level-2 { margin-left: 2rem; }
.poet-node.level-3 { margin-left: 3rem; }
.poet-node.level-4 { margin-left: 4rem; }
.poet-node.level-5 { margin-left: 5rem; }

/* Operator Node Styles */
.poet-operator-node .poet-node-header.card {
  background: rgba(255, 255, 255, 0.05);
  border-width: 2px;
  margin-bottom: 0.5rem;
  transition: all var(--transition-speed);
}

.poet-operator-node .poet-node-header.card:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Operator-specific border colors */
.poet-operator-node .border-success { border-color: #198754 !important; }
.poet-operator-node .border-primary { border-color: #0d6efd !important; }
.poet-operator-node .border-warning { border-color: #ffc107 !important; }
.poet-operator-node .border-info { border-color: #0dcaf0 !important; }
.poet-operator-node .border-danger { border-color: #dc3545 !important; }
.poet-operator-node .border-secondary { border-color: #6c757d !important; }
.poet-operator-node .border-dark { border-color: #212529 !important; }

/* Operator Icons */
.poet-operator-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-blue);
}

/* AND operator - green theme */
.poet-operator-node .border-success .poet-operator-icon {
  background: rgba(25, 135, 84, 0.2);
  color: #198754;
}

/* OR operator - blue theme */
.poet-operator-node .border-primary .poet-operator-icon {
  background: rgba(13, 110, 253, 0.2);
  color: #0d6efd;
}

/* THRESHOLD - yellow theme */
.poet-operator-node .border-warning .poet-operator-icon {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
}

/* Toggle Button Styles */
.poet-node-toggle {
  color: var(--accent-blue);
  text-decoration: none;
  transition: all var(--transition-speed);
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.poet-node-toggle:hover {
  color: var(--white);
  background-color: var(--accent-blue);
  border-radius: 50%;
  transform: rotate(90deg);
}

.poet-node-toggle:focus {
  box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25);
}

/* Node Children Container */
.poet-node-children {
  position: relative;
  overflow: hidden;
  transition: all var(--transition-speed) ease;
}

/* Connection lines for tree structure */
.poet-node-children::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
}

/* Condition Node Styles */
.poet-condition-node .alert {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--white);
  transition: all var(--transition-speed);
}

.poet-condition-node .alert:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-blue);
}

/* Condition Icons */
.poet-condition-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: rgba(74, 144, 226, 0.2);
  color: var(--accent-blue);
  font-size: 0.875rem;
}

/* Condition Details */
.poet-condition-details {
  color: rgba(255, 255, 255, 0.7);
}

/* Error and Unknown Node Styles */
.poet-error-node .alert-danger,
.poet-unknown-node .alert-warning {
  background: rgba(220, 53, 69, 0.1);
  border-color: rgba(220, 53, 69, 0.3);
  color: var(--white);
}

.poet-unknown-node .alert-warning {
  background: rgba(255, 193, 7, 0.1);
  border-color: rgba(255, 193, 7, 0.3);
}

/* Badges */
.poet-node .badge {
  font-size: 0.75rem;
  padding: 0.35em 0.65em;
}

/* Expand/Collapse Animation States */
.poet-node.expanded .poet-node-toggle i {
  transform: rotate(90deg);
}

.poet-node.collapsed .poet-node-children {
  max-height: 0;
  overflow: hidden;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.poet-node.expanded .poet-node-children {
  max-height: 2000px; /* Large enough for most trees */
  overflow: visible;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
  .poet-tree-wrapper {
    padding: 0.75rem;
    margin: 0.75rem 0;
  }
  
  .poet-tree-controls {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .poet-tree-controls .d-flex {
    justify-content: center;
  }
  
  /* Reduce indentation on mobile */
  .poet-node.level-1 { margin-left: 0.5rem; }
  .poet-node.level-2 { margin-left: 1rem; }
  .poet-node.level-3 { margin-left: 1.5rem; }
  .poet-node.level-4 { margin-left: 2rem; }
  .poet-node.level-5 { margin-left: 2.5rem; }
  
  /* Larger touch targets */
  .poet-node-toggle {
    width: 2rem;
    height: 2rem;
  }
  
  /* Simplified node headers */
  .poet-operator-node .card-body {
    padding: 0.75rem;
  }
  
  .poet-operator-desc {
    display: none; /* Hide descriptions on mobile to save space */
  }
}

/* Small mobile screens */
@media (max-width: 480px) {
  .poet-node.level-1,
  .poet-node.level-2,
  .poet-node.level-3,
  .poet-node.level-4,
  .poet-node.level-5 {
    margin-left: 0.25rem; /* Minimal indentation */
  }
  
  .poet-tree-controls small {
    display: none; /* Hide instructions on very small screens */
  }
}

/* Accessibility improvements */
.poet-node-toggle:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .poet-tree-wrapper {
    border-width: 2px;
  }
  
  .poet-operator-node .poet-node-header.card {
    border-width: 3px;
  }
  
  .poet-condition-node .alert {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .poet-node,
  .poet-node-toggle,
  .poet-node-children,
  .poet-operator-node .poet-node-header.card {
    transition: none;
  }
}

/*------------------------------------------------
  ENHANCED INTERACTIVE POET TREE COMPONENTS - T10_S02
  Select-then-Act paradigm with keyboard navigation
------------------------------------------------*/

/* Interactive Tree Wrapper */
.poet-interactive-tree-wrapper {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin: 1rem 0;
  position: relative;
}

.poet-interactive-tree-container {
  position: relative;
  outline: none; /* Remove focus outline since we handle focus internally */
}

/* Enhanced Tree Controls */
.poet-interactive-tree-controls {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.poet-keyboard-hints {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Interactive Node Base Styles */
.poet-interactive-node {
  position: relative;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
  border-radius: var(--border-radius);
  outline: none;
}

/* Node Selection States */
.poet-interactive-node:focus {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.poet-interactive-node.poet-node-selected {
  background: rgba(74, 144, 226, 0.1);
  box-shadow: 0 0 0 2px var(--accent-blue);
  transform: scale(1.02);
}

.poet-interactive-node.poet-node-selected .poet-node-content {
  background: rgba(74, 144, 226, 0.05);
}

/* Node Content Wrapper */
.poet-node-content {
  transition: all 0.2s ease;
  border-radius: var(--border-radius);
  position: relative;
}

/* Selection Interaction Area */
.poet-node-selection-area {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  cursor: pointer;
  z-index: 1;
  border-radius: var(--border-radius);
}

.poet-node-selection-area:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Contextual Actions */
.poet-contextual-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.2s ease;
  pointer-events: none;
}

.poet-contextual-actions.poet-actions-visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.poet-action-btn {
  min-width: 140px;
  text-align: left;
  font-size: 0.875rem;
  border-radius: var(--border-radius);
  animation: slideInAction 0.2s ease forwards;
  opacity: 0;
  transform: translateX(-10px);
}

@keyframes slideInAction {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.poet-action-btn:hover {
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.poet-action-add-child {
  background: #28a745;
  border-color: #28a745;
}

.poet-action-add-sibling {
  background: #17a2b8;
  border-color: #17a2b8;
}

.poet-action-edit {
  background: #ffc107;
  border-color: #ffc107;
  color: #000;
}

.poet-action-more {
  background: #6c757d;
  border-color: #6c757d;
}

/* Insertion and Context Menus */
.poet-insertion-menu,
.poet-context-menu {
  min-width: 200px;
  max-width: 280px;
  background: var(--dark-navy);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: menuSlideIn 0.2s ease;
  z-index: 1001;
}

@keyframes menuSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.poet-insertion-menu .card-header,
.poet-context-menu .card-header {
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.poet-insertion-menu .card-body,
.poet-context-menu .card-body {
  background: var(--dark-navy);
}

.poet-insertion-menu .btn,
.poet-context-menu .btn {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.2);
  transition: all 0.15s ease;
}

.poet-insertion-menu .btn:hover,
.poet-context-menu .btn:hover {
  background: rgba(74, 144, 226, 0.2);
  border-color: var(--accent-blue);
  transform: translateX(4px);
}

/* Configuration Panel */
.poet-config-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  height: 100vh;
  background: var(--dark-navy);
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 1002;
  overflow-y: auto;
}

.poet-config-panel.poet-config-panel-visible {
  transform: translateX(0);
}

.poet-config-header {
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.poet-config-form {
  background: var(--dark-navy);
}

.poet-config-form .form-label {
  color: var(--white);
  font-weight: 500;
}

.poet-config-form .form-control {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--white);
}

.poet-config-form .form-control:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-blue);
  color: var(--white);
  box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25);
}

.poet-config-form .form-control::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.poet-config-actions {
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Panel Overlay */
.poet-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1001;
  pointer-events: none;
}

.poet-panel-overlay.poet-panel-overlay-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Validation States */
.poet-interactive-node.validation-error {
  border-left: 3px solid #dc3545;
}

.poet-interactive-node.validation-warning {
  border-left: 3px solid #ffc107;
}

.poet-interactive-node.validation-success {
  border-left: 3px solid #28a745;
}

/* Validation Feedback */
.poet-validation-indicator {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  z-index: 2;
}

.poet-validation-indicator.error {
  background: #dc3545;
  color: white;
}

.poet-validation-indicator.warning {
  background: #ffc107;
  color: #000;
}

.poet-validation-indicator.success {
  background: #28a745;
  color: white;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
  .poet-config-panel {
    width: 100%;
    height: 100vh;
  }
  
  .poet-contextual-actions {
    position: fixed !important;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    background: rgba(27, 31, 59, 0.95);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.2);
  }
  
  .poet-contextual-actions.poet-actions-visible {
    transform: translateX(-50%) translateY(0);
  }
  
  .poet-action-btn {
    min-width: auto;
    padding: 0.5rem;
    font-size: 0.75rem;
  }
  
  .poet-insertion-menu,
  .poet-context-menu {
    max-width: 90vw;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  .poet-keyboard-hints {
    display: none; /* Hide keyboard hints on mobile */
  }
}

/* Mobile Master-Detail Navigation Styles */
.mobile-policy-master {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--dark-navy);
}

.mobile-nav-header {
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  min-height: 60px;
}

.mobile-breadcrumb span {
  font-size: 0.875rem;
  font-weight: 500;
}

.mobile-node-summary {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-node-list {
  background: var(--dark-navy);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-node-item {
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-node-item:hover,
.mobile-node-item.touched {
  background: rgba(255, 255, 255, 0.05);
}

.mobile-node-item:active {
  background: rgba(74, 144, 226, 0.1);
}

.mobile-node-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(74, 144, 226, 0.1);
  flex-shrink: 0;
}

.mobile-node-content h6 {
  font-weight: 600;
  color: var(--white);
}

.mobile-node-content p {
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.3;
}

.mobile-node-actions {
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.5);
}

.mobile-empty-state {
  padding: 3rem 1rem;
  color: rgba(255, 255, 255, 0.6);
}

.mobile-actions {
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.mobile-actions .btn {
  min-width: 120px;
  font-weight: 500;
}

/* Mobile Editor Styles */
.mobile-editor {
  background: var(--dark-navy);
  z-index: 1050;
}

.mobile-editor-header {
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  min-height: 60px;
  flex-shrink: 0;
}

.mobile-editor-content {
  background: var(--dark-navy);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-edit-form .form-control {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--white);
  font-size: 16px; /* Prevent zoom on iOS */
}

.mobile-edit-form .form-control:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25);
}

.mobile-edit-form .form-label {
  color: var(--white);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* Mobile Navigation Animations */
.mobile-view-transition {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-view-enter {
  transform: translateX(100%);
}

.mobile-view-enter-active {
  transform: translateX(0);
}

.mobile-view-exit {
  transform: translateX(0);
}

.mobile-view-exit-active {
  transform: translateX(-100%);
}

/* Touch Feedback */
.mobile-node-item:active,
.mobile-actions .btn:active {
  transform: scale(0.98);
}

/* Safe area handling for mobile devices */
@supports (padding: max(0px)) {
  .mobile-policy-master {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  .mobile-nav-header {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  
  .mobile-actions {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
}

/* Mobile-specific accessibility */
@media (max-width: 768px) {
  .mobile-node-item {
    min-height: 60px; /* Minimum touch target size */
  }
  
  .mobile-actions .btn {
    min-height: 44px; /* iOS recommended touch target */
    padding: 0.75rem 1rem;
  }
  
  /* High contrast for mobile */
  @media (prefers-contrast: high) {
    .mobile-node-item {
      border-bottom: 2px solid #ffffff;
    }
    
    .mobile-node-icon {
      border: 2px solid #ffffff;
    }
  }
  
  /* Reduced motion for mobile */
  @media (prefers-reduced-motion: reduce) {
    .mobile-view-transition,
    .mobile-node-item {
      transition: none;
    }
  }
}

/* Validation Tooltips and Enhanced Feedback */
.poet-validation-tooltip {
  position: fixed;
  background: var(--dark-navy);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius);
  padding: 0.75rem;
  max-width: 350px;
  font-size: 0.875rem;
  color: var(--white);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  line-height: 1.4;
}

.poet-validation-tooltip .validation-errors {
  margin-bottom: 0.5rem;
}

.poet-validation-tooltip .validation-errors strong {
  color: #dc3545;
  display: block;
  margin-bottom: 0.25rem;
}

.poet-validation-tooltip .validation-warnings {
  margin-bottom: 0.5rem;
}

.poet-validation-tooltip .validation-warnings strong {
  color: #ffc107;
  display: block;
  margin-bottom: 0.25rem;
}

.poet-validation-tooltip .validation-suggestions {
  margin-bottom: 0.5rem;
}

.poet-validation-tooltip .validation-suggestions strong {
  color: #17a2b8;
  display: block;
  margin-bottom: 0.25rem;
}

.poet-validation-tooltip ul {
  margin: 0;
  padding-left: 1rem;
  list-style-type: disc;
}

.poet-validation-tooltip li {
  margin-bottom: 0.25rem;
  color: rgba(255, 255, 255, 0.9);
}

/* Validation Summary */
.poet-validation-summary {
  margin-bottom: 1rem;
}

.poet-validation-summary .border {
  border-color: rgba(255, 255, 255, 0.2) !important;
  background: rgba(255, 255, 255, 0.02);
}

.poet-validation-summary .text-success {
  color: #28a745 !important;
}

.poet-validation-summary .text-danger {
  color: #dc3545 !important;
}

.poet-validation-summary .text-warning {
  color: #ffc107 !important;
}

/* Enhanced Validation Indicators */
.poet-validation-indicator {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  z-index: 2;
  border: 2px solid transparent;
  cursor: help;
  transition: all 0.2s ease;
}

.poet-validation-indicator:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.poet-validation-indicator.error {
  background: #dc3545;
  color: white;
  border-color: #c82333;
  animation: pulse-error 2s infinite;
}

.poet-validation-indicator.warning {
  background: #ffc107;
  color: #000;
  border-color: #e0a800;
  animation: pulse-warning 3s infinite;
}

.poet-validation-indicator.success {
  background: #28a745;
  color: white;
  border-color: #218838;
}

/* Validation indicator animations */
@keyframes pulse-error {
  0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

@keyframes pulse-warning {
  0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(255, 193, 7, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

/* Enhanced validation border states */
.poet-interactive-node.validation-error {
  border-left: 4px solid #dc3545;
  background: rgba(220, 53, 69, 0.05);
}

.poet-interactive-node.validation-warning {
  border-left: 4px solid #ffc107;
  background: rgba(255, 193, 7, 0.05);
}

.poet-interactive-node.validation-success {
  border-left: 4px solid #28a745;
  background: rgba(40, 167, 69, 0.03);
}

/* Validation highlight on hover */
.poet-interactive-node.validation-error:hover {
  background: rgba(220, 53, 69, 0.1);
  border-left-width: 6px;
}

.poet-interactive-node.validation-warning:hover {
  background: rgba(255, 193, 7, 0.1);
  border-left-width: 6px;
}

/* Real-time validation feedback */
.poet-validation-live {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--dark-navy);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius);
  padding: 1rem;
  max-width: 300px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 999;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.poet-validation-live.visible {
  opacity: 1;
  transform: translateY(0);
}

.poet-validation-live.error {
  border-color: #dc3545;
  background: rgba(220, 53, 69, 0.1);
}

.poet-validation-live.warning {
  border-color: #ffc107;
  background: rgba(255, 193, 7, 0.1);
}

.poet-validation-live.success {
  border-color: #28a745;
  background: rgba(40, 167, 69, 0.1);
}

/* Mobile validation adjustments */
@media (max-width: 768px) {
  .poet-validation-tooltip {
    max-width: 90vw;
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%);
    margin: 0;
  }
  
  .poet-validation-indicator {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.875rem;
  }
  
  .poet-validation-live {
    bottom: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
  
  .poet-validation-summary {
    font-size: 0.875rem;
  }
  
  /* Reduce animation on mobile for performance */
  .poet-validation-indicator.error,
  .poet-validation-indicator.warning {
    animation: none;
  }
}

/* Accessibility improvements for validation */
@media (prefers-reduced-motion: reduce) {
  .poet-validation-indicator,
  .poet-validation-live {
    animation: none;
    transition: none;
  }
}

@media (prefers-contrast: high) {
  .poet-validation-indicator.error {
    background: #ff0000;
    border-color: #ffffff;
  }
  
  .poet-validation-indicator.warning {
    background: #ffff00;
    color: #000000;
    border-color: #000000;
  }
  
  .poet-validation-indicator.success {
    background: #00ff00;
    color: #000000;
    border-color: #000000;
  }
  
  .poet-validation-tooltip {
    border: 2px solid #ffffff;
    background: #000000;
  }
}

/* Drag and Drop Enhancement (Optional - Desktop Only) */
@media (min-width: 769px) {
  .poet-interactive-node.draggable {
    cursor: grab;
  }
  
  .poet-interactive-node.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: rotate(2deg);
  }
  
  .poet-drop-zone {
    border: 2px dashed var(--accent-blue);
    background: rgba(74, 144, 226, 0.1);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin: 0.5rem 0;
    transition: all 0.2s ease;
  }
  
  .poet-drop-zone.active {
    background: rgba(74, 144, 226, 0.2);
    border-color: var(--accent-blue);
  }
}

/* Animation System */
.poet-tree-animation {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.poet-node-enter {
  opacity: 0;
  transform: scale(0.9) translateY(-10px);
}

.poet-node-enter-active {
  opacity: 1;
  transform: scale(1) translateY(0);
  transition: all 0.3s ease;
}

.poet-node-exit {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.poet-node-exit-active {
  opacity: 0;
  transform: scale(0.9) translateY(-10px);
  transition: all 0.3s ease;
}

/* Accessibility Enhancements */
.poet-interactive-tree-wrapper[role="tree"] {
  outline: none;
}

.poet-interactive-node[role="treeitem"] {
  outline: none;
}

.poet-interactive-node[aria-selected="true"] {
  background: rgba(74, 144, 226, 0.15);
}

@media (prefers-reduced-motion: reduce) {
  .poet-interactive-node,
  .poet-contextual-actions,
  .poet-action-btn,
  .poet-config-panel,
  .poet-panel-overlay,
  .poet-insertion-menu,
  .poet-context-menu {
    transition: none;
    animation: none;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .poet-interactive-node.poet-node-selected {
    outline: 3px solid #ffffff;
    background: #000000;
  }
  
  .poet-contextual-actions {
    border: 2px solid #ffffff;
  }
  
  .poet-config-panel {
    border: 2px solid #ffffff;
  }
}

/*------------------------------------------------
  TEMPLATE SELECTION INTERFACE
  Task: T04_S02_D - Template-Driven Policy Initiation
------------------------------------------------*/

/* Template selection screen layout */
.template-selection-screen {
  padding: 2rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.template-header h2 {
  color: var(--white);
  margin-bottom: 0.5rem;
}

.template-header .text-muted {
  color: var(--text-muted) !important;
}

.template-gallery {
  margin-bottom: 2rem;
}

/* Template card styling */
.template-card {
  background: var(--dark-navy);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  height: 100%;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  position: relative;
  overflow: hidden;
}

.template-card:hover {
  border-color: var(--accent-blue);
  background: rgba(74, 144, 226, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
}

.template-card:focus {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.template-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.template-icon {
  width: 48px;
  height: 48px;
  background: rgba(74, 144, 226, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
  font-size: 1.5rem;
}

.template-difficulty .badge {
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
}

.template-name {
  color: var(--white);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.template-description {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: 1rem;
}

.template-preview {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.template-preview-text {
  color: var(--accent-blue);
  font-size: 0.85rem;
  font-family: 'Monaco', 'Menlo', monospace;
}

.template-card-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.75rem;
  margin-top: auto;
}

.template-card-footer .text-muted {
  color: rgba(255, 255, 255, 0.6) !important;
  font-size: 0.8rem;
}

/* Start from scratch button */
#startFromScratchBtn {
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.8);
  padding: 0.75rem 1.5rem;
  font-weight: 500;
}

#startFromScratchBtn:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: rgba(74, 144, 226, 0.1);
}

.template-actions .text-muted {
  color: rgba(255, 255, 255, 0.5) !important;
}

/* Policy builder screen styling */
.policy-builder-screen {
  animation: slideInFromRight 0.3s ease-out;
}

@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/*------------------------------------------------
  THREE-CARD SKILL LEVEL SELECTION
  Task: T01_S27 - Three-Card Sign-Up UI Redesign
------------------------------------------------*/

/* Card Base Styling */
.skill-level-card {
  background: var(--dark-navy, #1b1f3b);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 1.5rem;
  height: 100%;
  transition: all var(--transition-speed, 0.3s) ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.skill-level-card:hover {
  border-color: var(--accent-blue, #4a90e2);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(74, 144, 226, 0.3);
}

/* Selected State */
.skill-level-card.selected {
  border-color: var(--accent-blue, #4a90e2);
  border-width: 2px;
  background: rgba(74, 144, 226, 0.1);
  box-shadow: 0 4px 16px rgba(74, 144, 226, 0.4);
}

.skill-level-card.selected .skill-icon {
  transform: scale(1.1);
}

/* Card Header Layout */
.skill-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg, 1.5rem);
}

/* Gradient Icon Circles */
.skill-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--white, #ffffff);
  transition: transform var(--transition-speed, 0.3s) ease;
}

.skill-level-card:hover .skill-icon {
  transform: scale(1.1);
}

.skill-icon-beginner {
  background: linear-gradient(135deg, #10b981, #059669);
}

.skill-icon-intermediate {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.skill-icon-advanced {
  background: linear-gradient(135deg, #f97316, #ea580c);
}

/* Badge Styling */
.skill-badge {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  color: var(--white, #ffffff);
}

.badge-beginner {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #10b981;
}

.badge-intermediate {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid #3b82f6;
}

.badge-advanced {
  background: rgba(249, 115, 22, 0.2);
  border: 1px solid #f97316;
}

/* Card Title and Description */
.skill-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-md, 1rem);
  color: var(--white, #ffffff);
}

.skill-card-description {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0;
  line-height: 1.5;
}

/* Shared Content Area (displays below cards) */
.skill-level-content-area {
  margin-top: var(--space-xl, 3rem);
  min-height: 300px;
}

.skill-content {
  animation: fadeIn 0.3s ease-in;
}

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

/* Chat Container (BEGINNER Content) */
.chat-container {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 350px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  margin-bottom: var(--space-md, 1rem);
  max-height: 450px;
}

.chat-message {
  margin-bottom: 1rem;
  display: flex;
  animation: fadeIn 0.3s ease;
}

/* Assistant messages - left aligned */
.assistant-message {
  justify-content: flex-start;
}

.assistant-message .message-content {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px 12px 12px 4px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
  max-width: 80%;
}

/* Markdown formatting within messages */
.message-content p {
  margin: 0.5rem 0;
}

.message-content p:first-child {
  margin-top: 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content strong {
  font-weight: 600;
  color: rgba(255, 255, 255, 1);
}

/* User messages - right aligned */
.user-message {
  justify-content: flex-end;
}

.user-message .message-content {
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px 12px 4px 12px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.5;
  max-width: 80%;
}

/* Action button container */
.chat-action-message {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 1rem;
  animation: fadeIn 0.3s ease;
}

/* Typing indicator */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: rgba(59, 130, 246, 0.8);
  border-radius: 50%;
  animation: typingDot 1.4s infinite;
}

.typing-indicator span:nth-child(1) {
  animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDot {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

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

.chat-input-wrapper {
  margin-top: auto;
}

.chat-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.75rem;
  color: var(--white, #ffffff);
  font-size: 0.875rem;
  resize: none;
  transition: border-color var(--transition-speed, 0.3s) ease;
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent-blue, #4a90e2);
  background: rgba(0, 0, 0, 0.4);
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* Template Gallery (INTERMEDIATE Content) */
.skill-content .template-gallery-section {
  padding: 0;
}

.skill-content .template-gallery-section .row {
  margin: 0;
}

/* Policy Builder Canvas (ADVANCED Content) */
.skill-content .policy-canvas-container {
  margin: 0;
}


/* Responsive Breakpoints */
@media (min-width: 992px) {
  .row.g-4 {
    display: flex;
  }
}

@media (min-width: 768px) and (max-width: 991px) {
  .skill-level-card {
    max-width: 400px;
    margin: 0 auto;
  }
}

@media (max-width: 767px) {
  .skill-level-card {
    padding: 1.25rem;
  }

  .skill-card-header {
    margin-bottom: var(--space-md, 1rem);
  }

  .skill-icon {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }

  .skill-card-title {
    font-size: 1.125rem;
  }

  .skill-card-description {
    font-size: 0.875rem;
  }

  .skill-level-content-area {
    margin-top: var(--space-lg, 2rem);
  }

  .chat-container,
  .mini-template-gallery,
  .advanced-features {
    min-height: 300px;
    padding: 1rem;
  }
}

/*------------------------------------------------
  TEMPLATE LOADING ANIMATIONS
  Task: T04_S02_E - Builder Visual Polish
------------------------------------------------*/

/* Enhanced Template Loading Overlay */
.template-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(27, 31, 59, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.template-loading-overlay.show {
  opacity: 1;
  visibility: visible;
}

.loading-content {
  text-align: center;
  max-width: 300px;
}

.loading-spinner {
  position: relative;
  width: 60px;
  height: 60px;
  margin: 0 auto var(--space-lg);
}

.spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 2px solid transparent;
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spinner-rotate 1.2s linear infinite;
}

.spinner-ring:nth-child(2) {
  width: 80%;
  height: 80%;
  top: 10%;
  left: 10%;
  border-top-color: rgba(74, 144, 226, 0.6);
  animation-duration: 1.5s;
  animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
  width: 60%;
  height: 60%;
  top: 20%;
  left: 20%;
  border-top-color: rgba(74, 144, 226, 0.3);
  animation-duration: 1.8s;
}

@keyframes spinner-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.loading-title {
  color: var(--white);
  font-size: var(--heading-secondary);
  font-weight: 500;
  margin-bottom: var(--space-sm);
}

.loading-description {
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--body-secondary);
  margin: 0;
}

/* Legacy support for existing spinner */
.template-loading-overlay .spinner-border {
  display: none; /* Hide old spinner in favor of new rings */
}

/*------------------------------------------------
  SUCCESS FEEDBACK ANIMATIONS
  Task: T04_S02_E - Builder Visual Polish
------------------------------------------------*/

/* Success animation for added conditions */
@keyframes condition-added-success {
  0% {
    transform: scale(0.9);
    opacity: 0;
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.condition-added {
  animation: condition-added-success 0.4s ease-out;
  border-color: #28a745 !important;
  background: rgba(40, 167, 69, 0.1) !important;
  position: relative;
}

.condition-added::after {
  content: '✓';
  position: absolute;
  top: -8px;
  right: -8px;
  background: #28a745;
  color: var(--white);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  animation: success-badge-appear 0.3s ease-out 0.2s both;
}

@keyframes success-badge-appear {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Remove success styling after animation completes */
.condition-added {
  animation-fill-mode: forwards;
}

/* Success feedback for policy tree updates */
@keyframes policy-tree-update {
  0% {
    transform: translateY(10px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.policy-tree-updated {
  animation: policy-tree-update 0.3s ease-out;
}

/* Success notification for template application */
@keyframes template-applied-success {
  0% {
    transform: scale(0.95) translateY(20px);
    opacity: 0;
  }
  50% {
    transform: scale(1.02) translateY(-5px);
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.template-applied {
  animation: template-applied-success 0.5s ease-out;
}

/* Pulse effect for active elements */
@keyframes success-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
  }
}

.success-pulse {
  animation: success-pulse 0.6s ease-out;
}

/*------------------------------------------------
  ENHANCED INTERACTIVE ELEMENTS & MICRO-INTERACTIONS
  Task: T04_S02_E - Builder Visual Polish
------------------------------------------------*/

/* Enhanced Button Interactions */
.btn {
  transition: all 0.2s ease;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  transform: translateY(-1px);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), #5ba3f5);
  border: none;
  box-shadow: 0 2px 4px rgba(74, 144, 226, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #5ba3f5, var(--accent-blue));
  box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

.btn-primary:focus {
  box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.5);
}

/* Ripple effects removed - not specified in task */

/* Enhanced Card Interactions */
.policy-card,
.condition-card,
.template-card {
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.policy-card:hover,
.condition-card:hover,
.template-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
  border-color: rgba(74, 144, 226, 0.5);
}

.policy-card:focus,
.condition-card:focus,
.template-card:focus {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.1);
}

/* Card shine effects removed - not specified in task */

/* Enhanced Form Controls */
.form-control,
.form-select {
  transition: all 0.3s ease;
  border-width: 1px;
}

.form-control:focus,
.form-select:focus {
  transform: scale(1.02);
  border-width: 2px;
}

/* Enhanced Modal Transitions */
.modal.fade .modal-dialog {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(0.9) translateY(-50px);
  opacity: 0;
}

.modal.show .modal-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Modal Backdrop Blur Effect */
.modal-backdrop.show {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Accordion Smooth Transitions */
.accordion-collapse {
  transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-button {
  transition: all 0.2s ease;
}

.accordion-button:hover {
  background-color: rgba(74, 144, 226, 0.05);
}

/* Accordion Button Active State */
.accordion-button:not(.collapsed) {
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.125);
  transition: all 0.3s ease;
}

/* Form Input Focus Animations */
.form-control {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Smooth List Item Interactions */
.list-group-item {
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.list-group-item:hover {
  background-color: rgba(74, 144, 226, 0.05);
  border-left-color: var(--accent-blue);
  transform: translateX(2px);
}

/* Complex dropdown, navigation, and icon effects removed - not specified in task */

/* Progress Bar Smooth Animations - Keep as this was specified */
.progress-bar {
  transition: width 0.6s ease;
}

/*------------------------------------------------
  VISUAL PROGRESS INDICATORS
  Task: T04_S02_E - Builder Visual Polish
------------------------------------------------*/

/* Policy Progress Indicator Container */
.policy-progress-container {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
}

.policy-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.policy-progress-header h6 {
  color: var(--white);
  margin: 0;
  font-size: var(--body-secondary);
  font-weight: 500;
}

.progress-percentage {
  color: var(--accent-blue);
  font-weight: 600;
  font-size: var(--body-secondary);
  animation: percentage-update 0.3s ease-out;
}

@keyframes percentage-update {
  0% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.policy-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  margin-bottom: var(--space-md);
  overflow: hidden;
  position: relative;
}

.policy-progress-bar .progress-bar {
  background: linear-gradient(90deg, var(--accent-blue), #5ba3f5);
  border-radius: 3px;
  transition: width 0.6s ease;
  position: relative;
}

/* Shimmer effects removed - not specified in task */

.progress-steps {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--body-small);
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.3s ease;
}

.progress-step i {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.progress-step.completed {
  color: #28a745;
}

.progress-step.completed i {
  background: #28a745;
  color: var(--white);
  animation: step-complete 0.3s ease-out;
}

@keyframes step-complete {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.progress-step.current {
  color: var(--accent-blue);
}

.progress-step.current i {
  background: var(--accent-blue);
  color: var(--white);
  animation: current-step-pulse 2s ease-in-out infinite;
}

@keyframes current-step-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Policy validation status indicators and completeness badges removed - not specified in task */

/* Circular progress and step-by-step progress removed - not specified in task */

/*------------------------------------------------
  ENHANCED MOBILE OPTIMIZATION & TOUCH TARGETS
  Task: T04_S02_E - Builder Visual Polish
------------------------------------------------*/

/* Mobile-First Touch Targets */
@media (max-width: 768px) {
  /* Policy Builder Container */
  .policy-builder-container {
    padding: var(--space-md);
  }
  
  /* Enhanced Touch Targets - Minimum 44px */
  .empty-state-actions {
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
  }
  
  .empty-state-primary-action,
  .empty-state-secondary-action {
    width: 100%;
    max-width: 280px;
    min-height: 44px;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--body-primary);
  }
  
  /* Template Cards - Larger Touch Areas */
  .template-card {
    min-height: 200px;
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
  }
  
  .template-icon {
    width: 56px;
    height: 56px;
    font-size: 1.75rem;
  }
  
  /* Condition Cards - Enhanced Touch Areas */
  .condition-card {
    min-height: 80px;
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    touch-action: manipulation;
  }
  
  /* Button Enhancements */
  .btn {
    min-height: 44px;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--body-primary);
    touch-action: manipulation;
  }
  
  .btn-sm {
    min-height: 40px;
    padding: 0.5rem 1rem;
  }
  
  .btn-lg {
    min-height: 48px;
    padding: var(--space-md) var(--space-lg);
    font-size: 1.1rem;
  }
  
  /* Form Controls - Better Touch Experience */
  .form-control,
  .form-select {
    min-height: 44px;
    font-size: var(--body-primary);
    padding: var(--space-sm) var(--space-md);
  }
  
  /* Modal Improvements */
  #conditionSelectionModal .modal-dialog {
    margin: var(--space-sm);
    max-width: calc(100vw - 2rem);
    min-height: calc(100vh - 2rem);
  }
  
  #conditionSelectionModal .modal-content {
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  
  #conditionSelectionModal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
  }
  
  /* Accordion Touch Targets */
  .accordion-button {
    min-height: 44px;
    padding: var(--space-md);
    font-size: var(--body-primary);
  }
  
  /* Navigation Touch Targets */
  .nav-link {
    min-height: 44px;
    padding: var(--space-sm) var(--space-md);
    display: flex;
    align-items: center;
  }
  
  /* Progress Steps - Mobile Optimized */
  .progress-steps {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }
  
  .progress-step {
    min-height: 32px;
    padding: var(--space-xs) 0;
  }
  
  /* Policy Progress Indicator - Mobile */
  .policy-progress-container {
    padding: var(--space-md);
    margin-bottom: var(--space-md);
  }
  
  .policy-progress-header {
    margin-bottom: var(--space-md);
  }
  
  .policy-progress-header h6 {
    font-size: var(--body-primary);
  }
  
  .progress-percentage {
    font-size: var(--body-primary);
  }
  
  /* Wizard Steps - Stacked on Mobile */
  .wizard-steps {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: left;
  }
  
  .wizard-step {
    padding: var(--space-xs) 0;
    border-left: 3px solid transparent;
    padding-left: var(--space-sm);
    transition: all 0.3s ease;
  }
  
  .wizard-step.active {
    border-left-color: var(--accent-blue);
    background: rgba(74, 144, 226, 0.05);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
  }
  
  /* Card Layouts - Full Width */
  .row {
    margin: 0;
  }
  
  .col-lg-6 {
    padding: 0;
    margin-bottom: var(--space-md);
  }
  
  .card {
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  .card-header {
    padding: var(--space-md);
    font-size: var(--body-primary);
  }
  
  .card-body {
    padding: var(--space-md);
  }
  
  /* Improved Empty State on Mobile */
  .policy-empty-state {
    padding: var(--space-xl) var(--space-md);
    margin: var(--space-md) 0;
  }
  
  .empty-state-icon {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }
  
  .empty-state-glow {
    width: 64px;
    height: 64px;
  }
  
  .empty-state-title {
    font-size: var(--heading-secondary);
    margin-bottom: var(--space-md);
  }
  
  .empty-state-description {
    font-size: var(--body-primary);
    max-width: 100%;
    margin-bottom: var(--space-xl);
  }
}

/* Small Mobile Screens - Extra Optimizations */
@media (max-width: 480px) {
  /* Reduce padding for very small screens */
  .policy-builder-container {
    padding: var(--space-sm);
  }
  
  .template-card {
    padding: var(--space-md);
    min-height: 180px;
  }
  
  .template-icon {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
  }
  
  .template-name {
    font-size: var(--body-primary);
  }
  
  .template-description {
    font-size: var(--body-secondary);
  }
  
  /* Simplified Progress Indicator */
  .policy-progress-container {
    padding: var(--space-sm);
  }
  
  .progress-steps {
    display: none; /* Hide detailed steps on very small screens */
  }
  
  /* Larger touch targets for critical actions */
  .empty-state-primary-action {
    min-height: 48px;
    font-size: 1.1rem;
  }
  
  /* Optimize modal for small screens */
  #conditionSelectionModal .modal-dialog {
    margin: 0;
    max-width: 100vw;
    min-height: 100vh;
    border-radius: 0;
  }
  
  #conditionSelectionModal .modal-content {
    border-radius: 0;
    border: none;
  }
}

/* Tablet Optimizations */
@media (min-width: 577px) and (max-width: 991px) {
  .template-card {
    min-height: 220px;
    padding: var(--space-lg);
  }
  
  .condition-card {
    min-height: 72px;
    padding: var(--space-md);
  }
  
  /* Optimize for tablet touch */
  .btn {
    min-height: 42px;
  }
  
  .form-control,
  .form-select {
    min-height: 42px;
  }
  
  /* Better modal sizing for tablets */
  #conditionSelectionModal .modal-dialog {
    max-width: 90vw;
    margin: var(--space-lg) auto;
  }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .template-card:hover,
  .condition-card:hover,
  .btn:hover {
    transform: none;
  }
  
  /* Enhanced focus states for touch navigation */
  .template-card:focus,
  .condition-card:focus {
    background: rgba(74, 144, 226, 0.1);
    border-color: var(--accent-blue);
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
  }
  
  /* Larger touch targets */
  .nav-link {
    min-height: 48px;
  }
  
  .accordion-button {
    min-height: 48px;
  }
  
  /* Prevent text selection on touch interactions */
  .template-card,
  .condition-card,
  .btn {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
}

/* High DPI Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
  .template-icon,
  .empty-state-icon {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Landscape Mobile Optimizations */
@media (max-width: 768px) and (orientation: landscape) {
  .policy-empty-state {
    padding: var(--space-lg) var(--space-md);
  }
  
  .empty-state-actions {
    flex-direction: row;
    justify-content: center;
    gap: var(--space-md);
  }
  
  .empty-state-primary-action,
  .empty-state-secondary-action {
    width: auto;
    min-width: 140px;
  }
  
  /* Reduce modal height in landscape */
  #conditionSelectionModal .modal-dialog {
    min-height: calc(100vh - 1rem);
    margin: 0.5rem;
  }
}

/* Policy tree preview styling */
.template-structure {
  margin-top: 1rem;
}

.template-structure h6 {
  color: var(--white);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.policy-tree-preview {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  padding: 1rem;
}

.policy-node {
  margin-bottom: 0.5rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
}

.policy-node.operator-node {
  color: var(--accent-blue);
  font-weight: 500;
}

.policy-node.condition-node {
  color: rgba(255, 255, 255, 0.7);
}

.policy-node i {
  width: 16px;
  text-align: center;
}

/* Toast container styling */
.toast-container .toast {
  background-color: var(--dark-navy);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.toast-container .toast-header {
  background-color: rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.toast-container .btn-close {
  filter: invert(1);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .template-selection-screen {
    padding: 1rem 0.5rem;
  }
  
  .template-card {
    padding: 1rem;
  }
  
  .template-name {
    font-size: 1rem;
  }
  
  .template-description {
    font-size: 0.85rem;
  }
  
  .template-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  
  .template-preview {
    padding: 0.5rem;
  }
  
  .template-preview-text {
    font-size: 0.8rem;
  }
  
  #startFromScratchBtn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
}

/* Tablet responsive adjustments */
@media (min-width: 577px) and (max-width: 991px) {
  .template-card {
    padding: 1.25rem;
  }
  
  .template-name {
    font-size: 1.05rem;
  }
}

/* Desktop optimization */
@media (min-width: 992px) {
  .template-gallery .row {
    justify-content: center;
  }
  
  .template-card:hover .template-icon {
    transform: scale(1.1);
    transition: transform var(--transition-speed) ease;
  }
}

/* High contrast mode support for templates */
@media (prefers-contrast: high) {
  .template-card {
    border-width: 2px;
  }
  
  .template-card:hover {
    border-width: 3px;
  }
  
  .template-preview {
    border: 1px solid rgba(255, 255, 255, 0.3);
  }
}

/* Reduced motion support for templates */
@media (prefers-reduced-motion: reduce) {
  .template-card,
  .template-icon,
  .policy-builder-screen {
    transition: none;
  }
  
  .template-card:hover {
    transform: none;
  }
  
  @keyframes slideInFromRight {
    from, to {
      opacity: 1;
      transform: translateX(0);
    }
  }
}

/*------------------------------------------------
  CONDITION SELECTION MODAL
  Task: T04_S02_B - Progressive Disclosure Modal
------------------------------------------------*/

/* Modal content styling for dark theme */
#conditionSelectionModal .modal-content {
  background-color: var(--dark-navy);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white);
}

#conditionSelectionModal .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(0, 0, 0, 0.1);
}

#conditionSelectionModal .modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(0, 0, 0, 0.05);
}

#conditionSelectionModal .modal-title {
  color: var(--white);
  font-weight: 600;
}

#conditionSelectionModal .btn-close {
  filter: invert(1);
}

/* Search input styling */
#conditionSelectionModal .condition-search-container .input-group-text {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--white);
}

#conditionSelectionModal .condition-search-container .form-control {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--white);
}

#conditionSelectionModal .condition-search-container .form-control:focus {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25);
  color: var(--white);
}

#conditionSelectionModal .condition-search-container .form-control::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

#conditionSelectionModal .condition-search-container .form-text {
  color: rgba(255, 255, 255, 0.6);
}

/* Accordion overrides within modal */
#conditionSelectionModal .accordion-button {
  background-color: transparent;
  color: var(--white);
  border: none;
  padding: 0.75rem 1rem;
  font-weight: 500;
}

#conditionSelectionModal .accordion-button:not(.collapsed) {
  background-color: rgba(74, 144, 226, 0.1);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

#conditionSelectionModal .accordion-button::after {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

#conditionSelectionModal .accordion-button:not(.collapsed)::after {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%234a90e2'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

#conditionSelectionModal .accordion-body {
  padding: 0.5rem;
}

#conditionSelectionModal .accordion-item {
  border-color: rgba(255, 255, 255, 0.1);
}

/* Category header styling */
.category-name {
  font-weight: 500;
  flex-grow: 1;
}

.condition-count {
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

/* Condition card styles within modal */
#conditionSelectionModal .condition-card {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
}

#conditionSelectionModal .condition-card:hover {
  background-color: rgba(74, 144, 226, 0.1);
  border-color: var(--accent-blue);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
}

#conditionSelectionModal .condition-card:focus {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

#conditionSelectionModal .condition-card.selected {
  background-color: rgba(74, 144, 226, 0.2);
  border-color: var(--accent-blue);
  transform: translateX(6px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

#conditionSelectionModal .condition-card.condition-selected {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: var(--white);
  border-color: #16a34a;
  transform: translateX(6px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
  animation: selectionPulse 0.6s ease-out;
}

@keyframes selectionPulse {
  0% {
    transform: translateX(6px) scale(1);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
  }
  50% {
    transform: translateX(8px) scale(1.02);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
  }
  100% {
    transform: translateX(6px) scale(1);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
  }
}

#conditionSelectionModal .condition-card.hidden {
  display: none;
}

#conditionSelectionModal .condition-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

#conditionSelectionModal.condition-search-active .accordion-item:not(.has-matches) {
  display: none;
}

/* Condition card icon (matches operator item pattern) */
#conditionSelectionModal .condition-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  font-size: 1.25rem;
  transition: all 0.2s ease;
}

#conditionSelectionModal .condition-card:hover .condition-icon {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Condition card content wrapper */
#conditionSelectionModal .condition-content {
  flex-grow: 1;
  min-width: 0;
}

/* Condition card arrow indicator (matches operator item pattern) */
#conditionSelectionModal .condition-arrow {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

#conditionSelectionModal .condition-card:hover .condition-arrow {
  transform: translateX(4px);
  color: var(--accent-blue);
}

.condition-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.5rem;
}

.condition-name {
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

.parameter-count {
  font-size: 0.75rem;
  color: var(--accent-blue);
  background-color: rgba(74, 144, 226, 0.1);
  padding: 0.125rem 0.375rem;
  border-radius: 10px;
  white-space: nowrap;
}

.condition-description {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
  line-height: 1.3;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.condition-meta {
  display: flex;
  gap: 0.25rem;
}

.badge-outline {
  background-color: transparent;
  border: 1px solid currentColor;
  font-size: 0.7rem;
  padding: 0.125rem 0.375rem;
  color: rgba(255, 255, 255, 0.6);
}

/*------------------------------------------------
  ENHANCED EMPTY STATES WITH ANIMATIONS
  Task: T04_S02_E - Builder Visual Polish
------------------------------------------------*/

/* Primary Empty State - New Policies */
.policy-empty-state {
  text-align: center;
  padding: var(--space-xxl) var(--space-lg);
  background: linear-gradient(135deg, 
    rgba(74, 144, 226, 0.05) 0%, 
    rgba(74, 144, 226, 0.02) 100%);
  border: 1px dashed rgba(74, 144, 226, 0.3);
  border-radius: 12px;
  transition: all 0.3s ease;
  margin: var(--space-lg) 0;
}

.policy-empty-state:hover {
  border-color: rgba(74, 144, 226, 0.5);
  background: linear-gradient(135deg, 
    rgba(74, 144, 226, 0.08) 0%, 
    rgba(74, 144, 226, 0.04) 100%);
}

.empty-state-visual {
  position: relative;
  margin-bottom: var(--space-lg);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent-blue), #6bb6ff);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
  font-size: 1.5rem;
  color: var(--white);
  animation: gentlePulse 2s ease-in-out infinite;
}

/* Glow effects removed - not specified in task */

@keyframes gentlePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* gentleGlow keyframes removed - not specified in task */

.empty-state-title {
  font-size: var(--heading-secondary);
  font-weight: 600;
  color: var(--white);
  margin-bottom: var(--space-sm);
}

.empty-state-description {
  font-size: var(--body-secondary);
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: var(--space-lg);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  line-height: var(--line-height-relaxed);
}

.empty-state-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

.empty-state-primary-action {
  animation: subtle-bounce 2s ease-in-out infinite;
}

@keyframes subtle-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* Secondary Empty State - For Policies with Conditions */
.policy-expansion-state {
  text-align: center;
  padding: var(--space-lg);
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius);
  margin: var(--space-md) 0;
  transition: all 0.3s ease;
}

.policy-expansion-state:hover {
  background: rgba(74, 144, 226, 0.05);
  border-color: rgba(74, 144, 226, 0.3);
}

.expansion-state-content {
  color: rgba(255, 255, 255, 0.8);
}

.expansion-icon {
  font-size: 1.5rem;
  color: var(--accent-blue);
  margin-bottom: var(--space-sm);
  animation: gentlePulse 2.5s ease-in-out infinite;
}

.expansion-description {
  font-size: var(--body-secondary);
  margin-bottom: var(--space-md);
  color: rgba(255, 255, 255, 0.7);
}

/* Legacy support for existing empty state */
.empty-policy-state {
  /* Apply new styling to existing empty states */
  @extend .policy-empty-state;
}

.empty-policy-state h4 {
  color: var(--white);
  margin-bottom: var(--space-sm);
}

.empty-policy-state .text-muted {
  color: rgba(255, 255, 255, 0.6) !important;
}

.empty-policy-state .fa-plus-circle {
  color: rgba(255, 255, 255, 0.4);
}

/* Modal responsive design */
@media (max-width: 576px) {
  #conditionSelectionModal .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
  
  #conditionSelectionModal .modal-body {
    padding: 1rem;
  }
  
  #conditionSelectionModal .condition-card {
    padding: 0.6rem;
  }
  
  #conditionSelectionModal .condition-description {
    -webkit-line-clamp: 2;
    font-size: 0.75rem;
  }
  
  #conditionSelectionModal .modal-title {
    font-size: 1.1rem;
  }
  
  .condition-name {
    font-size: 0.85rem;
  }
  
  .parameter-count {
    font-size: 0.7rem;
    padding: 0.1rem 0.3rem;
  }
}

/* Tablet modal adjustments */
@media (min-width: 577px) and (max-width: 991px) {
  #conditionSelectionModal .modal-dialog {
    max-width: 600px;
  }
  
  #conditionSelectionModal .condition-card {
    padding: 0.7rem;
  }
}

/* Desktop modal optimization */
@media (min-width: 992px) {
  #conditionSelectionModal .modal-dialog {
    max-width: 700px;
  }
  
  #conditionSelectionModal .modal-lg {
    max-width: 700px;
  }
  
  #conditionSelectionModal .condition-card:hover .parameter-count {
    transform: scale(1.05);
    transition: transform var(--transition-speed) ease;
  }
}

/* Toast styling for condition selection */
#conditionToastContainer .toast {
  background-color: var(--dark-navy);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white);
}

#conditionToastContainer .toast-header {
  background-color: rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white);
}

#conditionToastContainer .btn-close {
  filter: invert(1);
}

/* High contrast mode support for modal */
@media (prefers-contrast: high) {
  #conditionSelectionModal .modal-content {
    border-width: 2px;
  }
  
  #conditionSelectionModal .condition-card {
    border-width: 2px;
  }
  
  #conditionSelectionModal .condition-card:hover {
    border-width: 3px;
  }
}

/* Reduced motion support for modal */
@media (prefers-reduced-motion: reduce) {
  #conditionSelectionModal .condition-card {
    transition: none;
  }
  
  #conditionSelectionModal .condition-card:hover {
    transform: none;
  }
  
  .parameter-count {
    transition: none;
  }
}

/*------------------------------------------------
  POET BUILDER NAVIGATION INTEGRATION (T06_S02)
------------------------------------------------*/

/* POET Builder Section Styling */
#poetBuilder.section-content {
  background-color: var(--dark-navy);
  color: var(--white);
  min-height: 500px;
}

/* POET Breadcrumb Navigation */
.poet-breadcrumb-nav {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.poet-breadcrumb-nav .breadcrumb {
  margin-bottom: 0;
  background: transparent;
  padding: 0;
}

.poet-breadcrumb-nav .breadcrumb-item {
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--body-secondary);
}

.poet-breadcrumb-nav .breadcrumb-item.active {
  color: var(--white);
  font-weight: 500;
}

.poet-breadcrumb-nav .breadcrumb-item a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}

.poet-breadcrumb-nav .breadcrumb-item a:hover {
  color: var(--white);
  text-decoration: underline;
}

.poet-breadcrumb-nav .breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  color: rgba(255, 255, 255, 0.5);
  font-weight: normal;
}

/* POET Builder Content Areas */
.poet-builder-interface,
.poet-step-start,
.poet-step-conditions,
.poet-step-review {
  padding: var(--space-lg);
}

.poet-step-start .alert,
.poet-step-conditions .alert,
.poet-step-review .alert {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white);
  backdrop-filter: blur(5px);
}

.poet-step-start .alert-info {
  border-left: 4px solid var(--accent-blue);
}

.poet-step-conditions .alert-info {
  border-left: 4px solid #17a2b8;
}

.poet-step-review .alert-success {
  border-left: 4px solid #28a745;
}

/* Mobile Navigation Integration */
.mobile-tab-bar .nav-link[data-section="#poetBuilder"] {
  transition: all var(--transition-speed) ease;
}

.mobile-tab-bar .nav-link[data-section="#poetBuilder"]:hover {
  color: var(--accent-blue) !important;
  transform: translateY(-1px);
}

.mobile-tab-bar .nav-link[data-section="#poetBuilder"].active {
  color: var(--accent-blue) !important;
  background: rgba(74, 144, 226, 0.1);
}

/* Desktop Navigation Integration */
.navbar .nav-link[data-section="#poetBuilder"] {
  transition: color var(--transition-speed) ease;
}

.navbar .nav-link[data-section="#poetBuilder"]:hover {
  color: var(--accent-blue) !important;
}

.navbar .nav-link[data-section="#poetBuilder"].active {
  color: var(--accent-blue) !important;
  font-weight: 500;
}

/* Authentication State Integration */
.logged-out .requires-login {
  display: none !important;
}

.logged-in .requires-logout {
  display: none !important;
}

/* Responsive Design for POET Builder */
@media (max-width: 768px) {
  .poet-breadcrumb-nav {
    padding: var(--space-sm);
    margin-bottom: var(--space-md);
  }
  
  .poet-breadcrumb-nav .breadcrumb-item {
    font-size: var(--body-small);
  }
  
  .poet-step-start,
  .poet-step-conditions,
  .poet-step-review {
    padding: var(--space-md);
  }
}

@media (max-width: 576px) {
  .poet-breadcrumb-nav .breadcrumb {
    flex-wrap: wrap;
  }
  
  .poet-breadcrumb-nav .breadcrumb-item {
    margin-bottom: var(--space-xs);
  }
}

/*------------------------------------------------
  AUTO-SAVE STATUS INDICATORS
------------------------------------------------*/

/* Auto-save status indicator */
.auto-save-status {
  font-size: var(--body-secondary);
  opacity: 0.85;
  transition: all var(--transition-speed) ease;
  user-select: none;
}

.auto-save-status.saving {
  opacity: 1;
}

.auto-save-status .fa-save {
  transition: transform var(--transition-speed) ease;
  font-size: 0.875rem;
}

.auto-save-status.saving .fa-save {
  transform: scale(1.1);
}

/* Auto-save toast notification */
.auto-save-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: var(--dark-navy);
  color: var(--white);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--border-radius);
  border-left: 3px solid var(--accent-blue);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1050;
  opacity: 0;
  transform: translateX(100%);
  transition: all var(--transition-speed) ease;
  font-size: var(--body-secondary);
  display: flex;
  align-items: center;
  min-width: 140px;
}

.auto-save-toast.show {
  opacity: 1;
  transform: translateX(0);
}

.auto-save-toast i {
  color: var(--success-green);
  margin-right: var(--space-sm);
}

/* Responsive auto-save indicators */
@media (max-width: 768px) {
  .auto-save-status {
    font-size: var(--body-small);
  }
  
  .auto-save-status .fa-save {
    font-size: 0.75rem;
  }
  
  .auto-save-toast {
    top: 10px;
    right: 10px;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--body-small);
    min-width: 120px;
  }
}

@media (max-width: 576px) {
  /* Hide auto-save text on very small screens, keep icon only */
  .auto-save-status span {
    display: none;
  }
  
  .auto-save-status {
    opacity: 0.7;
  }
}

/*------------------------------------------------
  SIMPLE MOBILE UX FIXES
  Fix text wrapping, hide descriptions, stack buttons
------------------------------------------------*/

@media (max-width: 768px) {
  /* Fix condition title text wrapping */
  .node-name,
  .node-title,
  .condition-node h6,
  .tree-node h6 {
    font-size: 0.9rem !important;
    line-height: 1.2 !important;
    word-wrap: break-word;
    hyphens: auto;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
  }
  
  /* Hide description text on mobile */
  .node-description,
  .node-subtitle,
  .condition-node p,
  .tree-node p {
    display: none !important;
  }
  
  /* Fix button overflow - much simpler approach */
  
  /* Just make the buttons smaller and wrap if needed */
  .condition-actions .btn,
  .node-actions .btn,
  .btn-group-vertical .btn {
    font-size: 0.7rem !important;
    padding: 0.25rem 0.4rem !important;
    min-width: 32px !important;
  }
  
  /* Allow button container to wrap */
  .condition-actions,
  .node-actions,
  .btn-group-vertical {
    flex-wrap: wrap !important;
    gap: 2px !important;
  }
}

/*------------------------------------------------
  RECOVERY KIT STYLES
------------------------------------------------*/

/* Recovery Section Cards */
#recoverySection .card {
  background-color: rgba(26, 30, 55, 0.9);
  border: 1px solid rgba(74, 144, 226, 0.3);
  margin-bottom: var(--space-lg);
}

#recoverySection .card-header {
  background-color: rgba(74, 144, 226, 0.1);
  border-bottom: 1px solid rgba(74, 144, 226, 0.3);
  color: var(--white);
}

#recoverySection .card-body {
  color: var(--white);
}

/* Recovery Kit Display Area */
#recoveryKitDisplay {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(74, 144, 226, 0.4);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
}

#recoveryKitContent {
  background-color: var(--white);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  margin: var(--space-md) 0;
}

/* Recovery QR Code Styling */
.recovery-qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.recovery-qr-code {
  border: 3px solid var(--accent-blue);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  background-color: var(--white);
}

.recovery-qr-info {
  text-align: center;
  color: var(--dark-navy);
  font-weight: 600;
}

.recovery-metadata {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  font-size: var(--body-secondary);
  color: var(--dark-navy);
  margin-top: var(--space-md);
}

.recovery-metadata .label {
  font-weight: 600;
}

/* Recovery File Upload Area */
.recovery-upload-area {
  border: 2px dashed rgba(74, 144, 226, 0.4);
  border-radius: var(--border-radius);
  padding: var(--space-xl);
  text-align: center;
  transition: all var(--transition-speed);
  cursor: pointer;
}

.recovery-upload-area:hover,
.recovery-upload-area.dragover {
  border-color: var(--accent-blue);
  background-color: rgba(74, 144, 226, 0.1);
}

.recovery-upload-area .upload-icon {
  font-size: 3rem;
  color: var(--accent-blue);
  margin-bottom: var(--space-md);
}

/* Recovery Processing Animation */
#recoveryProcessing .alert {
  background-color: rgba(23, 162, 184, 0.2);
  border-color: var(--info-blue);
  color: var(--white);
}

/* Recovery Account Migration */
#recoveryAccountMigration .alert-success {
  background-color: rgba(40, 167, 69, 0.2);
  border-color: var(--success-green);
  color: var(--white);
}

/* Recovery Instructions Accordion */
#recoveryInstructionsAccordion .accordion-item {
  background-color: transparent;
  border: 1px solid rgba(74, 144, 226, 0.3);
  margin-bottom: var(--space-sm);
}

#recoveryInstructionsAccordion .accordion-button {
  background-color: rgba(74, 144, 226, 0.1);
  color: var(--white);
  border: none;
  font-weight: 600;
}

#recoveryInstructionsAccordion .accordion-button:not(.collapsed) {
  background-color: rgba(74, 144, 226, 0.2);
  color: var(--white);
  box-shadow: none;
}

#recoveryInstructionsAccordion .accordion-button::after {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

#recoveryInstructionsAccordion .accordion-body {
  background-color: rgba(26, 30, 55, 0.5);
  color: var(--white);
  border-top: 1px solid rgba(74, 144, 226, 0.3);
}

/* Recovery Button Styles */
.btn-recovery-primary {
  background-color: var(--accent-blue);
  border-color: var(--accent-blue);
  color: var(--white);
  font-weight: 600;
  transition: all var(--transition-speed);
}

.btn-recovery-primary:hover {
  background-color: #3a7bc8;
  border-color: #3a7bc8;
  transform: translateY(-1px);
}

.btn-recovery-secondary {
  background-color: transparent;
  border: 2px solid var(--accent-blue);
  color: var(--accent-blue);
  font-weight: 600;
  transition: all var(--transition-speed);
}

.btn-recovery-secondary:hover {
  background-color: var(--accent-blue);
  color: var(--white);
}

/* Recovery Alerts */
#recoverySection .alert {
  border-radius: var(--border-radius);
  border: none;
  font-weight: 500;
}

#recoverySection .alert-info {
  background-color: rgba(23, 162, 184, 0.2);
  color: var(--info-blue);
}

#recoverySection .alert-warning {
  background-color: rgba(255, 193, 7, 0.2);
  color: var(--warning-amber);
}

#recoverySection .alert-success {
  background-color: rgba(40, 167, 69, 0.2);
  color: var(--success-green);
}

/* Mobile Responsiveness for Recovery */
@media (max-width: 768px) {
  #recoverySection .row {
    margin: 0;
  }

  #recoverySection .col-md-6 {
    padding-left: 0;
    padding-right: 0;
    margin-bottom: var(--space-md);
  }

  .recovery-metadata {
    grid-template-columns: 1fr;
    text-align: center;
  }

  #recoveryKitContent {
    padding: var(--space-md);
  }
}

/* Print Styles for Recovery Kit */
@media print {
  #recoverySection nav,
  #recoverySection .card-header,
  #recoverySection button,
  #recoverySection .btn,
  .recovery-upload-area {
    display: none !important;
  }

  #recoveryKitContent {
    background-color: white !important;
    color: black !important;
    border: 2px solid black !important;
    page-break-inside: avoid;
  }

  .recovery-qr-code {
    border: 3px solid black !important;
  }

  .recovery-metadata {
    color: black !important;
  }
}

/**
 * POET Enhanced Visual Components CSS
 *
 * @deprecated Many styles in this file are deprecated as of 2025-11-02
 * The policy-card-styles.css file provides card-based styling for the new UI.
 * This file is maintained only for core variables and legacy compatibility.
 *
 * DO NOT add new styles to this file.
 * All new styling should go in policy-card-styles.css.
 */

/* ===== GROUP COLORS SCHEME ===== */
:root {
  /* Group Colors from POET Condition Library */
  --poet-transaction-color: #6b7280;      /* Gray - Transaction Constraints */
  --poet-input-color: #059669;            /* Green - Input Constraints */
  --poet-output-color: #2563eb;           /* Blue - Output Constraints */
  --poet-relationships-color: #7c3aed;    /* Purple - Relationship Constraints */
  --poet-stateful-color: #ea580c;         /* Orange - Stateful Logic */
  --poet-signatures-color: #dc2626;       /* Red - Signature Constraints */

  /* Semantic colors */
  --poet-success: #10b981;
  --poet-warning: #f59e0b;
  --poet-error: #ef4444;
  --poet-info: #3b82f6;

  /* Layout variables */
  --poet-border-radius: 8px;
  --poet-spacing-xs: 0.25rem;
  --poet-spacing-sm: 0.5rem;
  --poet-spacing-md: 1rem;
  --poet-spacing-lg: 1.5rem;
  --poet-spacing-xl: 2rem;

  /* Animation variables */
  --poet-transition-fast: 0.15s ease;
  --poet-transition-normal: 0.2s ease;
  --poet-transition-slow: 0.3s ease;
}

/* ===== CONDITION NODE ===== */
.condition-node {
  background: #1b1f3b;
  border: 1px solid #e5e7eb;
  border-radius: var(--poet-border-radius);
  padding: var(--poet-spacing-md);
  transition: all var(--poet-transition-normal);
  position: relative;
}

.condition-node.selectable-node {
  cursor: pointer;
}

.condition-node.selectable-node:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.condition-node.selected {
  border-color: var(--poet-info);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.condition-node.focused {
  outline: 2px solid var(--poet-info);
  outline-offset: 2px;
}

/* Node Header */
.node-header {
  display: flex;
  align-items: flex-start;
  gap: var(--poet-spacing-md);
}

.node-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--poet-border-radius);
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid currentColor;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.node-content {
  flex: 1;
  min-width: 0;
}

.node-name {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: var(--poet-spacing-xs);
}

.node-description {
  color: #6b7280;
  font-size: 0.875rem;
  line-height: 1.4;
}

.node-actions {
  display: flex;
  gap: var(--poet-spacing-sm);
  flex-shrink: 0;
}

/* ===== NODE PARAMETERS ===== */
.node-params {
  margin-top: var(--poet-spacing-md);
  padding-top: var(--poet-spacing-md);
  border-top: 1px solid #f3f4f6;
}

.node-params-empty {
  color: #9ca3af;
  font-style: italic;
  font-size: 0.875rem;
  text-align: center;
  padding: var(--poet-spacing-md);
  background: #f9fafb;
  border-radius: var(--poet-border-radius);
}

.params-header {
  font-weight: 600;
  color: #374151;
  margin-bottom: var(--poet-spacing-sm);
  font-size: 0.875rem;
}

.param-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--poet-spacing-xs) 0;
  font-size: 0.875rem;
}

.param-key {
  font-weight: 500;
  color: #4b5563;
}

.param-value {
  color: #1f2937;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ===== EMPTY STATE ===== */
.poet-tree-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--poet-spacing-xl);
  text-align: center;
  min-height: 300px;
}

.empty-state-icon {
  width: 4rem;
  height: 4rem;
  background: linear-gradient(135deg, #e5e7eb, #f3f4f6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #9ca3af;
  margin-bottom: var(--poet-spacing-lg);
}

.poet-tree-empty-state h5 {
  color: #374151;
  margin-bottom: var(--poet-spacing-sm);
}

.poet-tree-empty-state p {
  color: #6b7280;
  margin-bottom: var(--poet-spacing-lg);
}

.empty-state-actions {
  display: flex;
  gap: var(--poet-spacing-md);
  flex-wrap: wrap;
  justify-content: center;
}

/* ===== VALIDATION DISPLAY ===== */
.validation-display {
  margin-top: var(--poet-spacing-md);
  padding: var(--poet-spacing-md);
  border-radius: var(--poet-border-radius);
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

.validation-success {
  display: flex;
  align-items: center;
  color: var(--poet-success);
  font-size: 0.875rem;
}

.validation-errors {
  display: flex;
  flex-direction: column;
  gap: var(--poet-spacing-xs);
}

.validation-error {
  display: flex;
  align-items: center;
  color: var(--poet-error);
  font-size: 0.875rem;
}

.validation-warning {
  display: flex;
  align-items: center;
  color: var(--poet-warning);
  font-size: 0.875rem;
}

.validation-summary {
  margin-top: var(--poet-spacing-sm);
  padding-top: var(--poet-spacing-sm);
  border-top: 1px solid #e5e7eb;
  font-size: 0.75rem;
}

/* ===== FORM VALIDATION ===== */
.is-valid {
  border-color: var(--poet-success) !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1) !important;
}

.is-invalid {
  border-color: var(--poet-error) !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1) !important;
}

.valid-feedback {
  display: block;
  margin-top: var(--poet-spacing-xs);
  font-size: 0.75rem;
}

.invalid-feedback {
  display: block;
  margin-top: var(--poet-spacing-xs);
  font-size: 0.75rem;
}

/* ===== CATEGORY-SPECIFIC STYLES ===== */
.condition-node[data-category="transaction"] {
  border-left-color: var(--poet-transaction-color);
}

.condition-node[data-category="input"] {
  border-left-color: var(--poet-input-color);
}

.condition-node[data-category="output"] {
  border-left-color: var(--poet-output-color);
}

.condition-node[data-category="relationships"] {
  border-left-color: var(--poet-relationships-color);
}

.condition-node[data-category="stateful"] {
  border-left-color: var(--poet-stateful-color);
}

.condition-node[data-category="signatures"] {
  border-left-color: var(--poet-signatures-color);
}

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

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

/* ===== MOBILE RESPONSIVENESS ===== */
@media (max-width: 768px) {
  .node-header {
    flex-direction: column;
    gap: var(--poet-spacing-sm);
  }

  .node-actions {
    width: 100%;
    justify-content: center;
  }

  .empty-state-actions {
    flex-direction: column;
    width: 100%;
  }

  .param-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--poet-spacing-xs);
  }
}

/* ===== POLICY CANVAS STYLES ===== */
.policy-canvas-container {
  margin-bottom: var(--poet-spacing-lg);
}

/* Dark theme text colors */
.policy-canvas-card,
.policy-canvas-card .card-body,
.policy-canvas-empty-state,
.tree-node,
.tree-condition {
  color: var(--white, #ffffff) !important;
}

.policy-canvas-empty-state h3,
.policy-canvas-empty-state p,
.tree-node h6,
.tree-node p,
.tree-condition .condition-label {
  color: var(--white, #ffffff) !important;
}

/* Fix form input text colors for dark theme */
.condition-edit-form .form-control,
.condition-edit-form input[type="text"],
.condition-edit-form input[type="number"],
.condition-edit-form input[type="email"],
.condition-edit-form input[type="url"],
.condition-edit-form select,
.condition-edit-form textarea,
.condition-edit-panel .form-control,
.condition-edit-panel .param-input {
  color: #ffffff !important;
  background-color: rgb(27, 31, 59) !important;
  border-color: #4a5568 !important;
}

.condition-edit-form .form-control:focus,
.condition-edit-form input:focus,
.condition-edit-form select:focus,
.condition-edit-form textarea:focus,
.condition-edit-panel .form-control:focus,
.condition-edit-panel .param-input:focus {
  color: #ffffff !important;
  background-color: rgb(27, 31, 59) !important;
  border-color: var(--poet-info) !important;
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25) !important;
}

.condition-edit-form .form-control::placeholder {
  color: #a0aec0 !important;
}

/* Fix input field expansion when active */
.condition-edit-form .form-control,
.condition-edit-form input,
.condition-edit-form select,
.condition-edit-form textarea {
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.condition-edit-form .form-control:focus,
.condition-edit-form input:focus,
.condition-edit-form select:focus,
.condition-edit-form textarea:focus {
  transform: none !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* Prevent validation state expansion */
.condition-edit-form .form-control.is-valid,
.condition-edit-form .form-control.is-invalid {
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem) !important;
  background-position: right calc(0.375em + 0.1875rem) center !important;
  padding-right: calc(1.5em + 0.75rem) !important;
  width: 100% !important;
  max-width: 100% !important;
}

.policy-canvas-card {
  border: 1px solid #e5e7eb;
  border-radius: var(--poet-border-radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  background: #1b1f3b !important;
}

.policy-canvas-card .card-body {
  background: #1b1f3b !important;
}

/* Override Bootstrap card defaults */
.policy-canvas-card.card,
.policy-canvas-card .card,
.card.policy-canvas-card,
.card .policy-canvas-body {
  background-color: #1b1f3b !important;
}

.policy-canvas-card .card-header {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e5e7eb;
  padding: var(--poet-spacing-md) var(--poet-spacing-lg);
}

.policy-canvas-actions {
  display: flex;
  gap: var(--poet-spacing-sm);
}

.policy-canvas-body {
  min-height: 400px;
  padding: var(--poet-spacing-lg);
  background: #1b1f3b !important;
}

#policyCanvasContainer {
  background: #1b1f3b !important;
}

/* Canvas Empty State */
.policy-canvas-empty-state {
  text-align: center;
  padding: var(--poet-spacing-xl) var(--poet-spacing-lg);
  background: #1b1f3b !important;
}

.policy-canvas-empty-state .empty-state-visual {
  margin-bottom: var(--poet-spacing-lg);
}

.policy-canvas-empty-state .empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--poet-spacing-md);
  background: linear-gradient(135deg, var(--poet-info) 0%, #1e40af 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
}

/* Root Operator Selection */
.root-operator-selection {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--poet-spacing-lg);
}

.selection-header {
  text-align: center;
  margin-bottom: var(--poet-spacing-xl);
}

.operator-grid {
  display: flex;
  flex-direction: column;
  gap: var(--poet-spacing-md);
  margin-bottom: var(--poet-spacing-lg);
}

.operator-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--poet-spacing-sm);
}

/* Responsive: 3 columns on tablets */
@media (max-width: 992px) {
  .operator-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Responsive: 2 columns on mobile */
@media (max-width: 576px) {
  .operator-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.operator-btn {
  padding: var(--poet-spacing-md);
  text-align: left;
  border: 2px solid #e5e7eb;
  border-radius: var(--poet-border-radius);
  transition: all var(--poet-transition-normal);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: #1b1f3b;
  width: 100%;
  min-height: 80px;
}

.operator-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--poet-info);
}

.operator-btn strong {
  font-size: 1.1rem;
  margin-bottom: var(--poet-spacing-xs);
}

.operator-btn small {
  color: #6b7280;
  font-size: 0.875rem;
}

/* Threshold Setup */
.threshold-setup {
  max-width: 500px;
  margin: 0 auto;
  padding: var(--poet-spacing-lg);
}

.setup-header {
  text-align: center;
  margin-bottom: var(--poet-spacing-xl);
}

.threshold-input-group {
  margin-bottom: var(--poet-spacing-lg);
}

.setup-actions {
  display: flex;
  gap: var(--poet-spacing-md);
  justify-content: center;
}

/* Policy Tree Styles */
.policy-tree {
  padding: var(--poet-spacing-md);
}

.tree-node {
  margin-bottom: var(--poet-spacing-md);
  border: 2px solid #e5e7eb;
  border-radius: var(--poet-border-radius);
  background: #1b1f3b;
  transition: all var(--poet-transition-normal);
}

.tree-node:hover {
  border-color: var(--poet-info);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.root-node {
  border-left: 4px solid var(--poet-info);
}

.node-label {
  font-weight: 600;
  flex-grow: 1;
}

.threshold-badge {
  background: var(--poet-warning);
  color: white;
  padding: var(--poet-spacing-xs) var(--poet-spacing-sm);
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.node-children {
  border-top: 1px solid #f3f4f6;
  padding-top: var(--poet-spacing-sm);
  margin-top: var(--poet-spacing-sm);
}

.empty-children {
  text-align: center;
  padding: var(--poet-spacing-md);
  border-radius: var(--poet-border-radius);
  border: 2px dashed #d1d5db;
}

/* Popup Styles */
.popup-content {
  padding: 0;
}

.popup-header {
  padding: var(--poet-spacing-md) var(--poet-spacing-lg);
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.popup-header h6 {
  margin: 0;
  font-weight: 600;
}

.popup-close {
  border: none;
  background: none;
  font-size: 1.2rem;
  opacity: 0.5;
  cursor: pointer;
}

.popup-close:hover {
  opacity: 1;
}

.popup-body {
  padding: var(--poet-spacing-lg);
}

/* Group Colors for Operators */
.group-and .node-header {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  margin: calc(-1 * var(--poet-spacing-md));
  margin-bottom: var(--poet-spacing-sm);
  padding: var(--poet-spacing-md);
  border-radius: var(--poet-border-radius) var(--poet-border-radius) 0 0;
}

.group-or .node-header {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  margin: calc(-1 * var(--poet-spacing-md));
  margin-bottom: var(--poet-spacing-sm);
  padding: var(--poet-spacing-md);
  border-radius: var(--poet-border-radius) var(--poet-border-radius) 0 0;
}

.group-threshold .node-header {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  margin: calc(-1 * var(--poet-spacing-md));
  margin-bottom: var(--poet-spacing-sm);
  padding: var(--poet-spacing-md);
  border-radius: var(--poet-border-radius) var(--poet-border-radius) 0 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .empty-state-actions {
    flex-direction: column;
    align-items: center;
  }

  .empty-state-primary-action,
  .empty-state-secondary-action {
    width: 100%;
    max-width: 300px;
  }

  .policy-canvas-actions {
    flex-direction: column;
  }

  .add-child-popup {
    margin: 10px;
    min-width: 280px;
    max-width: calc(100vw - 20px);
  }
}

/* Tree Condition Styles */
.tree-condition {
  margin-left: var(--poet-spacing-lg);
  margin-bottom: var(--poet-spacing-sm);
  border: 1px solid #e5e7eb;
  border-radius: var(--poet-border-radius);
  background: #1b1f3b;
  transition: all var(--poet-transition-normal);
}

.tree-condition:hover {
  border-color: var(--poet-success);
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.1);
}

.condition-content {
  padding: var(--poet-spacing-sm) var(--poet-spacing-md);
}

.condition-header {
  display: flex;
  align-items: center;
  gap: var(--poet-spacing-sm);
  margin-bottom: var(--poet-spacing-xs);
}

.condition-icon {
  font-size: 1rem;
}

.condition-label {
  font-weight: 500;
  flex-grow: 1;
}

.condition-actions {
  display: flex;
  gap: var(--poet-spacing-xs);
  margin-left: auto;
}

.condition-summary {
  margin-top: var(--poet-spacing-xs);
}

/* Condition added animation */
.condition-added {
  animation: condition-added-success 0.4s ease-out;
  border-color: var(--poet-success) !important;
  background: rgba(16, 185, 129, 0.05) !important;
}

@keyframes condition-added-success {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Modal backdrop for popups */
.modal-backdrop-custom {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1040;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Nested Operator Selection Popup - Override previous positioning */
.add-child-popup {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  z-index: 1050 !important;
  background: #1b1f3b;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--poet-border-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  min-width: 320px;
  max-width: 400px;
  color: var(--white, #ffffff);
  margin: 20px;
}

.add-child-popup .popup-content {
  padding: 0;
}

.add-child-popup .popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--poet-spacing-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.add-child-popup .popup-header h6 {
  margin: 0;
  color: var(--white, #ffffff);
  font-weight: 600;
}

.add-child-popup .popup-close {
  background: none;
  border: none;
  color: var(--white, #ffffff);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-child-popup .popup-close:hover {
  color: #ff6b6b;
}

.add-child-popup .popup-body {
  padding: var(--poet-spacing-md);
}

.add-child-popup .nested-operator-btn {
  color: var(--white, #ffffff);
  border-color: rgba(255, 255, 255, 0.2);
  text-align: left;
}

.add-child-popup .nested-operator-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--white, #ffffff);
}

/* ===== PRINT STYLES ===== */
@media print {
  .policy-canvas-card {
    border: none;
    box-shadow: none;
  }

  .node-actions,
  .empty-state-actions,
  .policy-canvas-actions {
    display: none;
  }

  .condition-node,
  .tree-node {
    break-inside: avoid;
  }
}
/* =============================================================================
   POLICY CARD-BASED BUILDER STYLES
   ============================================================================
   Purpose: Card-stack interface for nested policy trees with mobile-first design
   Features: Depth shading, operator patterns, validity indicators, collapsible UI
   Accessibility: WCAG 2.1 AA compliant with focus indicators and screen reader support
   ============================================================================= */

/* ===== CSS CUSTOM PROPERTIES (THEMING) ===== */
:root {
  /* Depth shading - progressive darkening for nested levels */
  --card-depth-0: #1b1f3b;
  --card-depth-1: #1f2342;
  --card-depth-2: #232749;
  --card-depth-3: #272b50;
  --card-depth-4: #2b2f57;
  --card-depth-5: #2f3360;

  /* Operator stripe colors (accessible) */
  --op-and: #4F7CF7;      /* Blue - parallel execution */
  --op-or: #22C55E;       /* Green - branching paths */
  --op-not: #EF4444;      /* Red - negation/exclusion */
  --op-threshold: #A855F7; /* Purple - quorum logic */

  /* Validity indicator colors */
  --valid-green: #10b981;
  --warning-yellow: #f59e0b;
  --invalid-red: #ef4444;

  /* Card layout spacing */
  --card-spacing-xs: 0.25rem;
  --card-spacing-sm: 0.5rem;
  --card-spacing-md: 1rem;
  --card-spacing-lg: 1.5rem;
  --card-spacing-xl: 2rem;

  /* Animation timings */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;

  /* Touch target sizing (WCAG 2.1 AA: minimum 44x44px) */
  --min-touch-target: 44px;

  /* Card design tokens */
  --card-border-radius: 8px;
  --card-stripe-width: 6px;
  --card-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ===== CARD CONTAINER & LAYOUT ===== */
.policy-card-builder-container {
  width: 100%;
  min-height: 400px;
  background: var(--card-depth-0);
  border: 1px solid rgba(229, 231, 235, 0.2);
  border-radius: var(--card-border-radius);
  overflow: hidden;
  position: relative;
}

/* Desktop: vertical stack with indentation */
.card-depth-container {
  display: flex;
  flex-direction: column;
  gap: var(--card-spacing-md);
  padding: var(--card-spacing-lg);
  transition: all var(--transition-normal);
}

/* Mobile: horizontal scroll for depth levels */
@media (max-width: 768px) {
  .card-depth-container {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: var(--card-spacing-md);
    gap: var(--card-spacing-sm);
  }

  .card-depth-level {
    min-width: 280px;
    scroll-snap-align: start;
    flex-shrink: 0;
  }
}

/* ===== POLICY CARD STRUCTURE ===== */
.policy-card {
  position: relative;
  border: 1px solid rgba(229, 231, 235, 0.3);
  border-radius: var(--card-border-radius);
  box-shadow: var(--card-shadow);
  transition: all var(--transition-normal);
  margin-bottom: var(--card-spacing-md);
  overflow: hidden;
}

/* Depth shading - progressive darkening */
.policy-card.depth-0 { background: var(--card-depth-0); }
.policy-card.depth-1 { background: var(--card-depth-1); }
.policy-card.depth-2 { background: var(--card-depth-2); }
.policy-card.depth-3 { background: var(--card-depth-3); }
.policy-card.depth-4 { background: var(--card-depth-4); }
.policy-card.depth-5 { background: var(--card-depth-5); }

/* Hover state for interactive cards */
.policy-card.interactive:hover {
  border-color: rgba(79, 124, 247, 0.5);
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-1px);
}

/* Focus state for keyboard navigation (WCAG 2.1 AA) */
.policy-card:focus-within {
  outline: 2px solid var(--op-and);
  outline-offset: 2px;
  z-index: 10;
}

/* ===== OPERATOR STRIPES WITH SVG PATTERNS (ACCESSIBLE) ===== */
/* Left border stripe indicating operator type */
.policy-card.operator-and {
  border-left: var(--card-stripe-width) solid var(--op-and);
}

.policy-card.operator-or {
  border-left: var(--card-stripe-width) solid var(--op-or);
}

.policy-card.operator-not {
  border-left: var(--card-stripe-width) solid var(--op-not);
}

.policy-card.operator-threshold {
  border-left: var(--card-stripe-width) solid var(--op-threshold);
}

/* SVG pattern definitions for enhanced accessibility (not color-dependent) */
.operator-pattern-defs {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* AND pattern: parallel horizontal lines */
.policy-card.operator-and::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--card-stripe-width);
  background-image: repeating-linear-gradient(
    0deg,
    var(--op-and),
    var(--op-and) 3px,
    transparent 3px,
    transparent 6px
  );
}

/* OR pattern: branching diagonal lines */
.policy-card.operator-or::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--card-stripe-width);
  background-image: repeating-linear-gradient(
    45deg,
    var(--op-or),
    var(--op-or) 2px,
    transparent 2px,
    transparent 8px
  );
}

/* NOT pattern: strikethrough horizontal line */
.policy-card.operator-not::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: var(--card-stripe-width);
  height: 2px;
  background: var(--op-not);
  transform: translateY(-50%);
}

/* THRESHOLD pattern: filled dots */
.policy-card.operator-threshold::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--card-stripe-width);
  background-image: radial-gradient(
    circle at 3px 5px,
    var(--op-threshold) 2px,
    transparent 2px
  );
  background-size: 6px 10px;
}

/* ===== CARD HEADER ===== */
.policy-card-header {
  display: flex;
  align-items: center;
  gap: var(--card-spacing-md);
  padding: var(--card-spacing-md) var(--card-spacing-lg);
  padding-left: calc(var(--card-spacing-lg) + var(--card-stripe-width));
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  user-select: none;
}

.policy-card-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Expand/collapse icon */
.card-expand-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-normal);
  color: rgba(255, 255, 255, 0.7);
}

.policy-card.expanded .card-expand-icon {
  transform: rotate(90deg);
}

/* Operator badge */
.operator-badge {
  flex-shrink: 0;
  padding: var(--card-spacing-xs) var(--card-spacing-sm);
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: white;
}

.operator-badge.and { background: var(--op-and); }
.operator-badge.or { background: var(--op-or); }
.operator-badge.not { background: var(--op-not); }
.operator-badge.threshold { background: var(--op-threshold); }

/* Card title */
.card-title {
  flex: 1;
  font-weight: 600;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.95);
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Validity indicator */
.validity-badge {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: bold;
}

.validity-badge.valid {
  background: var(--valid-green);
  color: white;
}

.validity-badge.valid::after {
  content: '✓';
}

.validity-badge.warning {
  background: var(--warning-yellow);
  color: #1f2937;
}

.validity-badge.warning::after {
  content: '⚠';
}

.validity-badge.invalid {
  background: var(--invalid-red);
  color: white;
}

.validity-badge.invalid::after {
  content: '✕';
}

/* Action buttons */
.card-header-actions {
  display: flex;
  gap: var(--card-spacing-xs);
  flex-shrink: 0;
}

.card-action-btn {
  min-width: var(--min-touch-target);
  min-height: var(--min-touch-target);
  padding: var(--card-spacing-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.card-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-color: rgba(255, 255, 255, 0.4);
}

.card-action-btn:focus {
  outline: 2px solid var(--op-and);
  outline-offset: 2px;
}

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

/* ===== CARD BODY (COLLAPSIBLE) ===== */
.policy-card-body {
  max-height: 2000px;
  overflow: hidden;
  transition: max-height var(--transition-slow), opacity var(--transition-normal);
  opacity: 1;
}

.policy-card.collapsed .policy-card-body {
  max-height: 0;
  opacity: 0;
}

/* Card content area */
.card-content {
  padding: var(--card-spacing-lg);
  padding-left: calc(var(--card-spacing-lg) + var(--card-stripe-width));
}

/* ===== SUMMARY CHIPS (COLLAPSED STATE) ===== */
.card-summary-chips {
  display: none;
  flex-wrap: wrap;
  gap: var(--card-spacing-xs);
  padding: var(--card-spacing-sm) var(--card-spacing-lg);
  padding-left: calc(var(--card-spacing-lg) + var(--card-stripe-width));
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.policy-card.collapsed .card-summary-chips {
  display: flex;
}

.summary-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--card-spacing-xs);
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

.summary-chip .chip-icon {
  font-size: 0.875rem;
}

.summary-chip.overflow {
  background: rgba(255, 255, 255, 0.12);
  font-weight: 600;
}

/* Tooltip for overflow chips (mobile: show in drawer) */
.summary-chip-tooltip {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: var(--card-spacing-xs);
  padding: var(--card-spacing-sm) var(--card-spacing-md);
  background: #1f2937;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--card-border-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 100;
  display: none;
  max-width: 300px;
  color: white;
  font-size: 0.875rem;
}

.summary-chip.overflow:hover .summary-chip-tooltip {
  display: block;
}

/* ===== CHILDREN RENDERING ===== */
.card-children {
  display: flex;
  flex-direction: column;
  gap: var(--card-spacing-md);
}

.card-children .policy-card {
  margin-left: var(--card-spacing-lg);
  position: relative;
}

/* Connection line for nested cards */
.card-children .policy-card::after {
  content: '';
  position: absolute;
  left: calc(-1 * var(--card-spacing-lg) + 2px);
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.1);
}

/* ===== CONDITION ROWS (LEAF NODES) ===== */
.condition-row {
  display: flex;
  align-items: center;
  gap: var(--card-spacing-md);
  padding: var(--card-spacing-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--card-border-radius);
  transition: all var(--transition-normal);
  width: 100%;
  box-sizing: border-box;
  flex-wrap: nowrap;
}

.condition-row:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}

.condition-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
}

.condition-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
}

.condition-content {
  flex: 1;
  min-width: 0;
}

.condition-label {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 2px;
}

.condition-description {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.6);
  overflow-wrap: break-word;
}

.condition-actions {
  display: flex;
  gap: var(--card-spacing-xs);
  flex-shrink: 0;
  flex-wrap: nowrap;
}

/* Fix for missing condition-details container */
.condition-details {
  flex: 1;
  min-width: 0; /* Critical for proper text wrapping in flex container */
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ===== ADD BUTTONS ===== */
.add-child-zone {
  text-align: center;
  padding: var(--card-spacing-md);
}

.add-child-btn {
  min-width: var(--min-touch-target);
  min-height: var(--min-touch-target);
  display: inline-flex;
  align-items: center;
  gap: var(--card-spacing-sm);
  padding: var(--card-spacing-sm) var(--card-spacing-lg);
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: var(--card-border-radius);
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.add-child-btn:hover {
  border-color: var(--op-and);
  color: var(--op-and);
  background: rgba(79, 124, 247, 0.05);
}

.add-child-btn:focus {
  outline: 2px solid var(--op-and);
  outline-offset: 2px;
}

/* ===== BREADCRUMBS (NAVIGATION) ===== */
.policy-breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--card-spacing-xs);
  padding: var(--card-spacing-md) var(--card-spacing-lg);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: var(--card-spacing-xs);
  white-space: nowrap;
}

.breadcrumb-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  padding: var(--card-spacing-xs) var(--card-spacing-sm);
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.breadcrumb-link:hover {
  color: var(--op-and);
  background: rgba(79, 124, 247, 0.1);
}

.breadcrumb-link:focus {
  outline: 2px solid var(--op-and);
  outline-offset: 2px;
}

.breadcrumb-separator {
  color: rgba(255, 255, 255, 0.3);
  user-select: none;
}

.breadcrumb-item.active .breadcrumb-link {
  color: white;
  font-weight: 600;
  pointer-events: none;
}

/* ===== MOBILE OPTIMIZATION ===== */
@media (max-width: 768px) {
  /* Stack cards vertically in mobile view */
  .policy-card {
    margin-left: 0 !important;
  }

  /* Simplify nested indentation */
  .card-children .policy-card::after {
    display: none;
  }

  /* Touch-friendly spacing */
  .policy-card-header {
    padding: var(--card-spacing-md);
    padding-left: calc(var(--card-spacing-md) + var(--card-stripe-width));
  }

  .card-content {
    padding: var(--card-spacing-md);
    padding-left: calc(var(--card-spacing-md) + var(--card-stripe-width));
  }

  /* Larger touch targets */
  .card-action-btn {
    min-width: 48px;
    min-height: 48px;
  }

  /* Summary chips in mobile drawer */
  .card-summary-chips {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Horizontal breadcrumb scroll */
  .policy-breadcrumbs {
    padding: var(--card-spacing-sm) var(--card-spacing-md);
  }

  /* CRITICAL: Override sigbash.css global mobile rules for policy cards */
  .condition-row[data-node-id] {
    flex-direction: row !important;
  }

  .condition-row[data-node-id] .btn {
    width: auto !important;
  }

  /* Mobile-specific condition row adjustments */
  .condition-row {
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .condition-info {
    flex: 1 1 0;
    min-width: 0;
    gap: 0.5rem;
  }

  .condition-icon {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }

  .condition-details {
    flex: 1 1 0;
    min-width: 0;
  }

  .condition-name {
    font-size: 0.875rem;
  }

  .condition-description {
    font-size: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .condition-actions {
    gap: 0.25rem;
    flex: 0 0 auto;
  }

  .condition-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }

  /* One-expanded-group rule for mobile */
  .policy-card-builder-container.mobile-mode .policy-card.depth-gt-1.expanded ~ .policy-card.depth-gt-1.expanded {
    /* Automatically collapse siblings when one is expanded */
  }
}

/* ===== ANIMATIONS ===== */
/* Smooth expand/collapse animation */
@keyframes expand-card {
  from {
    max-height: 0;
    opacity: 0;
  }
  to {
    max-height: 2000px;
    opacity: 1;
  }
}

@keyframes collapse-card {
  from {
    max-height: 2000px;
    opacity: 1;
  }
  to {
    max-height: 0;
    opacity: 0;
  }
}

/* Card added animation */
@keyframes card-added-flash {
  0% {
    background: rgba(79, 124, 247, 0.2);
    transform: scale(0.98);
  }
  50% {
    background: rgba(79, 124, 247, 0.1);
    transform: scale(1.01);
  }
  100% {
    background: inherit;
    transform: scale(1);
  }
}

.policy-card.card-added {
  animation: card-added-flash 0.5s ease-out;
}

/* ===== ACCESSIBILITY (WCAG 2.1 AA) ===== */
/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .card-expand-icon {
    transition: none;
  }
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
  .policy-card {
    border-width: 2px;
    border-color: rgba(255, 255, 255, 0.6);
  }

  .operator-badge {
    border: 2px solid white;
  }

  .card-action-btn {
    border-width: 2px;
    border-color: rgba(255, 255, 255, 0.5);
  }
}

/* Focus visible (keyboard navigation) */
.policy-card:focus-visible,
.card-action-btn:focus-visible,
.breadcrumb-link:focus-visible,
.add-child-btn:focus-visible {
  outline: 3px solid var(--op-and);
  outline-offset: 3px;
}

/* ===== MINIMAP (OPTIONAL) ===== */
.policy-minimap {
  position: fixed;
  bottom: var(--card-spacing-lg);
  right: var(--card-spacing-lg);
  width: 200px;
  max-height: 400px;
  background: rgba(27, 31, 59, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--card-border-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  padding: var(--card-spacing-md);
  z-index: 1000;
  overflow-y: auto;
}

.minimap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--card-spacing-sm);
  padding-bottom: var(--card-spacing-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.minimap-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.minimap-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 0;
  font-size: 1.2rem;
}

.minimap-close:hover {
  color: white;
}

.minimap-tree {
  font-size: 0.75rem;
}

.minimap-node {
  padding: 4px 8px;
  margin-bottom: 4px;
  border-left: 3px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.minimap-node:hover {
  background: rgba(255, 255, 255, 0.1);
  border-left-color: var(--op-and);
}

.minimap-node.active {
  background: rgba(79, 124, 247, 0.2);
  border-left-color: var(--op-and);
  font-weight: 600;
}

/* Hide minimap on mobile */
@media (max-width: 768px) {
  .policy-minimap {
    display: none;
  }
}

/* ===== EMPTY STATE ===== */
.policy-card-empty-state {
  text-align: center;
  padding: var(--card-spacing-xl);
  color: rgba(255, 255, 255, 0.7);
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--card-spacing-lg);
  background: linear-gradient(135deg, rgba(79, 124, 247, 0.2), rgba(79, 124, 247, 0.1));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--op-and);
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--card-spacing-sm);
}

.empty-state-description {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: var(--card-spacing-lg);
}

/* ===== DARK THEME INTEGRATION ===== */
/* Match existing POET builder dark theme */
.policy-card,
.policy-card-header,
.card-content,
.condition-row,
.policy-breadcrumbs {
  color: rgba(255, 255, 255, 0.95);
}

/* Input field styling for dark theme */
.card-inline-edit input,
.card-inline-edit select {
  background: rgba(27, 31, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: var(--card-spacing-sm);
  border-radius: 4px;
}

.card-inline-edit input:focus,
.card-inline-edit select:focus {
  outline: 2px solid var(--op-and);
  outline-offset: 2px;
  border-color: var(--op-and);
}

/* ===== WEIGHT INPUT (WEIGHTED_THRESHOLD) ===== */
.weight-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.weight-label {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
  white-space: nowrap;
}

.weight-input {
  width: 70px;
  background-color: #495057 !important;
  border: 1px solid #6c757d !important;
  color: #fff !important;
  text-align: center;
  font-size: 0.875rem;
  padding: 0.25rem 0.5rem;
}

.weight-input:focus {
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
  border-color: var(--accent-blue) !important;
}

/* Mobile: Stack weight input below condition */
@media (max-width: 768px) {
  .condition-row {
    flex-wrap: wrap;
  }

  .weight-input-wrapper {
    flex-basis: 100%;
    margin-top: 0.5rem;
    margin-left: 2.5rem; /* Align with condition text */
  }

  .weight-input {
    width: 100px; /* Wider on mobile */
  }
}

/* ===== THRESHOLD BADGE CLICK-TO-EDIT ===== */
.threshold-badge {
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
}

.threshold-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.3);
}

.threshold-badge:focus {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.threshold-badge:active {
  transform: scale(0.98);
}

.inline-threshold-input {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.inline-threshold-input:focus {
  outline: 2px solid var(--accent-blue);
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* ===== DUAL CONTAINER LAYOUT (IMPLIES/VETO) ===== */
.dual-container-card .dual-sections {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.1);
}

.section-left,
.section-right {
  padding: 1rem;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.section-left:hover,
.section-right:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.2);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  margin-bottom: 0.5rem;
}

.section-icon {
  font-size: 1.25rem;
  font-weight: bold;
  opacity: 0.9;
}

.section-title {
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.95);
}

.section-sublabel {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: normal;
  margin-left: auto;
}

.section-children {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 40px;
}

/* Remove drop zone text - no longer needed */
.section-children:empty::before {
  display: none;
}

.section-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.5rem;
  padding: 0 0.5rem;
}

.btn-add-section {
  width: 100%;
  margin-top: auto;
  padding: 1rem 1.5rem !important;
  font-size: 0.95rem !important;
  font-weight: 500;
  border: 2px dashed rgba(13, 110, 253, 0.4) !important;
  background-color: rgba(13, 110, 253, 0.05) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  transition: all 0.2s ease;
  border-radius: 6px !important;
  min-height: 80px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-add-section:hover {
  border-style: solid !important;
  border-color: rgba(13, 110, 253, 0.7) !important;
  background-color: rgba(13, 110, 253, 0.15) !important;
  color: rgba(255, 255, 255, 0.95) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.2);
}

.btn-add-section:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(13, 110, 253, 0.2);
}

/* Mobile: Stack sections vertically */
@media (max-width: 968px) {
  .dual-container-card .dual-sections {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 1rem;
  }

  .section-divider {
    transform: rotate(90deg);
    padding: 0.5rem 0;
  }

  .section-left,
  .section-right {
    min-height: 120px;
  }

  /* Transform section headers from full-width bars to compact inline badges */
  .section-header {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-bottom: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 0.75rem;
    width: auto;
  }

  .section-icon {
    font-size: 0.9rem;
  }

  .section-title {
    font-size: 0.75rem;
    letter-spacing: 0.3px;
  }

  /* Hide sublabels on mobile - they're redundant when stacked */
  .section-sublabel {
    display: none;
  }

  /* Adjust button size for mobile */
  .btn-add-section {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    min-height: 60px;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .policy-card-builder-container {
    border: none;
    box-shadow: none;
  }

  .card-action-btn,
  .add-child-btn,
  .policy-minimap {
    display: none;
  }

  .policy-card {
    page-break-inside: avoid;
    box-shadow: none;
  }

  .policy-card.collapsed .policy-card-body {
    max-height: none;
    opacity: 1;
  }
}
/* POET Interface Overrides for dev.html
 * These styles override Bootstrap and POET CSS conflicts
 * MUST load LAST to maintain override specificity
 */

/* Override conflicting styles from sigbash.css for POET interface */
#poet-unified-interface,
#poet-unified-interface * {
  color: inherit !important;
}

/* Ensure proper text colors in POET interface */
.poet-template-gallery h3,
.poet-template-gallery h6,
.poet-template-gallery p,
.poet-template-gallery label,
.poet-advanced-tree h3,
.poet-advanced-tree h6,
.poet-advanced-tree p,
.poet-advanced-tree label,
.tree-node .node-header h6,
.tree-node .node-content,
.template-card .template-name,
.template-card .template-description {
  color: var(--bs-body-color) !important;
}

/* Fix text colors in wizard containers */
#wizardGroupsContainer *,
#wizardConditionsContainer * {
  color: black !important;
}

/* Override for validation feedback - must be red */
#wizardConditionsContainer .invalid-feedback,
#wizardGroupsContainer .invalid-feedback {
  color: #dc3545 !important;
  font-weight: bold !important;
}

/* Fix icon display issues */
.tree-node .btn i,
.template-card i,
.poet-advanced-tree .btn i {
  display: inline-block !important;
  width: auto !important;
  height: auto !important;
}

/* Ensure buttons have proper styling */
.poet-advanced-tree .btn,
.poet-template-gallery .btn {
  color: inherit !important;
}

/* Fix delete button icons */
.btn-outline-danger i::before,
.delete-node-btn i::before {
  content: "\f2ed" !important; /* Font Awesome trash icon */
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900 !important;
}

/* Fix parameter editor input field backgrounds */
.condition-edit-panel .form-control,
.condition-edit-panel .param-input {
  background-color: white !important;
  color: var(--bs-body-color) !important;
  border: 1px solid #ced4da !important;
}

/* Operator Selection Modal Styles - Dark Theme */
#operatorSelectionModal .modal-content {
  background-color: var(--dark-navy, #1b1f3b);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white, #ffffff);
}

#operatorSelectionModal .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#operatorSelectionModal .modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#operatorSelectionModal .modal-title {
  color: var(--white, #ffffff);
}

/* Condition Selection Modal Styles - Match Operator Modal Dark Theme */
#conditionSelectionModal .modal-content {
  background-color: var(--dark-navy, #1b1f3b);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white, #ffffff);
}

#conditionSelectionModal .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#conditionSelectionModal .modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#conditionSelectionModal .modal-title {
  color: var(--white, #ffffff);
}

/* Add Child Modal Styling */
#addChildModal .modal-content {
  background-color: var(--dark-navy, #1b1f3b);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white, #ffffff);
}

#addChildModal .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#addChildModal .modal-title {
  color: var(--white, #ffffff);
}

#addChildModal .add-option-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#addChildModal .add-option-card {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 1rem;
}

#addChildModal .add-option-card:hover {
  background-color: rgba(74, 144, 226, 0.1);
  border-color: var(--accent-blue, #4a90e2);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
}

#addChildModal .add-option-card:active {
  transform: translateY(0);
}

#addChildModal .add-option-card:focus {
  outline: 2px solid var(--accent-blue, #4a90e2);
  outline-offset: 2px;
}

#addChildModal .option-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(74, 144, 226, 0.2);
  border-radius: 8px;
  color: var(--accent-blue, #4a90e2);
  font-size: 1.25rem;
}

#addChildModal .option-content {
  flex-grow: 1;
}

#addChildModal .option-title {
  margin: 0 0 0.25rem 0;
  font-weight: 600;
  color: var(--white, #ffffff);
}

#addChildModal .option-description {
  margin: 0;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.6);
}

#addChildModal .option-arrow {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.3);
  transition: transform 0.2s ease;
}

#addChildModal .add-option-card:hover .option-arrow {
  transform: translateX(4px);
  color: var(--accent-blue, #4a90e2);
}

.operator-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.operator-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.375rem;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.operator-item:hover {
  border-color: var(--accent-blue, #4a90e2);
  background: rgba(74, 144, 226, 0.1);
  transform: translateX(4px);
}

.operator-item:active {
  transform: translateX(2px);
}

.operator-item-selected {
  border-color: var(--accent-blue, #4a90e2) !important;
  background: rgba(74, 144, 226, 0.2) !important;
}

.operator-item-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 2.5rem;
  text-align: center;
}

.operator-item-content {
  flex: 1;
  min-width: 0;
}

.operator-item-label {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  color: var(--white, #ffffff);
}

.operator-item-description {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.3;
}

.operator-item-arrow {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* Mobile responsive */
@media (max-width: 576px) {
  .operator-item {
    padding: 0.75rem;
    gap: 0.75rem;
  }

  .operator-item-icon {
    font-size: 1.25rem;
    width: 2rem;
  }

  .operator-item-label {
    font-size: 0.875rem;
  }

  .operator-item-description {
    font-size: 0.8rem;
  }
}

/* Threshold Configuration Modal Styles - Dark Theme */
#thresholdConfigModal .modal-content {
  background-color: var(--dark-navy, #1b1f3b);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white, #ffffff);
}

#thresholdConfigModal .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#thresholdConfigModal .modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#thresholdConfigModal .modal-title {
  color: var(--white, #ffffff);
}

#thresholdConfigModal .form-label {
  color: rgba(255, 255, 255, 0.9);
}

#thresholdConfigModal .form-text {
  color: rgba(255, 255, 255, 0.7);
}

#thresholdConfigModal .input-group-text {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--white, #ffffff);
}

#thresholdConfigModal .form-control {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--white, #ffffff);
}

#thresholdConfigModal .form-control:focus {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-blue, #4a90e2);
  color: var(--white, #ffffff);
  box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25);
}

#thresholdConfigModal .alert-info {
  background-color: rgba(74, 144, 226, 0.15);
  border-color: rgba(74, 144, 226, 0.3);
  color: rgba(255, 255, 255, 0.9);
}

#thresholdConfigModal small.text-muted {
  color: rgba(255, 255, 255, 0.6) !important;
}

/* Desktop: Make threshold input compact and centered */
#thresholdConfigModal .input-group {
  width: auto;
  display: inline-flex;
  margin-left: auto;
  margin-right: auto;
}

/* Center the container holding the input group */
#thresholdConfigModal .threshold-config-form > div:has(.input-group) {
  text-align: center;
}

#thresholdConfigModal .form-control {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  text-align: center;
  flex: 0 0 80px;
}

#thresholdConfigModal .input-group-text {
  flex-shrink: 0;
}

/* Hide the "or more" / "+" label - the ≥ symbol is sufficient */
#thresholdConfigModal #thresholdLabel {
  display: none;
}

/* Mobile: Reduce sizing further */
@media (max-width: 576px) {
  /* Override input-group-lg to be regular size on mobile */
  #thresholdConfigModal .input-group-lg > .input-group-text {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
  }

  #thresholdConfigModal .input-group-lg > .form-control {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
  }

  #thresholdConfigModal .form-control {
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    flex: 0 0 60px;
  }
}

/* Condition Modal: Fix search bar inline layout on mobile */
@media (max-width: 768px) {
  #conditionSelectionModal .condition-search-container .input-group {
    display: flex !important;
    flex-wrap: nowrap !important;
  }

  #conditionSelectionModal .condition-search-container .form-control {
    width: auto !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  #conditionSelectionModal .condition-search-container .input-group-text {
    flex-shrink: 0 !important;
  }
}

/* Condition Modal: Selection animation */
.condition-card {
  position: relative;
  transition: all 0.2s ease;
}

.condition-card:active {
  transform: scale(0.98);
  background-color: rgba(74, 144, 226, 0.1);
}

.condition-card.condition-selected {
  background-color: rgba(34, 197, 94, 0.15) !important;
  border-color: #22c55e !important;
}

.selection-checkmark {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  font-size: 2rem;
  color: #22c55e;
  animation: checkmark-appear 0.3s ease;
  pointer-events: none;
}

@keyframes checkmark-appear {
  0% {
    opacity: 0;
    transform: translateY(-50%) scale(0.5);
  }
  50% {
    transform: translateY(-50%) scale(1.2);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

/* Mobile: Truncate long descriptions */
@media (max-width: 768px) {
  .condition-description {
    font-size: 0.875rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* Confirmation Modal Styles - Dark Theme */
#confirmationModal .modal-content {
  background-color: var(--dark-navy, #1b1f3b);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white, #ffffff);
}

#confirmationModal .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#confirmationModal .modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#confirmationModal .modal-title {
  color: var(--white, #ffffff);
}

#confirmationModal .modal-title i {
  color: #ffc107;
}

#confirmationModal .modal-body p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  line-height: 1.5;
}

#confirmationModal .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* Badge Color Overrides - Fix for white/invisible badge text */
.policy-card .badge {
  /* Remove any white color override that makes badges invisible */
  color: inherit !important;
}

/* Ensure proper text colors for Bootstrap badge variants */
.policy-card .badge-success {
  background-color: #198754;
  color: white !important;
}

.policy-card .badge-warning {
  background-color: #ffc107;
  color: #000 !important;
}

.policy-card .badge-danger {
  background-color: #dc3545;
  color: white !important;
}

.policy-card .badge-secondary {
  background-color: #6c757d;
  color: white !important;
}
.json-viewer {
	color: #000;
	padding-left: 20px;
}

.json-viewer ul {
	list-style-type: none;
	margin: 0;
	margin: 0 0 0 1px;
	border-left: 1px dotted #ccc;
	padding-left: 2em;
}

.json-viewer .hide {
	display: none;
}

.json-viewer .type-string {
	color: #0B7500;
	word-wrap: break-word;
	overflow-wrap: break-word;
	word-break: break-all;
	white-space: pre-wrap;
}

.json-viewer .type-date {
	color: #CB7500;
}

.json-viewer .type-boolean {
	color: #1A01CC;
	font-weight: bold;
}

.json-viewer .type-number {
	color: #1A01CC;
}

.json-viewer .type-null, .json-viewer .type-undefined {
	color: #90a;
}

.json-viewer a.list-link {
	color: #000;
	text-decoration: none;
	position: relative;
}

.json-viewer a.list-link:before {
	color: #aaa;
	content: "\25BC";
	position: absolute;
	display: inline-block;
	width: 1em;
	left: -1em;
}

.json-viewer a.list-link.collapsed:before {
	content: "\25B6";
}

.json-viewer a.list-link.empty:before {
	content: "";
}

.json-viewer .items-ph {
	color: #aaa;
	padding: 0 1em;
}

.json-viewer .items-ph:hover {
	text-decoration: underline;
}

/* EMZA Platform Customizations */

/* Container styling for KMC JSON viewer */
.kmc-json-viewer-container {
	background-color: #f8f9fa;
	border: 1px solid #dee2e6;
	border-radius: 0.25rem;
	padding: 1rem;
	max-height: 600px;
	overflow-y: auto;
	overflow-x: hidden;
	word-wrap: break-word;
	margin-bottom: 1rem;
}

/* Enhance json-viewer typography */
.kmc-json-viewer-container .json-viewer {
	font-family: 'Courier New', Courier, monospace;
	font-size: 0.875rem;
	color: #212529;
}

/* Enhance link styles for better visibility */
.json-viewer a.list-link:hover {
	background-color: #e9ecef;
	border-radius: 3px;
	padding: 2px 4px;
	margin: -2px -4px;
}

/* Custom scrollbar styling */
.kmc-json-viewer-container::-webkit-scrollbar {
	width: 8px;
}

.kmc-json-viewer-container::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 4px;
}

.kmc-json-viewer-container::-webkit-scrollbar-thumb {
	background: #888;
	border-radius: 4px;
}

.kmc-json-viewer-container::-webkit-scrollbar-thumb:hover {
	background: #555;
}

/* Responsive adjustments for mobile */
@media (max-width: 767px) {
	.kmc-json-viewer-container {
		font-size: 0.75rem;
		padding: 0.75rem;
		max-height: 400px;
	}

	.kmc-json-viewer-container .json-viewer {
		font-size: 0.75rem;
	}
}

/* JSONViewer Copy Functionality Enhancements */

/* Make copyable values more obviously interactive */
.json-viewer .type-string,
.json-viewer .type-number,
.json-viewer .type-boolean,
.json-viewer .type-null,
.json-viewer .type-date {
	padding: 2px 4px;
	border-radius: 3px;
	transition: background-color 0.2s ease;
}

.json-viewer .type-string:hover,
.json-viewer .type-number:hover,
.json-viewer .type-boolean:hover,
.json-viewer .type-null:hover,
.json-viewer .type-date:hover {
	background-color: rgba(0, 123, 255, 0.1);
	outline: 1px solid rgba(0, 123, 255, 0.3);
}

/* Copy All button styling */
.json-copy-all-btn {
	font-size: 0.875rem;
	padding: 0.25rem 0.5rem;
	white-space: nowrap;
}

.json-copy-all-btn i {
	font-size: 0.875rem;
	margin-right: 0.25rem;
}

/* Mobile adjustments for copy button */
@media (max-width: 767px) {
	.json-copy-all-btn {
		font-size: 0.75rem;
		padding: 0.2rem 0.4rem;
	}

	.json-copy-all-btn i {
		margin-right: 0.15rem;
	}
}

/* JSONViewer List Item Click-to-Copy Styling */
.json-viewer li {
	border-radius: 3px;
	transition: background-color 0.2s ease, outline 0.2s ease;
	margin: 2px 0;
	padding: 2px;
}

.json-viewer li:hover {
	background-color: rgba(0, 123, 255, 0.05);
	outline: 1px solid rgba(0, 123, 255, 0.3);
}

/* JSONViewer Copy Icon Positioning - Left Side, Always Visible */
.json-viewer .json-copy-icon {
	display: inline-block;
	cursor: pointer;
	opacity: 0.5;
	color: #6c757d;
	font-size: 0.7rem;
	margin-right: 0.5em;
	padding: 2px 4px;
	border-radius: 3px;
	transition: all 0.2s ease;
	vertical-align: middle;
}

.json-viewer .json-copy-icon:hover {
	opacity: 1;
	color: #007bff;
	background-color: rgba(0, 123, 255, 0.1);
}

/* Ensure list items have enough left padding for the copy icon */
.json-viewer li {
	position: relative;
	padding-left: 0.5em;
}

/* Mobile adjustments */
@media (max-width: 767px) {
	.json-viewer .json-copy-icon {
		font-size: 0.65rem;
		padding: 1px 3px;
		margin-right: 0.3em;
	}
}

/*------------------------------------------------
  Enhanced WASM Loading Overlay Styles

  To integrate: Replace the WASM Loading Overlay section
  in sigbash.css (lines 7547-7589) with these styles
-------------------------------------------------*/

.wasm-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(11, 11, 19, 0.98), rgba(26, 32, 53, 0.98));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.6s ease-out;
}

.wasm-loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.wasm-loading-content {
  text-align: center;
  color: white;
  max-width: 600px;
  padding: 3rem 2rem;
  animation: wasmFadeIn 0.6s ease-out;
}

@keyframes wasmFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stage Icon Animation */
.wasm-stage-icon {
  animation: wasmIconEntry 0.6s ease-out;
}

@keyframes wasmIconEntry {
  from {
    opacity: 0;
    transform: scale(0.8) rotate(-10deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.wasm-icon-pulse {
  animation: wasmIconPulse 2s ease-in-out infinite;
}

@keyframes wasmIconPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

/* Stage Description */
.wasm-stage-description {
  min-height: 60px;
  transition: all 0.4s ease;
}

.wasm-stage-description p {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.wasm-stage-description small {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.6);
}

/* Enhanced Progress Bar with Glow */
.wasm-progress-container {
  position: relative;
}

.wasm-progress-bar {
  height: 36px;
  margin-top: 1.5rem;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  overflow: visible;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.wasm-progress-glow {
  background: linear-gradient(90deg, #0d6efd, #4a90e2, #0d6efd);
  background-size: 200% 100%;
  animation: wasmProgressGlow 2s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(13, 110, 253, 0.6),
              0 0 40px rgba(13, 110, 253, 0.4);
  border-radius: 18px;
  position: relative;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes wasmProgressGlow {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.wasm-progress-text {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 36px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Educational Content Badges */
.wasm-educational-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: wasmBadgeFadeIn 0.6s ease-out 0.3s both;
}

@keyframes wasmBadgeFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wasm-feature-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  background: rgba(13, 110, 253, 0.15);
  border: 1px solid rgba(13, 110, 253, 0.3);
  border-radius: 12px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.9);
  transition: all 0.3s ease;
}

.wasm-feature-badge:hover {
  background: rgba(13, 110, 253, 0.25);
  border-color: rgba(13, 110, 253, 0.5);
  transform: translateY(-2px);
}

.wasm-feature-badge i {
  color: #4a90e2;
  font-size: 1rem;
}

.wasm-feature-badge strong {
  color: #ffffff;
  font-weight: 700;
}

/* Constraint Budget Visualization */
.wasm-constraint-budget {
  padding: 0.75rem 1.5rem;
  background: rgba(74, 144, 226, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(74, 144, 226, 0.3);
  animation: wasmConstraintFadeIn 0.5s ease-out both;
}

@keyframes wasmConstraintFadeIn {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 100px;
  }
}

/* Loading Timer */
.wasm-loading-timer {
  opacity: 0.6;
  font-size: 0.8rem;
}

/* Success Animation (when complete) */
.wasm-loading-overlay.wasm-success .wasm-stage-icon i {
  animation: wasmSuccessPulse 0.6s ease-out;
  color: #28a745 !important;
}

@keyframes wasmSuccessPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

/* Mobile Responsive Adjustments */
@media (max-width: 767px) {
  .wasm-loading-content {
    padding: 2rem 1.5rem;
    max-width: 90%;
  }

  .wasm-stage-icon i {
    font-size: 2rem !important;
  }

  .wasm-stage-description p {
    font-size: 1rem;
  }

  .wasm-feature-badge {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
  }

  .wasm-progress-bar {
    height: 28px;
  }

  .wasm-progress-text {
    font-size: 0.8rem;
    line-height: 28px;
  }
}

/* Tablet Adjustments */
@media (min-width: 768px) and (max-width: 991px) {
  .wasm-loading-content {
    max-width: 500px;
  }
}
/*------------------------------------------------
  Enhanced CTA Button Styles
------------------------------------------------*/
.btn-cta-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  font-weight: 600;
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  border-radius: 50px;
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-cta-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  color: white;
}

.btn-cta-primary:active {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.btn-cta-primary:focus {
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3), 0 0 0 0.25rem rgba(102, 126, 234, 0.25);
}

.btn-animated {
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
  }
  50% {
    box-shadow: 0 10px 35px rgba(102, 126, 234, 0.6);
  }
}

/* Footer text enhancements */
footer p, .footer-text {
  font-size: 1.05rem;
  font-weight: 500;
  color: #e0e0e0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.3px;
}

footer strong, .footer-emphasis {
  color: #667eea;
  font-weight: 700;
}

/* Review Policy List - Fix text overflow for long content like addresses */
#reviewPolicyList {
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

#reviewPolicyList ul,
#reviewPolicyList ol {
  padding-left: 1.5rem;
}

#reviewPolicyList li {
  word-break: break-word;
  overflow-wrap: break-word;
  margin-bottom: 0.5rem;
}

/* Mobile-specific adjustments for review policy list */
@media (max-width: 768px) {
  #reviewPolicyList {
    font-size: 0.9rem;
    padding: 0.75rem;
  }

  #reviewPolicyList li {
    font-size: 0.85rem;
  }
}

/* Fix mobile footer dead space - ensure footer sticks to bottom */
html {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: auto;
}

.main-container {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

.footer {
  flex-shrink: 0;
  margin-top: auto !important;
}

/* Ensure sections expand to fill available space */
.section-content {
  flex: 1 0 auto;
}

/* SR-2: Enhanced chat styles for assistant questions */
.chat-message.assistant-question {
  background: linear-gradient(135deg, rgba(74, 144, 226, 0.12) 0%, rgba(74, 144, 226, 0.05) 100%);
  border-left: 3px solid #4a90e2;
  padding-left: 14px;
}

/* SR-2: Visual indicator for Q&A mode */
.chat-message.qa-response {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.12) 0%, rgba(76, 175, 80, 0.05) 100%);
  border-left: 3px solid #4caf50;
  padding-left: 14px;
}

.chat-message.qa-response .message-content::before {
  content: "💡 ";
  margin-right: 6px;
  font-size: 18px;
}

/* Enhanced privacy note styling */
.chat-message .text-muted.small {
  opacity: 0.8;
  font-style: italic;
}


/* =============================================================================
   VISUAL POLISH MICRO-INTERACTIONS - Beta Demo Enhancement
   Designed for "wow" factor with vanilla JS + Bootstrap compatibility
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. GRADIENT ANIMATED TEXT - Hero Headlines
   ----------------------------------------------------------------------------- */

/* Apply gradient animation to hero headlines */
h1.display-3, 
h1.display-3.fw-bold,
.gradient-text-animated {
  background: linear-gradient(
    90deg,
    var(--accent-blue) 0%,
    #6bb6ff 25%,
    #4a90e2 50%,
    #5ba3f5 75%,
    var(--accent-blue) 100%
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% center;
  }
  50% {
    background-position: 100% center;
  }
}

/* Fallback for browsers that don't support background-clip: text */
@supports not (background-clip: text) {
  h1.display-3,
  h1.display-3.fw-bold,
  .gradient-text-animated {
    background: none;
    -webkit-text-fill-color: inherit;
    color: var(--white);
  }
}

/* -----------------------------------------------------------------------------
   2. RIPPLE EFFECTS - Skill Card Clicks
   ----------------------------------------------------------------------------- */

/* Enhanced skill card for ripple effect */
.skill-level-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

/* Ripple effect container */
.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(74, 144, 226, 0.4);
  transform: scale(0);
  animation: rippleAnimation 0.6s ease-out;
  pointer-events: none;
}

@keyframes rippleAnimation {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* Enhanced hover state for skill cards */
.skill-level-card:hover {
  transform: translateY(-4px) scale(1.02);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Enhanced selected state with glow */
.skill-level-card.selected {
  box-shadow: 0 0 0 3px var(--accent-blue),
              0 8px 24px rgba(74, 144, 226, 0.35);
  animation: selectionGlow 2s ease-in-out infinite;
}

@keyframes selectionGlow {
  0%, 100% {
    box-shadow: 0 0 0 3px var(--accent-blue),
                0 8px 24px rgba(74, 144, 226, 0.35);
  }
  50% {
    box-shadow: 0 0 0 3px var(--accent-blue),
                0 8px 32px rgba(74, 144, 226, 0.5);
  }
}

/* -----------------------------------------------------------------------------
   3. BLUR-FADE TRANSITIONS - Section Transitions
   ----------------------------------------------------------------------------- */

/* Enhanced fade-in with blur effect */
.fadeInBlur {
  animation: fadeInBlurAnimation 0.6s ease-out forwards;
}

@keyframes fadeInBlurAnimation {
  0% {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

/* Directional blur-fade variants */
.fadeInBlurLeft {
  animation: fadeInBlurLeftAnimation 0.6s ease-out forwards;
}

@keyframes fadeInBlurLeftAnimation {
  0% {
    opacity: 0;
    filter: blur(10px);
    transform: translateX(-30px);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: translateX(0);
  }
}

.fadeInBlurRight {
  animation: fadeInBlurRightAnimation 0.6s ease-out forwards;
}

@keyframes fadeInBlurRightAnimation {
  0% {
    opacity: 0;
    filter: blur(10px);
    transform: translateX(30px);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: translateX(0);
  }
}

/* Fade out with blur (for hiding sections) */
.fadeOutBlur {
  animation: fadeOutBlurAnimation 0.4s ease-in forwards;
}

@keyframes fadeOutBlurAnimation {
  0% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
  100% {
    opacity: 0;
    filter: blur(8px);
    transform: scale(0.95);
  }
}

/* -----------------------------------------------------------------------------
   4. FEATURE CARD PARALLAX - 3D Tilt Effect on Hover
   ----------------------------------------------------------------------------- */

/* Enhanced feature card with 3D perspective */
.feature-card {
  perspective: 1000px;
  transform-style: preserve-3d;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 3D tilt effect - applied via JS on mousemove */
.feature-card.tilt-active {
  transition: transform 0.1s ease-out;
}

/* Enhanced inner content for 3D depth */
.feature-card:hover {
  transform: translateY(-8px);
}

.feature-card:hover::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, 
    rgba(74, 144, 226, 0.1) 0%,
    rgba(107, 182, 255, 0.05) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: -1;
}

.feature-card:hover::before {
  opacity: 1;
}

/* Parallax depth layers for card content */
.feature-card .icon-wrapper {
  transition: transform 0.3s ease;
  will-change: transform;
}

.feature-card:hover .icon-wrapper {
  transform: translateZ(20px) scale(1.1);
}

/* Hero feature card enhanced parallax */
.feature-card-hero:hover {
  transform: translateY(-10px);
}

/* -----------------------------------------------------------------------------
   5. SMART BUTTON LOADING STATES
   ----------------------------------------------------------------------------- */

/* Button loading state container */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.btn-loading .btn-text {
  visibility: hidden;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: buttonSpinner 0.6s linear infinite;
}

@keyframes buttonSpinner {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Button with success state */
.btn-success-state {
  background: linear-gradient(135deg, #28a745, #20c997) !important;
  border-color: #28a745 !important;
  animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Button with error state */
.btn-error-state {
  background: linear-gradient(135deg, #dc3545, #c82333) !important;
  border-color: #dc3545 !important;
  animation: errorShake 0.4s ease-out;
}

@keyframes errorShake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  75% {
    transform: translateX(8px);
  }
}

/* -----------------------------------------------------------------------------
   6. SUCCESS CHECKMARK ANIMATION
   ----------------------------------------------------------------------------- */

/* Success checkmark container */
.success-checkmark-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #28a745, #20c997);
  box-shadow: 0 4px 20px rgba(40, 167, 69, 0.4);
  animation: checkmarkAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes checkmarkAppear {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-45deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* SVG checkmark path animation */
.success-checkmark-svg {
  width: 32px;
  height: 32px;
}

.success-checkmark-path {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: checkmarkDraw 0.5s 0.2s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

@keyframes checkmarkDraw {
  to {
    stroke-dashoffset: 0;
  }
}

/* Inline success checkmark (smaller version) */
.success-checkmark-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #28a745;
  margin-left: 8px;
  animation: checkmarkAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.success-checkmark-inline svg {
  width: 14px;
  height: 14px;
}

.success-checkmark-inline .success-checkmark-path {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  stroke-width: 2.5;
  animation: checkmarkDrawSmall 0.4s 0.15s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

@keyframes checkmarkDrawSmall {
  to {
    stroke-dashoffset: 0;
  }
}

/* -----------------------------------------------------------------------------
   ACCESSIBILITY - Respect prefers-reduced-motion
   ----------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  /* Disable gradient animation */
  h1.display-3,
  h1.display-3.fw-bold,
  .gradient-text-animated {
    animation: none;
    background-position: 0% center;
  }

  /* Disable ripple effects */
  .ripple-effect {
    display: none;
  }

  /* Simplify transitions to fade only */
  .fadeInBlur,
  .fadeInBlurLeft,
  .fadeInBlurRight {
    animation: simpleFadeIn 0.3s ease-out forwards;
  }

  @keyframes simpleFadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  .fadeOutBlur {
    animation: simpleFadeOut 0.2s ease-in forwards;
  }

  @keyframes simpleFadeOut {
    from {
      opacity: 1;
    }
    to {
      opacity: 0;
    }
  }

  /* Disable 3D transforms */
  .feature-card,
  .feature-card:hover {
    transform: none;
  }

  .feature-card .icon-wrapper,
  .feature-card:hover .icon-wrapper {
    transform: none;
  }

  /* Disable card selection animation */
  .skill-level-card.selected {
    animation: none;
  }

  /* Simplify button states */
  .btn-loading::after {
    animation-duration: 1s;
  }

  .btn-success-state,
  .btn-error-state {
    animation: none;
  }

  /* Keep checkmark but simplify animation */
  .success-checkmark-container,
  .success-checkmark-inline {
    animation-duration: 0.2s;
  }

  .success-checkmark-path {
    animation-duration: 0.3s;
    animation-delay: 0.1s;
  }
}

/* -----------------------------------------------------------------------------
   UTILITY CLASSES - Easy Application
   ----------------------------------------------------------------------------- */

/* Apply parallax hover to any card */
.parallax-hover {
  perspective: 1000px;
  transition: transform 0.3s ease;
}

.parallax-hover:hover {
  transform: translateY(-6px);
}

/* Glow effect utility */
.glow-accent {
  box-shadow: 0 0 20px rgba(74, 144, 226, 0.3);
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(74, 144, 226, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(74, 144, 226, 0.5);
  }
}

/* Smooth scale utility */
.scale-hover {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scale-hover:hover {
  transform: scale(1.05);
}


/*------------------------------------------------
  RESPONSIVE IMPROVEMENTS - Mobile Polish
------------------------------------------------*/
@media (max-width: 768px) {
  :root {
    --font-display: 2.5rem;
    --font-h1: 2rem;
    --font-h2: 1.75rem;
    --heading-hero: 2.5rem;
    --heading-section: 2rem;
  }
  
  .btn {
    min-height: 48px;
    min-width: 48px;
  }
  
  .feature-card {
    padding: var(--space-4);
  }
  
  section {
    padding-top: var(--space-8);
    padding-bottom: var(--space-8);
  }
  
  .tech-badges {
    gap: 0.5rem;
  }
  
  .badge-tech {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
}

@media (max-width: 576px) {
  :root {
    --font-display: 2rem;
    --font-h1: 1.75rem;
    --heading-hero: 2rem;
  }
  
  .hero-section h1 {
    font-size: 2rem !important;
  }
  
  .lead {
    font-size: 1rem;
  }
}

/*------------------------------------------------
  WASM INTEGRITY ERROR STYLING (T02_S28)
------------------------------------------------*/
.wasm-integrity-error {
  background-color: #dc3545 !important; /* Bootstrap danger red */
}

.wasm-integrity-error .progress-bar {
  background-color: #721c24 !important;
}

.wasm-integrity-error .wasm-stage-icon i {
  color: #f8d7da !important;
}
