/* ===== ACE EDITOR - Top buttons, navigation, GTM layout, Ace editor, console toggles, user ID ===== */

.top-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  align-items: flex-start;
  margin: 20px 0;
}
.button-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/*
 * Event navigation bar styling.  Displays a row of buttons to
 * quickly scroll to each event section.  Buttons use a neutral
 * colour palette similar to secondary actions.
 */
.event-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.event-nav .nav-btn {
  background-color: #e2e6ea;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  color: #333;
  cursor: pointer;
  transition: background-color 0.15s ease;
  font-size: 14px;
}
.event-nav .nav-btn:hover {
  background-color: #d4dadd;
}

.event-nav-title {
  font-weight: 600;
  margin: 10px 0 5px;
}

/* Sub-label styling used below section headers for explanatory notes. */
.sub-label {
  color: gray;
  font-size: 14px;
  margin-top: -10px;
  margin-bottom: 20px;
}

/* Layout for the GTM ID and local file row.  Places the GTM ID input and
   local file picker side by side on wider screens.  Allows wrapping on
   narrow screens. */
.gtm-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  margin: 10px 0;
}
.gtm-id-group input {
  margin-right: 8px;
}
.local-file-group input[type='file'] {
  /* Reset margin so the file input aligns vertically with the adjacent button */
  margin: 0;
}
/* Align the file input and the local loader button horizontally. */
.local-file-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Ace editor uses its own themes; ensure fonts align with the rest of the app. */
.ace_editor {
  font-family: var(--font-monospace);
  font-size: 14px;
  border-radius: 0 0 4px 4px;
  border: none;
}

/* Make autocomplete suggestion list wider to show full variable names */
.ace_autocomplete {
  width: auto !important;
  min-width: 400px !important;
  max-width: 600px !important;
}

.ace_autocomplete .ace_completion-meta {
  min-width: 120px !important;
}

/* Allow the Ace editor container to be vertically resizable by the user. */
.ace-editor-container {
  resize: vertical;
  overflow: auto;
  min-height: 148px; /* Ensure minimum height for 10 lines */
}

/* Lighten the appearance of error highlights in Ace to reduce visual noise. */
.ace_editor .ace_error {
  background-color: #fee2e2 !important;
}
.ace_editor .ace_gutter-cell.ace_error {
  background-color: #fee2e2 !important;
  color: #721c24 !important;
}
.ace_editor .ace_marker-layer .ace_error {
  background-color: #fecaca !important;
}

/* Lighten warning annotations (e.g., trailing whitespace) but keep them visible. */
.ace_editor .ace_warning {
  background-color: #fff3cd !important;
}
.ace_editor .ace_gutter-cell.ace_warning {
  background-color: #fff3cd !important;
  color: #856404 !important;
}
.ace_editor .ace_marker-layer .ace_warning {
  background-color: #ffe8a1 !important;
}

/* Version label styling - hide only the standalone floating version, not the integrated one */
.version-label {
  position: fixed;
  top: 10px;
  right: 10px;
  font-size: 12px;
  color: gray;
  z-index: 1000;
  /* Hide the standalone version label - now integrated into title */
  display: none;
}

/* Show version label when it's inside the title header */
.title-header .version-label {
  display: block !important;
}

/* Console logging toggles styling */
.console-toggles {
  margin: 15px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.console-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 12px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
}
.console-toggle input[type='checkbox'] {
  width: auto;
  margin: 0;
}
.console-toggle label {
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

/* Editor suggestions toggles styling */
.editor-toggles {
  margin: 15px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.editor-toggles .console-toggle {
  /* Use same styling as other toggles - no special background */
}

/* Random User ID section styling */
.user-id-section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-id-section .user-id-row {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
}
.user-id-display {
  font-family: var(--font-monospace);
  font-size: 14px;
  color: #495057;
  background: #f8f9fa;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #dee2e6;
  min-width: 200px;
}
.user-id-section button {
  font-size: 14px;
  padding: 6px 12px;
}

.user-id-help {
  margin-top: 8px;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 4px;
  border-left: 3px solid #007bff;
}

.user-id-help small {
  color: #6c757d;
}
