/*
 * Grove Design System
 * Modern CSS-first approach with design tokens and utility classes
 */

/* =============================================================================
   Design Tokens (CSS Custom Properties)
   ============================================================================= */

:root {
  /* Color Palette */
  --grove-primary: #2d5a2d;
  --grove-primary-hover: #1e3f1e;
  --grove-primary-light: #4a7a4a;
  --grove-secondary: #7ba05b;
  --grove-secondary-hover: #5d7d44;
  --grove-accent: #d4851a;
  --grove-accent-hover: #b8700d;

  /* Semantic Colors */
  --grove-success: #28a745;
  --grove-success-light: #d4edda;
  --grove-warning: #ffc107;
  --grove-warning-light: #fff3cd;
  --grove-error: #dc3545;
  --grove-error-light: #f8d7da;
  --grove-info: #17a2b8;
  --grove-info-light: #d6f5f7;

  /* Neutral Colors */
  --grove-surface: #ffffff;
  --grove-surface-alt: #f8f9fa;
  --grove-surface-elevated: #ffffff;
  --grove-text: #212529;
  --grove-text-muted: #6c757d;
  --grove-text-light: #ffffff;
  --grove-border: #dee2e6;
  --grove-border-light: #f1f3f4;

  /* Spacing Scale */
  --grove-space-xs: 0.25rem;
  --grove-space-sm: 0.5rem;
  --grove-space-md: 1rem;
  --grove-space-lg: 1.5rem;
  --grove-space-xl: 2rem;
  --grove-space-xxl: 3rem;

  /* Typography */
  --grove-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --grove-font-size-xs: 0.75rem;
  --grove-font-size-sm: 0.875rem;
  --grove-font-size-md: 1rem;
  --grove-font-size-lg: 1.125rem;
  --grove-font-size-xl: 1.25rem;
  --grove-font-size-xxl: 1.5rem;
  --grove-font-weight-normal: 400;
  --grove-font-weight-medium: 500;
  --grove-font-weight-semibold: 600;
  --grove-font-weight-bold: 700;
  --grove-line-height-tight: 1.25;
  --grove-line-height-normal: 1.5;
  --grove-line-height-loose: 1.75;

  /* Border Radius */
  --grove-radius-sm: 0.25rem;
  --grove-radius-md: 0.375rem;
  --grove-radius-lg: 0.5rem;
  --grove-radius-xl: 0.75rem;
  --grove-radius-full: 9999px;

  /* Shadows */
  --grove-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --grove-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --grove-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --grove-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Transitions */
  --grove-transition-fast: 0.1s ease-in-out;
  --grove-transition-normal: 0.2s ease-in-out;
  --grove-transition-slow: 0.3s ease-in-out;

  /* Z-Index Scale */
  --grove-z-dropdown: 1000;
  --grove-z-sticky: 1010;
  --grove-z-fixed: 1020;
  --grove-z-modal: 1030;
  --grove-z-popover: 1040;
  --grove-z-tooltip: 1050;
}

/* =============================================================================
   Base Styles & Resets
   ============================================================================= */

* {
  box-sizing: border-box;
}

body {
  font-family: var(--grove-font-family);
  color: var(--grove-text);
  line-height: var(--grove-line-height-normal);
}

/* =============================================================================
   Alert System Improvements
   ============================================================================= */

.alert {
  border: 1px solid transparent;
  border-radius: var(--grove-radius-md);
  padding: var(--grove-space-md);
  margin-bottom: var(--grove-space-md);
  position: relative;
  transition: var(--grove-transition-normal);
}

.alert-debug {
  color: var(--grove-text);
  background-color: var(--grove-surface-alt);
  border-color: var(--grove-border);
}

.alert-error {
  color: var(--grove-error);
  background-color: var(--grove-error-light);
  border-color: var(--grove-error);
}

.alert-success {
  color: var(--grove-success);
  background-color: var(--grove-success-light);
  border-color: var(--grove-success);
}

.alert-warning {
  color: var(--grove-warning);
  background-color: var(--grove-warning-light);
  border-color: var(--grove-warning);
}

.alert-info {
  color: var(--grove-info);
  background-color: var(--grove-info-light);
  border-color: var(--grove-info);
}

.alert-dismissible {
  padding-right: calc(var(--grove-space-md) * 3);
}

.alert .btn-close {
  position: absolute;
  top: 0;
  right: 0;
  padding: var(--grove-space-md);
  background: none;
  border: none;
  cursor: pointer;
  transition: var(--grove-transition-fast);
}

.alert .btn-close:hover {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: var(--grove-radius-sm);
}

/* =============================================================================
   Button System
   ============================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--grove-space-sm) var(--grove-space-md);
  font-size: var(--grove-font-size-sm);
  font-weight: var(--grove-font-weight-medium);
  line-height: var(--grove-line-height-tight);
  border: 1px solid transparent;
  border-radius: var(--grove-radius-md);
  text-decoration: none;
  cursor: pointer;
  transition: var(--grove-transition-fast);
  user-select: none;
  white-space: nowrap;
}

.btn:focus {
  outline: 2px solid var(--grove-primary);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  color: var(--grove-text-light);
  background-color: var(--grove-primary);
  border-color: var(--grove-primary);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--grove-primary-hover);
  border-color: var(--grove-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--grove-shadow-sm);
}

.btn-secondary {
  color: var(--grove-text-light);
  background-color: var(--grove-secondary);
  border-color: var(--grove-secondary);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--grove-secondary-hover);
  border-color: var(--grove-secondary-hover);
  transform: translateY(-1px);
  box-shadow: var(--grove-shadow-sm);
}

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

.btn-outline-primary:hover:not(:disabled) {
  color: var(--grove-text-light);
  background-color: var(--grove-primary);
  border-color: var(--grove-primary);
}

.btn-sm {
  padding: var(--grove-space-xs) var(--grove-space-sm);
  font-size: var(--grove-font-size-xs);
}

.btn-lg {
  padding: var(--grove-space-md) var(--grove-space-lg);
  font-size: var(--grove-font-size-lg);
}

/* CSS-only loading state */
.btn.loading {
  color: transparent;
  position: relative;
}

.btn.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid white;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

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

/* =============================================================================
   Navigation Improvements
   ============================================================================= */

.navbar {
  background-color: var(--grove-surface-elevated) !important;
  box-shadow: var(--grove-shadow-sm);
  border-bottom: 1px solid var(--grove-border-light);
}

.navbar-brand {
  font-weight: var(--grove-font-weight-bold);
  color: var(--grove-primary) !important;
  font-size: var(--grove-font-size-xl);
  text-decoration: none;
  transition: var(--grove-transition-fast);
}

.navbar-brand:hover {
  color: var(--grove-primary-hover) !important;
}

.nav-link {
  color: var(--grove-text) !important;
  font-weight: var(--grove-font-weight-medium);
  padding: var(--grove-space-sm) var(--grove-space-md) !important;
  border-radius: var(--grove-radius-md);
  transition: var(--grove-transition-fast);
  position: relative;
}

.nav-link:hover {
  color: var(--grove-primary) !important;
  background-color: var(--grove-surface-alt);
}

.nav-link:focus {
  outline: 2px solid var(--grove-primary);
  outline-offset: 2px;
}

/* Add icons using CSS (Unicode symbols) */
.nav-link::before {
  content: "";
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-right: var(--grove-space-xs);
  vertical-align: text-bottom;
}

.nav-link[href*="shipping_date_calculator"]::before {
  content: "📅";
}

.nav-link[href*="mass_edit_tool"]::before {
  content: "⚙️";
}

.nav-link[href*="ship_rate_calculator"]::before {
  content: "🚢";
}

.nav-link[href*="delivery_profiles"]::before {
  content: "📦";
}

.nav-link[href*="accuracy"]::before {
  content: "📊";
}

.nav-link[href*="detail"]::before {
  content: "👤";
}

.nav-link[href*="logout"]::before {
  content: "🚪";
}

/* =============================================================================
   Form Improvements
   ============================================================================= */

.form-control {
  border: 1px solid var(--grove-border);
  border-radius: var(--grove-radius-md);
  padding: var(--grove-space-sm) var(--grove-space-md);
  font-size: var(--grove-font-size-sm);
  transition: var(--grove-transition-fast);
}

.form-control:focus {
  border-color: var(--grove-primary);
  outline: 0;
  box-shadow: 0 0 0 2px rgba(45, 90, 45, 0.1);
}

.form-control::placeholder {
  color: var(--grove-text-muted);
}

.form-label {
  font-weight: var(--grove-font-weight-medium);
  color: var(--grove-text);
  margin-bottom: var(--grove-space-xs);
}

.form-text {
  color: var(--grove-text-muted);
  font-size: var(--grove-font-size-xs);
}

.is-invalid {
  border-color: var(--grove-error);
}

.is-invalid:focus {
  border-color: var(--grove-error);
  box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1);
}

.invalid-feedback {
  color: var(--grove-error);
  font-size: var(--grove-font-size-xs);
  margin-top: var(--grove-space-xs);
}

.is-valid {
  border-color: var(--grove-success);
}

.is-valid:focus {
  border-color: var(--grove-success);
  box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.1);
}

.valid-feedback {
  color: var(--grove-success);
  font-size: var(--grove-font-size-xs);
  margin-top: var(--grove-space-xs);
}

/* =============================================================================
   Table Improvements
   ============================================================================= */

.table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: var(--grove-space-md);
}

.table th {
  background-color: var(--grove-surface-alt);
  color: var(--grove-text);
  font-weight: var(--grove-font-weight-semibold);
  padding: var(--grove-space-md);
  border-bottom: 2px solid var(--grove-border);
  text-align: left;
}

.table td {
  padding: var(--grove-space-md);
  border-bottom: 1px solid var(--grove-border-light);
  transition: var(--grove-transition-fast);
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: var(--grove-surface-alt);
}

.table-hover tbody tr:hover {
  background-color: rgba(163, 193, 35, 0.1) !important; /* Light green-yellow tint */
  cursor: pointer;
}

/* Override Bootstrap's active/selected row styling */
.table-active,
.table tbody tr.table-active,
.table tbody tr.selected,
.table > :not(caption) > * > .table-active {
  --bs-table-active-bg: rgba(163, 193, 35, 0.15) !important;
  --bs-table-active-color: var(--grove-text) !important;
  background-color: rgba(163, 193, 35, 0.15) !important;
  color: var(--grove-text) !important;
}

/* =============================================================================
   Grove Sidebar Layout
   ============================================================================= */

/* Update color variables to match PDF design */
:root {
  --grove-sidebar-bg: #256261; /* TEST: Solid color instead of gradient to check if gradient is causing glow */
  /* --grove-sidebar-bg: linear-gradient(180deg, #256261 0%, #2e888e 100%); */
  --grove-sidebar-text: #ffffff;
  --grove-sidebar-accent: #a3c123;
  --grove-header-bg: #ffffff;
  --grove-content-bg: #f5fafb;
}

/* Main Layout Container */
.grove-layout {
  margin: 0;
  padding: 0;
  background: var(--grove-content-bg);
}

.grove-app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar Styles */
.grove-sidebar {
  width: 260px;
  background: var(--grove-sidebar-bg);
  color: var(--grove-sidebar-text);
  padding: 25px 0;
  overflow-y: auto;
  flex-shrink: 0;
  /* Removed box-shadow to eliminate white glow effect */
  box-shadow: none !important;
  /* Ensure no shadows from any other sources */
  border-right: none;
}

.grove-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 15px;
}

.grove-logo-badge {
  background: #638c1c;
  width: 50px;
  height: 50px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 20px;
  border: 3px solid white;
  color: white;
}

.grove-sidebar-logo h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  color: var(--grove-sidebar-text);
}

.grove-nav-section {
  margin-bottom: 25px;
}

.grove-nav-header {
  padding: 10px 25px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
}

.grove-nav-item {
  display: block;
  padding: 12px 25px;
  color: var(--grove-sidebar-text);
  text-decoration: none;
  transition: all 0.2s;
  font-size: 15px;
  border-left: 3px solid transparent;
}

.grove-nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-left-color: var(--grove-sidebar-accent);
  color: var(--grove-sidebar-text);
  text-decoration: none;
}

.grove-nav-item.active {
  background: rgba(163, 193, 35, 0.2);
  border-left-color: var(--grove-sidebar-accent);
  font-weight: 500;
  color: var(--grove-sidebar-text);
}

/* Main Content Wrapper */
.grove-main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Ensure no shadows affecting sidebar boundary */
  box-shadow: none;
  border-left: none;
}

/* Header Styles */
.grove-header {
  background: var(--grove-header-bg);
  border-bottom: 1px solid var(--grove-border);
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Removed box-shadow to eliminate potential white glow near sidebar */
}

.grove-breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  color: var(--grove-text-muted);
}

.grove-breadcrumb a {
  color: var(--grove-primary);
  text-decoration: none;
}

.grove-header-actions {
  display: flex;
  gap: 15px;
  align-items: center;
}

.grove-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--grove-border);
  background: var(--grove-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.grove-icon-btn:hover {
  background: var(--grove-surface-alt);
}

.grove-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--grove-primary);
  color: var(--grove-text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

/* Main Content Area */
.grove-main-content {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
  background: var(--grove-content-bg);
}

/* Button Styles matching PDF design */
.btn-grove-primary {
  background: linear-gradient(135deg, #638c1c 0%, #a3c123 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn-grove-primary:hover {
  transform: translateY(-1px);
  color: white;
  text-decoration: none;
}

.btn-grove-yellow {
  background: #f7da04;
  color: #256261;
  border: none;
  padding: 16px 32px;
  font-size: 18px;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  display: inline-block;
}

.btn-grove-yellow:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  color: #256261;
  text-decoration: none;
}

/* Card styles matching PDF design */
.grove-card {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--grove-border-light);
  margin-bottom: var(--grove-space-lg);
}

.grove-card-header {
  border-bottom: 1px solid var(--grove-border-light);
  padding-bottom: var(--grove-space-md);
  margin-bottom: var(--grove-space-lg);
}

.grove-card.grove-card-accent {
  border-left: 5px solid var(--grove-sidebar-accent);
}

.grove-card.grove-card-primary {
  border-top: 4px solid var(--grove-primary);
}

.grove-card.grove-card-secondary {
  border-top: 4px solid var(--grove-secondary);
}

/* Page titles */
.grove-page-title {
  color: var(--grove-primary);
  font-size: 32px;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  gap: 15px;
}

/* Sidebar Header and Toggle */
.grove-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 25px;
  margin-bottom: 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 25px;
}

.grove-sidebar-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--grove-sidebar-text);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 18px;
  flex-shrink: 0;
}

.grove-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.grove-toggle-icon {
  transition: transform 0.3s ease;
  font-weight: bold;
}

/* Collapsed Sidebar Styles */
.grove-sidebar {
  transition: width 0.3s ease;
}

.grove-sidebar.collapsed {
  width: 70px;
  overflow: visible;
}

.grove-sidebar.collapsed .grove-sidebar-header {
  padding: 0 15px;
  justify-content: center;
}

.grove-sidebar.collapsed .grove-sidebar-logo h2 {
  display: none;
}

.grove-sidebar.collapsed .grove-nav-header {
  display: none;
}

.grove-sidebar.collapsed .grove-nav-item {
  padding: 12px 15px;
  text-align: center;
  position: relative;
  overflow: hidden;
  text-indent: -9999px;
}

.grove-sidebar.collapsed .grove-nav-item::after {
  content: "●";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-indent: 0;
  color: var(--grove-sidebar-text);
  font-size: 12px;
}

/* Tooltip styles - will be positioned by JavaScript */
.grove-tooltip {
  position: fixed;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
  max-width: calc(100vw - 100px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Override any other pseudo-elements that might create arrows */
.grove-tooltip::after {
  display: none !important;
  content: none !important;
}

.grove-tooltip.visible {
  opacity: 1;
}

/* Disable ALL pseudo-elements first */
.grove-tooltip::before,
.grove-tooltip::after {
  display: none !important;
  content: none !important;
}

/* Only enable the specific arrow we want */
.grove-tooltip[data-arrow="left"]::before {
  display: block !important;
  content: "" !important;
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 6px 6px 0;
  border-color: transparent rgba(0, 0, 0, 0.9) transparent transparent;
}

.grove-tooltip[data-arrow="right"]::before {
  display: block !important;
  content: "" !important;
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 6px;
  border-color: transparent transparent transparent rgba(0, 0, 0, 0.9);
}

/* Keep the dots but disable CSS tooltips */
.grove-sidebar.collapsed .grove-nav-item::before {
  display: none !important;
  content: none !important;
}

/* Restore the dots for collapsed nav items */
.grove-sidebar.collapsed .grove-nav-item::after {
  content: "●";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-indent: 0;
  color: var(--grove-sidebar-text);
  font-size: 12px;
}

/* Disable any hover-based CSS tooltips */
.grove-sidebar.collapsed .grove-nav-item[data-grove-tooltip]:hover::before {
  display: none !important;
  content: none !important;
}

.grove-sidebar.collapsed .grove-toggle-icon {
  transform: rotate(180deg);
}

/* No margin adjustment needed - flexbox will handle it */
.grove-main-wrapper {
  flex: 1;
  min-width: 0;
}


/* Welcome section for homepage */
.grove-welcome {
  background: white;
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 30px;
  border-left: 5px solid var(--grove-sidebar-accent);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.grove-welcome h1 {
  color: var(--grove-primary);
  margin-bottom: 10px;
  font-size: 32px;
}

.grove-welcome p {
  color: var(--grove-text-muted);
  font-size: 16px;
  margin: 0;
}

.results-table {
  border-radius: var(--grove-radius-md);
  overflow: hidden;
  box-shadow: var(--grove-shadow-sm);
}

.error-row {
  color: var(--grove-error);
  background-color: var(--grove-error-light);
}

.warning-row {
  color: var(--grove-warning);
  background-color: var(--grove-warning-light);
}

.success-row {
  color: var(--grove-success);
  background-color: var(--grove-success-light);
}

/* =============================================================================
   Card Components
   ============================================================================= */

.card {
  background-color: var(--grove-surface-elevated);
  border: 1px solid var(--grove-border-light);
  border-radius: var(--grove-radius-lg);
  box-shadow: var(--grove-shadow-sm);
  transition: var(--grove-transition-normal);
}

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

.card-header {
  background-color: var(--grove-surface-alt);
  border-bottom: 1px solid var(--grove-border-light);
  padding: var(--grove-space-md);
  font-weight: var(--grove-font-weight-semibold);
}

.card-body {
  padding: var(--grove-space-md);
}

.card-footer {
  background-color: var(--grove-surface-alt);
  border-top: 1px solid var(--grove-border-light);
  padding: var(--grove-space-md);
}

/* =============================================================================
   Badge Components
   ============================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--grove-space-xs) var(--grove-space-sm);
  font-size: var(--grove-font-size-xs);
  font-weight: var(--grove-font-weight-medium);
  line-height: 1;
  border-radius: var(--grove-radius-full);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-primary {
  color: var(--grove-text-light);
  background-color: var(--grove-primary);
}

.badge-secondary {
  color: var(--grove-text-light);
  background-color: var(--grove-secondary);
}

.badge-success {
  color: var(--grove-text-light);
  background-color: var(--grove-success);
}

.badge-warning {
  color: var(--grove-text);
  background-color: var(--grove-warning);
}

.badge-error {
  color: var(--grove-text-light);
  background-color: var(--grove-error);
}

.badge-info {
  color: var(--grove-text-light);
  background-color: var(--grove-info);
}

/* Review Status Badges - Specialized variants for Data Accuracy app */
.review-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: var(--grove-space-xs) var(--grove-space-sm);
  font-size: var(--grove-font-size-xs);
  font-weight: var(--grove-font-weight-medium);
  line-height: 1;
  border-radius: var(--grove-radius-full);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  border: 1px solid transparent;
  transition: all var(--grove-transition-fast);
}

.review-status-badge.unreviewed {
  background-color: var(--grove-error-light);
  color: var(--grove-error);
  border-color: var(--grove-error);
}

.review-status-badge.investigating {
  background-color: var(--grove-warning-light);
  color: #856404; /* Darker yellow for better contrast */
  border-color: var(--grove-warning);
}

.review-status-badge.resolved {
  background-color: var(--grove-success-light);
  color: var(--grove-success);
  border-color: var(--grove-success);
}

.review-status-badge.known-issue {
  background-color: var(--grove-info-light);
  color: var(--grove-info);
  border-color: var(--grove-info);
}

.review-status-badge.false-positive {
  background-color: var(--grove-surface-alt);
  color: var(--grove-text-muted);
  border-color: var(--grove-border);
}

/* Hover states for interactive badges (when used as buttons/links) */
.review-status-badge.interactive:hover {
  transform: translateY(-1px);
  box-shadow: var(--grove-shadow-sm);
  cursor: pointer;
}

/* =============================================================================
   Data Accuracy App Components
   ============================================================================= */

/* Hero Section - Run Comparison */
.accuracy-hero {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border: 2px solid var(--grove-primary-light);
  border-radius: var(--grove-radius-lg);
  padding: var(--grove-space-xl);
  margin-bottom: var(--grove-space-lg);
  box-shadow: var(--grove-shadow-md);
}

.accuracy-hero h2 {
  color: var(--grove-primary);
  font-size: var(--grove-font-size-xl);
  font-weight: var(--grove-font-weight-bold);
  margin-bottom: var(--grove-space-md);
  display: flex;
  align-items: center;
  gap: var(--grove-space-sm);
}

.accuracy-hero .form-group {
  margin-bottom: var(--grove-space-md);
}

.accuracy-hero .form-label {
  font-weight: var(--grove-font-weight-medium);
  color: var(--grove-text);
  margin-bottom: var(--grove-space-xs);
  display: block;
}

.accuracy-hero .btn-primary {
  width: 100%;
  padding: var(--grove-space-md) var(--grove-space-xl);
  font-size: var(--grove-font-size-lg);
  font-weight: var(--grove-font-weight-semibold);
  background: linear-gradient(135deg, #638c1c 0%, #a3c123 100%);
  border: none;
  border-radius: var(--grove-radius-md);
  transition: all var(--grove-transition-normal);
}

.accuracy-hero .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--grove-shadow-lg);
}

/* Active Issues Widget */
.active-issues-widget {
  background: var(--grove-surface);
  border-left: 5px solid var(--grove-sidebar-accent);
  border-radius: var(--grove-radius-lg);
  padding: var(--grove-space-lg);
  margin-bottom: var(--grove-space-lg);
  box-shadow: var(--grove-shadow-sm);
}

.active-issues-widget h3 {
  color: var(--grove-text);
  font-size: var(--grove-font-size-lg);
  font-weight: var(--grove-font-weight-semibold);
  margin-bottom: var(--grove-space-md);
  display: flex;
  align-items: center;
  gap: var(--grove-space-sm);
}

.issue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--grove-space-md);
  margin-bottom: var(--grove-space-sm);
  border-radius: var(--grove-radius-md);
  transition: all var(--grove-transition-fast);
  text-decoration: none;
  color: inherit;
}

.issue-item:hover {
  transform: translateX(4px);
  box-shadow: var(--grove-shadow-sm);
}

.issue-item.critical {
  background-color: var(--grove-error-light);
  border-left: 3px solid var(--grove-error);
}

.issue-item.warning {
  background-color: var(--grove-warning-light);
  border-left: 3px solid var(--grove-warning);
}

.issue-item.info {
  background-color: var(--grove-info-light);
  border-left: 3px solid var(--grove-info);
}

.issue-item-icon {
  font-size: var(--grove-font-size-xl);
  margin-right: var(--grove-space-sm);
}

.issue-item-text {
  flex: 1;
  font-weight: var(--grove-font-weight-medium);
}

.issue-item-count {
  font-size: var(--grove-font-size-lg);
  font-weight: var(--grove-font-weight-bold);
  margin-right: var(--grove-space-sm);
}

.issue-item-arrow {
  color: var(--grove-text-muted);
  font-size: var(--grove-font-size-lg);
}

/* Investigation Panel - Expandable result details */
.investigation-panel {
  background: var(--grove-surface-alt);
  border: 1px solid var(--grove-border);
  border-radius: var(--grove-radius-md);
  padding: var(--grove-space-lg);
  margin-top: var(--grove-space-sm);
  margin-bottom: var(--grove-space-sm);
}

.investigation-panel h4 {
  color: var(--grove-primary);
  font-size: var(--grove-font-size-md);
  font-weight: var(--grove-font-weight-semibold);
  margin-bottom: var(--grove-space-md);
  padding-bottom: var(--grove-space-sm);
  border-bottom: 2px solid var(--grove-border-light);
}

.value-comparison {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--grove-space-md);
  margin-bottom: var(--grove-space-lg);
}

.value-box {
  background: var(--grove-surface);
  border-radius: var(--grove-radius-md);
  padding: var(--grove-space-md);
  text-align: center;
  border: 2px solid transparent;
  transition: all var(--grove-transition-fast);
}

.value-box.matches {
  border-color: var(--grove-success);
  background-color: var(--grove-success-light);
}

.value-box.differs {
  border-color: var(--grove-error);
  background-color: var(--grove-error-light);
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: var(--grove-error); }
  50% { border-color: var(--grove-error-light); }
}

.value-box-label {
  font-size: var(--grove-font-size-xs);
  font-weight: var(--grove-font-weight-bold);
  text-transform: uppercase;
  color: var(--grove-text-muted);
  margin-bottom: var(--grove-space-xs);
}

.value-box-value {
  font-size: var(--grove-font-size-lg);
  font-weight: var(--grove-font-weight-medium);
  color: var(--grove-text);
  word-break: break-word;
}

/* Review controls within investigation panel */
.review-controls {
  background: var(--grove-surface);
  border-radius: var(--grove-radius-md);
  padding: var(--grove-space-md);
  margin-bottom: var(--grove-space-md);
}

.review-controls .form-group {
  margin-bottom: var(--grove-space-md);
}

.review-controls .form-label {
  font-weight: var(--grove-font-weight-medium);
  margin-bottom: var(--grove-space-xs);
}

/* Note history display */
.note-history {
  margin-top: var(--grove-space-md);
}

.note-item {
  background: var(--grove-surface);
  border-left: 3px solid var(--grove-primary);
  border-radius: var(--grove-radius-sm);
  padding: var(--grove-space-sm) var(--grove-space-md);
  margin-bottom: var(--grove-space-sm);
}

.note-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--grove-space-xs);
  font-size: var(--grove-font-size-xs);
  color: var(--grove-text-muted);
}

.note-item-author {
  font-weight: var(--grove-font-weight-semibold);
  color: var(--grove-text);
}

.note-item-content {
  font-size: var(--grove-font-size-sm);
  color: var(--grove-text);
  line-height: var(--grove-line-height-normal);
}

/* Expandable row toggle */
.expand-toggle {
  cursor: pointer;
  transition: transform var(--grove-transition-fast);
  user-select: none;
}

.expand-toggle.expanded {
  transform: rotate(180deg);
}

/* Quick action buttons in tables */
.quick-actions {
  display: flex;
  gap: var(--grove-space-xs);
  align-items: center;
}

.quick-actions .btn-sm {
  padding: var(--grove-space-xs) var(--grove-space-sm);
  font-size: var(--grove-font-size-xs);
  border-radius: var(--grove-radius-sm);
}

/* =============================================================================
   Utility Classes
   ============================================================================= */

/* Spacing utilities */
.mt-xs {
  margin-top: var(--grove-space-xs);
}
.mt-sm {
  margin-top: var(--grove-space-sm);
}
.mt-md {
  margin-top: var(--grove-space-md);
}
.mt-lg {
  margin-top: var(--grove-space-lg);
}
.mt-xl {
  margin-top: var(--grove-space-xl);
}

.mb-xs {
  margin-bottom: var(--grove-space-xs);
}
.mb-sm {
  margin-bottom: var(--grove-space-sm);
}
.mb-md {
  margin-bottom: var(--grove-space-md);
}
.mb-lg {
  margin-bottom: var(--grove-space-lg);
}
.mb-xl {
  margin-bottom: var(--grove-space-xl);
}

.p-xs {
  padding: var(--grove-space-xs);
}
.p-sm {
  padding: var(--grove-space-sm);
}
.p-md {
  padding: var(--grove-space-md);
}
.p-lg {
  padding: var(--grove-space-lg);
}
.p-xl {
  padding: var(--grove-space-xl);
}

/* Text utilities */
.text-primary {
  color: var(--grove-primary);
}
.text-secondary {
  color: var(--grove-secondary);
}
.text-success {
  color: var(--grove-success);
}
.text-warning {
  color: var(--grove-warning);
}
.text-error {
  color: var(--grove-error);
}
.text-muted {
  color: var(--grove-text-muted);
}

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

/* Border utilities */
.border-radius-sm {
  border-radius: var(--grove-radius-sm);
}
.border-radius-md {
  border-radius: var(--grove-radius-md);
}
.border-radius-lg {
  border-radius: var(--grove-radius-lg);
}

/* Shadow utilities */
.shadow-sm {
  box-shadow: var(--grove-shadow-sm);
}
.shadow-md {
  box-shadow: var(--grove-shadow-md);
}
.shadow-lg {
  box-shadow: var(--grove-shadow-lg);
}

/* =============================================================================
   Responsive Design
   ============================================================================= */

@media (max-width: 768px) {
  .navbar-nav {
    padding-top: var(--grove-space-sm);
  }

  .nav-link {
    padding: var(--grove-space-md) var(--grove-space-sm) !important;
  }

  .card {
    margin-bottom: var(--grove-space-md);
  }

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

  .table th,
  .table td {
    padding: var(--grove-space-sm);
  }
}

/* =============================================================================
   Accessibility Improvements
   ============================================================================= */

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

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --grove-border: #000000;
    --grove-text: #000000;
    --grove-text-muted: #333333;
  }
}

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

/* 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;
}

/* =============================================================================
   Print Styles
   ============================================================================= */

@media print {
  .navbar,
  .btn,
  .alert .btn-close {
    display: none !important;
  }

  .card {
    box-shadow: none;
    border: 1px solid var(--grove-border);
  }

  .table {
    border-collapse: collapse;
  }

  .table th,
  .table td {
    border: 1px solid var(--grove-border);
  }
}
