/* ============================================================
   SchoolERP — interactive guided-tour + onboarding engine
   A self-contained spotlight tour (no external library).
   Themes off app.css variables, so it follows light/dark + RTL.
   ============================================================ */

.sg-blocker {
    position: fixed;
    inset: 0;
    z-index: 21000;
    cursor: default;
    background: transparent;
    animation: sg-bg-in .25s ease;
}

/* The spotlight hole. Its huge box-shadow IS the page dimmer. */
.sg-spot {
    position: fixed;
    z-index: 21001;
    border-radius: 14px;
    box-shadow: 0 0 0 9999px rgba(8, 12, 30, .58);
    transition: top .42s cubic-bezier(.22, 1, .36, 1),
                left .42s cubic-bezier(.22, 1, .36, 1),
                width .42s cubic-bezier(.22, 1, .36, 1),
                height .42s cubic-bezier(.22, 1, .36, 1);
    pointer-events: none;
}

:root[data-theme="dark"] .sg-spot {
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, .68);
}

.sg-spot::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 16px;
    border: 2.5px solid var(--primary, #5b5fef);
    animation: sg-ring 1.7s cubic-bezier(.22, 1, .36, 1) infinite;
}

.sg-spot.sg-centered {
    box-shadow: 0 0 0 9999px rgba(8, 12, 30, .62);
}
.sg-spot.sg-centered::after { display: none; }

/* Tooltip card */
.sg-pop {
    position: fixed;
    z-index: 21002;
    width: min(360px, calc(100vw - 32px));
    background: var(--card, #fff);
    color: var(--text, #1b2559);
    border: 1px solid var(--border, #e6edf5);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(8, 12, 30, .35);
    padding: 18px 18px 14px;
    font-family: var(--font, 'Cairo', 'Segoe UI', sans-serif);
    animation: sg-pop-in .34s cubic-bezier(.22, 1, .36, 1);
}

.sg-pop__arrow {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--card, #fff);
    border: 1px solid var(--border, #e6edf5);
    transform: rotate(45deg);
}

.sg-pop__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .4px;
    color: var(--primary, #5b5fef);
    background: var(--primary-soft, #f3f3ff);
    border-radius: 999px;
    padding: 4px 10px;
    margin-bottom: 10px;
}

.sg-pop__title {
    font-size: 17px;
    font-weight: 800;
    margin: 0 0 6px;
    line-height: 1.3;
    color: var(--text, #1b2559);
}

.sg-pop__body {
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--text-muted, #8f9bba);
    margin: 0 0 14px;
}

.sg-pop__foot {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sg-dots {
    display: flex;
    gap: 6px;
    flex: 1;
    flex-wrap: wrap;
}
.sg-dots i {
    width: 7px;
    height: 7px;
    border-radius: 99px;
    background: var(--border, #d9e1ec);
    transition: all .25s ease;
}
.sg-dots i.on {
    width: 20px;
    background: var(--primary, #5b5fef);
}

.sg-btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 800;
    font-size: 13px;
    border-radius: 11px;
    padding: 9px 16px;
    transition: transform .12s ease, filter .15s ease, background .15s ease;
}
.sg-btn:active { transform: scale(.95); }

.sg-btn--ghost {
    background: transparent;
    color: var(--text-muted, #8f9bba);
    padding: 9px 12px;
}
.sg-btn--ghost:hover { color: var(--text, #1b2559); }

.sg-btn--primary {
    background: linear-gradient(135deg, #5b5fef, #8a5cf6);
    color: #fff;
    box-shadow: 0 8px 20px rgba(91, 95, 239, .35);
}
.sg-btn--primary:hover { filter: brightness(1.06); }

.sg-close {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: none;
    background: transparent;
    color: var(--text-muted, #8f9bba);
    border-radius: 8px;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
}
.sg-close:hover { background: var(--track, #eef1f6); color: var(--text); }

/* ===================== Welcome / onboarding ===================== */
.sg-welcome-bg {
    position: fixed;
    inset: 0;
    z-index: 21000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: radial-gradient(120% 120% at 50% 0%, rgba(91, 95, 239, .35), rgba(8, 12, 30, .82));
    backdrop-filter: blur(7px);
    animation: sg-bg-in .35s ease;
}

.sg-welcome {
    width: min(560px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    background: var(--card, #fff);
    border: 1px solid var(--border, #e6edf5);
    border-radius: 26px;
    box-shadow: 0 40px 90px rgba(8, 12, 30, .5);
    padding: 30px 30px 26px;
    text-align: center;
    font-family: var(--font, 'Cairo', 'Segoe UI', sans-serif);
    animation: sg-rise .5s cubic-bezier(.22, 1, .36, 1);
}

.sg-welcome__hero {
    width: 74px;
    height: 74px;
    margin: 0 auto 16px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #5b5fef, #8a5cf6);
    box-shadow: 0 16px 34px rgba(91, 95, 239, .45);
    animation: sg-float 3.4s ease-in-out infinite;
}
.sg-welcome__hero svg { width: 40px; height: 40px; }

.sg-welcome__title {
    font-size: 23px;
    font-weight: 800;
    margin: 0 0 6px;
    color: var(--text, #1b2559);
}
.sg-welcome__sub {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-muted, #8f9bba);
    margin: 0 0 18px;
}

.sg-welcome__prompt {
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--text-muted, #8f9bba);
    margin: 0 0 12px;
}

.sg-langs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 22px;
}

.sg-lang {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding: 16px 8px;
    border: 1.5px solid var(--border, #e6edf5);
    border-radius: 18px;
    background: var(--surface-2, #fbfcfe);
    cursor: pointer;
    text-decoration: none;
    color: var(--text, #1b2559);
    font-weight: 800;
    font-size: 14px;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
    opacity: 0;
    animation: sg-fade-up .5s ease forwards;
}
.sg-lang:nth-child(1) { animation-delay: .12s; }
.sg-lang:nth-child(2) { animation-delay: .20s; }
.sg-lang:nth-child(3) { animation-delay: .28s; }

.sg-lang:hover {
    transform: translateY(-4px);
    border-color: var(--primary, #5b5fef);
    box-shadow: 0 14px 30px rgba(91, 95, 239, .22);
}
.sg-lang.on {
    border-color: var(--primary, #5b5fef);
    box-shadow: 0 0 0 3px var(--primary-soft, #f3f3ff);
}

.sg-lang .flag {
    width: 48px;
    height: 32px;
    border-radius: 7px;
    box-shadow: 0 3px 8px rgba(8, 12, 30, .18);
    overflow: hidden;
}

.sg-welcome__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}
.sg-welcome__actions .sg-btn--primary { padding: 12px 26px; font-size: 14px; }

/* ===================== Floating help button ===================== */
.guide-fab {
    position: fixed;
    bottom: 22px;
    inset-inline-end: 22px;
    z-index: 1200;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #5b5fef, #8a5cf6);
    box-shadow: 0 12px 28px rgba(91, 95, 239, .45);
    display: grid;
    place-items: center;
    transition: transform .16s ease, box-shadow .16s ease;
}
.guide-fab:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 16px 34px rgba(91, 95, 239, .55); }
.guide-fab:active { transform: scale(.94); }
.guide-fab svg { width: 24px; height: 24px; }

/* First-visit hint pill (sits just above the floating help button) */
.sg-hint {
    position: fixed;
    bottom: 84px;
    inset-inline-end: 22px;
    z-index: 1250;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 330px;
    background: var(--card, #fff);
    color: var(--text, #1b2559);
    border: 1px solid var(--border, #e6edf5);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(8, 12, 30, .28);
    padding: 10px 12px;
    font-family: var(--font, 'Cairo', 'Segoe UI', sans-serif);
    animation: sg-hint-in .35s cubic-bezier(.22, 1, .36, 1);
}
.sg-hint--out { animation: sg-hint-out .3s ease forwards; }
.sg-hint__ic { font-size: 18px; line-height: 1; }
.sg-hint__tx { font-size: 13px; font-weight: 600; line-height: 1.4; flex: 1; }
.sg-hint__go {
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 800;
    font-size: 12.5px;
    color: #fff;
    background: linear-gradient(135deg, #5b5fef, #8a5cf6);
    border-radius: 9px;
    padding: 7px 12px;
    white-space: nowrap;
}
.sg-hint__x {
    border: none;
    background: transparent;
    color: var(--text-muted, #8f9bba);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px 4px;
}
@keyframes sg-hint-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes sg-hint-out { to { opacity: 0; transform: translateY(14px); } }

@media print { .guide-fab, .sg-blocker, .sg-spot, .sg-pop, .sg-welcome-bg, .sg-hint { display: none !important; } }

/* ===================== Keyframes ===================== */
@keyframes sg-bg-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sg-pop-in { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes sg-rise { from { opacity: 0; transform: translateY(26px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes sg-fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes sg-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes sg-ring {
    0% { box-shadow: 0 0 0 0 rgba(91, 95, 239, .45); }
    70% { box-shadow: 0 0 0 14px rgba(91, 95, 239, 0); }
    100% { box-shadow: 0 0 0 0 rgba(91, 95, 239, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .sg-spot, .sg-pop, .sg-welcome, .sg-lang, .sg-welcome__hero, .sg-spot::after { animation: none !important; transition: none !important; }
}
