/* CapaIQ AI CAPA System Styles */
:root {
  --primary-color: #033c59;
  --secondary-color: #f5a302;
  --success-color: #198754;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --light-bg: #f8f9fa;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--light-bg);
}

.navbar {
  background-color: var(--primary-color) !important;
}

.navbar-brand {
  font-size: 1.5rem;
  color: white !important;
}

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

.btn-primary:hover {
  background-color: #024a6b;
  border-color: #024a6b;
}

.btn-warning {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  color: white;
}

.btn-warning:hover {
  background-color: #d48806;
  border-color: #d48806;
  color: white;
}

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

.bg-primary {
  background-color: var(--primary-color) !important;
}

.border-warning {
  border-color: var(--secondary-color) !important;
}

.bg-warning {
  background-color: var(--secondary-color) !important;
}

#right-panel {
  min-height: calc(100vh - 56px);
  position: sticky;
  top: 0;
}

.panel-section {
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 1rem;
}

.panel-section:last-child {
  border-bottom: none;
}

.confidence-score {
  font-size: 0.85rem;
  color: #6c757d;
}

.ai-badge {
  background-color: #e3f2fd;
  color: var(--primary-color);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
}

/* Progress Steps Timeline */
.progress-steps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0;
  padding: 0 20px;
}

.step {
  flex: 1;
  text-align: center;
  position: relative;
}

.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 15px;
  right: -50%;
  width: 100%;
  height: 2px;
  background-color: #dee2e6;
  z-index: 1;
}

.step.active:not(:last-child)::after {
  background-color: var(--primary-color);
}

.step-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: #dee2e6;
  color: #6c757d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 12px;
  position: relative;
  z-index: 2;
}

.step.active .step-circle {
  background-color: var(--primary-color);
  color: white;
}

.step.completed .step-circle {
  background-color: var(--secondary-color);
  color: white;
}

.step-label {
  font-size: 11px;
  margin-top: 5px;
  color: #6c757d;
}

.step.active .step-label {
  color: var(--primary-color);
  font-weight: bold;
}

/* Remove border radius for sharp edges */
.card,
.btn,
.form-control,
.form-select {
  border-radius: 0 !important;
}

/* Professional button styling - Fixed layout */
.btn-view-list {
  background-color: var(--primary-color);
  border: 1px solid var(--primary-color);
  color: white;
  border-radius: 0;
  font-weight: 500;
  padding: 10px 20px;
  margin-left: 8px;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-view-list:hover {
  background-color: #024a6b;
  border-color: #024a6b;
  color: white;
  transform: translateY(-1px);
}

/* Button container */
.buttons-container {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

/* Global Navigation Menu */
/* Remove extra margin on nav */
.global-navigation {
  margin-right: 0;
  /* Prevent extra space */
  padding-right: 0;
  gap: 10px;
  /* Space between nav items */
}

.nav-item {
  color: var(--primary-color);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.2s ease;
  background-color: rgba(3, 60, 89, 0.05);
  border: 1px solid rgba(3, 60, 89, 0.1);
}

.nav-item:hover {
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  border-color: var(--primary-color);
}

.nav-item.active {
  background-color: var(--secondary-color);
  color: white;
  border-color: var(--secondary-color);
}

/* Clean header layout */
.dashboard-header {
  background-color: #033C59;
  padding: 10px 65px 3px 15px;
}

.dashboard-title {
  font-size: 2rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 5px;
  line-height: 1.2;
}

.dashboard-subtitle {
  color: #6c757d;
  font-size: 0.95rem;
  margin-bottom: 0;
}

/* Section headers */
.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--secondary-color);
  display: inline-block;
}

/* Fixed Right Sidebar */
.fixed-right-panel {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  width: 25% !important;
  height: 100vh !important;
  background-color: #f8f9fa !important;
  border-left: 1px solid #dee2e6 !important;
  z-index: 1000 !important;
  transition: transform 0.3s ease;
  display: flex !important;
  flex-direction: column !important;
  overflow-y: auto;
}

.fixed-right-panel.hidden {
  transform: translateX(100%) !important;
}

/* Panel Toggle Button - Fixed outside panel */
.panel-toggle {
  position: fixed !important;
  top: 15px !important;
  right: 15px !important;
  background: var(--primary-color) !important;
  color: white !important;
  border: none !important;
  width: 35px !important;
  height: 35px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18px !important;
  z-index: 1002 !important;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* When panel is hidden, move toggle button to the edge */
.main-content-area.expanded .panel-toggle {
  right: 15px !important;
}

.panel-toggle:hover {
  background: #024a6b;
}

/* Panel Content Area */
.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 50px 20px 20px 20px;
}

/* Chat Interface - Increased Height */
.chat-interface {
  border-top: 1px solid #dee2e6;
  background: white;
  padding: 15px;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  height: 250px;
}

.chat-messages {
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 10px;
  flex: 1;
}

.chat-message {
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.chat-message.user {
  background: var(--primary-color);
  color: white;
  margin-left: 20px;
  text-align: right;
}

.chat-message.ai {
  background: #e9ecef;
  color: #333;
  margin-right: 20px;
}

.chat-input-container {
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  border: 1px solid #ced4da;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 0;
}

.chat-send {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 8px 15px;
  cursor: pointer;
  border-radius: 0;
}

.chat-send:hover {
  background: #024a6b;
}

/* Main content adjustment */
.main-content-area {
  transition: margin-right 0.3s ease;
  margin-right: 25% !important;
  width: 75% !important;
  max-width: 75% !important;
}

.main-content-area.expanded {
  margin-right: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .fixed-right-panel {
    width: 80%;
  }

  .main-content-area {
    margin-right: 0;
  }

  .fixed-right-panel.hidden {
    transform: translateX(100%);
  }
}

/* Filters Section */
.filters-section {
  background: white;
  padding: 20px;
  margin-bottom: 20px;
  border: 2px solid var(--primary-color);
  border-radius: 0;
}

.filters-section label {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 5px;
  display: block;
}

.filters-section .form-control {
  border: 1px solid #ccc;
  border-radius: 0;
  padding: 8px 12px;
}

/* Summary Cards */
.summary-card {
  background: white;
  padding: 20px;
  text-align: center;
  border: 2px solid var(--primary-color);
  border-radius: 0;
  margin-bottom: 20px;
}

.summary-card h4 {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--primary-color);
  margin: 0;
}

.summary-card.critical h4 {
  color: #dc3545;
}

.summary-card.major h4 {
  color: #fd7e14;
}

.summary-card.minor h4 {
  color: #28a745;
}

.summary-card p {
  margin: 10px 0 0 0;
  font-weight: 600;
  color: #666;
}

/* Table Styling */
.table-container {
  background: white;
  border: 2px solid var(--primary-color);
  border-radius: 0;
  overflow-x: auto;
}

.table {
  margin: 0;
  border-radius: 0;
}

.table th {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 15px 10px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.table th:hover {
  background: #024a6b;
}

.table tr:hover {
  background: #024a6b;
}

.table td {
  padding: 12px 10px;
  vertical-align: middle;
}

/* Status and Severity Badges */
.severity-badge,
.status-badge {
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}

.severity-badge.critical {
  background: #f8d7da;
  color: #721c24;
}

.severity-badge.major {
  background: #ffeaa7;
  color: #856404;
}

.severity-badge.minor {
  background: #d4edda;
  color: #155724;
}

.status-badge.open {
  background: #cce5ff;
  color: #004085;
}

.status-badge.under-investigation {
  background: #fff3cd;
  color: #856404;
}

.status-badge.closed {
  background: #d4edda;
  color: #155724;
}

/* ID Links */
.id-link {
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
}

.id-link:hover {
  text-decoration: underline;
  color: #024a6b;
}

/* Priority Badges */
.priority-badge {
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}

.priority-badge.high {
  background: #f8d7da;
  color: #721c24;
}

.priority-badge.medium {
  background: #ffeaa7;
  color: #856404;
}

.priority-badge.low {
  background: #d4edda;
  color: #155724;
}

/* RCA Badges */
.rca-badge {
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}

.rca-badge.yes {
  background: #f8d7da;
  color: #721c24;
}

.rca-badge.no {
  background: #d4edda;
  color: #155724;
}

/* Overdue Badge */
.overdue-badge {
  background: #dc3545;
  color: white;
  padding: 2px 6px;
  font-size: 0.7rem;
  border-radius: 2px;
  margin-left: 5px;
  font-weight: bold;
}

/* Table row highlighting */
.table-danger {
  background-color: rgba(248, 215, 218, 0.3) !important;
}

/* Status badges for CAPA-specific statuses */
.status-badge.pending-confirmation {
  background: #fff3cd;
  color: #856404;
}

.status-badge.in-progress {
  background: #cce5ff;
  color: #004085;
}

/* CAPA Intake Form Styles */
.toast-container {
  z-index: 9999;
}

#capaIntakeForm .form-control.is-invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

#capaIntakeForm .card-header {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#capaIntakeForm .card-header:hover {
  background-color: rgba(0, 123, 255, 0.1);
}

#capaIntakeForm .position-relative .btn {
  z-index: 10;
}

.progress {
  transition: width 0.3s ease;
}

.spinner-border {
  animation: spinner-border 1s linear infinite;
}

/* Loading animation */
@keyframes spinner-border {
  to {
    transform: rotate(360deg);
  }
}

/* Master Layout Styles */
.fixed-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 350px;
  /* Leave space for sidebar */
  z-index: 1030;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: right 0.3s ease;
  /* Smooth transition */
}

.fixed-header.expanded {
  right: 0;
  /* Full width when sidebar hidden */
}


.main-layout {
  display: flex;
  margin-top: 100px;
  /* Space for fixed header */
  min-height: calc(100vh - 100px);
}

.content-area {
  flex: 1;
  padding: 20px;
  margin-right: 350px;
  /* Space for sidebar */
  transition: margin-right 0.3s ease;
  background: #f8f9fa;
}

.content-area.expanded {
  margin-right: 0;
  /* Full width when sidebar hidden */
}

/* Fixed right sidebar */
.ai-assistant-sidebar {
  position: fixed;
  top: 0;
  /* Change from top: 100px to top: 0 */
  right: 0;
  width: 350px;
  height: 100vh;
  /* Change from calc(100vh - 100px) to 100vh */
  background-color: #f8f9fa;
  border-left: 2px solid #dee2e6;
  overflow-y: auto;
  z-index: 1020;
  padding: 20px;
  /* Add top padding to account for header */
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

/* Make sidebar content a flex column so chat can sit at the bottom */
.sidebar-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ai-assistant-sidebar.hidden {
  transform: translateX(100%);
}

.sidebar-toggle-btn {
  position: absolute;
  /* Not fixed anymore */
  top: 50%;
  right: 10px;
  /* ✅ Close to right edge of screen */
  transform: translateY(-50%);
  background: transparent;
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.3s ease;
  z-index: 1100;
}



/* Optional hover effect */
.sidebar-toggle-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
}


.sidebar-toggle-btn.visible {
  display: flex;
  /* Show as flex when visible */
  align-items: center;
  justify-content: center;
}

.ai-assistant-sidebar .sidebar-close:hover {
  background: var(--secondary-color);
  transform: scale(1.1);
}

/* Sidebar sections */
.sidebar-section {
  display: flex;
  flex-direction: column;
  height: 100%;
  /* or a fixed height matching your sidebar */
  padding-bottom: 15px;
  margin-bottom: 25px;
  border-bottom: 1px solid #dee2e6;
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-section h5 {
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 1rem;
}

/* Close button */
.sidebar-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: var(--primary-color);
  color: white;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
}

.sidebar-close:hover {
  background: #024a6b;
}

/* Suggestion items */
.suggestion-item {
  padding: 8px 12px;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.suggestion-item:hover {
  background: #e3f2fd;
  border-color: var(--primary-color);
}

/* Help links */
.help-link {
  color: var(--primary-color);
  text-decoration: none;
  display: block;
  padding: 5px 0;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}

.help-link:hover {
  text-decoration: underline;
  color: #024a6b;
}

/* Chat container */
.chat-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 10px;
  box-sizing: border-box;
}


.chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  margin-bottom: 10px;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 4px;
}

.ai-message {
  background: #e3f2fd;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.user-message {
  background: #fff3e0;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.85rem;
  text-align: right;
}

.chat-input-container {
  display: flex;
  gap: 5px;
  margin-top: auto;
  /* push input to bottom */
}

.chat-input-container input {
  flex: 1;
  font-size: 0.85rem;
  padding: 6px 10px;
}

.chat-input-container button {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* Content area styling */
#content-placeholder {
  background: white;
  border: 2px solid var(--primary-color);
  border-radius: 0;
  min-height: 500px;
  padding: 20px;
}

/* Responsive design */
@media (max-width: 768px) {
  .content-area {
    margin-right: 0;
  }

  .ai-assistant-sidebar {
    position: fixed;
    top: 100px;
    /* Start below the fixed header instead of top: 0 */
    right: 0;
    width: 350px;
    height: calc(100vh - 100px);
    /* Adjust height to account for header */
    background-color: #f8f9fa;
    border-left: 2px solid #dee2e6;
    overflow-y: auto;
    z-index: 1020;
    padding: 20px;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
  }

  .ai-assistant-sidebar.visible {
    transform: translateX(0);
  }
}

.fixed-header {
  background: var(--primary-color) !important;
  /* Blue background */
  color: white;
  border-bottom: none;
}

.dashboard-title {
  color: white !important;
  font-weight: bold;
}

.header-logo {
  height: 50px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

.dashboard-subtitle {
  color: rgba(255, 255, 255, 0.8) !important;
}

.global-navigation .nav-item {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 8px;
  font-weight: 500;
}

.global-navigation .nav-item:hover {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
}

/* Expandable Detail Row */
.detail-row {
  background: #f8f9fa;
  border-top: 3px solid var(--primary-color);
  animation: expandDetail 0.3s ease-out;
}

.detail-row td {
  padding: 0 !important;
}

.detail-content {
  padding: 25px;
  background: white;
  margin: 10px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--secondary-color);
}

.detail-close-btn {
  background: var(--danger-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
}

.detail-close-btn:hover {
  background: #c82333;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.detail-field {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 4px;
  border-left: 4px solid var(--primary-color);
}

.detail-field label {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 0.9rem;
  display: block;
  margin-bottom: 5px;
}

.detail-field .value {
  font-size: 1rem;
  color: #333;
}

.detail-description {
  grid-column: 1 / -1;
  background: white;
  border: 1px solid #dee2e6;
  padding: 15px;
  border-radius: 4px;
}

@keyframes expandDetail {
  from {
    opacity: 0;
    transform: scaleY(0);
    transform-origin: top;
  }

  to {
    opacity: 1;
    transform: scaleY(1);
    transform-origin: top;
  }
}

/* Ensure table rows don't have conflicting animations */
.table tbody tr {
  transition: none;
}

/* PDF Viewer Styles */
.pdf-viewer-container {
  border-radius: 8px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
  font-family: 'Times New Roman', serif;
}

.pdf-content {
  line-height: 1.6;
  color: #333;
}

.pdf-header {
  text-align: center;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.pdf-header h3 {
  color: var(--primary-color);
  font-weight: bold;
  margin-bottom: 10px;
}

.pdf-section {
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.pdf-section:last-child {
  border-bottom: none;
}

.pdf-section h5 {
  color: var(--primary-color);
  font-weight: bold;
  margin-bottom: 15px;
  text-transform: uppercase;
  font-size: 1rem;
}

.pdf-field {
  display: flex;
  margin-bottom: 8px;
}

.pdf-label {
  font-weight: bold;
  min-width: 150px;
  color: #555;
}

.pdf-value {
  flex: 1;
  color: #333;
}

.pdf-signature-section {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 2px solid var(--primary-color);
}

.signature-line {
  border-bottom: 1px solid #333;
  width: 200px;
  height: 40px;
  display: inline-block;
  margin-right: 50px;
}

/* PDF Generation Fixes */
#pdf-content {
  background: white !important;
  color: black !important;
  font-family: Arial, sans-serif !important;
}

#pdf-content * {
  color: black !important;
  background: transparent !important;
}

#pdf-content .pdf-field {
  display: block !important;
  margin-bottom: 8px !important;
}

#pdf-content .pdf-label {
  font-weight: bold !important;
  display: inline-block !important;
  width: 150px !important;
}

#pdf-content .pdf-value {
  display: inline !important;
}

.sort-icon {
  opacity: 0.5;
  transition: all 0.2s ease;
}

.sort-icon:hover {
  opacity: 1;
}

.sort-icon.text-primary {
  opacity: 1;
}

/* Table header hover effects */
thead th {
  transition: background-color 0.2s ease;
}

thead th:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Filter section styling */
.card-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-bottom: 1px solid #dee2e6;
}

.form-check {
  margin-top: 8px;
}

/* Status badges */
.status-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.status-badge.open {
  background-color: #cfe2ff;
  color: #0d6efd;
}

.status-badge.pending-confirmation {
  background-color: #fff3cd;
  color: #664d03;
}

.status-badge.approved-for-intake {
  background-color: #d1ecf1;
  color: #0c5460;
}

.status-badge.in-progress {
  background-color: #d4edda;
  color: #155724;
}

.status-badge.closed {
  background-color: #e2e3e5;
  color: #383d41;
}

.priority-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.priority-badge.critical {
  background-color: #f8d7da;
  color: #721c24;
}

.priority-badge.high {
  background-color: #fff3cd;
  color: #664d03;
}

.priority-badge.medium {
  background-color: #cfe2ff;
  color: #0d6efd;
}

.priority-badge.low {
  background-color: #d4edda;
  color: #155724;
}

.severity-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.severity-badge.critical {
  background-color: #f8d7da;
  color: #721c24;
}

.severity-badge.major {
  background-color: #fff3cd;
  color: #664d03;
}

.severity-badge.minor {
  background-color: #cfe2ff;
  color: #0d6efd;
}

.severity-badge.low {
  background-color: #d4edda;
  color: #155724;
}

.rca-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.rca-badge.yes {
  background-color: #fff3cd;
  color: #664d03;
}

.rca-badge.no {
  background-color: #d4edda;
  color: #155724;
}

.overdue-badge {
  background-color: #f8d7da;
  color: #721c24;
  padding: 0.15rem 0.3rem;
  border-radius: 0.2rem;
  font-size: 0.65rem;
  font-weight: bold;
  margin-left: 0.5rem;
}

/* Enhanced table styling */
.table-danger {
  background-color: rgba(248, 215, 218, 0.3);
}

.id-link {
  color: #0d6efd;
  text-decoration: none;
  font-weight: 500;
}

.id-link:hover {
  color: #0a58ca;
  text-decoration: underline;
}

/* Detail row styling */
.detail-row {
  background-color: #f8f9fa;
  border-left: 4px solid #0d6efd;
}

.detail-content {
  padding: 1rem;
}

.detail-header {
  display: flex;
  justify-content: between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #dee2e6;
}

.detail-close-btn {
  background: none;
  border: none;
  color: #6c757d;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
}

.detail-close-btn:hover {
  background-color: #e9ecef;
  color: #495057;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.detail-field label {
  font-weight: 600;
  color: #495057;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  display: block;
}

.detail-field .value {
  color: #212529;
  font-size: 0.875rem;
}

.detail-field.detail-description {
  grid-column: 1 / -1;
}

.detail-description .value {
  background-color: #ffffff;
  padding: 0.75rem;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  white-space: pre-wrap;
  line-height: 1.5;
}

/* Toast container positioning */
.toast-container {
  z-index: 1050;
  position: fixed;
  top: 80px;
  right: 20px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .btn-group {
    flex-direction: column;
  }

  .form-check {
    margin-top: 0.5rem;
  }
}

/* Loading states */
.table tbody tr.loading {
  opacity: 0.6;
  background-color: #f8f9fa;
}

/* Export button styling */
.btn-outline-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Filter collapse animation */
.collapse {
  transition: all 0.3s ease;
}

/* Advanced search styling */
.input-group .btn {
  border-color: #0d6efd;
}

.input-group .btn:hover {
  background-color: #0d6efd;
  border-color: #0d6efd;
}

#ai-transparency-container {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

.ai-transparency-ticker {
  height: 80px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  position: relative;
  margin-bottom: 0.75rem;
}

#ai-ticker-content {
  animation: ticker-scroll 15s linear infinite;
  padding: 0.5rem;
  white-space: nowrap;
}

.ticker-item {
  display: block;
  font-size: 0.8rem;
  color: #495057;
  margin-bottom: 0.5rem;
  line-height: 1.4;
  white-space: normal;
  padding: 0.25rem 0;
}

.ticker-item.active {
  color: #0d6efd;
  font-weight: 500;
}

.ticker-item.completed {
  color: #198754;
}

.ticker-item.processing {
  color: #fd7e14;
}

@keyframes ticker-scroll {
  0% {
    transform: translateY(100%);
  }

  100% {
    transform: translateY(-100%);
  }
}

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

.ai-process-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #6c757d;
  animation: pulse 2s infinite;
}

.status-dot.active {
  background-color: #0d6efd;
}

.status-dot.processing {
  background-color: #fd7e14;
  animation: pulse 0.8s infinite;
}

.status-dot.completed {
  background-color: #198754;
  animation: none;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }

  100% {
    opacity: 1;
  }
}

/* Responsive adjustments for existing sidebar */
@media (max-width: 768px) {
  .ai-transparency-ticker {
    height: 60px;
  }

  #ai-ticker-content {
    animation-duration: 20s;
  }
}

.ai-transparency-container {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

.ai-transparency-ticker {
  height: 80px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  position: relative;
  margin-bottom: 0.75rem;
}

#ai-ticker-content {
  animation: ticker-scroll 15s linear infinite;
  padding: 0.5rem;
  white-space: nowrap;
}

.ticker-item {
  display: block;
  font-size: 0.8rem;
  color: #495057;
  margin-bottom: 0.5rem;
  line-height: 1.4;
  white-space: normal;
  padding: 0.25rem 0;
}

.ticker-item.active {
  color: #0d6efd;
  font-weight: 500;
}

.ticker-item.completed {
  color: #198754;
}

.ticker-item.processing {
  color: #fd7e14;
}

@keyframes ticker-scroll {
  0% {
    transform: translateY(100%);
  }

  100% {
    transform: translateY(-100%);
  }
}

/* AI Process Status */
.ai-process-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-process-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #6c757d;
  animation: pulse 2s infinite;
}

.status-dot.active {
  background-color: #0d6efd;
}

.status-dot.processing {
  background-color: #fd7e14;
  animation: pulse 0.8s infinite;
}

.status-dot.completed {
  background-color: #198754;
  animation: none;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }

  100% {
    opacity: 1;
  }
}

/* Enhanced Chat Styles */
.chat-container {
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  /* allow messages to shrink within flex parent */
}

.chat-messages {
  flex: 1;
  max-height: 200px;
  overflow-y: auto;
  padding: 0.75rem;
  background: #f8f9fa;
}

.chat-message {
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  line-height: 1.4;
}

.chat-message.ai {
  background-color: #e7f3ff;
  color: #0d6efd;
  border-left: 3px solid #0d6efd;
}

.chat-message.user {
  background-color: #e9ecef;
  color: #495057;
  text-align: right;
  border-right: 3px solid #6c757d;
}

.chat-input-container {
  display: flex;
  padding: 0.5rem;
  background: #ffffff;
  border-top: 1px solid #e9ecef;
  border-radius: 0 0 0.375rem 0.375rem;
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.chat-input {
  flex: 1;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  padding: 0.375rem 0.5rem;
  font-size: 0.8rem;
  margin-right: 0.5rem;
}

.chat-input:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
  outline: 0;
}

.chat-send-btn {
  background-color: #0d6efd;
  color: white;
  border: none;
  border-radius: 0.25rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out;
}

.chat-send-btn:hover {
  background-color: #0b5ed7;
}

/* Sidebar Section Spacing */
.sidebar-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e9ecef;
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-section h5 {
  color: #033c59;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .ai-transparency-ticker {
    height: 60px;
  }

  .chat-messages {
    max-height: 150px;
  }

  #ai-ticker-content {
    animation-duration: 20s;
  }
}

/* Scrollbar styling for chat */
.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.dashboard-header .col-4,
.dashboard-header .row,
.fixed-header {
  padding-right: 0 !important;
  margin-right: 0 !important;
}