/**
 * Tour Onboarding Styles
 * ======================
 * 
 * Styles for spotlight overlay, tooltips, modals, and progress indicators.
 * Compatible with dark mode via CSS variables.
 */

/* ============================================================================
   SPOTLIGHT OVERLAY
   ============================================================================ */

/* Parent container - must be ghostly to allow clicks through */
#tour-overlay-container {
    pointer-events: none !important;  /* Allow clicks to pass through container */
}

/* Keep tooltip clickable even though parent has pointer-events: none */
#tour-overlay-container .tour-tooltip {
    pointer-events: auto !important;
}

/* Spotlight overlay - solid background with clip-path cutout */
.tour-spotlight-overlay,
#tour-spotlight-active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);  /* Solid background - hole cut with clip-path */
    pointer-events: none !important; /* Don't block clicks - cutout reveals target naturally */
    z-index: 19990 !important;  /* Above bulk editor modal (2000) but below tooltip (20000) */
    transition: clip-path 0.3s ease;
}

/* Purple border around highlighted element (created by JavaScript for non-card components) */
#tour-highlight-border {
    position: fixed;
    border: 3px solid var(--brand-purple, #B429FF);
    border-radius: 8px;
    pointer-events: none;
    z-index: 19995 !important;  /* Above overlay (19990), below tooltip (20000) */
    box-shadow: 0 0 20px rgba(180, 41, 255, 0.6);
    transition: opacity 0.3s ease, transform 0.3s ease, top 0.3s ease, left 0.3s ease, width 0.3s ease, height 0.3s ease;
    animation: pulse-border 2s ease-in-out infinite;
    display: block;  /* Ensure always visible when element exists */
    opacity: 0;  /* Start hidden, will animate to 1 */
    transform: scale(0.95);  /* Start slightly smaller for smooth entrance */
}

#tour-highlight-border.show {
    opacity: 1;
    transform: scale(1);
}

/* Purple border applied directly to card components during tour */
.tour-active {
    border: 3px solid var(--brand-purple, #B429FF) !important;
    box-shadow: 0 0 20px rgba(180, 41, 255, 0.6) !important;
    animation: pulse-border 2s ease-in-out infinite !important;
    position: relative !important;
    z-index: 19995 !important;  /* Above overlay (19990), below tooltip (20000) */
    transition: border-color 0.3s ease, box-shadow 0.3s ease !important;
}

@keyframes pulse-border {
    0%, 100% {
        box-shadow: 0 0 20px rgba(180, 41, 255, 0.6);
    }
    50% {
        box-shadow: 0 0 30px rgba(180, 41, 255, 0.8);
    }
}

/* ============================================================================
   TOUR TOOLTIP
   ============================================================================ */

.tour-tooltip {
    position: fixed;
    background-color: var(--bg-primary, #FFFFFF);
    color: var(--text-primary, #1F2937);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 380px;
    min-width: 300px;
    z-index: 20000 !important;  /* Above bulk editor modal (2000) and all other modals */
    border: 2px solid var(--brand-purple, #B429FF);
    pointer-events: auto;  /* Allow interaction */
    opacity: 0;  /* Initially hidden, shown by JS */
    transform: scale(0.95) translateY(-10px);  /* Start slightly smaller and higher */
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.tour-tooltip.show {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* For centered tooltips, only animate opacity (transform is set inline for centering) */
.tour-tooltip.centered {
    transform: translate(-50%, -50%) scale(0.95);
}

.tour-tooltip.centered.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Tooltip arrow (optional - add positioning variants) */
.tour-tooltip::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.tour-tooltip-right::before {
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 10px 10px 10px 0;
    border-color: transparent var(--brand-purple, #B429FF) transparent transparent;
}

.tour-tooltip-left::before {
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent var(--brand-purple, #B429FF);
}

.tour-tooltip-top::before {
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0 10px;
    border-color: var(--brand-purple, #B429FF) transparent transparent transparent;
}

.tour-tooltip-bottom::before {
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 10px 10px 10px;
    border-color: transparent transparent var(--brand-purple, #B429FF) transparent;
}

/* ============================================================================
   PROGRESS INDICATOR
   ============================================================================ */

.tour-progress-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.tour-step-badge {
    background-color: var(--brand-purple, #B429FF);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.tour-progress-bar {
    flex: 1;
    height: 6px;
    background-color: var(--bg-secondary, #F3F4F6);
    border-radius: 3px;
    overflow: hidden;
}

.tour-progress-fill {
    height: 100%;
    background-color: var(--brand-purple, #B429FF);
    transition: width 0.3s ease;
}

/* ============================================================================
   TOUR MODALS
   ============================================================================ */

.tour-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--bg-primary, #FFFFFF);
    border-radius: 16px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    z-index: 10001;
    animation: modal-fade-in 0.3s ease;
}

@keyframes modal-fade-in {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.tour-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    animation: overlay-fade-in 0.3s ease;
}

@keyframes overlay-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tour-modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.tour-modal-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary, #1F2937);
    margin: 0 0 12px 0;
}

.tour-modal-subtitle {
    font-size: 16px;
    color: var(--text-secondary, #6B7280);
    margin: 0;
}

.tour-modal-body {
    margin-bottom: 24px;
}

.tour-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ============================================================================
   TOUR INFO CARDS (for modals)
   ============================================================================ */

.tour-info-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    background-color: var(--bg-secondary, #F9FAFB);
    border-radius: 8px;
    border: 1px solid var(--border-primary, #E5E7EB);
    margin-bottom: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tour-info-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tour-info-card:last-child {
    margin-bottom: 0;
}

.tour-card-icon {
    font-size: 32px;
    line-height: 1;
    min-width: 40px;
    text-align: center;
}

.tour-card-content {
    flex: 1;
}

.tour-card-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #1F2937);
}

.tour-card-description {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary, #6B7280);
    line-height: 1.5;
}

/* ============================================================================
   TOUR BUTTONS
   ============================================================================ */

.tour-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
}

.tour-btn-primary {
    background-color: var(--brand-purple, #B429FF);
    color: white;
}

.tour-btn-primary:hover {
    background-color: var(--brand-purple-hover, #9A1FE6);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(180, 41, 255, 0.3);
}

.tour-btn-secondary {
    background-color: transparent;
    color: var(--text-secondary, #6B7280);
    border: 1px solid var(--border-primary, #E5E7EB);
}

.tour-btn-secondary:hover {
    background-color: var(--bg-secondary, #F9FAFB);
}

/* Disabled Next button styling - greyed out until action completes */
#tour-next-step-btn:disabled,
#tour-next-step-btn[disabled] {
    background-color: var(--bg-secondary, #E5E7EB) !important;
    color: var(--text-secondary, #9CA3AF) !important;
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    border: 1px solid var(--border-primary, #D1D5DB) !important;
}

#tour-next-step-btn:disabled:hover,
#tour-next-step-btn[disabled]:hover {
    background-color: var(--bg-secondary, #E5E7EB) !important;
    transform: none !important;
    box-shadow: none !important;
}

/* ============================================================================
   MOBILE RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .tour-tooltip {
        max-width: 90vw;
        min-width: unset;
        padding: 16px;
    }
    
    .tour-modal {
        width: 95%;
        padding: 24px;
        max-height: 90vh;
    }
    
    .tour-modal-title {
        font-size: 24px;
    }
    
    .tour-info-card {
        flex-direction: column;
        text-align: center;
    }
    
    .tour-card-icon {
        font-size: 48px;
        margin: 0 auto;
    }
}

/* ============================================================================
   BANK ACCORDION STYLING (Theme-aware)
   ============================================================================ */

.tour-bank-accordion .accordion-button {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

.tour-bank-accordion .accordion-button:not(.collapsed) {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(180, 100, 255, 0.25) !important;
}

.tour-bank-accordion .accordion-button:focus {
    border-color: var(--brand-purple) !important;
    box-shadow: 0 0 0 0.25rem rgba(180, 100, 255, 0.25) !important;
}

.tour-bank-accordion .accordion-button::after {
    filter: brightness(0) saturate(100%) invert(1);
}

[data-theme="light"] .tour-bank-accordion .accordion-button::after {
    filter: brightness(0) saturate(100%);
}

.tour-bank-accordion .accordion-body {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

.tour-bank-accordion .accordion-item {
    background-color: var(--bg-primary) !important;
    border-color: var(--border-primary) !important;
}

.tour-bank-accordion-item .accordion-button {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

.tour-bank-accordion-item .accordion-button:not(.collapsed) {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

/* ============================================================================
   DARK MODE COMPATIBILITY
   ============================================================================ */

[data-theme="dark"] .tour-tooltip {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--brand-purple);
}

[data-theme="dark"] .tour-modal {
    background-color: var(--bg-primary);
}

[data-theme="dark"] .tour-info-card {
    background-color: var(--bg-secondary);
    border-color: var(--border-primary);
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes tour-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.tour-tooltip.shake {
    animation: tour-shake 0.3s ease;
}

/* Fade in animation for tour elements */
.tour-fade-in {
    animation: fade-in 0.3s ease;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
