/* jhacal-tutorial-v5.css — 042026.1.36 */
/* =========================================================
   JHACAL Tutorial v5 - TWO COLUMN INTERIOR LAYOUT
   Modal stays bottom-right corner (same size/position)
   INSIDE: Nav left (35%), Content right (65%)
   ========================================================= */

:root {
  --tc-bg: rgba(28, 32, 36, 0.86);
  --tc-border: #ff9800;
  --tc-accent: #ff9800;
  --tc-text: #e5e7eb;
  --tc-muted: #9ca3af;
  --tc-radius: 18px;
  --tc-shadow: 0 30px 80px rgba(0,0,0,0.65);
}

/* Root overlay */
#jhacalTutorialRoot {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10050;
}

#jhacalTutorialOverlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  pointer-events: none;
}

#jhacalTutorialOverlay .jt-modal {
  pointer-events: auto;
}

/* ===== MODAL - STAYS BOTTOM RIGHT, SAME SIZE ===== */
.jt-modal {
  position: fixed;
  right: 24px;
  bottom: max(24px, env(safe-area-inset-bottom));
  width: 480px; /* Slightly narrower to uncover more of the app */
  max-width: calc(100vw - 48px);
  height: 65vh; /* Reduced height to leave more app visible */
  max-height: calc(100dvh - 120px);
  background: var(--tc-bg);
  border: 2px solid var(--tc-border);
  border-radius: var(--tc-radius);
  box-shadow: var(--tc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  backdrop-filter: blur(14px);
  /* Draggable — JS will set left/top; cursor shows it's moveable */
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

/* Drag handle indicator on the header */
.jt-header::before {
  content: '⠿';
  color: rgba(255,152,0,0.35);
  font-size: 1.1rem;
  margin-right: 6px;
  cursor: grab;
  flex-shrink: 0;
}
.jt-header { cursor: grab; }
.jt-header:active { cursor: grabbing; }

#jhacalTutorialOverlay.open .jt-modal {
  opacity: 1;
  transform: translateY(0);
}

/* ===== HEADER ===== */
.jt-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,152,0,0.35);
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.jt-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#jtTitle {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--tc-accent);
  flex: 1;
}

#jtClose {
  background: transparent;
  border: 1px solid rgba(255,152,0,0.4);
  color: var(--tc-accent);
  width: 44px;   /* [L11-2 g36] 32→44 WCAG 2.5.5 AAA */
  height: 44px;  /* [L11-2 g36] 32→44 WCAG 2.5.5 AAA */
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s;
}

#jtClose:hover {
  background: rgba(255,152,0,0.2);
}

/* ===== TWO COLUMN INTERIOR ===== */
.jt-main-area {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0; /* Important for flex overflow */
}

/* ===== LEFT COLUMN - NAVIGATION (35%) ===== */
.jt-navigation {
  width: 35%;
  background: rgba(0,0,0,0.3);
  border-right: 1px solid rgba(255,152,0,0.25);
  display: flex;
  flex-direction: column;
  position: relative; /* Contain absolutely positioned nav-progress */
}

.jt-nav-header {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,152,0,0.2);
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.jt-nav-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tc-accent);
  margin: 0;
}

.jt-nav-body {
  flex: 1;
  padding: 6px;
  display: flex;
  flex-direction: column;
}

/* Section selector */
#jtSectionSelector {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

/* Section category headers */
.jt-section-category {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tc-accent);
  padding: 10px 6px 4px 6px;
  margin-top: 6px;
  border-top: 1px solid rgba(255, 152, 0, 0.15);
}

.jt-section-category:first-child {
  margin-top: 0;
  padding-top: 6px;
  border-top: none;
}

/* Section buttons - COMPACT */
.jt-section-btn {
  display: flex;
  align-items: center;
  width: 100%;
  background: rgba(255,152,0,0.1);
  border: 1px solid rgba(255,152,0,0.3);
  border-left: 3px solid transparent;
  color: var(--tc-text);
  padding: 7px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  font-weight: 500;
  line-height: 1.3;
}

.jt-section-btn:hover {
  background: rgba(255,152,0,0.2);
  border-left-color: var(--tc-accent);
  transform: translateX(2px);
}

.jt-section-btn.active {
  background: rgba(255,152,0,0.25);
  border-color: var(--tc-accent);
  border-left-color: var(--tc-accent);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(255,152,0,0.3);
}

/* Progress in nav footer */
.jt-nav-progress {
  padding: 8px 10px;
  border-top: 1px solid rgba(255,152,0,0.2);
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.jt-progress-label {
  font-size: 0.65rem;
  color: var(--tc-muted);
  margin-bottom: 4px;
  font-weight: 600;
}

.jt-progress-bar {
  height: 4px;
  background: rgba(255,152,0,0.2);
  border-radius: 2px;
  overflow: hidden;
}

.jt-progress-fill {
  height: 100%;
  background: var(--tc-accent);
  border-radius: 2px;
  transition: width 0.3s ease;
  box-shadow: 0 0 6px rgba(255,152,0,0.6);
}

/* ===== RIGHT COLUMN - CONTENT (65%) ===== */
.jt-content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.jt-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  color: var(--tc-text);
  line-height: 1.65;
  font-size: 0.95rem;
}

.jt-body h3 {
  color: var(--tc-accent);
  margin: 0 0 12px 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.jt-body p {
  margin: 0 0 12px 0;
}

.jt-body ul {
  margin: 8px 0 14px 20px;
}

.jt-body ul li {
  margin-bottom: 6px;
}

.jt-body strong {
  color: var(--tc-accent);
  font-weight: 600;
}

.jt-body code {
  background: rgba(255,152,0,0.1);
  padding: 2px 5px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  color: var(--tc-accent);
}

/* ===== FOOTER ===== */
.jt-footer {
  position: relative; /* For absolute timer positioning */
  border-top: 1px solid rgba(255,152,0,0.35);
  padding: 20px 16px 16px 16px; /* Increased: 20px top, 16px bottom for full button visibility */
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
  min-height: 60px; /* Ensure minimum height for buttons */
  z-index: 100; /* Ensure footer is always on top */
}

.jt-btn {
  background: rgba(255,152,0,0.2);
  border: 1px solid var(--tc-border);
  color: var(--tc-accent);
  padding: 10px 14px; /* Increased from 8px 12px for better visibility */
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
  transition: all 0.2s;
  font-size: 0.85rem;
  min-height: 38px; /* Ensure minimum touch target size */
}

.jt-btn:hover {
  background: rgba(255,152,0,0.3);
  transform: translateY(-1px);
}

.jt-btn.primary {
  background: var(--tc-accent);
  color: #000;
  box-shadow: 0 2px 8px rgba(255,152,0,0.4);
  animation: pulse-glow 2s infinite;
}

.jt-btn.primary:hover {
  background: #ffaa33;
  box-shadow: 0 4px 12px rgba(255,152,0,0.6);
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 2px 8px rgba(255,152,0,0.4); }
  50% { box-shadow: 0 2px 16px rgba(255,152,0,0.7); }
}

/* Resume button when waiting - GREEN background */
.jt-btn.resume {
  background: linear-gradient(135deg, rgba(91, 141, 87, 0.3), rgba(91, 141, 87, 0.2)) !important;
  border-color: #5B8D57 !important;
  color: #5B8D57 !important;
  box-shadow: 0 2px 8px rgba(91, 141, 87, 0.4);
  animation: resume-pulse 2s infinite !important;
}

.jt-btn.resume:hover {
  background: linear-gradient(135deg, rgba(91, 141, 87, 0.4), rgba(91, 141, 87, 0.3)) !important;
  box-shadow: 0 4px 12px rgba(91, 141, 87, 0.6);
}

@keyframes resume-pulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(91, 141, 87, 0.4); }
  50% { box-shadow: 0 2px 16px rgba(91, 141, 87, 0.7); }
}

#jtDepth {
  flex: none;
  min-width: 100px;
  font-size: 0.75rem;
  color: var(--tc-muted);
  text-align: center;
}

/* Timer display above buttons */
.jt-timer {
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,152,0,0.15);
  border: 1px solid rgba(255,152,0,0.4);
  border-radius: 12px;
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tc-accent);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  animation: timer-pulse 1.5s infinite;
}

@keyframes timer-pulse {
  0%, 100% { 
    background: rgba(255,152,0,0.15);
    border-color: rgba(255,152,0,0.4);
  }
  50% { 
    background: rgba(255,152,0,0.25);
    border-color: rgba(255,152,0,0.6);
  }
}

/* Tutorial highlight */
.tutorial-highlight {
  outline: 3px solid var(--tc-accent) !important;
  outline-offset: 4px;
  border-radius: 8px;
  box-shadow: 0 0 0 3px rgba(255,152,0,0.3);
}

/* ===== SCROLLBAR STYLING ===== */

/* ===== MOBILE - STACK VERTICALLY ===== */
@media (max-width: 640px) {
  .jt-modal {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
    height: calc(100dvh - 24px);
  }
  
  /* Stack navigation on top */
  .jt-main-area {
    flex-direction: column;
  }
  
  .jt-navigation {
    width: 100%;
    max-height: 35%;
    border-right: none;
    border-bottom: 1px solid rgba(255,152,0,0.25);
  }
  
  .jt-nav-progress {
    display: none; /* Save space on mobile */
  }
  
  .jt-body {
    padding: 14px 16px;
    font-size: 0.9rem;
  }
  
  .jt-body h3 {
    font-size: 1rem;
  }
  
  #jtTitle {
    font-size: 1rem;
  }
}

/* =====================================================
   SWITCH ACCESS / SCAN MODE STYLING
   Clear but not outlandish visual design
   ===================================================== */

/* Highlighted item during scan */
.scan-highlight {
  outline: 4px solid #ff9800 !important;
  outline-offset: 6px;
  box-shadow: 
    0 0 20px rgba(255, 152, 0, 0.8),
    0 0 40px rgba(255, 152, 0, 0.4) !important;
  animation: scan-pulse 1s infinite alternate;
  z-index: 1000;
  position: relative;
}

/* Pulsing animation for highlighted item */
@keyframes scan-pulse {
  from { 
    box-shadow: 
      0 0 20px rgba(255, 152, 0, 0.8),
      0 0 40px rgba(255, 152, 0, 0.4);
  }
  to { 
    box-shadow: 
      0 0 30px rgba(255, 152, 0, 1),
      0 0 60px rgba(255, 152, 0, 0.6);
  }
}

/* Dim non-highlighted items in scan mode */
body.scan-mode .path-tile:not(.scan-highlight),
body.scan-mode .toolbar-btn:not(.scan-highlight),
body.scan-mode .tool-btn:not(.scan-highlight),
body.scan-mode .qr-response-btn:not(.scan-highlight),
body.scan-mode #qrPanel h3:not(.scan-highlight) {
  opacity: 0.4;
  transition: opacity 0.3s;
}

/* Highlighted items stay full opacity */
body.scan-mode .scan-highlight {
  opacity: 1 !important;
}

/* Scan mode indicator in header */
.scan-mode-indicator {
  position: fixed;
  top: 16px;
  right: 16px;
  background: rgba(255, 152, 0, 0.2);
  border: 2px solid #ff9800;
  border-radius: 12px;
  padding: 8px 16px;
  color: #ff9800;
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 10000;
  animation: indicator-pulse 2s infinite;
  pointer-events: none;
}

@keyframes indicator-pulse {
  0%, 100% { 
    background: rgba(255, 152, 0, 0.2);
    border-color: rgba(255, 152, 0, 0.8);
  }
  50% { 
    background: rgba(255, 152, 0, 0.3);
    border-color: rgba(255, 152, 0, 1);
  }
}

/* Ensure highlighted rapid response items are clearly visible */
body.scan-mode #qrPanel h3.scan-highlight {
  background: rgba(255, 152, 0, 0.15);
  padding: 8px;
  margin: 12px -8px 8px -8px;
  border-radius: 8px;
}

/* Mobile adjustments for scan mode */
@media (max-width: 768px) {
  .scan-highlight {
    outline-width: 3px;
    outline-offset: 4px;
  }
  
  .scan-mode-indicator {
    top: 8px;
    right: 8px;
    padding: 6px 12px;
    font-size: 0.8rem;
  }
}

