/* General styles */
:root {
  --primary: #000000;
  --primary-dark: #121212;
  --accent: #ff0000;
  --accent-light: #ff3333;
  --text-dark: #000000;
  --text-light: #ffffff;
  --bg-dark: #212121;
  --bg-light: #ffffff;

  /* Override Bootstrap variables */
  --bs-primary: var(--primary);
  --bs-primary-rgb: 0, 0, 0;
  --bs-danger: var(--accent);
  --bs-danger-rgb: 255, 0, 0;
  --bs-link-color: var(--accent);
  --bs-link-hover-color: var(--accent-light);
}

/* Container width overrides - use more screen width */
.container {
  max-width: 95% !important;
  padding-left: 2rem;
  padding-right: 2rem;
}

/* PII/PHI tag styles */
.pii-tag,
.phi-tag {
  background-color: #000;
  color: transparent;
  padding: 0 4px;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  display: inline-block;
  min-width: 40px;
  text-align: center;
  transition: all 0.2s ease;
  overflow: hidden;
  user-select: none;
}

.pii-tag:hover,
.phi-tag:hover {
  background-color: #333;
}

.pii-tag::after {
  content: "PII";
  color: #fff;
  font-size: 0.75rem;
  font-weight: bold;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.phi-tag::after {
  content: "PHI";
  color: #fff;
  font-size: 0.75rem;
  font-weight: bold;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.pii-tag.revealed,
.phi-tag.revealed {
  background-color: #ffc107;
  color: #000;
  padding: 0 6px;
  overflow: visible;
  user-select: text;
}

.pii-tag.revealed::after,
.phi-tag.revealed::after {
  content: none;
}

.synthetic-voice-indicator {
  cursor: help;
  font-size: 1.1rem;
  margin-left: 4px;
  display: inline-block;
  transition: transform 0.2s;
  position: relative;
}

.synthetic-voice-indicator:hover {
  transform: scale(1.2);
}

.synthetic-voice-indicator[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 10px;
  background-color: #333;
  color: white;
  font-size: 0.875rem;
  white-space: nowrap;
  border-radius: 4px;
  margin-bottom: 5px;
  z-index: 1000;
  pointer-events: none;
}

.synthetic-voice-indicator[data-tooltip]:hover::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
  margin-bottom: 0;
  z-index: 1000;
  pointer-events: none;
}

@media (min-width: 1200px) {
  .container {
    max-width: 90% !important;
  }
}

@media (min-width: 1600px) {
  .container {
    max-width: 85% !important;
  }
}

html,
body {
  height: 100%;
  margin: 0;
  background-color: var(--bg-light);
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Button styles */
.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary-dark);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: var(--primary-dark);
  border-color: #000;
}

.btn-danger {
  background-color: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-danger:hover,
.btn-danger:focus,
.btn-danger:active {
  background-color: var(--accent-light);
  border-color: var(--accent);
  color: white;
}

/* Form controls */
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.25rem rgba(255, 0, 0, 0.25);
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

/* Content wrapper */
.content-wrapper {
  flex: 1;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

/* Card styles */
.card {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 1rem;
  border-color: #ddd;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 5px 15px rgba(255, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.card-header {
  background-color: var(--primary);
  color: var(--text-light);
  font-weight: 500;
}

/* Login and registration forms */
.auth-container {
  max-width: 450px;
  margin: 2rem auto;
  padding: 0;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background-color: white;
  border-top: 4px solid var(--accent);
}

.auth-header {
  text-align: center;
  padding: 1.5rem 1rem;
  background-color: var(--primary);
  color: white;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}

.auth-body {
  padding: 2rem;
}

/* Navbar styles */
.navbar-brand img {
  height: 30px;
  margin-right: 8px;
}

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

.navbar .nav-link {
  color: rgba(255, 255, 255, 0.85) !important;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: white !important;
}

.navbar .nav-link.active {
  color: var(--accent) !important;
  font-weight: 500;
}

.navbar .dropdown-menu {
  background-color: var(--primary);
  border-color: #333;
}

.navbar .dropdown-item {
  color: rgba(255, 255, 255, 0.85);
}

.navbar .dropdown-item:hover {
  background-color: #333;
  color: white;
}

/* Footer */
footer {
  background-color: var(--primary);
  padding: 1rem 0;
  margin-top: auto;
  border-top: 1px solid #333;
  color: var(--text-light);
}

footer p {
  margin-bottom: 0;
  color: var(--text-light);
}

/* Organization selection */
.org-option {
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  background-color: #fff;
  cursor: pointer;
  transition:
    border-color 0.15s ease-in-out,
    box-shadow 0.15s ease-in-out;
}

.org-option:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.25rem rgba(255, 0, 0, 0.25);
}

.org-option.selected {
  border-color: var(--accent);
  background-color: rgba(255, 0, 0, 0.1);
}

/* Responsive tables */
@media (max-width: 767.98px) {
  .table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Dashboard cards */
.dashboard-card {
  text-align: center;
  padding: 1.5rem;
  border-radius: 0.25rem;
  margin-bottom: 1rem;
  background-color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-left: 3px solid var(--accent);
  transition: all 0.3s ease;
}

.dashboard-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
}

.dashboard-card .card-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--accent);
}

.dashboard-card .card-label {
  font-size: 0.9rem;
  color: #6c757d;
}

/* Alert styling */
.alert-danger {
  background-color: rgba(255, 0, 0, 0.1);
  border-color: var(--accent);
  color: var(--text-dark);
}

.alert-success {
  background-color: rgba(40, 167, 69, 0.1);
  border-color: #28a745;
  color: var(--text-dark);
}

/* Conversation item styles */
.conversation-item {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.conversation-item:hover {
  background-color: #f8f9fa;
}

.hover-bg-light:hover {
  background-color: #f8f9fa;
}

/* Highlighted clip animation */
.highlighted-clip {
  animation: highlight-pulse 2s ease-in-out;
  transition: all 0.3s ease;
}

@keyframes highlight-pulse {
  0% {
    background-color: transparent;
    box-shadow: none;
  }
  50% {
    background-color: #fff3cd;
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
  }
  100% {
    background-color: transparent;
    box-shadow: none;
  }
}

/* Behavior evidence clips */
.clip-evidence {
  padding: 0.25rem 0.5rem;
  margin-bottom: 0.25rem;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
}

.clip-evidence:hover {
  background-color: #f8f9fa;
  transform: translateX(2px);
}

.definitive-clip {
  padding-left: 0.75rem;
}

/* Behavior details */
.behavior-details {
  transition: all 0.3s ease;
}

/* Translation styles */
.translated-text {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted #6c757d;
}

.translated-text:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 0;
  background-color: #333;
  color: white;
  padding: 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  white-space: pre-wrap;
  max-width: 400px;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Inline behavior detection styles */
.behavior-detection-inline {
  position: relative;
  margin-left: 1rem;
}

.evidence-clip-item {
  border-color: #ffc107 !important;
  background-color: #fffbf0;
}

.evidence-clips-container {
  position: relative;
  padding-left: 1rem;
}

.evidence-connector {
  position: relative;
  margin: 0.5rem 0;
  padding-left: 2rem;
}

.evidence-connector .connector-line {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  width: 1rem;
  height: 1px;
  background-color: #6c757d;
}

.evidence-connector .connector-line::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #6c757d;
}

.evidence-connector.above .connector-line::after,
.evidence-connector.below .connector-line::after {
  content: "";
  position: absolute;
  right: -8px;
  top: -3px;
  width: 0;
  height: 0;
  border-style: solid;
}

.evidence-connector.above .connector-line::after {
  border-width: 0 0 6px 6px;
  border-color: transparent transparent #6c757d transparent;
}

.evidence-connector.below .connector-line::after {
  border-width: 6px 0 0 6px;
  border-color: transparent transparent transparent #6c757d;
}

.evidence-preview {
  cursor: pointer;
  font-size: 0.875rem;
  color: #6c757d;
  transition: all 0.2s ease;
}

.evidence-preview:hover {
  color: #495057;
  transform: translateX(2px);
}

/* Sidebar accordion scrolling fix */
.accordion-body {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Ensure the sidebar itself doesn't expand beyond viewport */
.conversation-sidebar {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  position: sticky;
  top: 1rem;
}

/* Activity log specific height constraint */
#conversationActivityCollapse .accordion-body,
.activity-log-section .accordion-body {
  max-height: 250px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* Custom scrollbar for accordion bodies */
.accordion-body::-webkit-scrollbar {
  width: 6px;
}

.accordion-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.accordion-body::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

.accordion-body::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* MOTD Banner Styles */
.motd-banner {
  width: 100%;
  background-color: #d1ecf1;
  border-bottom: 1px solid #bee5eb;
  animation: slideDown 0.3s ease-out;
}

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

.motd-banner .motd-content {
  margin-bottom: 0;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  border-radius: 0.375rem;
}

#motd-message {
  margin: 0;
  padding-right: 1rem;
}

#motd-message p {
  margin-bottom: 0.5rem;
}

#motd-message p:last-child {
  margin-bottom: 0;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .motd-banner {
    background-color: #1a1d21;
    border-bottom-color: #495057;
  }

  .motd-banner .alert-info {
    background-color: #0c5460;
    border-color: #0c5460;
    color: #d1ecf1;
  }

  .motd-banner .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
  }
}

/* APIs Page Styles */
#apiSidebar {
  border-right: 1px solid var(--bs-gray-300);
  padding-right: 1.5rem;
  min-height: 600px;
}

#apiSidebar .list-group-item {
  border: none;
  border-radius: 0.375rem;
  margin-bottom: 0.25rem;
  transition: all 0.2s ease;
}

#apiSidebar .list-group-item:hover {
  background-color: var(--bs-light);
  transform: translateX(2px);
}

#apiSidebar .list-group-item.active {
  background-color: var(--bs-primary);
  color: white;
}

#apiSidebar h6 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

#apiDetailsTemplate pre {
  overflow-x: auto;
  overflow-y: visible;
}

#resultJson {
  max-height: none;
  white-space: pre-wrap;
  word-wrap: break-word;
}

#apiDetailsTemplate .accordion-button:not(.collapsed) {
  background-color: var(--bs-light);
  color: var(--bs-primary);
}

#apiDetailsTemplate .accordion-button:focus {
  box-shadow: none;
  border-color: var(--bs-primary);
}

#apiDetailsTemplate .accordion-body {
  max-height: none;
  overflow: visible;
}

#specFrame {
  border: 1px solid var(--bs-gray-300);
  border-radius: 0.375rem;
  min-height: 600px;
}

/* Chart container styles */
#usageChart,
#responseChart {
  height: 300px;
}

/* Code example styles */
#codeExampleContent pre {
  margin: 0;
  overflow-x: auto;
  background-color: #f8f9fa;
  border-radius: 0.25rem;
}

#codeExampleContent code {
  display: block;
  padding: 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre;
}

/* Processing indicator */
#processingIndicator .spinner-border {
  width: 3rem;
  height: 3rem;
}

/* API sidebar category headers */
#apiSidebar h6 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  opacity: 0.7;
}

#apiSidebar h6:first-child {
  margin-top: 0;
}

/* Logs table styles */
#logsTableBody code {
  font-size: 0.8rem;
  padding: 0.2rem 0.4rem;
  background-color: var(--bs-gray-100);
}

/* Main content area */
#apiContent,
#apiDetailsTemplate {
  padding-left: 1.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #apiSidebar {
    border-right: none;
    border-bottom: 1px solid var(--bs-gray-300);
    padding-right: 0;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    min-height: auto;
  }

  #apiContent,
  #apiDetailsTemplate {
    padding-left: 0;
  }

  #apiDetailsTemplate .row > div {
    margin-bottom: 1rem;
  }
}
.processing-header {
  animation: fadeIn 0.3s ease-in;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes pulseGlow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(13, 110, 253, 0);
  }
}
.processing-header .spinner-border {
  animation:
    spinner-border 0.75s linear infinite,
    pulseGlow 2s ease-in-out infinite;
}
.clip-item,
.mb-3.p-3.bg-light.rounded {
  animation: slideInUp 0.4s ease-out;
  animation-fill-mode: both;
}
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.clip-item:nth-child(1) {
  animation-delay: 0s;
}
.clip-item:nth-child(2) {
  animation-delay: 0.05s;
}
.clip-item:nth-child(3) {
  animation-delay: 0.1s;
}
.clip-item:nth-child(4) {
  animation-delay: 0.15s;
}
.clip-item:nth-child(5) {
  animation-delay: 0.2s;
}
.processing-stage-indicator {
  position: relative;
  padding-left: 1.5rem;
}
.processing-stage-indicator::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #0d6efd;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
  50% {
    opacity: 0.5;
    transform: translateY(-50%) scale(1.2);
  }
}

/* Processing status in header */
.conversation-header [data-role="processingStatus"] {
  border-top: 1px solid var(--border-color, #dee2e6);
  padding-top: 0.75rem;
}
.conversation-header [data-role="processingStatus"] .spinner-border-sm {
  width: 1rem;
  height: 1rem;
  border-width: 0.15em;
}
.conversation-header [data-role="processingStatus"] small {
  font-size: 0.875rem;
}
