/* ==========================================================================
   جلسه‌یار — موتور راهنمای تعاملی
   ========================================================================== */

:root {
    --jdw-guide-accent: #2563eb;
    --jdw-guide-accent-2: #0ea5e9;
    --jdw-guide-ink: #0f172a;
    --jdw-guide-muted: #64748b;
    --jdw-guide-surface: #ffffff;
    --jdw-guide-radius: 18px;
}

.jdw-guide-root {
    position: fixed;
    inset: 0;
    z-index: 100000;
    pointer-events: none;
    direction: rtl;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.jdw-guide-spotlight {
    position: fixed;
    border-radius: 14px;
    pointer-events: none;
    z-index: 100001;
    box-shadow:
        0 0 0 9999px rgba(8, 15, 33, .66),
        0 0 0 3px rgba(255, 255, 255, .92),
        0 0 0 8px rgba(37, 99, 235, .38);
    transition: left .35s cubic-bezier(.22, 1, .36, 1),
                top .35s cubic-bezier(.22, 1, .36, 1),
                width .35s cubic-bezier(.22, 1, .36, 1),
                height .35s cubic-bezier(.22, 1, .36, 1);
}

.jdw-guide-spotlight::after {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 20px;
    border: 2px solid rgba(96, 165, 250, .55);
    animation: jdwGuideRing 2.2s ease-out infinite;
}

.jdw-guide-arrow {
    position: fixed;
    width: 16px;
    height: 16px;
    background: var(--jdw-guide-surface);
    transform: rotate(45deg);
    z-index: 100002;
    border-radius: 2px;
    box-shadow: 0 8px 18px rgba(2, 6, 23, .18);
    pointer-events: none;
    transition: left .3s ease, top .3s ease;
}

.jdw-guide-tooltip {
    position: fixed;
    width: min(390px, calc(100vw - 24px));
    background: var(--jdw-guide-surface);
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: var(--jdw-guide-radius);
    box-shadow: 0 28px 70px rgba(2, 6, 23, .32);
    padding: 18px 18px 14px;
    z-index: 100003;
    pointer-events: auto;
    color: var(--jdw-guide-ink);
    overflow: hidden;
    animation: jdwGuidePop .28s cubic-bezier(.22, 1, .36, 1);
}

.jdw-guide-tooltip::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--jdw-guide-accent), var(--jdw-guide-accent-2));
    opacity: .95;
}

.jdw-guide-progress {
    position: absolute;
    inset: auto 0 0 0;
    height: 4px;
    background: #eef2f7;
}

.jdw-guide-progress > span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--jdw-guide-accent), var(--jdw-guide-accent-2));
    transition: width .18s linear;
}

.jdw-guide-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.jdw-guide-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .72rem;
    font-weight: 800;
    color: var(--jdw-guide-accent);
    background: #eff6ff;
    border: 1px solid #dbeafe;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.jdw-guide-close {
    border: 0;
    background: #f1f5f9;
    color: #475569;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    line-height: 1;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

.jdw-guide-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.jdw-guide-title {
    margin: 0 0 6px;
    font-size: 1.02rem;
    font-weight: 900;
    line-height: 1.7;
    color: var(--jdw-guide-ink);
}

.jdw-guide-text {
    margin: 0;
    font-size: .88rem;
    line-height: 1.95;
    color: #475569;
}

.jdw-guide-extra {
    margin-top: 12px;
}

.jdw-guide-extra:empty {
    display: none;
}

.jdw-guide-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.jdw-guide-btn {
    border: 0;
    border-radius: 12px;
    padding: 9px 16px;
    font-family: inherit;
    font-size: .82rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.jdw-guide-btn:active {
    transform: translateY(1px);
}

.jdw-guide-btn-primary {
    background: linear-gradient(135deg, var(--jdw-guide-accent), var(--jdw-guide-accent-2));
    color: #fff;
    box-shadow: 0 8px 20px rgba(37, 99, 235, .28);
}

.jdw-guide-btn-primary:hover {
    box-shadow: 0 12px 24px rgba(37, 99, 235, .34);
}

.jdw-guide-btn-ghost {
    background: #f1f5f9;
    color: #334155;
}

.jdw-guide-btn-ghost:hover {
    background: #e2e8f0;
}

.jdw-guide-btn-skip {
    background: transparent;
    color: #94a3b8;
    margin-inline-start: auto;
    padding-inline: 6px;
}

.jdw-guide-btn-skip:hover {
    color: #475569;
}

.jdw-guide-hint {
    margin-top: 10px;
    font-size: .68rem;
    color: #94a3b8;
    line-height: 1.7;
}

.jdw-guide-demo-result {
    border: 1px solid #bfdbfe;
    background: #f8fbff;
    border-radius: 14px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.jdw-guide-demo-result-title {
    font-weight: 800;
    font-size: .88rem;
}

.jdw-guide-demo-result-meta {
    font-size: .7rem;
    color: #64748b;
    margin-top: 3px;
}

.jdw-guide-demo-join {
    border: 1px dashed #bfdbfe;
    background: #f8fbff;
    border-radius: 14px;
    padding: 12px;
}

.jdw-guide-demo-join .form-control {
    background: #fff;
}

.jdw-guide-mock-room {
    margin-top: 6px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #dbeafe;
    background: #f8fbff;
}

.jdw-guide-mock-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: .7rem;
}

.jdw-guide-mock-dots {
    display: flex;
    gap: 4px;
}

.jdw-guide-mock-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #475569;
}

.jdw-guide-mock-body {
    min-height: 118px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #1e3a8a;
    background:
        radial-gradient(circle at 20% 0%, rgba(37, 99, 235, .12), transparent 45%),
        radial-gradient(circle at 90% 100%, rgba(14, 165, 233, .12), transparent 45%),
        #f8fbff;
    text-align: center;
    padding: 16px;
}

.jdw-guide-mock-body b {
    font-size: .86rem;
}

.jdw-guide-mock-body span {
    font-size: .7rem;
    color: #64748b;
}

.jdw-guide-sim-click {
    animation: jdwGuideClick .55s ease;
}

.jdw-guide-typing {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .18) !important;
    border-color: var(--jdw-guide-accent) !important;
}

/* ---------- Launcher ---------- */
.jdw-guide-launcher {
    position: fixed;
    inset-inline-start: 22px;
    bottom: 22px;
    z-index: 99990;
    direction: rtl;
    font-family: inherit;
}

.jdw-guide-launcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, .22);
    background: linear-gradient(135deg, #0f172a, #1e3a8a);
    color: #fff;
    border-radius: 999px;
    padding: 11px 16px;
    font-family: inherit;
    font-size: .8rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 16px 34px rgba(15, 23, 42, .28);
    transition: transform .2s ease, box-shadow .2s ease;
}

.jdw-guide-launcher-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(15, 23, 42, .34);
}

.jdw-guide-launcher-btn .jdw-guide-launcher-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 0 0 rgba(56, 189, 248, .65);
    animation: jdwGuidePulse 2s infinite;
}

.jdw-guide-launcher-menu {
    position: absolute;
    inset-inline-start: 0;
    bottom: calc(100% + 10px);
    width: 250px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 22px 55px rgba(2, 6, 23, .25);
    padding: 8px;
    animation: jdwGuidePop .22s ease;
}

.jdw-guide-launcher-menu[hidden] {
    display: none;
}

.jdw-guide-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 0;
    background: transparent;
    color: #1e293b;
    text-align: right;
    padding: 10px 11px;
    border-radius: 10px;
    font-family: inherit;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
}

.jdw-guide-menu-item:hover {
    background: #f1f5f9;
}

.jdw-guide-menu-item small {
    display: block;
    color: #94a3b8;
    font-size: .66rem;
    font-weight: 500;
    margin-top: 2px;
}

.jdw-guide-menu-sep {
    height: 1px;
    background: #eef2f7;
    margin: 6px 4px;
}

.jdw-topbar-help {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 999px;
    padding: 7px 12px;
    font-family: inherit;
    font-size: .74rem;
    font-weight: 800;
    cursor: pointer;
    margin-inline-end: 10px;
    transition: background .18s ease, border-color .18s ease;
}

.jdw-topbar-help:hover {
    background: #dbeafe;
    border-color: #bfdbfe;
}

/* ---------- Guide center ---------- */
.jdw-guide-center-hero {
    background: linear-gradient(135deg, #0f172a, #1e3a8a 60%, #0ea5e9);
    color: #fff;
    border-radius: 22px;
    padding: 28px;
    position: relative;
    overflow: hidden;
    margin-bottom: 22px;
}

.jdw-guide-center-hero::after {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .10);
    top: -120px;
    left: -60px;
}

.jdw-guide-center-hero h2 {
    font-size: 1.45rem;
    font-weight: 900;
    margin: 0 0 8px;
    position: relative;
    z-index: 1;
}

.jdw-guide-center-hero p {
    margin: 0;
    color: rgba(255, 255, 255, .82);
    font-size: .88rem;
    line-height: 1.9;
    max-width: 720px;
    position: relative;
    z-index: 1;
}

.jdw-guide-center-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.jdw-guide-role-tab {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    border-radius: 999px;
    padding: 7px 14px;
    font-family: inherit;
    font-size: .76rem;
    font-weight: 800;
    cursor: pointer;
}

.jdw-guide-role-tab.active {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
}

.jdw-guide-center-search {
    flex: 1;
    min-width: 220px;
}

.jdw-guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.jdw-guide-card {
    display: flex;
    flex-direction: column;
    gap: 9px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 18px;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.jdw-guide-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(15, 23, 42, .08);
    border-color: #bfdbfe;
}

.jdw-guide-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: #eff6ff;
    color: #1d4ed8;
}

.jdw-guide-card h3 {
    font-size: .94rem;
    font-weight: 900;
    margin: 0;
    color: #0f172a;
}

.jdw-guide-card p {
    font-size: .78rem;
    line-height: 1.85;
    color: #64748b;
    margin: 0;
    flex: 1;
}

.jdw-guide-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: .7rem;
    color: #94a3b8;
    margin-top: 2px;
}

.jdw-guide-card-btn {
    border: 0;
    border-radius: 11px;
    background: #0f172a;
    color: #fff;
    font-family: inherit;
    font-size: .76rem;
    font-weight: 800;
    padding: 9px 12px;
    cursor: pointer;
    margin-top: 4px;
}

.jdw-guide-card-btn:hover {
    background: #1e3a8a;
}

.jdw-guide-empty {
    padding: 40px 20px;
    text-align: center;
    color: #64748b;
}

/* ---------- Animations ---------- */
@keyframes jdwGuidePop {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes jdwGuideRing {
    0% { opacity: .85; transform: scale(.98); }
    70% { opacity: 0; transform: scale(1.06); }
    100% { opacity: 0; transform: scale(1.06); }
}

@keyframes jdwGuideClick {
    0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .45); }
    60% { box-shadow: 0 0 0 14px rgba(37, 99, 235, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

@keyframes jdwGuidePulse {
    0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, .65); }
    70% { box-shadow: 0 0 0 8px rgba(56, 189, 248, 0); }
    100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
    .jdw-guide-tooltip {
        left: 12px !important;
        right: 12px !important;
        top: auto !important;
        bottom: 12px;
        width: auto;
        max-height: 64vh;
        overflow-y: auto;
        border-radius: 18px 18px 14px 14px;
    }

    .jdw-guide-arrow {
        display: none;
    }

    .jdw-guide-launcher {
        inset-inline-start: 14px;
        bottom: 14px;
    }

    .jdw-guide-launcher-btn {
        width: 46px;
        height: 46px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
        font-size: 1rem;
    }

    .jdw-guide-launcher-btn .jdw-guide-launcher-label {
        display: none;
    }

    .jdw-guide-actions {
        gap: 6px;
    }

    .jdw-guide-btn {
        padding: 9px 13px;
    }

    .jdw-topbar-help {
        padding: 7px 9px;
        font-size: .68rem;
    }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .jdw-guide-spotlight,
    .jdw-guide-arrow,
    .jdw-guide-tooltip,
    .jdw-guide-launcher-btn,
    .jdw-guide-card {
        transition: none !important;
        animation: none !important;
    }

    .jdw-guide-spotlight::after,
    .jdw-guide-launcher-btn .jdw-guide-launcher-dot {
        animation: none !important;
    }
}
