/* ===== RESPONSIVE & FINAL - Media queries, mobile styles, print styles ===== */

/* Notes section styling and related elements */
.notes-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #f5f7fa;
  border-bottom: 1px solid #eceff3;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background-color 0.2s ease;
}

.notes-header:hover {
  background: #e2e6ea;
}

.notes-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #495057;
  flex: 1;
}

.notes-toggle {
  background: none;
  border: none;
  color: #6c757d;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-size: 14px;
  order: -1;
  margin-right: 10px;
}

.notes-toggle:hover {
  background-color: #e2e6ea;
  color: #495057;
}

.notes-toggle-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notes-toggle-icon.collapsed {
  transform: rotate(-90deg);
}

.notes-content {
  padding: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: none;
  opacity: 1;
  overflow: hidden;
  background: #fff;
}

.notes-content.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0 16px;
  overflow: hidden;
}

.notes-text {
  line-height: 1.6;
  color: #495057;
  margin: 0;
}

.notes-text a {
  color: #007bff;
  text-decoration: none;
  font-weight: 500;
}

.notes-text a:hover {
  text-decoration: underline;
  color: #0056b3;
}

.notes-textarea {
  width: 100%;
  min-height: 100px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid #ced4da;
  border-radius: 4px;
  padding: 10px;
  resize: vertical;
  background: #fff;
}

.notes-textarea:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.notes-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.notes-actions button {
  font-size: 12px;
  padding: 6px 10px;
}

/* Mobile banner responsive behavior - removed blue styling, keeping light yellow only */

/* Tablet responsive adjustments */
@media (max-width: 1024px) {
  .section {
    margin: 15px 0;
    padding: 12px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .section-title {
    font-size: 16px;
  }

  .section-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .section-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .section-row label {
    min-width: auto;
  }

  .example-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .preset-content {
    flex-direction: column;
  }

  .preset-content .code-area,
  .preset-content .comment-area {
    width: 100%;
    margin: 0;
  }

  .preset-content .divider {
    display: none;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  .section {
    margin: 10px 0;
    padding: 10px;
  }

  .section-header {
    padding-bottom: 8px;
    margin-bottom: 12px;
  }

  .section-title {
    font-size: 14px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 14px;
  }

  .btn-sm {
    padding: 6px 10px;
    font-size: 12px;
  }

  input,
  textarea,
  select {
    font-size: 14px;
    padding: 8px;
  }

  .preset-wrapper {
    margin: 10px 0;
  }

  .preset-header-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .preset-header-title {
    font-size: 14px;
  }

  .status-indicators-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
  }

  .status-indicators-section > div {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .status-indicators-section label {
    font-size: 12px;
  }

  .status-select {
    min-width: 100%;
    font-size: 12px;
    padding: 5px 8px;
  }

  .preset-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .ace-editor-container {
    min-height: 200px;
  }

  .event-nav {
    flex-wrap: wrap;
    gap: 8px;
  }

  .event-nav .nav-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .top-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .button-group {
    flex-direction: column;
    gap: 8px;
  }

  .gtm-row {
    flex-direction: column;
    gap: 12px;
  }

  .gtm-id-group,
  .local-file-group {
    width: 100%;
  }
}

/* Print styles */
@media print {
  body {
    background: white;
    color: black;
    font-size: 12pt;
    line-height: 1.4;
  }

  .section {
    border: 1px solid #ccc;
    box-shadow: none;
    margin: 10pt 0;
    padding: 10pt;
    page-break-inside: avoid;
  }

  .section-header {
    border-bottom: 1px solid #ccc;
    margin-bottom: 10pt;
    padding-bottom: 8pt;
  }

  .section-title {
    color: black;
    font-size: 14pt;
    font-weight: bold;
  }

  .btn,
  .section-toggle-btn,
  .doc-toggle {
    display: none;
  }

  .section-content.collapsed,
  .documentation-section.collapsed .doc-section {
    display: block !important;
    opacity: 1 !important;
    max-height: none !important;
  }

  .preset-wrapper.collapsed .preset-content {
    display: none;
    max-height: 0;
    overflow: hidden;
  }

  .mobile-banner {
    display: none;
  }

  .ace-editor-container {
    border: 1px solid #ccc;
    background: white;
    color: black;
  }

  .ace_editor {
    background: white !important;
    color: black !important;
  }

  .ace_editor .ace_gutter {
    background: #f5f5f5 !important;
    color: #666 !important;
  }

  .ace_editor .ace_gutter-cell {
    color: #666 !important;
  }

  .ace_editor .ace_marker-layer .ace_error,
  .ace_editor .ace_marker-layer .ace_warning {
    background: transparent !important;
  }

  .ace_editor .ace_gutter-cell.ace_error,
  .ace_editor .ace_gutter-cell.ace_warning {
    background: transparent !important;
  }

  .console-toggles,
  .version-label {
    display: none;
  }

  .footer-style {
    border-top: 1px solid #ccc;
    margin-top: 20pt;
    padding-top: 10pt;
    text-align: center;
    color: #666;
  }

  .example-grid {
    grid-template-columns: 1fr;
    gap: 10pt;
  }

  .example-item {
    border: 1px solid #ccc;
    background: white;
    padding: 10pt;
  }

  .example-item pre {
    background: #f5f5f5;
    border: 1px solid #ccc;
    padding: 8pt;
    overflow: visible;
    white-space: pre-wrap;
    word-wrap: break-word;
  }

  .example-item code {
    color: black;
  }

  .links-container {
    border: 1px solid #ccc;
    background: white;
    padding: 10pt;
    margin: 10pt 0;
  }

  .links-list a {
    color: black;
    text-decoration: underline;
  }

  .change-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 8pt;
    border-radius: 4pt;
    margin: 8pt 0;
  }

  .link-form {
    border: 1px solid #ccc;
    background: white;
    padding: 10pt;
    margin: 10pt 0;
  }

  .link-form input {
    border: 1px solid #ccc;
    background: white;
    color: black;
    padding: 6pt;
  }

  .link-form-actions {
    margin-top: 8pt;
  }

  .link-form-actions button {
    display: none;
  }

  .user-id-section {
    border: 1px solid #ccc;
    background: white;
    padding: 10pt;
    margin: 10pt 0;
  }

  .user-id-display {
    background: #f5f5f5;
    border: 1px solid #ccc;
    padding: 6pt;
    font-family: var(--font-monospace);
    color: black;
  }

  .user-id-help {
    margin-top: 8pt;
    padding: 8pt;
    background: #f8f9fa;
    border: 1px solid #ccc;
  }

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

  .user-id-help code {
    background: #f5f5f5;
    border: 1px solid #ccc;
    padding: 2pt 4pt;
    color: black;
  }
}

/* Journey section styling */
.journey-queue {
  min-height: 60px;
  padding: 12px;
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: 4px;
  margin-bottom: 16px;
}

.journey-queue.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  font-style: italic;
}

.journey-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  margin-bottom: 8px;
  cursor: move;
  transition: all 0.2s ease;
}

.journey-item:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.journey-item.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.journey-item .event-icon {
  display: inline-block;
  min-width: 1ch;
  max-width: none;
  text-align: left;
  flex-shrink: 0;
  white-space: nowrap;
}

.journey-item .event-name {
  flex: 1;
  font-weight: 500;
}

.journey-item .remove-btn {
  background: none;
  border: none;
  color: #dc3545;
  cursor: pointer;
  padding: 4px;
  border-radius: 3px;
  transition: background-color 0.2s ease;
}

.journey-item .remove-btn:hover {
  background-color: #fee2e2;
}

.journey-status {
  margin: 15px 0;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.journey-progress {
  display: flex;
  align-items: center;
  gap: 15px;
}

.progress-bar {
  flex: 1;
  height: 20px;
  background-color: #e9ecef;
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: #28a745;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-weight: 600;
  color: #495057;
  min-width: 60px;
  text-align: center;
}

.journey-delay {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 15px;
}

.journey-delay input {
  width: 80px;
  text-align: center;
}

.journey-delay label {
  font-size: 14px;
  color: #6c757d;
}

.journey-settings-section {
  margin: 15px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.journey-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.small-journey-btn {
  font-size: 14px;
  padding: 6px 12px;
  min-width: auto;
  flex: none;
}

/* Queue button styling for individual events */
.queue-btn {
  background-color: #e2e6ea !important;
  color: #333 !important;
}

.queue-btn:hover {
  background-color: #d4dadd !important;
}

.queue-btn.queued {
  background-color: #28a745 !important;
  color: #fff !important;
}

.queue-btn.queued:hover {
  background-color: #218838 !important;
}

.queue-clear-btn {
  background-color: #dc3545 !important;
  color: #fff !important;
  margin-left: 5px;
}

.queue-clear-btn:hover {
  background-color: #c82333 !important;
}

/* Journey events styling */
.journey-presets {
  margin-top: 20px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.presets-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.presets-header h4 {
  margin: 0;
  color: #495057;
  font-size: 16px;
}

.presets-count {
  color: #6c757d;
  font-size: 14px;
  font-style: italic;
}

.presets-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preset-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.preset-item:hover {
  border-color: #007bff;
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
}

.preset-info {
  flex: 1;
}

.preset-name {
  font-weight: 600;
  color: #007bff;
  margin-bottom: 4px;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.preset-name:hover {
  color: #0056b3;
}

.preset-details {
  font-size: 12px;
  color: #6c757d;
}

.preset-actions {
  display: flex;
  gap: 8px;
}

.preset-load-btn {
  background-color: #007bff !important;
  color: white !important;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.preset-load-btn:hover {
  background-color: #0056b3 !important;
}

.preset-delete-btn {
  background-color: #dc3545 !important;
  color: white !important;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.preset-delete-btn:hover {
  background-color: #c82333 !important;
}

/* No playgrounds message styling */
.no-playgrounds {
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  margin: 20px 0;
}

.no-playgrounds h3 {
  margin: 0 0 16px 0;
  color: #495057;
  font-size: 18px;
  font-weight: 600;
}

.no-playgrounds p {
  margin: 0 0 20px 0;
  line-height: 1.6;
}

.no-playgrounds .btn {
  margin: 0 8px;
}

/* Ensure smooth transitions for all event elements */
.preset-wrapper textarea,
.preset-wrapper .preset-header-bar,
.preset-wrapper .preset-actions {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Event addition/removal animations */
.preset-wrapper {
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: top;
}

.preset-wrapper.removing {
  animation: slideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: top;
}

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

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

/* Smooth expansion for loaded events section */
.loaded-events-section {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
}

.loaded-events-section.expanding {
  animation: sectionExpand 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes sectionExpand {
  from {
    height: var(--current-height);
  }
  to {
    height: var(--new-height);
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .section {
    border-width: 2px;
  }

  .btn {
    border-width: 2px;
  }

  .section-header {
    border-bottom-width: 2px;
  }

  .preset-header-bar {
    border-bottom-width: 2px;
  }

  .notes-header {
    border-bottom-width: 2px;
  }

  .link-form {
    border-width: 2px;
  }

  .user-id-section {
    border-width: 2px;
  }
}

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

  .section-content,
  .documentation-section .doc-section,
  .preset-wrapper .preset-content {
    transition: none !important;
  }

  .toggle-icon,
  .section-toggle-btn .toggle-icon {
    transition: none !important;
  }
}
