/* ==========================================================================
   AveLynx — Universal Help, Tutorial, Ticket & Feedback System
   File: avelynx-help-system.css
   Standardized styling for modals, tabs, tour spotlight, ticket forms, and stars.
   ========================================================================== */

:root {
  --ax-help-bg: #0f172a;
  --ax-help-surface: #1e293b;
  --ax-help-border: rgba(255, 255, 255, 0.1);
  --ax-help-accent: #38bdf8;
  --ax-help-accent-glow: rgba(56, 189, 248, 0.2);
  --ax-help-text: #f8fafc;
  --ax-help-text-muted: #94a3b8;
  --ax-help-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Modal Overlay Backdrop */
.ax-help-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  font-family: var(--ax-help-font);
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.ax-help-backdrop.ax-active {
  display: flex;
  opacity: 1;
}

/* Modal Card */
.ax-help-modal {
  background: #0f172a;
  background: linear-gradient(145deg, #131d35 0%, #0a0f1d 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(56, 189, 248, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--ax-help-text);
  animation: axModalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes axModalSlideUp {
  from {
    transform: translateY(20px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Header */
.ax-help-header {
  padding: 16px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.6);
}

.ax-help-title-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ax-help-app-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 20px;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.ax-help-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.ax-help-subtitle {
  margin: 2px 0 0 0;
  font-size: 11px;
  color: #94a3b8;
}

.ax-help-close-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.ax-help-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

/* Nav Tabs */
.ax-help-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 18px;
  background: rgba(10, 15, 29, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
}

.ax-help-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.ax-help-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.ax-help-tab-btn.ax-active {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.1);
}

/* Modal Body */
.ax-help-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
  max-height: calc(85vh - 130px);
}

.ax-help-pane {
  display: none;
}

.ax-help-pane.ax-active {
  display: block;
}

/* Cards & Bento Blocks */
.ax-help-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.ax-help-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s ease;
}

.ax-help-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
  background: rgba(30, 41, 59, 0.85);
}

.ax-help-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ax-help-card-desc {
  font-size: 12px;
  line-height: 1.5;
  color: #94a3b8;
  margin: 0;
}

/* Banner / Action Callouts */
.ax-help-banner {
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.15) 0%, rgba(99, 102, 241, 0.15) 100%);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.ax-help-btn-primary {
  background: #38bdf8;
  color: #0f172a;
  border: none;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.ax-help-btn-primary:hover {
  background: #7dd3fc;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.4);
}

.ax-help-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.ax-help-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Forms */
.ax-form-group {
  margin-bottom: 16px;
}

.ax-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.ax-form-input,
.ax-form-select,
.ax-form-textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 10px 12px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s ease;
}

.ax-form-input:focus,
.ax-form-select:focus,
.ax-form-textarea:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.ax-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Star Rating */
.ax-star-rating {
  display: flex;
  gap: 8px;
  font-size: 26px;
  cursor: pointer;
}

.ax-star {
  color: #475569;
  transition: color 0.15s ease;
}

.ax-star.ax-filled,
.ax-star:hover,
.ax-star:hover ~ .ax-star {
  color: #fbbf24;
}

/* Category Chips */
.ax-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.ax-chip-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ax-chip-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.ax-chip-btn.ax-selected {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
}

/* Tickets History Table */
.ax-tickets-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 12px;
}

.ax-tickets-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-weight: 600;
}

.ax-tickets-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.ax-priority-p0 { color: #f43f5e; font-weight: bold; }
.ax-priority-p1 { color: #fb923c; font-weight: bold; }
.ax-priority-p2 { color: #38bdf8; }
.ax-priority-p3 { color: #94a3b8; }

/* Interactive Spotlight Tour Overlay */
.ax-tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  pointer-events: none;
  display: none;
}

.ax-tour-overlay.ax-active {
  display: block;
}

.ax-tour-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.82);
  pointer-events: auto;
}

/* The sidebar's hide/show tab sits above everything (z-index at the maximum), so it would draw over the tour card: it steps aside while the tour runs */
body.ax-tour-on #avlSidebarToggle { visibility: hidden !important; }

/* The ring around the item a step points at. The page is dimmed by the four panels beside it (.ax-tour-dim), not by a giant shadow:
   a shadow 9,999 px wide made the browser build a layer of about 20,000 by 20,000 pixels and use a great deal of graphics memory. */
.ax-tour-spot {
  position: fixed;
  display: none;
  border-radius: 6px;
  box-shadow: 0 0 0 3px #38bdf8;
  pointer-events: none;
  z-index: 100001;
  transition: left 0.5s cubic-bezier(0.22, 1, 0.36, 1), top 0.5s cubic-bezier(0.22, 1, 0.36, 1), width 0.5s cubic-bezier(0.22, 1, 0.36, 1), height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.ax-tour-spot.ax-on {
  display: block;
}

/* Closed to a dot while the page changes screen or scrolls: no blue ring, the whole page stays evenly dimmed */
.ax-tour-spot.ax-closed {
  box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
}

/* The dimming: four panels above, below, left and right of the lit area. Each is a fixed box no bigger than the screen, placed by left, top,
   width and height just like the ring (.ax-tour-spot), so the two always move together. */
.ax-tour-dim {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  display: none;
  background: rgba(15, 23, 42, 0.78);
  pointer-events: none;
  z-index: 100000;
}

.ax-tour-overlay.ax-has-spot .ax-tour-dim {
  display: block;
}

.ax-tour-overlay.ax-has-spot .ax-tour-backdrop {
  background: transparent;
}

/* The tab the current step is on: lifted above the dimming and ringed, so users can see which tab the tour has opened */
[role="tab"].ax-tour-current-tab.ax-tour-tab-lifted {
  position: relative;
  z-index: 100001;
  outline: 3px solid #38bdf8;
  outline-offset: 2px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.22);
}

.ax-tour-card {
  position: fixed;
  z-index: 100002;
  background: #0f172a;
  border: 1px solid #38bdf8;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.4);
  border-radius: 12px;
  padding: 16px 18px;
  max-width: min(380px, calc(100vw - 24px));
  width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  color: #fff;
  font-family: var(--ax-help-font);
  pointer-events: auto;
  animation: axTourPop 0.2s ease-out;
}

/* On a wide window the card can be wider, so the same words take fewer lines and the card covers less of the page */
@media (min-width: 900px) {
  .ax-tour-card {
    max-width: min(480px, calc(100vw - 24px));
  }
}

@keyframes axTourPop {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.ax-tour-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  flex: 0 0 auto;
}

.ax-tour-step-badge {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  color: #38bdf8;
  letter-spacing: 0.04em;
  line-height: 1.3;
}

#axBtnCloseTour {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  font-size: 20px;
  color: #f8fafc;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  box-sizing: border-box;
  flex: 0 0 44px;
}

#axBtnCloseTour:focus,
#axBtnCloseTour:focus-visible,
#axBtnTourPrev:focus,
#axBtnTourPrev:focus-visible,
#axBtnTourNext:focus,
#axBtnTourNext:focus-visible,
.ax-tour-body:focus,
.ax-tour-body:focus-visible,
.ax-tour-title:focus,
.ax-tour-title:focus-visible {
  outline: 3px solid #38bdf8;
  outline-offset: 2px;
}

.ax-tour-title {
  margin: 0 0 8px 0;
  font-size: 20px;
  line-height: 1.35;
  font-weight: 700;
  color: #fff;
  flex: 0 0 auto;
}

.ax-tour-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin: 0 0 12px 0;
  padding-right: 4px;
}

.ax-tour-desc {
  font-size: 16px;
  line-height: 1.6;
  color: #e2e8f0;
  margin: 0;
}

.ax-tour-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  flex: 0 0 auto;
}

.ax-tour-progress-row {
  display: flex;
  align-items: center;
  width: 100%;
}

.ax-tour-progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.ax-tour-progress-fill {
  height: 100%;
  width: 0%;
  background: #38bdf8;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.ax-tour-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ax-tour-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
}

.ax-tour-dot.ax-active {
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

.ax-tour-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  width: 100%;
}

#axBtnTourPrev,
#axBtnTourNext {
  min-height: 44px;
  min-width: 96px;
  padding: 10px 18px;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 700;
  border-radius: 8px;
  box-sizing: border-box;
  justify-content: center;
  flex: 0 0 auto;
}

#axBtnTourPrev {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #94a3b8;
}

#axBtnTourPrev[aria-disabled="true"] {
  background: #1e293b;
  color: #cbd5e1;
  border-color: #64748b;
  cursor: not-allowed;
}

#axBtnTourNext {
  background: #38bdf8;
  color: #0f172a;
  border: 1px solid #38bdf8;
}

/* Light theme support for the tour card (warm, low-glare surfaces <= 84% light, never cooler than neutral) */
[data-theme="light"] .ax-tour-card {
  background: #cfc8ba;
  color: #1a1815;
  border-color: #6b6356;
  box-shadow: 0 10px 35px rgba(26, 24, 21, 0.28);
}

[data-theme="light"] .ax-tour-step-badge {
  color: #2b261f;
}

[data-theme="light"] .ax-tour-title {
  color: #1a1815;
}

[data-theme="light"] .ax-tour-desc {
  color: #26221c;
}

[data-theme="light"] .ax-tour-footer {
  border-top-color: #9e9585;
}

[data-theme="light"] .ax-tour-progress {
  background: #b5ad9d;
}

[data-theme="light"] .ax-tour-progress-fill {
  background: #3d362c;
}

[data-theme="light"] .ax-tour-dot {
  background: #9e9585;
}

[data-theme="light"] .ax-tour-dot.ax-active {
  background: #2b261f;
  box-shadow: none;
}

[data-theme="light"] #axBtnCloseTour {
  background: #c2baaa;
  color: #1a1815;
  border-color: #6b6356;
}

[data-theme="light"] #axBtnTourPrev {
  background: #c2baaa;
  color: #1a1815;
  border-color: #6b6356;
}

[data-theme="light"] #axBtnTourPrev[aria-disabled="true"] {
  background: #c2baaa;
  color: #3d362c;
  border-color: #857c6d;
}

[data-theme="light"] #axBtnTourNext {
  background: #2b261f;
  color: #e6dfd1;
  border-color: #2b261f;
}

[data-theme="light"] #axBtnCloseTour:focus,
[data-theme="light"] #axBtnCloseTour:focus-visible,
[data-theme="light"] #axBtnTourPrev:focus,
[data-theme="light"] #axBtnTourPrev:focus-visible,
[data-theme="light"] #axBtnTourNext:focus,
[data-theme="light"] #axBtnTourNext:focus-visible,
[data-theme="light"] .ax-tour-body:focus,
[data-theme="light"] .ax-tour-body:focus-visible,
[data-theme="light"] .ax-tour-title:focus,
[data-theme="light"] .ax-tour-title:focus-visible {
  outline: 3px solid #2b261f;
  outline-offset: 2px;
}

.ax-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Toast Notifications */
.ax-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  border: 1px solid #38bdf8;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 12px rgba(56, 189, 248, 0.3);
  font-family: var(--ax-help-font);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 100010;
  animation: axToastSlide 0.25s ease-out;
}

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