/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Live Logs - CSS-based filtering for performance optimization */
/* Only render logs matching the current filter, avoiding expensive querySelectorAll operations */
#live_logs_list.filter-output .log-entry:not([data-log-type="output"]) {
  display: none;
}

#live_logs_list.filter-error .log-entry:not([data-log-type="error"]) {
  display: none;
}

#live_logs_list.filter-pm2_system .log-entry:not([data-log-type="pm2_system"]) {
  display: none;
}

/* filter-all shows everything, no need for a rule */

/* User Selection Optimization - Allow selecting only log content, not metadata */
/* This prevents copying timestamps, environment names, indices, and other metadata */

/* Live Logs - Make timestamps and environment info non-selectable */
.log-entry span:first-child,
.log-entry .log-env {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Dashboard/Regular Logs - Make all metadata spans non-selectable */
#logs > div > div > span {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Search Results - Make match indices, headers, and timestamps non-selectable */
.bg-indigo-600 span,
.text-xs.font-mono span:first-child,
.bg-yellow-100 > div > span,
.bg-yellow-100 > div > svg {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Context logs - Make timestamps non-selectable */
.bg-gray-100 .text-xs.font-mono span:first-child {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Ensure log content (pre elements) remains selectable */
.log-content,
pre.inline,
pre.text-sm,
pre.whitespace-pre-wrap {
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

/* Maximized view styles */
[data-controller="live-logs"].maximized-view {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  margin: 0 !important;
  border-radius: 0 !important;
}

[data-controller="live-logs"].maximized-view #live_logs_container {
  height: calc(100vh - 60px) !important;
}

[data-controller="live-logs"].maximized-view .bg-gray-800 {
  position: sticky;
  top: 0;
  z-index: 10;
}
