/* Guided Tour System — Custom Shepherd.js Theme
   Purple brand: #7c3aed / #6d28d9 / #5b21b6
   Matches PITS Admin voice/AI purple theme */

/* =============================================
   1. SHEPHERD OVERLAY & SPOTLIGHT
   ============================================= */
.shepherd-modal-overlay-container {
    z-index: 99990 !important;
}
.shepherd-modal-overlay-container .shepherd-modal-mask-rect {
    fill: rgba(0, 0, 0, 0.55);
}
.shepherd-target {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.3), 0 0 20px rgba(124, 58, 237, 0.15) !important;
    border-radius: 8px !important;
    z-index: 99991 !important;
    position: relative;
}

/* =============================================
   2. SHEPHERD TOOLTIP
   ============================================= */
.shepherd-element {
    z-index: 99995 !important;
    max-width: 400px !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 60px rgba(124, 58, 237, 0.2), 0 0 0 1px rgba(124, 58, 237, 0.1) !important;
    background: #ffffff !important;
    border: 2px solid rgba(124, 58, 237, 0.15) !important;
    font-family: system-ui, -apple-system, sans-serif !important;
    overflow: hidden;
    padding: 0 !important;
}
.shepherd-element .shepherd-arrow::before {
    background: #ffffff !important;
    border: 2px solid rgba(124, 58, 237, 0.15) !important;
}

/* =============================================
   3. SHEPHERD HEADER (Step Counter)
   ============================================= */
.shepherd-element .shepherd-header {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
    padding: 14px 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-bottom: none !important;
}
.shepherd-element .shepherd-title {
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    margin: 0 !important;
    line-height: 1.3 !important;
    display: flex;
    align-items: center;
    gap: 8px;
}
.shepherd-element .shepherd-cancel-icon {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 20px !important;
    font-weight: 400 !important;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.15s ease;
}
.shepherd-element .shepherd-cancel-icon:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
}

/* =============================================
   4. TOUR PROGRESS BAR (in header)
   ============================================= */
.gt-progress-bar {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}
.gt-progress-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 2px;
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* =============================================
   5. VOICE WAVEFORM
   ============================================= */
.gt-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 28px;
    padding: 8px 18px 0;
}
.gt-waveform .gt-bar {
    width: 3px;
    background: rgba(124, 58, 237, 0.5);
    border-radius: 2px;
    transition: height 0.15s ease;
}
.gt-waveform.gt-playing .gt-bar {
    animation: gt-wave 1.2s ease-in-out infinite;
}
.gt-waveform .gt-bar:nth-child(1) { animation-delay: 0s; height: 10px; }
.gt-waveform .gt-bar:nth-child(2) { animation-delay: 0.15s; height: 18px; }
.gt-waveform .gt-bar:nth-child(3) { animation-delay: 0.3s; height: 12px; }
.gt-waveform .gt-bar:nth-child(4) { animation-delay: 0.45s; height: 20px; }
.gt-waveform .gt-bar:nth-child(5) { animation-delay: 0.6s; height: 14px; }
.gt-waveform.gt-paused .gt-bar { animation: none; height: 10px; }

@keyframes gt-wave {
    0%, 100% { height: 8px; }
    50% { height: 22px; }
}

/* =============================================
   6. SHEPHERD TEXT CONTENT
   ============================================= */
.shepherd-element .shepherd-text {
    padding: 14px 18px !important;
    color: #374151 !important;
    font-size: 14px !important;
    line-height: 1.65 !important;
}
.shepherd-element .shepherd-text strong {
    color: #111827;
    font-weight: 600;
}
.shepherd-element .shepherd-text code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: #7c3aed;
}

/* =============================================
   7. SHEPHERD FOOTER (Controls)
   ============================================= */
.shepherd-element .shepherd-footer {
    padding: 12px 18px !important;
    border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
}

/* Previous / Next buttons */
.shepherd-element .shepherd-button {
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    font-family: system-ui, sans-serif !important;
    padding: 8px 16px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    line-height: 1 !important;
}
.shepherd-element .shepherd-button.gt-btn-prev {
    background: none !important;
    border: 1px solid #e5e7eb !important;
    color: #6b7280 !important;
}
.shepherd-element .shepherd-button.gt-btn-prev:hover {
    background: #f3f4f6 !important;
    color: #374151 !important;
}
.shepherd-element .shepherd-button.gt-btn-prev:disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
}

/* Play/Pause center button */
.shepherd-element .shepherd-button.gt-btn-play {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
    border: none !important;
    color: white !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35) !important;
}
.shepherd-element .shepherd-button.gt-btn-play:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%) !important;
    transform: scale(1.06);
}

.shepherd-element .shepherd-button.gt-btn-next {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
    border: none !important;
    color: white !important;
}
.shepherd-element .shepherd-button.gt-btn-next:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%) !important;
}

/* Finish button (last step) */
.shepherd-element .shepherd-button.gt-btn-finish {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    border: none !important;
    color: white !important;
}
.shepherd-element .shepherd-button.gt-btn-finish:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
}

/* Mute button */
.shepherd-element .shepherd-button.gt-btn-mute {
    width: 32px !important;
    height: 32px !important;
    border-radius: 6px !important;
    background: rgba(124, 58, 237, 0.08) !important;
    border: none !important;
    color: #7c3aed !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    right: 18px !important;
    top: auto !important;
}
.shepherd-element .shepherd-button.gt-btn-mute:hover {
    background: rgba(124, 58, 237, 0.15) !important;
}
.shepherd-element .shepherd-button.gt-btn-mute.gt-muted {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.08) !important;
}

/* Skip tour link */
.gt-skip-link {
    display: block;
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    padding: 6px 18px 12px;
    cursor: pointer;
    transition: color 0.15s ease;
    text-decoration: none;
}
.gt-skip-link:hover {
    color: #6b7280;
    text-decoration: underline;
}

/* =============================================
   8. FLOATING LAUNCHER BUTTON
   ============================================= */
#gt-launcher-btn {
    position: fixed !important;
    bottom: 90px !important;
    left: 24px !important;
    z-index: 99998 !important;
    width: 56px !important;
    height: 56px !important;
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
    color: white !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    cursor: pointer !important;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4), 0 0 0 0 rgba(124, 58, 237, 0.3) !important;
    transition: all 0.25s ease !important;
    animation: gt-pulse 3s ease-in-out infinite !important;
    padding: 0 !important;
}
#gt-launcher-btn:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%) !important;
    transform: scale(1.08) !important;
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5) !important;
    animation: none !important;
}
#gt-launcher-btn.gt-tour-active {
    animation: gt-playing-glow 1.5s ease-in-out infinite !important;
}

/* Completion badge */
.gt-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid white;
    font-family: system-ui, sans-serif;
    line-height: 1;
}
.gt-badge-progress {
    background: #7c3aed;
    color: white;
}
.gt-badge-complete {
    background: #10b981;
    color: white;
    width: 20px;
    padding: 0;
}

/* Label tooltip */
#gt-launcher-btn .gt-label {
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: #1f2937;
    color: #f9fafb;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    font-family: system-ui, sans-serif;
}
#gt-launcher-btn .gt-label::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #1f2937;
}
#gt-launcher-btn:hover .gt-label { opacity: 1; }

@keyframes gt-pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4), 0 0 0 0 rgba(124, 58, 237, 0.3); }
    50% { box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4), 0 0 0 8px rgba(124, 58, 237, 0); }
}
@keyframes gt-playing-glow {
    0%, 100% { box-shadow: 0 4px 15px rgba(124, 58, 237, 0.5), 0 0 0 0 rgba(124, 58, 237, 0.25); }
    50% { box-shadow: 0 4px 20px rgba(124, 58, 237, 0.6), 0 0 0 6px rgba(124, 58, 237, 0); }
}

/* =============================================
   9. TOUR MENU PANEL
   ============================================= */
#gt-menu-panel {
    position: fixed !important;
    bottom: 150px !important;
    left: 24px !important;
    z-index: 99998 !important;
    width: 340px;
    max-height: 420px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transform: translateY(12px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: system-ui, sans-serif;
    display: flex;
    flex-direction: column;
}
#gt-menu-panel.gt-open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

.gt-menu-header {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.gt-menu-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.gt-menu-header-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.gt-menu-title {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}
.gt-menu-subtitle {
    color: rgba(255,255,255,0.75);
    font-size: 11px;
    margin: 0;
    line-height: 1.3;
}
.gt-menu-close {
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    padding: 0;
}
.gt-menu-close:hover { background: rgba(255,255,255,0.3); }

/* Tour list */
.gt-menu-body {
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
}

/* Difficulty section headers */
.gt-section-header {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 6px;
}
.gt-section-header.gt-beginner { color: #10b981; }
.gt-section-header.gt-intermediate { color: #3b82f6; }
.gt-section-header.gt-advanced { color: #f59e0b; }

/* Individual tour row */
.gt-tour-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.gt-tour-row:hover { background: #f9fafb; }
.gt-tour-row.gt-locked {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tour icon */
.gt-tour-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.gt-tour-icon.gt-not-started { background: #f3f4f6; color: #6b7280; }
.gt-tour-icon.gt-completed { background: #10b981; color: white; }
.gt-tour-icon.gt-in-progress { background: #7c3aed; color: white; }
.gt-tour-icon.gt-locked-icon { background: #e5e7eb; color: #9ca3af; }

/* Tour info */
.gt-tour-info { flex: 1; min-width: 0; }
.gt-tour-name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gt-tour-desc {
    font-size: 11px;
    color: #9ca3af;
    margin: 0;
    line-height: 1.3;
}
.gt-tour-desc.gt-completed-text { color: #10b981; }

/* Tour meta (duration/status) */
.gt-tour-meta {
    font-size: 11px;
    color: #9ca3af;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.gt-tour-meta.gt-done {
    color: #10b981;
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
}

/* Footer progress */
.gt-menu-footer {
    padding: 12px 16px;
    border-top: 1px solid #f3f4f6;
    flex-shrink: 0;
}
.gt-footer-bar {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}
.gt-footer-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    border-radius: 2px;
    transition: width 0.5s ease;
}
.gt-footer-fill.gt-all-done {
    background: linear-gradient(90deg, #10b981, #34d399);
}
.gt-footer-text {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
    font-weight: 500;
}

/* =============================================
   10. MOBILE: HIDE TOUR SYSTEM ENTIRELY
   Tour is desktop-only — mobile screens are too
   small for meaningful element highlighting.
   ============================================= */
@media (max-width: 768px) {
    #gt-launcher-btn { display: none !important; }
    #gt-menu-panel { display: none !important; }
}
