/* AI-NOTE: Reusable Component Library - Centralized UI patterns */
/* Import after design-tokens.css and before page-specific CSS */

/* ========================================
   GLOBAL ACCESSIBILITY — FOCUS VISIBLE
   Provides a consistent keyboard-navigation ring on all interactive
   elements. Uses :focus-visible so mouse users are not affected.
   ======================================== */
:focus-visible {
  outline: 2px solid var(--primary-color, #3b82f6);
  outline-offset: 2px;
  border-radius: var(--radius-sm, 4px);
}

/* Remove browser default focus ring now that we handle it */
:focus:not(:focus-visible) {
  outline: none;
}

/* Buttons: use slightly thicker ring for larger tap targets */
button:focus-visible,
[role="button"]:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary-color, #3b82f6);
  outline-offset: 3px;
  border-radius: var(--radius-md, 6px);
}

/* Form inputs already show border-color change; keep ring subtle */
.form-control:focus-visible,
.form-select:focus-visible {
  outline: none; /* Handled by box-shadow in forms.css */
}


.badge-status {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  line-height: var(--leading-none);
  text-align: center;
  white-space: nowrap;
}

/* Status Badge Variants */
.badge-status--new {
  background: var(--status-new);
  color: white;
}

.badge-status--active {
  background: var(--status-active);
  color: white;
}

.badge-status--pending {
  background: var(--status-pending);
  color: white;
}

.badge-status--completed {
  background: var(--status-completed);
  color: white;
}

.badge-status--cancelled,
.badge-status--canceled {
  background: var(--status-cancelled);
  color: white;
}

.badge-status--overdue {
  background: var(--status-overdue);
  color: white;
}

.badge-status--in-progress,
.badge-status--in_progress {
  background: var(--status-in-progress);
  color: white;
}

.badge-status--discarded {
  background: var(--status-discarded);
  color: white;
}

.badge-status--open {
  background: var(--status-open);
  color: white;
}

/* General-purpose semantic badge variants
   Usage: <span class="badge-status badge-status--success">Active</span>
          <span class="badge-status badge-status--info">Role Name</span> */
.badge-status--success,
.badge-status--active {
  background: var(--success-color, #10b981);
  color: white;
}

.badge-status--warning {
  background: var(--warning-color, #f59e0b);
  color: var(--color-slate-900);
}

.badge-status--danger,
.badge-status--inactive {
  background: var(--danger-color, #ef4444);
  color: white;
}

.badge-status--info {
  background: var(--info-color, #3b82f6);
  color: white;
}

.badge-status--secondary,
.badge-status--neutral {
  background: var(--card-header-bg, #f1f5f9);
  color: var(--muted-text, #6b7280);
  border: 1px solid var(--border-color, #e2e8f0);
}

/* Role-specific badge — uses primary-color so it's tenant-branded */
.badge-status--role {
  background: color-mix(in srgb, var(--primary-color) 15%, transparent);
  color: var(--primary-color);
  border: 1px solid color-mix(in srgb, var(--primary-color) 30%, transparent);
}

/* Trial / time-limited badge */
.badge-status--trial {
  background: var(--warning-color, #f59e0b);
  color: var(--color-slate-900);
}

/* Dark mode overrides */
[data-bs-theme="dark"] .badge-status--secondary,
[data-bs-theme="dark"] .badge-status--neutral {
  background: rgba(148, 163, 184, 0.15);
  color: var(--muted-text);
  border-color: var(--border-color);
}

/* ========================================
   PRIORITY BADGES
   ======================================== */
.badge-priority {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  line-height: var(--leading-none);
}

.badge-priority--high {
  background: var(--priority-high);
  color: white;
}

.badge-priority--medium {
  background: var(--priority-medium);
  color: var(--color-slate-900);
}

.badge-priority--low {
  background: var(--priority-low);
  color: white;
}

/* ========================================
   AVATAR COMPONENTS
   ======================================== */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--space-8); /* 32px default */
  height: var(--space-8);
  border-radius: var(--radius-full);
  background-color: var(--primary-color);
  color: white;
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-initials {
  text-transform: uppercase;
}

/* Avatar Sizes */
.avatar--sm {
  width: var(--space-6); /* 24px */
  height: var(--space-6);
  font-size: var(--text-xs);
}

.avatar--md {
  /* Default size, already defined above */
}

.avatar--lg {
  width: var(--space-10); /* 40px */
  height: var(--space-10);
  font-size: var(--text-base);
}

.avatar--xl {
  width: var(--space-12); /* 48px */
  height: var(--space-12);
  font-size: var(--text-lg);
}

.avatar--2xl {
  width: var(--space-16); /* 64px */
  height: var(--space-16);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
}

/* Legacy support for existing avatar classes */
.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
}

/* ========================================
   TABLE COLUMN WIDTH UTILITIES
   ======================================== */
.col-w-xs {
  width: var(--col-w-xs);
  max-width: var(--col-w-xs);
}

.col-w-sm {
  width: var(--col-w-sm);
  max-width: var(--col-w-sm);
}

.col-w-md {
  width: var(--col-w-md);
  max-width: var(--col-w-md);
}

.col-w-lg {
  width: var(--col-w-lg);
  max-width: var(--col-w-lg);
}

.col-w-xl {
  width: var(--col-w-xl);
  max-width: var(--col-w-xl);
}

/* ========================================
   TABLE LAYOUT UTILITIES
   ======================================== */
.table-fixed {
  table-layout: fixed;
  width: 100%;
}

/* ========================================
   TEXT SIZE UTILITIES
   ======================================== */
.text-sm {
  font-size: 0.875rem; /* 14px */
}

.text-xs {
  font-size: 0.75rem; /* 12px */
}

/* ========================================
   CURSOR UTILITIES
   ======================================== */
.cursor-grab {
  cursor: grab;
}

.cursor-grabbing {
  cursor: grabbing;
}

.cursor-pointer {
  cursor: pointer;
}

/* ========================================
   FORM WIDTH UTILITIES
   ======================================== */
.form-select-min {
  width: auto;
  min-width: 120px;
}

/* ========================================
   IMAGE UTILITIES
   ======================================== */
.qr-code-img {
  width: 64px;
  height: 64px;
}

/* ========================================
   MODAL UTILITIES
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-card-md {
  min-width: 480px;
}

.modal-card-lg {
  min-width: 520px;
}

/* ========================================
   FORM SELECT UTILITIES
   ======================================== */
.form-select-status {
  min-width: 160px;
}

.form-select-priority {
  min-width: 140px;
}

/* ========================================
   PROGRESS BAR UTILITIES
   ======================================== */
.progress-thin {
  height: 12px;
}

/* ========================================
   LOGO UTILITIES
   ======================================== */
.navbar-logo {
  height: 40px;
  max-width: 200px;
  object-fit: contain;
}

/* ========================================
   TEXT WRAP UTILITIES
   ======================================== */
.text-wrap-break {
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal !important;
  word-break: break-word;
}

/* ========================================
   PAGINATION UTILITIES
   ======================================== */
.pagination-info {
  margin-inline: 10px;
}

/* ========================================
   FONT SIZE UTILITIES
   ======================================== */
.text-2xs {
  font-size: 0.65rem;
}

/* ========================================
   WIDTH UTILITIES
   ======================================== */
.w-160 {
  width: 160px;
}

.w-180 {
  width: 180px;
}

.w-220 {
  width: 220px;
}

.w-200 {
  width: 200px;
}

/* ========================================
   SEARCH DROPDOWN UTILITIES
   ======================================== */
.search-results-dropdown {
  z-index: 1050;
  max-height: 250px;
  overflow-y: auto;
  background-color: var(--card-bg);
  color: var(--body-text);
  border-color: var(--border-color) !important;
}

/* ========================================
   AUTO-GEN BUTTON UTILITIES
   ======================================== */
.btn-auto-gen {
  z-index: 5;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
}

/* ========================================
   FILTER CARD UTILITIES
   ======================================== */
.filter-card-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}

/* ========================================
   FONT SIZE UTILITIES (Extended)
   ======================================== */
.text-sm {
  font-size: 0.8rem;
}

/* ========================================
   DROPDOWN WIDTH UTILITIES
   ======================================== */
.dropdown-menu-w-220 {
  min-width: 220px;
}

.dropdown-menu-w-240 {
  min-width: 240px;
}

.dropdown-menu-w-260 {
  min-width: 260px;
}

.dropdown-menu-w-280 {
  min-width: 280px;
}

/* Min-width utilities for badges/outputs */
.min-w-3rem {
  min-width: 3rem;
}

/* Max-width utilities */
.max-w-xl {
  max-width: 240px;
}

.max-w-lg {
  max-width: 170px;
}

.max-w-md {
  max-width: 150px;
}

/* ========================================
   LOGO UTILITIES (Extended)
   ======================================== */
.navbar-logo-sm {
  height: 36px;
  max-width: 160px;
  object-fit: contain;
}

/* ========================================
   CONTENT EDITOR UTILITIES
   ======================================== */
.content-editor-sm {
  min-height: 120px;
}

.content-editor-md {
  min-height: 180px;
}

.content-editor-lg {
  min-height: 220px;
}

/* ========================================
   CODE/PRE UTILITIES
   ======================================== */
.pre-wrap {
  white-space: pre-wrap;
}

/* ========================================
   LANDING PAGE / DEMO UTILITIES
   ======================================== */
.demo-flex-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.demo-stat-box {
  flex: 1;
  text-align: center;
  padding: 0.75rem;
  background: var(--glass);
  border-radius: 8px;
}

.demo-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
}

.demo-stat-label {
  font-size: 0.7rem;
  color: var(--muted);
}

.demo-text-muted-sm {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 1rem;
}

/* Progress bar widths for landing page */
.w-34 { width: 34%; }
.w-58 { width: 58%; }
.w-72 { width: 72%; }

/* Chart bar heights for landing page */
.h-45 { height: 45%; }
.h-60 { height: 60%; }
.h-70 { height: 70%; }
.h-80 { height: 80%; }
.h-90 { height: 90%; }
.h-95 { height: 95%; }

/* ========================================
   DROPDOWN WIDTH UTILITIES
   ======================================== */
.dropdown-min-w-sm {
  min-width: 180px;
}

.dropdown-min-w-md {
  min-width: 220px;
}

.dropdown-min-w-lg {
  min-width: 260px;
}

.dropdown-min-w-xl {
  min-width: 320px;
}

.col-w-2xl {
  width: var(--col-w-2xl);
  max-width: var(--col-w-2xl);
}

.col-w-3xl {
  width: var(--col-w-3xl);
  max-width: var(--col-w-3xl);
}

/* Percentage-based column widths for flexible tables */
.col-w-5 {
  width: 5%;
}

.col-w-10 {
  width: var(--col-w-10);
}

.col-w-12 {
  width: 12%;
}

.col-w-13 {
  width: 13%;
}

.col-w-15 {
  width: var(--col-w-15);
}

.col-w-20 {
  width: var(--col-w-20);
}

.col-w-25 {
  width: var(--col-w-25);
}

.col-w-30 {
  width: var(--col-w-30);
}

.col-w-auto {
  width: auto;
}

/* ========================================
   SEARCH DROPDOWN COMPONENT
   ======================================== */

.search-dropdown-container .search-results {
  border-top: none !important;
}

.search-dropdown-container:focus-within {
  z-index: 2000;
}

.search-dropdown-container .selected-chips {
  max-height: 120px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--card-header-bg);
  display: grid;
  gap: 6px;
}

.search-dropdown-container .selected-item {
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  font-size: var(--text-sm);
}

.search-dropdown-container .selected-item-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-dropdown-container .chip-remove {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--input-placeholder);
}

.search-dropdown-container .search-result-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  color: var(--body-text);
}

.search-dropdown-container .search-result-item:hover {
  background-color: var(--hover-bg);
  color: var(--body-text);
}

.search-dropdown-container .search-result-item:last-child {
  border-bottom: none;
}

.search-results-footer {
  background-color: var(--card-header-bg);
  color: var(--muted-text);
}

.search-dropdown-container .htmx-indicator {
  display: none;
}

.search-dropdown-container .htmx-request .htmx-indicator {
  display: block;
}

/* ========================================
   BREADCRUMB COMPONENT
   ======================================== */

.breadcrumb-container {
  margin-bottom: 8px;
  padding: 6px 12px;
  background: linear-gradient(135deg, var(--color-slate-50) 0%, var(--color-slate-200) 100%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

[data-bs-theme="dark"] .breadcrumb-container {
  background: linear-gradient(135deg, var(--color-slate-800) 0%, var(--color-slate-900) 100%);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.breadcrumb-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.breadcrumb-nav > div:first-child {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.breadcrumb-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--color-slate-500);
  color: white;
  border-radius: 50%;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: var(--font-medium);
  transition: background-color var(--transition-base), color var(--transition-base), box-shadow var(--transition-base);
}

[data-bs-theme="dark"] .breadcrumb-home {
  background: var(--color-slate-600);
}

.breadcrumb-home:hover {
  background: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  color: white;
}

.breadcrumb-separator {
  margin: 0 12px;
  color: var(--muted-text);
  font-size: 1.1rem;
}

[data-bs-theme="dark"] .breadcrumb-separator {
  color: var(--color-slate-400);
}

.breadcrumb-item {
  position: relative;
  color: var(--color-slate-600);
  text-decoration: none;
  padding: 2px 8px;
  border-radius: 16px;
  transition: background-color var(--transition-base), color var(--transition-base);
  font-weight: var(--font-medium);
}

[data-bs-theme="dark"] .breadcrumb-item {
  color: var(--color-slate-200);
}

.breadcrumb-item:hover {
  background: var(--primary-light);
  color: var(--primary-color);
  text-decoration: none;
}

[data-bs-theme="dark"] .breadcrumb-item:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.breadcrumb-current {
  position: relative;
  color: var(--primary-color);
  font-weight: 600;
  padding: 2px 8px;
  background: var(--primary-light);
  border-radius: 16px;
}

[data-bs-theme="dark"] .breadcrumb-current {
  color: var(--primary-color);
  background: var(--primary-light);
}

.breadcrumb-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}

.breadcrumb-actions .btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  border-radius: 20px;
  padding: 4px 10px;
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.2px;
  transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  border: none;
  overflow: hidden;
}

.breadcrumb-actions .btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.breadcrumb-actions .btn:hover::before {
  left: 100%;
}

.breadcrumb-actions .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.breadcrumb-actions .btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.breadcrumb-actions .btn-primary {
  background: var(--primary-color);
  color: white;
}

.breadcrumb-actions .btn-primary:hover {
  background: var(--primary-hover);
}

.breadcrumb-actions .btn-secondary {
  background: var(--secondary-color);
  color: white;
}

.breadcrumb-actions .btn-secondary:hover {
  background: var(--secondary-hover);
}

.breadcrumb-actions .btn-success {
  background: linear-gradient(135deg, var(--success-color) 0%, var(--success-dark) 100%);
  color: white;
}

.breadcrumb-actions .btn-danger {
  background: linear-gradient(135deg, var(--danger-color) 0%, var(--danger-dark) 100%);
  color: white;
}

.breadcrumb-actions .btn-outline-primary {
  background: var(--primary-color);
  color: white;
  border: 2px solid var(--primary-color);
}

.breadcrumb-actions .btn-outline-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: white;
}

.breadcrumb-actions .btn-outline-secondary {
  background: var(--secondary-color);
  color: white;
  border: 2px solid var(--secondary-color);
}

.breadcrumb-actions .btn-outline-secondary:hover {
  background: var(--secondary-hover);
  border-color: var(--secondary-hover);
  color: white;
}

@media (max-width: 768px) {
  .breadcrumb-container {
    padding: 12px 16px;
  }
  
  .breadcrumb-nav {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }
  
  .breadcrumb-nav > div:first-child {
    flex-wrap: wrap;
  }
  
  .breadcrumb-home {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }
  
  .breadcrumb-separator {
    margin: 0 8px;
  }
  
  .breadcrumb-item, .breadcrumb-current {
    padding: 4px 8px;
    font-size: 0.85rem;
  }
  
  .breadcrumb-actions .btn {
    padding: 5px 12px;
    font-size: 0.75rem;
    border-radius: 16px;
  }
}

/* ========================================
   PAGINATION COMPONENT
   ======================================== */

.pagination-select {
  border-radius: var(--radius-md);
  border-color: var(--border-color);
  color: var(--body-text);
  font-weight: var(--font-medium);
  background-color: var(--card-bg);
  cursor: pointer;
  height: 31px;
  padding: 2px 2rem 2px 10px;
  font-size: var(--table-font-size);
  line-height: 1.2;
}

.pagination-container {
  border-color: var(--border-color) !important;
  height: 31px;
}

.pagination-info {
  font-size: 13px;
}

.pagination-nav-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  transition: background 0.2s;
}

.pagination-nav-btn:hover {
  background-color: var(--hover-bg);
}

.pagination-nav-btn-disabled {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  opacity: 0.4;
  cursor: default;
}

.pagination-separator {
  width: 1px;
  height: 16px;
  background: var(--border-color);
  margin: 0 8px;
}

.pagination-icon {
  font-size: 10px;
}

/* ========================================
   INSTITUTION DETAIL PAGE
   ======================================== */

.description-wrap {
  max-width: 100%;
  padding: 0.75rem;
  background-color: var(--card-header-bg);
  color: var(--body-text);
  border-radius: 0.375rem;
  overflow: auto;
  max-height: 220px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.rating-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.rating-bar .progress {
  flex: 1 1 auto;
  height: 10px;
  margin: 0;
  min-width: 0;
}

.rating-bar .value {
  font-size: 0.75rem;
  padding-left: 0.25rem;
  white-space: nowrap;
}

.table-borderless {
  table-layout: auto;
  width: 100%;
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.table-borderless td {
  max-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.table-borderless td a {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  display: inline-block;
  max-width: 100%;
}

.table-borderless td:first-child {
  width: 40%;
  min-width: 120px;
}

.inst-name-text {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

/* ========================================
   ICON BUTTON COMPONENT
   ======================================== */

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
  border: none;
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  text-decoration: none;
}

.icon-button:focus {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color) 30%, transparent);
}

.icon-button i {
  font-size: 14px;
}

/* Icon Button Variants */
.icon-button--primary {
  color: var(--info-color);
}

.icon-button--primary:hover {
  background-color: var(--info-light);
  color: var(--info-dark);
}

.icon-button--secondary {
  color: var(--muted-text);
}

.icon-button--secondary:hover {
  background-color: var(--hover-bg);
  color: var(--body-text);
}

.icon-button--success {
  color: var(--success-color);
}

.icon-button--success:hover {
  background-color: var(--success-light);
  color: var(--success-dark);
}

.icon-button--error {
  color: var(--danger-color);
}

.icon-button--error:hover {
  background-color: var(--danger-light);
  color: var(--color-red-600);
}

.icon-button--warning {
  color: var(--warning-color);
}

.icon-button--warning:hover {
  background-color: var(--warning-light);
  color: var(--color-amber-600);
}

.icon-button--info {
  color: var(--color-blue-500);
}

.icon-button--info:hover {
  background-color: var(--color-blue-50);
  color: var(--color-blue-600);
}

.icon-button--dark {
  color: var(--color-slate-800);
}

.icon-button--dark:hover {
  background-color: var(--color-slate-50);
  color: var(--color-slate-900);
}

.icon-button--light {
  color: var(--color-slate-400);
}

.icon-button--light:hover {
  background-color: var(--hover-bg);
  color: var(--muted-text);
}

/* ========================================
   MARKDOWN EDITOR COMPONENT
   ======================================== */

.CodeMirror {
  border-radius: 0 0 6px 6px;
  border: 1px solid var(--input-border);
  background-color: var(--input-bg);
  color: var(--input-text);
  font-family: inherit;
  min-height: 300px;
}

.editor-toolbar {
  border-radius: 6px 6px 0 0;
  border: 1px solid var(--input-border);
  border-bottom: none;
  background-color: var(--card-bg);
  opacity: 1 !important;
}

.editor-toolbar button {
  color: var(--text-muted) !important;
}

.editor-toolbar button.active,
.editor-toolbar button:hover {
  background-color: var(--hover-bg);
  border-color: var(--input-border);
  color: var(--text-main) !important;
}

.editor-toolbar i.separator {
  border-left: 1px solid var(--input-border);
  border-right: none;
}

.editor-statusbar {
  color: var(--text-muted);
}

[data-bs-theme="dark"] .CodeMirror,
[data-bs-theme="dark"] .CodeMirror-scroll,
[data-bs-theme="dark"] .CodeMirror pre.CodeMirror-line,
[data-bs-theme="dark"] .CodeMirror pre.CodeMirror-line-like {
  background-color: var(--input-bg);
  color: var(--input-text);
}

[data-bs-theme="dark"] .CodeMirror-gutter-filler,
[data-bs-theme="dark"] .CodeMirror-scrollbar-filler {
  background-color: var(--input-bg);
}

[data-bs-theme="dark"] .CodeMirror-gutters {
  background-color: var(--card-header-bg);
  border-right-color: var(--input-border);
}

[data-bs-theme="dark"] .CodeMirror-cursor {
  border-left-color: var(--input-text);
}

[data-bs-theme="dark"] .CodeMirror-selected {
  background: color-mix(in srgb, var(--primary-color) 25%, transparent);
}

[data-bs-theme="dark"] .editor-preview,
[data-bs-theme="dark"] .editor-preview-side {
  background-color: var(--card-bg);
  color: var(--body-text);
  border-color: var(--input-border);
}

[data-bs-theme="dark"] .editor-statusbar {
  color: var(--muted-text);
}

[data-bs-theme="dark"] .editor-toolbar {
  background-color: var(--card-header-bg);
  border-color: var(--input-border);
}

[data-bs-theme="dark"] .editor-toolbar button {
  color: var(--muted-text) !important;
}

[data-bs-theme="dark"] .editor-toolbar button.active,
[data-bs-theme="dark"] .editor-toolbar button:hover {
  background-color: var(--hover-bg);
  border-color: var(--input-border);
  color: var(--body-text) !important;
}

/* ========================================
   SUBAGENCY LITE MODE COMPONENTS
   ======================================== */

.lite-card {
  border-radius: 1.25rem;
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
}

.lite-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.lite-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.application-type-badge {
  align-self: flex-start;
}

/* Subagency Lite Mode - Extended Styles */
.bg-lite-blue {
  background-color: var(--color-blue-50);
  color: var(--color-blue-600);
}

.bg-lite-green {
  background-color: var(--color-green-50);
  color: var(--color-green-600);
}

.bg-lite-purple {
  background-color: var(--color-purple-50);
  color: var(--color-purple-600);
}

.bg-lite-orange {
  background-color: var(--color-amber-50);
  color: var(--color-amber-600);
}

/* Subagency Form Styles */
.subagency-form .form-control,
.subagency-form .form-select {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--input-border);
}

.subagency-form .form-control:focus,
.subagency-form .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--primary-color) 25%, transparent);
}

/* ========================================
   NOTIFICATIONS COMPONENT
   ======================================== */

/* Notification List Page */
.notification-list-item {
  display: flex;
  align-items: flex-start;
  padding: 1.25rem;
  text-decoration: none;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--card-bg);
  transition: background-color 0.15s ease;
  color: inherit;
  position: relative;
}

.notification-list-item:last-child {
  border-bottom: none;
}

.notification-list-item:hover {
  background-color: var(--hover-bg);
  text-decoration: none;
  color: inherit;
}

.notification-list-item.unread {
  background-color: color-mix(in srgb, var(--primary-color) 6%, var(--card-bg));
}

.notification-list-item.unread:hover {
  background-color: color-mix(in srgb, var(--primary-color) 12%, var(--card-bg));
}

.notif-avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-semibold);
  font-size: 1.1rem;
  margin-right: 1.25rem;
  text-transform: uppercase;
}

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

.notif-title {
  font-size: 1rem;
  color: var(--color-slate-800);
  margin-bottom: 0.25rem;
  font-weight: var(--font-semibold);
}

.notif-body {
  font-size: 0.95rem;
  color: var(--color-slate-600);
  margin-bottom: 0.25rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--muted-text);
  margin-top: 0.25rem;
}

.notif-indicator {
  width: 10px;
  height: 10px;
  background-color: var(--danger-color);
  border-radius: 50%;
  margin-left: 1rem;
  flex-shrink: 0;
  align-self: center;
}

/* Navbar Notifications Popover */
.navbar-notifications-popover {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 360px;
  background: var(--card-bg);
  border: 1px solid var(--navbar-border);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 1200;
  overflow: hidden;
  animation: slideIn 0.2s ease-out;
}

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

.navbar-notifications-popover-header {
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navbar-text);
  border-bottom: 1px solid var(--navbar-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--card-header-bg);
}

.navbar-notifications-popover-list {
  max-height: 400px;
  overflow-y: auto;
}

.navbar-notifications-popover-item {
  display: flex;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  text-decoration: none;
  border-bottom: 1px solid var(--navbar-border);
  transition: background-color 0.15s ease;
  position: relative;
}

.navbar-notifications-popover-item:last-child {
  border-bottom: none;
}

.navbar-notifications-popover-item:hover {
  background-color: var(--hover-bg);
  text-decoration: none;
}

.navbar-notifications-popover-item.unread {
  background-color: color-mix(in srgb, var(--primary-color) 6%, var(--card-bg));
}

.navbar-notifications-popover-item.unread:hover {
  background-color: color-mix(in srgb, var(--primary-color) 12%, var(--card-bg));
}

.navbar-notifications-popover .notif-avatar {
  width: 40px;
  height: 40px;
  font-size: 0.9rem;
  margin-right: 1rem;
}

.notif-text {
  font-size: 0.9rem;
  color: var(--body-text);
  margin-bottom: 0.25rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 500;
}

.notif-time {
  font-size: 0.75rem;
  color: var(--muted-text);
}

.navbar-notifications-popover .notif-indicator {
  width: 8px;
  height: 8px;
  margin-left: 0.75rem;
  margin-top: 0.4rem;
}

.navbar-notifications-popover-empty {
  padding: 2rem;
  text-align: center;
  color: var(--muted-text);
  font-size: 0.9rem;
}

.navbar-notifications-popover-footer {
  padding: 0.75rem;
  text-align: center;
  border-top: 1px solid var(--navbar-border);
  background-color: var(--card-header-bg);
}

.btn-view-all {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-color);
  text-decoration: none;
}

.btn-view-all:hover {
  text-decoration: underline;
}

.mark-all-read-btn {
  background: transparent;
  border: none;
  color: var(--primary-color);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  line-height: 1;
}

.mark-all-read-btn:hover {
  background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
  color: var(--primary-color);
}

/* ========================================
   FEEDBACK SYSTEM
   ======================================== */

.feedback-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.feedback-header h1 {
  margin: 0;
  font-size: 28px;
  color: var(--body-text);
}

.feedback-nav {
  display: flex;
  gap: 15px;
}

.feedback-nav a {
  padding: 10px 20px;
  text-decoration: none;
  color: var(--muted-text);
  border-radius: 5px;
  transition: background-color 0.2s, color 0.2s;
}

.feedback-nav a:hover,
.feedback-nav a.active {
  background: var(--hover-bg);
  color: var(--body-text);
}

.feedback-nav a.btn-primary {
  background: var(--primary-color);
  color: white;
}

.feedback-nav a.btn-primary:hover {
  background: var(--primary-hover);
}

.feedback-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 15px;
  transition: all 0.15s ease-in-out;
}

.feedback-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-slate-300);
}

.feedback-type-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.feedback-type-feature {
  background: var(--info-light);
  color: var(--info-dark);
}

.feedback-type-bug {
  background: var(--danger-light);
  color: var(--danger-dark);
}

.feedback-status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.feedback-status-new { background: var(--info-light); color: var(--info-dark); }
.feedback-status-review { background: var(--warning-light); color: var(--warning-dark); }
.feedback-status-planned { background: var(--success-light); color: var(--success-dark); }
.feedback-status-in_progress { background: var(--color-blue-50); color: var(--color-blue-600); }
.feedback-status-testing { background: var(--color-purple-50); color: var(--color-purple-600); }
.feedback-status-completed { background: var(--success-light); color: var(--success-dark); }
.feedback-status-declined { background: var(--danger-light); color: var(--danger-dark); }
.feedback-status-on_hold { background: var(--color-slate-100); color: var(--color-slate-500); }

.priority-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.priority-critical { background: var(--danger-light); color: var(--danger-dark); }
.priority-high { background: var(--warning-light); color: var(--warning-dark); }
.priority-medium { background: var(--info-light); color: var(--info-dark); }
.priority-low { background: var(--color-slate-100); color: var(--color-slate-500); }

.vote-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  background: var(--hover-bg);
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.vote-button:hover {
  background: var(--card-header-bg);
}

.vote-button.voted {
  background: var(--primary-color);
  color: white;
}

.vote-count {
  font-weight: 600;
}

.filter-bar {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.filter-row {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 150px;
}

.filter-group label {
  font-size: 14px;
  color: var(--muted-text);
  font-weight: 500;
}

.filter-group select,
.filter-group input {
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  min-width: 150px;
  font-size: 14px;
  transition: all 0.15s ease-in-out;
  background-color: var(--input-bg);
  color: var(--input-text);
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 10%, transparent);
}

.comment-section {
  background: var(--hover-bg);
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
}

.comment {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.comment-author {
  font-weight: 600;
  color: var(--body-text);
}

.comment-date {
  color: var(--muted-text);
  font-size: 12px;
}

.comment-text {
  color: var(--body-text);
  line-height: 1.6;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--hover-bg);
  border-radius: 5px;
  text-decoration: none;
  color: var(--body-text);
  transition: background-color 0.2s, color 0.2s;
}

.attachment:hover {
  background: var(--hover-bg);
}

.attachment-icon {
  font-size: 18px;
}

.roadmap-column {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.roadmap-column h3 {
  margin: 0 0 15px 0;
  font-size: 20px;
  color: var(--body-text);
}

.notification-item {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
}

.notification-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.notification-item.unread {
  background: color-mix(in srgb, var(--primary-color) 8%, var(--card-bg));
  border-color: var(--primary-color);
}

.notification-time {
  color: var(--input-placeholder);
  font-size: 12px;
}

.markdown-content {
  line-height: 1.6;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
  margin-top: 20px;
}

.markdown-content p {
  margin-bottom: 10px;
}

/* Feedback Dark Mode */
[data-bs-theme="dark"] .feedback-type-feature,
[data-bs-theme="dark"] .feedback-status-new,
[data-bs-theme="dark"] .priority-medium,
[data-bs-theme="dark"] .feedback-status-in_progress,
[data-bs-theme="dark"] .notification-item.unread {
  background: color-mix(in srgb, var(--primary-color) 20%, transparent);
  color: var(--color-blue-400);
  border-color: color-mix(in srgb, var(--primary-color) 30%, transparent);
}

[data-bs-theme="dark"] .feedback-type-bug,
[data-bs-theme="dark"] .feedback-status-declined,
[data-bs-theme="dark"] .priority-critical {
  background: color-mix(in srgb, var(--danger-color) 20%, transparent);
  color: var(--color-red-400);
}

[data-bs-theme="dark"] .feedback-status-review,
[data-bs-theme="dark"] .priority-high {
  background: color-mix(in srgb, var(--warning-color) 20%, transparent);
  color: var(--color-amber-400);
}

[data-bs-theme="dark"] .feedback-status-planned,
[data-bs-theme="dark"] .feedback-status-completed {
  background: color-mix(in srgb, var(--success-color) 20%, transparent);
  color: var(--color-green-500);
}

[data-bs-theme="dark"] .feedback-status-testing {
  background: color-mix(in srgb, var(--color-purple-500) 20%, transparent);
  color: var(--color-purple-100);
}

[data-bs-theme="dark"] .feedback-status-on_hold,
[data-bs-theme="dark"] .priority-low {
  background: color-mix(in srgb, var(--color-slate-500) 20%, transparent);
  color: var(--color-slate-400);
}

[data-bs-theme="dark"] .vote-button {
  background: var(--card-header-bg);
  color: var(--body-text);
}

[data-bs-theme="dark"] .vote-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .vote-button.voted {
  background: var(--primary-color);
  color: white;
}

/* ========================================
   COURSE COMPARISON
   ======================================== */

.compare-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

.compare-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.compare-title h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0;
}

.compare-title .subtitle {
  font-size: 0.95rem;
  color: var(--muted-text);
  margin-top: 0.25rem;
}

.compare-actions {
  display: flex;
  gap: 0.75rem;
}

/* Comparison Table Styling */
.compare-table-wrapper {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  word-break: break-word;
}

.compare-table th, .compare-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--card-border);
  vertical-align: top;
}

.compare-table th {
  background: var(--card-header-bg);
  text-align: left;
  font-weight: var(--font-semibold);
  color: var(--color-slate-600);
  width: 200px;
}

.compare-table td {
  text-align: left;
  border-left: 1px solid var(--card-border);
}

/* Header Row specific */
.header-row th {
  background: var(--card-bg);
}

.header-row td {
  background: var(--card-header-bg);
  padding-bottom: 1.5rem;
}

.institution-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--body-text);
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2.4em;
  word-wrap: break-word;
}

.course-name {
  font-size: 0.9rem;
  color: var(--muted-text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2.8em;
  word-wrap: break-word;
  white-space: normal;
}

/* Section headers */
.section-header th {
  background: var(--bg-light);
  color: var(--primary-color);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 0.8rem;
  padding-top: 1.5rem;
}

.compare-value {
  font-size: 0.95rem;
  color: var(--text-main);
}

.compare-value.commission {
  color: var(--success-dark);
  font-weight: var(--font-semibold);
}

.muted {
  color: var(--color-slate-400);
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-color);
}

/* Print Specific Styles */
@media print {
  @page {
    size: landscape;
    margin: 10mm;
  }
  
  body {
    background: white !important;
    font-family: var(--font-family) !important;
    margin: 0 !important;
    padding: 0 !important;
    color: black !important;
  }

  /* Hide ALL non-essential UI elements */
  .app-navbar, .app-sidebar, .breadcrumb-container, .compare-actions,
  .btn, .no-print {
    display: none !important;
  }

  .compare-container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .compare-table-wrapper {
    box-shadow: none !important;
    border: 1px solid var(--color-slate-200) !important;
    page-break-inside: avoid;
  }

  .compare-table th {
    background: var(--color-slate-50) !important;
    color: black !important;
  }

  .section-header th {
    background: var(--color-slate-200) !important;
    color: black !important;
  }

  /* Ensure table fits on one page */
  .compare-table-wrapper, tr, td, th {
    page-break-inside: avoid !important;
  }
}

/* ========================================
   INVOICING / ESTIMATING FORMS
   ======================================== */

/* Lines Table Styles */
#lines-table-responsive {
  overflow-x: auto;
  overflow-y: visible;
}

#lines-table td {
  overflow: visible;
  position: relative;
}

#lines-table .search-results {
  z-index: 3000 !important;
}

/* Invoice/Estimate Detail - Details/Summary Toggle */
details.invoice-more summary,
details.estimate-more summary {
  list-style: none;
}

details.invoice-more summary::-webkit-details-marker,
details.estimate-more summary::-webkit-details-marker {
  display: none;
}

details.invoice-more .invoice-more-open,
details.estimate-more .estimate-more-open {
  display: none;
}

details.invoice-more[open] .invoice-more-open,
details.estimate-more[open] .estimate-more-open {
  display: inline;
}

details.invoice-more[open] .invoice-more-closed,
details.estimate-more[open] .estimate-more-closed {
  display: none;
}

/* Print Templates */
@media print {
  .invoice-print,
  .estimate-print,
  .receipt-print,
  .costing-print {
    --ink: var(--color-slate-900);
    --muted: var(--muted-text);
    --border: var(--border-color);
    --bg: var(--card-header-bg);
  }
}

/* Costing Form Styles */
.costing-form #form_card.form-container {
  max-width: none;
  margin: 0;
  padding: 0;
}

.costing-form #form_card .form-card {
  width: 100%;
}

.costing-form #lines-section .lines-table,
.costing-form #lines-table {
  font-size: 0.65rem;
  table-layout: fixed;
  width: 100%;
}

.costing-form #lines-section .lines-table th,
.costing-form #lines-section .lines-table td,
.costing-form #lines-table th,
.costing-form #lines-table td {
  padding: 0.1rem 0.2rem;
  vertical-align: middle;
}

.costing-form .line-group-select,
.costing-form .line-cost-type-select,
.costing-form .line-applicant-select,
.costing-form .line-applicant-type-select,
.costing-form .line-nature-select {
  width: 100%;
  min-width: 100%;
  display: block;
  padding-top: 10px;
  padding-bottom: 10px;
}

.costing-form #group-order-table {
  font-size: 0.7rem;
}

.costing-form #group-order-table th,
.costing-form #group-order-table td {
  padding: 0.25rem 0.35rem;
  vertical-align: middle;
}

.costing-form .drag-handle {
  cursor: grab;
}

.costing-form .drag-row.dragging {
  opacity: 0.5;
}

/* ========================================
   AGENCIES APP COMPONENTS
   ======================================== */

/* Avatar Large */
.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 24px;
  font-weight: bold;
}

/* Celebration/Success Modal Animation */
.celebration {
  position: relative;
}

.tick-wrap {
  display: inline-block;
  margin-bottom: 12px;
}

.tick-svg {
  width: 128px;
  height: 128px;
}

/* Form Header */
.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Detail Card */
.detail-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
}

/* Course Proposal Card */
.course-proposal-card {
  transition: transform 0.2s, box-shadow 0.2s;
  border-left: 5px solid transparent !important;
}

.course-proposal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Priority & Stage Badges */
.priority-badge,
.stage-badge {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
}

/* Pipeline Steps */
.pipeline-steps .pipeline-step {
  flex: 1;
  position: relative;
}

.pipeline-step .step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card-header-bg);
  color: var(--muted-text);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  font-weight: bold;
  border: 2px solid var(--border-color);
}

/* Quick Chips */
.quick-chip {
  font-size: 0.8rem;
  border-radius: 0.25rem;
  padding: 0.15rem 0.5rem;
}

.quick-chip.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

@media (max-width: 576px) {
  .quick-chip {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
  }
}

/* Filters Card */
.filters-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

/* Task Detail Styles */
.priority-high {
  background: var(--danger-light);
  color: var(--danger-dark);
}

.priority-medium {
  background: var(--warning-light);
  color: var(--warning-dark);
}

.priority-low {
  background: var(--info-light);
  color: var(--info-dark);
}

.task-status-badge {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
}

.task-status-open {
  background: var(--info-light);
  color: var(--info-dark);
}

.task-status-done {
  background: var(--success-light);
  color: var(--success-dark);
}

.task-status-canceled {
  background: var(--danger-light);
  color: var(--danger-dark);
}

.task-due-badge {
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
}

.task-due-overdue {
  background: var(--danger-light);
  color: var(--danger-dark);
}

.task-due-upcoming {
  background: var(--warning-light);
  color: var(--warning-dark);
}

/* Student Form Styles */
.form-container {
  max-width: 900px;
  margin: 0 auto;
}

.student-form {
  background: var(--card-bg);
  padding: 30px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
}

.form-sections {
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin-bottom: 30px;
}

.form-section {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 20px;
  background: var(--card-header-bg);
}

.form-section h3 {
  margin: 0 0 20px 0;
  color: var(--body-text);
  font-size: 1.1rem;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--card-border);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: var(--font-medium);
  margin-bottom: 5px;
  color: var(--body-text);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--input-bg);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color) 25%, transparent);
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.alert-error {
  background: var(--danger-light);
  color: var(--danger-dark);
  border: 1px solid color-mix(in srgb, var(--danger-color) 30%, transparent);
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
}

.btn-outline {
  background: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.btn-outline:hover {
  background: var(--primary-color);
  color: white;
}

@media (max-width: 768px) {
  .avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .form-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }
  
  .form-actions {
    flex-direction: column;
  }
}

/* ========================================
   ELEARNING APP COMPONENTS
   ======================================== */

/* Branding-aware color overrides */
.brand-primary-bg {
  background-color: var(--primary-color) !important;
}

.brand-primary-text {
  color: var(--primary-color) !important;
}

.brand-primary-border {
  border-color: var(--primary-color) !important;
}

.brand-primary-bg-opacity {
  background-color: color-mix(in srgb, var(--primary-color) 10%, transparent) !important;
}

/* Article completion states */
.article-completed {
  background-color: var(--success-light);
}

.article-incomplete {
  background-color: var(--card-header-bg);
}

/* Hover utilities */
.hover-bg-light:hover {
  background-color: var(--body-bg) !important;
}

/* Status badges */
.status-badge-enrolled {
  background-color: var(--color-slate-500);
  color: white;
}

.status-badge-in_progress {
  background-color: var(--primary-color);
  color: white;
}

.status-badge-completed {
  background-color: var(--success-color);
  color: white;
}

.status-badge-failed {
  background-color: var(--danger-color);
  color: white;
}

/* Brand opacity variants */
.brand-primary-text-opacity {
  color: color-mix(in srgb, var(--primary-color) 70%, black) !important;
}

.brand-secondary-bg-opacity {
  background-color: color-mix(in srgb, var(--secondary-color) 10%, transparent) !important;
}

.brand-secondary-text-opacity {
  color: color-mix(in srgb, var(--secondary-color) 70%, black) !important;
}

/* Metric cards */
.metric-card {
  transition: transform 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
}

/* Chart containers */
.chart-container {
  position: relative;
  height: 250px;
}

/* Course accordion */
#courseAccordion .accordion-item {
  border-color: var(--color-blue-200);
}

#courseAccordion .accordion-button {
  background-color: var(--color-blue-50);
  color: var(--color-slate-800);
  border: 1px solid var(--color-blue-200);
  box-shadow: none;
}

#courseAccordion .accordion-button:not(.collapsed) {
  background-color: var(--color-blue-50);
  color: var(--color-slate-800);
  box-shadow: none;
}

#courseAccordion .accordion-body .text-dark {
  color: var(--color-slate-800) !important;
}

/* Breadcrumb styling */
.breadcrumb-container .breadcrumb-item,
.breadcrumb-container .breadcrumb-current,
.breadcrumb-container .breadcrumb-separator {
  color: var(--primary-color) !important;
}

.breadcrumb-container .breadcrumb-item:hover {
  color: var(--primary-color) !important;
  background: var(--primary-light) !important;
  text-decoration: none;
}

/* Learning grid */
.learning-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;
}

.learning-grid .card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.learning-grid .card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.learning-grid .card-content {
  flex: 1;
}

.learning-grid .card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  min-height: 2.6rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.learning-grid .card-img-top {
  height: 160px;
  object-fit: cover;
}

.learning-grid .stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.learning-grid .stat-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted-text);
}

.learning-grid .progress-section {
  margin-bottom: 1rem;
}

.learning-grid .progress {
  height: 6px;
  background-color: var(--card-header-bg);
  border-radius: 3px;
}

.learning-grid .progress-bar {
  background-color: var(--primary-color);
  border-radius: 3px;
}

.learning-grid .actions-section {
  margin-top: auto;
}

.learning-grid .actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.learning-grid .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  white-space: nowrap;
  min-height: 2.5rem;
}

.learning-grid .badge {
  font-size: 0.65rem;
  padding: 0.25rem 0.5rem;
}

@media (max-width: 992px) {
  .learning-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .learning-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 768px) {
  .learning-grid .actions-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1200px) {
  .learning-grid .actions-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* ========================================
   KNOWLEDGEBASE APP COMPONENTS
   ======================================== */

/* Soft background variants */
.bg-danger-soft {
  background-color: rgba(220, 53, 69, 0.1);
}

.bg-success-soft {
  background-color: rgba(25, 135, 84, 0.1);
}

.bg-primary-soft {
  background-color: rgba(13, 110, 253, 0.1);
}

.bg-secondary-soft {
  background-color: rgba(108, 117, 125, 0.1);
}

.bg-light-soft {
  background-color: rgba(248, 249, 250, 0.5);
}

/* Subtle background variants */
.bg-danger-subtle {
  background-color: rgba(220, 53, 69, 0.05) !important;
}

.bg-warning-subtle {
  background-color: rgba(255, 193, 7, 0.05) !important;
}

.bg-info-subtle {
  background-color: rgba(13, 202, 240, 0.05) !important;
}

/* Border utilities */
.border-4 {
  border-left-width: 4px !important;
}

/* Article history offcanvas */
#articleHistory {
  top: 72px !important;
  height: calc(100% - 72px) !important;
  z-index: 1060 !important;
  border-top: 1px solid rgba(0,0,0,.1);
  box-shadow: -5px 5px 15px rgba(0,0,0,0.08);
}

.offcanvas-backdrop {
  top: 72px !important;
  height: calc(100% - 72px) !important;
  z-index: 1055 !important;
}

/* Soft text variants */
.text-danger-soft {
  color: rgba(220, 53, 69, 0.7);
}

/* Extra small button */
.btn-xs {
  padding: 0.125rem 0.25rem;
  font-size: 0.75rem;
}

/* Progress bar transition */
.progress-bar {
  transition: height 0.3s ease;
}

/* ========================================
   EVENTS APP COMPONENTS
   ======================================== */

/* Border utilities for responsive breakpoints */
@media (min-width: 992px) {
  .border-end-lg {
    border-right: 1px solid var(--bs-border-color) !important;
  }
}

/* Extra small text */
.x-small {
  font-size: 0.75rem;
}

.x-small-alt {
  font-size: 0.7rem;
}

/* Subtle background variants (events specific) */
.bg-success-subtle {
  background-color: var(--success-light);
  color: var(--success-dark);
}

.bg-danger-subtle {
  background-color: var(--color-red-100);
  color: var(--danger-dark);
}

.bg-secondary-subtle {
  background-color: var(--color-slate-100);
  color: var(--color-slate-600);
}

/* Letter spacing */
.tracking-wider {
  letter-spacing: 0.05em;
}

/* Cover image container (mobile) */
@media (max-width: 767.98px) {
  .cover-image-container {
    margin-left: -1rem;
    margin-right: -1rem;
    border-radius: 0 !important;
  }
  
  .event-title {
    font-size: 1.5rem;
  }
}

/* Avatar small */
.avatar-sm {
  flex-shrink: 0;
}

/* Lead text small */
.lead-sm {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--body-text);
}

/* Button checked state */
.btn-check:checked + .btn-outline-primary {
  background-color: var(--bs-primary);
  color: white;
  box-shadow: 0 4px 8px rgba(var(--bs-primary-rgb), 0.3);
  transform: translateY(-1px);
}

.btn-check:checked + .btn-outline-primary i {
  display: inline-block !important;
}

/* Status selector */
.status-selector label {
  cursor: pointer;
  border-width: 2px;
}

/* Transition all — scoped to visual properties, avoids painting layout */
.transition-all {
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, opacity 0.2s ease-in-out, transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

/* Description preview */
.description-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.collapse.show + .toggle-container .description-preview {
  display: none;
}

/* Toggle button */
.toggle-btn {
  cursor: pointer;
  transition: color 0.2s ease, opacity 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--bs-primary);
  font-weight: 500;
  font-size: 0.875rem;
}

.toggle-btn:hover {
  opacity: 0.8;
}

.toggle-btn .icon-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: rgba(var(--bs-primary-rgb), 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.toggle-btn[aria-expanded="true"] .icon-circle {
  transform: rotate(180deg);
}

.toggle-btn[aria-expanded="true"] .text-more {
  display: none;
}

.toggle-btn[aria-expanded="false"] .text-less {
  display: none;
}

/* ========================================
   SUCCESS MODAL ANIMATIONS
   ======================================== */

.tick-circle {
  fill: none;
  stroke: var(--success-color);
  stroke-width: 6;
  opacity: 0.15;
  transform-origin: 50% 50%;
  animation: pop 400ms ease-out forwards;
}

.tick-path {
  fill: none;
  stroke: var(--success-color);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 80;
  stroke-dashoffset: 80;
  animation: draw 500ms 200ms ease-out forwards;
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

@keyframes pop {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.1); opacity: 0.15; }
  100% { transform: scale(1); opacity: 0.15; }
}

.confetti-container {
  pointer-events: none;
  z-index: 2;
}

.confetti-container .confetti {
  position: absolute;
  left: calc(var(--x, 50) * 1%);
  top: -24px;
  width: 8px;
  height: 14px;
  background: hsl(var(--h, 180), 90%, 55%);
  border-radius: 1px;
  animation: confetti-fall 1600ms ease-out calc(var(--d, 0) * 8ms) forwards;
  transform: rotate(10deg);
}

.confetti-container .confetti:nth-child(3n) {
  width: 6px;
  height: 12px;
  border-radius: 1px;
}

.confetti-container .confetti:nth-child(3n+1) {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.confetti-container .confetti:nth-child(3n+2) {
  width: 9px;
  height: 9px;
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  50% { transform: translateY(90px) rotate(360deg); }
  100% { transform: translateY(180px) rotate(540deg); opacity: 0; }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Text Utilities */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-xs {
  font-size: var(--text-xs);
}

.text-sm {
  font-size: var(--text-sm);
}

.text-base {
  font-size: var(--text-base);
}

.text-lg {
  font-size: var(--text-lg);
}

.text-xl {
  font-size: var(--text-xl);
}

.text-2xl {
  font-size: var(--text-2xl);
}

/* Font Weight */
.font-normal {
  font-weight: var(--font-normal);
}

.font-medium {
  font-weight: var(--font-medium);
}

.font-semibold {
  font-weight: var(--font-semibold);
}

.font-bold {
  font-weight: var(--font-bold);
}

/* Flex Utilities */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-start {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.flex-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* Stack Layouts */
.stack-xs {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stack-md {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.stack-lg {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Gap Utilities */
.gap-xs {
  gap: var(--space-1);
}

.gap-sm {
  gap: var(--space-2);
}

.gap-md {
  gap: var(--space-3);
}

.gap-lg {
  gap: var(--space-4);
}

.gap-xl {
  gap: var(--space-6);
}

/* Spacing Utilities */
.m-0 {
  margin: 0;
}

.mt-1 {
  margin-top: var(--space-1);
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-3 {
  margin-top: var(--space-3);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mb-1 {
  margin-bottom: var(--space-1);
}

.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-3 {
  margin-bottom: var(--space-3);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.p-0 {
  padding: 0;
}

.p-1 {
  padding: var(--space-1);
}

.p-2 {
  padding: var(--space-2);
}

.p-3 {
  padding: var(--space-3);
}

.p-4 {
  padding: var(--space-4);
}

/* Border Radius */
.rounded-sm {
  border-radius: var(--radius-sm);
}

.rounded-md {
  border-radius: var(--radius-md);
}

.rounded-lg {
  border-radius: var(--radius-lg);
}

.rounded-xl {
  border-radius: var(--radius-xl);
}

.rounded-full {
  border-radius: var(--radius-full);
}

/* Shadow Utilities */
.shadow-sm {
  box-shadow: var(--shadow-sm);
}

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

.shadow-lg {
  box-shadow: var(--shadow-lg);
}

.shadow-none {
  box-shadow: none;
}

/* Max Width Utilities */
.max-w-xs {
  max-width: var(--container-xs);
}

.max-w-sm {
  max-width: var(--container-sm);
}

.max-w-md {
  max-width: var(--container-md);
}

.max-w-lg {
  max-width: var(--container-lg);
}

.max-w-xl {
  max-width: var(--container-xl);
}

/* ========================================
   AVATAR COMPONENT
   ======================================== */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--secondary-light);
  color: var(--secondary-color);
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--sm {
  width: 24px;
  height: 24px;
  font-size: var(--text-xs);
}

.avatar--lg {
  width: 40px;
  height: 40px;
  font-size: var(--text-base);
}

.avatar--xl {
  width: 48px;
  height: 48px;
  font-size: var(--text-lg);
}

/* ========================================
   CARD ENHANCEMENTS
   ======================================== */
.card-compact {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-compact .card-header {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--card-border);
  background: var(--card-header-bg);
}

.card-compact .card-body {
  padding: var(--space-4);
}

/* ========================================
   LOADING STATES — SKELETON SHIMMER
   Usage: <div class="skeleton skeleton--text"></div>
          <div class="skeleton skeleton--card"></div>
          <div class="skeleton skeleton--avatar"></div>
   Works in both light and dark mode via CSS tokens.
   ======================================== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--card-bg)         0%,
    var(--card-header-bg)  50%,
    var(--card-bg)         100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
  display: block;
}

/* Shape variants */
.skeleton--text {
  height: 0.875rem;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-full);
}

.skeleton--text-sm {
  height: 0.75rem;
  width: 60%;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-full);
}

.skeleton--heading {
  height: 1.25rem;
  width: 40%;
  margin-bottom: var(--space-3);
  border-radius: var(--radius-full);
}

.skeleton--avatar {
  width: var(--space-8);   /* 32px */
  height: var(--space-8);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.skeleton--avatar-lg {
  width: var(--space-10);  /* 40px */
  height: var(--space-10);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.skeleton--card {
  height: 80px;
  border-radius: var(--radius-lg);
}

.skeleton--table-row {
  height: 2.5rem;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-1);
}

.skeleton--badge {
  height: 1.25rem;
  width: 4rem;
  border-radius: var(--radius-full);
  display: inline-block;
}

/* Width helpers for text skeletons */
.skeleton--w-full  { width: 100%; }
.skeleton--w-3-4   { width: 75%; }
.skeleton--w-2-3   { width: 66%; }
.skeleton--w-half  { width: 50%; }
.skeleton--w-third { width: 33%; }
.skeleton--w-1-4   { width: 25%; }

@keyframes skeleton-loading {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Dark mode: slightly brighter shimmer so it's visible */
[data-bs-theme="dark"] .skeleton {
  background: linear-gradient(
    90deg,
    var(--card-bg)        0%,
    rgba(148,163,184,0.1) 50%,
    var(--card-bg)        100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* ========================================
   HTMX INDICATORS — GLOBAL LOADING PATTERN
   HTMX adds .htmx-request to the element triggering a request.
   Use hx-indicator="#my-indicator" on the trigger element,
   or place .htmx-indicator inside a .htmx-request parent.

   Patterns:
     A) Inline spinner next to a button:
        <button hx-get="/data" hx-indicator="#spinner">
          Load <span id="spinner" class="htmx-indicator htmx-spinner"></span>
        </button>

     B) Full-area overlay while a container reloads:
        <div hx-get="/data" hx-target="#results">
          <div id="results">
            <div class="htmx-indicator htmx-area-loader">Loading…</div>
            ...content...
          </div>
        </div>

     C) Skeleton rows while a table body loads:
        <tbody id="my-tbody" hx-get="/rows" hx-trigger="load">
          <tr class="htmx-indicator">
            <td colspan="5"><div class="skeleton skeleton--table-row"></div></td>
          </tr>
        </tbody>
   ======================================== */

/* Hidden by default — shown when parent has .htmx-request */
.htmx-indicator {
  display: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-flex;
  opacity: 1;
}

/* Block-level indicator (for area loaders) */
.htmx-request .htmx-indicator--block,
.htmx-request.htmx-indicator--block {
  display: block;
  opacity: 1;
}

/* ---- Inline spinner (small, sits next to button text) ---- */
.htmx-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: htmx-spin 0.65s linear infinite;
  vertical-align: -0.15em;
  margin-left: var(--space-2);
  flex-shrink: 0;
}

@keyframes htmx-spin {
  to { transform: rotate(360deg); }
}

/* ---- Area loader overlay (dims a content region while it reloads) ---- */
.htmx-area-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-6);
  color: var(--muted-text);
  font-size: var(--text-sm);
}

.htmx-area-loader::before {
  content: "";
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: htmx-spin 0.65s linear infinite;
  flex-shrink: 0;
}

/* ---- Button loading state (disable + show spinner while in-flight) ---- */
.htmx-request[type="submit"],
.htmx-request.btn {
  opacity: 0.7;
  pointer-events: none;
  cursor: not-allowed;
}


.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: spinner-rotate 0.6s linear infinite;
}

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

.spinner--sm {
  width: 12px;
  height: 12px;
  border-width: 1.5px;
}

.spinner--lg {
  width: 24px;
  height: 24px;
  border-width: 3px;
}

/* ========================================
   STAT / KPI CARDS
   Usage:
     <div class="stat-card">
       <div class="stat-card__icon stat-card__icon--blue">
         <i class="bi bi-people"></i>
       </div>
       <div class="stat-card__body">
         <div class="stat-card__value">1,284</div>
         <div class="stat-card__label">Total Clients</div>
         <div class="stat-card__trend stat-card__trend--up">
           <i class="bi bi-arrow-up-short"></i> 12% vs last month
         </div>
       </div>
     </div>
   ======================================== */
.stat-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-card__icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
}

/* Icon color variants — all use light bg + matching icon color */
.stat-card__icon--blue    { background: var(--color-blue-50);  color: var(--color-blue-600); }
.stat-card__icon--green   { background: var(--color-green-50); color: var(--color-green-600); }
.stat-card__icon--amber   { background: var(--color-amber-50); color: var(--color-amber-600); }
.stat-card__icon--red     { background: var(--color-red-50);   color: var(--color-red-600); }
.stat-card__icon--primary { background: var(--primary-light);  color: var(--primary-color); }
.stat-card__icon--slate   { background: var(--color-slate-100); color: var(--color-slate-600); }

.stat-card__body {
  flex: 1;
  min-width: 0;
}

.stat-card__value {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--body-text);
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
}

.stat-card__label {
  font-size: var(--text-xs);
  color: var(--muted-text);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: var(--space-1);
}

.stat-card__trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  margin-top: var(--space-2);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
}

.stat-card__trend--up {
  color: var(--color-green-600);
  background: var(--color-green-50);
}

.stat-card__trend--down {
  color: var(--color-red-600);
  background: var(--color-red-50);
}

.stat-card__trend--neutral {
  color: var(--muted-text);
  background: var(--color-slate-100);
}

/* Compact variant — no icon, for tighter dashboards */
.stat-card--compact {
  padding: var(--space-4);
  gap: var(--space-3);
}

.stat-card--compact .stat-card__icon {
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  border-radius: var(--radius-md);
}

.stat-card--compact .stat-card__value {
  font-size: var(--text-xl);
}

/* Dark mode */
[data-bs-theme="dark"] .stat-card__icon--blue  { background: color-mix(in srgb, var(--color-blue-500) 15%, transparent); color: var(--color-blue-400); }
[data-bs-theme="dark"] .stat-card__icon--green { background: color-mix(in srgb, var(--success-color) 15%, transparent); color: var(--color-green-500); }
[data-bs-theme="dark"] .stat-card__icon--amber { background: color-mix(in srgb, var(--warning-color) 15%, transparent); color: var(--color-amber-400); }
[data-bs-theme="dark"] .stat-card__icon--red   { background: color-mix(in srgb, var(--danger-color) 15%, transparent);  color: var(--color-red-400); }
[data-bs-theme="dark"] .stat-card__icon--primary { background: var(--primary-light); color: var(--primary-color); }
[data-bs-theme="dark"] .stat-card__trend--up   { background: color-mix(in srgb, var(--success-color) 15%, transparent); color: var(--color-green-500); }
[data-bs-theme="dark"] .stat-card__trend--down { background: color-mix(in srgb, var(--danger-color) 15%, transparent);  color: var(--color-red-400); }
[data-bs-theme="dark"] .stat-card__trend--neutral { background: rgba(148,163,184,0.1); }

/* ========================================
   EMPTY STATE COMPONENT
   Usage:
     <div class="empty-state">
       <div class="empty-state__icon"><i class="bi bi-inbox"></i></div>
       <h3 class="empty-state__title">No items found</h3>
       <p class="empty-state__body">Try adjusting your filters.</p>
       <a href="..." class="btn btn-primary">Add First Item</a>  <!-- optional -->
     </div>
   ======================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
  background: var(--card-bg);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-xl);
  color: var(--muted-text);
}

.empty-state__icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--card-header-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--muted-text);
  margin-bottom: var(--space-4);
}

.empty-state__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--body-text);
  margin: 0 0 var(--space-2);
}

.empty-state__body {
  font-size: var(--text-sm);
  color: var(--muted-text);
  max-width: 360px;
  line-height: var(--leading-relaxed);
  margin: 0 0 var(--space-4);
}

/* Compact variant (inside a table tbody or card) */
.empty-state--sm {
  padding: var(--space-8) var(--space-4);
}

.empty-state--sm .empty-state__icon {
  width: 48px;
  height: 48px;
  font-size: 1.25rem;
  margin-bottom: var(--space-3);
}

.empty-state--sm .empty-state__title {
  font-size: var(--text-base);
}

/* ========================================
   PREFERS-REDUCED-MOTION GUARD
   Wraps ALL animations in the project.
   Any new animation MUST be inside this block
   or have its own @media prefers-reduced-motion check.
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  /* Kill all animations */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* Skeleton: show flat color instead of shimmer */
  .skeleton,
  [data-bs-theme="dark"] .skeleton {
    animation: none !important;
    background: var(--card-header-bg) !important;
  }

  /* HTMX spinner: show static border instead of spinning */
  .htmx-spinner {
    animation: none !important;
    border-top-color: currentColor;
    opacity: 0.5;
  }

  /* Page fade-in: skip entirely */
  .page-content {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  /* Hover lifts: disable translate */
  .stat-card:hover,
  .lite-card:hover,
  .metric-card:hover,
  .course-proposal-card:hover {
    transform: none !important;
  }
}

