/**
 * elTutors — In-App Help & Guidance System Stylesheet
 * Designed to Behance-level corporate standards with full RTL/LTR support.
 */

:root {
    --bh-help-primary: #0057FF;
    --bh-help-primary-subtle: #EBF2FF;
    --bh-help-dark: #0F172A;
    --bh-help-surface: #FFFFFF;
    --bh-help-border: #E2E8F0;
    --bh-help-text: #1E293B;
    --bh-help-muted: #64748B;
    --bh-help-warning: #D97706;
    --bh-help-success: #16A34A;
    --bh-help-radius: 12px;
    --bh-help-shadow: 0 12px 36px -4px rgba(15, 23, 42, 0.16), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
}

/* 1. Accessible Question Mark (?) Icon */
.bh-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: var(--bh-help-primary-subtle);
    color: var(--bh-help-primary);
    font-size: 0.72rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid rgba(0, 87, 255, 0.18);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    vertical-align: middle;
    margin-inline-start: 6px;
    outline: none;
    user-select: none;
    flex-shrink: 0;
}

.bh-help-icon:hover,
.bh-help-icon:focus-visible {
    background-color: var(--bh-help-primary);
    color: #FFFFFF;
    transform: scale(1.15);
    box-shadow: 0 0 0 3px rgba(0, 87, 255, 0.25);
}

/* 2. Help Mode Active Pulsing */
body.bh-help-mode-active [data-help-key] {
    position: relative;
    outline: 2px dashed var(--bh-help-primary) !important;
    outline-offset: 3px !important;
    background-color: rgba(0, 87, 255, 0.03) !important;
    transition: all 0.2s ease;
}

body.bh-help-mode-active .bh-help-icon {
    animation: bh-pulse 1.8s infinite;
    background-color: var(--bh-help-primary);
    color: #FFFFFF;
}

@keyframes bh-pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 87, 255, 0.5); }
    70% { box-shadow: 0 0 0 8px rgba(0, 87, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 87, 255, 0); }
}

/* 3. Floating Contextual Popover (Desktop) */
.bh-help-popover {
    position: absolute;
    z-index: 10050;
    width: 320px;
    max-width: calc(100vw - 32px);
    background: var(--bh-help-surface);
    border: 1px solid var(--bh-help-border);
    border-radius: var(--bh-help-radius);
    box-shadow: var(--bh-help-shadow);
    padding: 16px;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--bh-help-text);
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.bh-help-popover.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.bh-help-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--bh-help-border);
}

.bh-help-popover-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--bh-help-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bh-help-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
}

.bh-help-badge-financial { background: #FEF3C7; color: #B45309; }
.bh-help-badge-legal { background: #F1F5F9; color: #475569; }
.bh-help-badge-tooltip { background: var(--bh-help-primary-subtle); color: var(--bh-help-primary); }

.bh-help-popover-body {
    max-height: 260px;
    overflow-y: auto;
    scrollbar-width: thin;
    padding-inline-end: 4px;
}

.bh-help-example-box {
    background-color: #F8FAFC;
    border-inline-start: 3px solid var(--bh-help-primary);
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 0.82rem;
}

.bh-help-note-box {
    background-color: #FFFBEB;
    border-inline-start: 3px solid var(--bh-help-warning);
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 8px;
    font-size: 0.82rem;
    color: #92400E;
}

.bh-help-popover-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--bh-help-border);
    font-size: 0.82rem;
}

.bh-help-learn-more {
    color: var(--bh-help-primary);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: transform 0.15s ease;
}

.bh-help-learn-more:hover {
    text-decoration: underline;
    transform: translateX(-2px);
}
[dir="ltr"] .bh-help-learn-more:hover {
    transform: translateX(2px);
}

/* 4. Mobile Bottom Sheet Overlay */
.bh-help-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    z-index: 10060;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.bh-help-sheet-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.bh-help-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bh-help-surface);
    border-radius: 20px 20px 0 0;
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 10070;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
}

.bh-help-bottom-sheet.active {
    transform: translateY(0);
}

.bh-help-sheet-handle {
    width: 44px;
    height: 5px;
    background: #CBD5E1;
    border-radius: 3px;
    margin: 0 auto 16px auto;
}

/* 5. Guided Tour Spotlight & Backdrop */
.bh-tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 10080;
    pointer-events: none;
    transition: all 0.3s ease;
}

.bh-tour-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    z-index: 10079;
    pointer-events: none !important;
    display: none !important;
    opacity: 0;
    transition: opacity 0.25s ease, background 0.25s ease;
}

.bh-tour-backdrop.active {
    display: block !important;
    pointer-events: auto !important;
    opacity: 1;
}

.bh-tour-backdrop.transparent-backdrop {
    background: transparent !important;
}

.bh-tour-spotlight {
    position: absolute;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.72), 0 0 25px rgba(0, 87, 255, 0.45);
    border: 3px solid var(--bh-help-primary);
    border-radius: 12px;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10081;
    background: transparent !important;
}

.bh-tour-highlighted-element {
    position: relative !important;
    z-index: 10082 !important;
    box-shadow: 0 0 0 4px #0057FF, 0 10px 30px rgba(0, 87, 255, 0.35) !important;
    border-radius: 8px !important;
    transition: box-shadow 0.3s ease !important;
    pointer-events: auto !important;
}

.bh-tour-card {
    position: absolute;
    z-index: 10085;
    width: 360px;
    max-width: calc(100vw - 32px);
    background: var(--bh-help-surface);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bh-tour-progress-bar {
    height: 4px;
    background: #E2E8F0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 14px;
}

.bh-tour-progress-fill {
    height: 100%;
    background: var(--bh-help-primary);
    transition: width 0.3s ease;
}

/* 6. Quick Help Floating Widget Button */
.bh-floating-help-btn {
    position: fixed;
    bottom: 24px;
    inset-inline-end: 24px;
    z-index: 9990;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bh-help-primary);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 8px 24px rgba(0, 87, 255, 0.35);
    border: none;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.bh-floating-help-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 30px rgba(0, 87, 255, 0.45);
}
