﻿/* ============================================================================
   onboarding.css — طبقة عرض Guided Onboarding (نظام التوجيه التعليمي)
   كل القيم الهندسية تأتي من TutorialHost.Layout() كمتغيرات CSS على .kt-tour-root،
   حتى يبقى هذا الملف بصريًا فقط: لا حسابات أبعاد، لا قيم مكرّرة.
   ============================================================================ */

.kt-tour-root {
    position: fixed;
    inset: 0;
    z-index: 9049;                 /* الحاوية شفافة؛ كل طبقة تحمل z-indexها */
    pointer-events: none;          /* لا تحجب اللعبة */
    --kt-pad: 8px;                 /* PaddingDesktop — يضبطه C# */
    --kt-gap: 14px;                /* GapDesktop — يضبطه C# */
    --kt-margin: 16px;             /* MarginDesktop — يضبطه C# */
    --kt-hand: 44px;               /* HandDesktop — يضبطه C# */
    --kt-card-w: 380px;            /* CardWidthDesktop — يضبطه C# */
    --kt-radius: 7px;
    --kt-accent: #60853e;
    --kt-accent-soft: rgba(96, 133, 62, .18);
    --kt-ink: #30352d;
    --kt-ink-dim: #697064;
    --kt-surface: #f3f4f1;
    --kt-surface-2: #ffffff;
    --kt-border: #cdd2c7;
    --kt-scrim: rgba(32, 39, 29, .16);
    --kt-shadow: 0 5px 18px rgba(37, 46, 31, .14), 0 1px 0 #fff inset;
}

/* ── الحجاب المظلل: أربعة أشرطة حول الفتحة ──────────────────────────────── */
.kt-tour-spot {
    position: fixed;
    background: var(--kt-scrim);
    z-index: 9050;
    pointer-events: none;
    transition: opacity .18s ease;
}

/* ── إطار الإبراز حول الهدف ─────────────────────────────────────────────── */
.kt-tour-ring {
    position: fixed;
    z-index: 9051;
    pointer-events: none;
    border: 2px solid var(--kt-accent);
    border-radius: var(--kt-radius);
    box-shadow: 0 0 0 3px var(--kt-accent-soft), 0 0 22px rgba(96, 133, 62, .15);
    animation: kt-ring-pulse 2.4s ease-in-out infinite;
}

@keyframes kt-ring-pulse {
    0%, 100% { box-shadow: 0 0 0 3px var(--kt-accent-soft), 0 0 22px rgba(96, 133, 62, .12); }
    50%      { box-shadow: 0 0 0 6px var(--kt-accent-soft), 0 0 30px rgba(96, 133, 62, .22); }
}

/* ── يد التشير: رأسها (الإصبع) عند نقطة الهدف تمامًا ───────────────────── */
.kt-tour-hand {
    position: fixed;
    z-index: 9052;
    pointer-events: none;
    width: var(--kt-hand);
    height: var(--kt-hand);
    color: #fff;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .55));
    transform-origin: 50% 0%;      /* = موضع طرف الإصبع (زاوية الصندوق السفلية) */
    animation: kt-hand-bounce 1.6s ease-in-out infinite;
}

.kt-tour-hand svg { display: block; width: 100%; height: 100%; }

@keyframes kt-hand-bounce {
    0%, 100% { filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .55)); }
    50%      { filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .65)); }
}

/* نبضة نقطة اللمس */
.kt-tour-tip {
    position: fixed;
    z-index: 9052;
    pointer-events: none;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;          /* متمركزة على النقطة */
    border-radius: 50%;
    background: var(--kt-accent);
    box-shadow: 0 0 0 0 var(--kt-accent-soft);
    animation: kt-tip 1.6s ease-out infinite;
}

@keyframes kt-tip {
    0%   { box-shadow: 0 0 0 0 rgba(96, 133, 62, .45); }
    70%  { box-shadow: 0 0 0 12px rgba(96, 133, 62, 0); }
    100% { box-shadow: 0 0 0 0 rgba(96, 133, 62, 0); }
}

/* ── بطاقة الشرح ────────────────────────────────────────────────────────── */
.kt-tour-card {
    position: fixed;
    z-index: 9060;                 /* تحت 9999 (النوافذ المنبثقة) وفوق كل الواجهة */
    pointer-events: auto;
    width: var(--kt-card-w);
    max-width: calc(100vw - 2 * var(--kt-margin));
    box-sizing: border-box;
    background: linear-gradient(180deg, var(--kt-surface-2), var(--kt-surface));
    color: var(--kt-ink);
    border: 1px solid var(--kt-border);
    border-radius: 16px;
    box-shadow: var(--kt-shadow);
    padding: 14px 16px 12px;
    font-family: inherit;
    line-height: 1.75;
    animation: kt-fade-in .15s ease-out;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

@keyframes kt-card-in {
    from { opacity: 0; transform: translateY(6px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

.kt-tour-card__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.kt-tour-card__chapter {
    font-size: 12px;
    color: var(--kt-accent);
    background: #eef2e9;
    border: 1px solid #d4ddc9;
    border-radius: 999px;
    padding: 1px 9px;
    white-space: nowrap;
}

.kt-tour-card__count {
    font-size: 12px;
    color: var(--kt-ink-dim);
    margin-inline-start: auto;
    font-variant-numeric: tabular-nums;
}

.kt-tour-card__title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--kt-ink);
}

.kt-tour-card__body {
    font-size: 14px;
    color: var(--kt-ink);
    white-space: pre-line;        /* يحترم أسطر تعداد الوحدات */
    margin: 0 0 10px;
}

.kt-tour-card__risk {
    display: flex;
    gap: 8px;
    font-size: 13px;
    color: #922f23;
    background: rgba(220, 53, 69, .14);
    border: 1px solid rgba(220, 53, 69, .38);
    border-radius: 10px;
    padding: 8px 10px;
    margin: 0 0 10px;
}

.kt-tour-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--kt-border);
    padding-top: 10px;
}

.kt-tour-card__page {
    font-size: 12px;
    color: var(--kt-ink-dim);
    margin-inline-end: auto;
}

.kt-tour-btn {
    appearance: none;
    border: 1px solid var(--kt-border);
    background: #eef0eb;
    color: var(--kt-ink);
    border-radius: 10px;
    padding: 7px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, transform .1s ease;
}

.kt-tour-btn:hover { background: #e4e8de; }
.kt-tour-btn:active { transform: translateY(1px); }
.kt-tour-btn:focus-visible { outline: 2px solid var(--kt-accent); outline-offset: 2px; }

.kt-tour-btn--primary {
    background: linear-gradient(180deg, #84ad54, #628b3b);
    border-color: rgba(0, 0, 0, .25);
    color: #fff;
}

.kt-tour-btn--primary:hover { background: linear-gradient(180deg, #91b960, #6c9644); }

.kt-tour-btn--ghost {
    background: transparent;
    color: var(--kt-ink-dim);
    border-color: transparent;
    padding-inline: 8px;
}

.kt-tour-btn--ghost:hover { color: var(--kt-ink); background: #eef0eb; }

/* ── نافذة الاختيار: «لاعب جديد أم خبير؟» ───────────────────────────────── */
.kt-tour-choice-scrim {
    position: fixed;
    inset: 0;
    z-index: 9070;
    pointer-events: auto;
    background: rgba(29, 36, 26, .36);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: kt-fade-in .2s ease-out;
}

@keyframes kt-fade-in { from { opacity: 0; } to { opacity: 1; } }

.kt-tour-choice {
    width: 100%;
    max-width: 460px;
    background: linear-gradient(180deg, var(--kt-surface-2), var(--kt-surface));
    color: var(--kt-ink);
    border: 1px solid var(--kt-border);
    border-radius: 18px;
    box-shadow: var(--kt-shadow);
    padding: 20px;
    line-height: 1.8;
    animation: kt-fade-in .15s ease-out;
}

.kt-tour-choice h3 {
    margin: 0 0 6px;
    font-size: 18px;
    color: var(--kt-ink);
}

.kt-tour-choice p {
    margin: 0 0 14px;
    font-size: 14px;
    color: var(--kt-ink-dim);
}

.kt-tour-choice__opts {
    display: grid;
    gap: 10px;
}

.kt-tour-choice__opt {
    display: block;
    width: 100%;
    text-align: start;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--kt-border);
    background: #fff;
    color: var(--kt-ink);
    font: inherit;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.kt-tour-choice__opt:hover {
    border-color: rgba(96, 133, 62, .45);
    background: #eef2e9;
}

.kt-tour-choice__opt strong { display: block; font-size: 15px; color: var(--kt-ink); margin-bottom: 2px; }
.kt-tour-choice__opt span { font-size: 13px; color: var(--kt-ink-dim); }

.kt-tour-choice__later {
    margin-top: 12px;
    text-align: center;
    font-size: 12px;
    color: var(--kt-ink-dim);
}

/* ── قائمة الفصول الجانبية ──────────────────────────────────────────────── */
.kt-checklist {
    position: fixed;
    z-index: 9055;
    pointer-events: auto;
    inset-inline-end: var(--kt-margin);
    top: 96px;
    width: 264px;
    max-height: min(62vh, 520px);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--kt-surface-2), var(--kt-surface));
    color: var(--kt-ink);
    border: 1px solid var(--kt-border);
    border-radius: 14px;
    box-shadow: var(--kt-shadow);
    font-size: 13px;
    overflow: hidden;
}

.kt-checklist__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--kt-border);
    cursor: pointer;
    user-select: none;
}

.kt-checklist__head strong { font-size: 13px; color: var(--kt-ink); }
.kt-checklist__prog { margin-inline-start: auto; color: var(--kt-ink-dim); font-variant-numeric: tabular-nums; }

.kt-checklist__bar {
    height: 4px;
    background: rgba(255, 255, 255, .08);
    border-radius: 2px;
    overflow: hidden;
}

.kt-checklist__bar > i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #60853e, #89ad62);
    transition: width .3s ease;
}

.kt-checklist__body {
    overflow-y: auto;
    padding: 6px 0 8px;
    overscroll-behavior: contain;
}

.kt-checklist__chapter {
    padding: 6px 12px 2px;
    font-size: 11px;
    letter-spacing: .2px;
    color: var(--kt-ink-dim);
}

.kt-checklist__step {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 4px 12px;
    color: var(--kt-ink-dim);
}

.kt-checklist__step.is-done { color: #426e26; }
.kt-checklist__step.is-current { color: var(--kt-ink); background: #eef2e9; }

.kt-checklist__step i {
    font-style: normal;
    width: 14px;
    flex: 0 0 14px;
    text-align: center;
    line-height: 1.5;
}

/* ── الجوال: بطاقة كشيت سفلي بعرض كامل ──────────────────────────────────── */
@media (max-width: 600px) {
    .kt-tour-card {
        border-radius: 14px;
        padding: 10px 12px;
        overflow-y: auto;
        animation: kt-fade-in .15s ease-out;
    }

    @keyframes kt-sheet-in {
        from { opacity: 0; transform: translateY(18px); }
        to   { opacity: 1; transform: none; }
    }

    .kt-tour-card__title { font-size: 15px; }
    .kt-tour-card__body { font-size: 13.5px; }
    .kt-tour-btn { padding: 8px 14px; font-size: 13px; }

    .kt-checklist {
        inset-inline: var(--kt-margin);
        width: auto;
        top: auto;
        bottom: auto;
        top: calc(var(--kt-header-h, 74px) + 8px);
        max-height: 44vh;
    }

    .kt-tour-choice { padding: 16px; border-radius: 16px; }
}

/* ── أجهزة صغيرة جدًا أو شاشات منخفضة ──────────────────────────────────── */
@media (max-height: 520px) {
    .kt-tour-card { max-height: 62vh; overflow-y: auto; }
}

/* ── تقليل الحركة ────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .kt-tour-hand,
    .kt-tour-ring,
    .kt-tour-tip { animation: none !important; }
    .kt-tour-card,
    .kt-tour-choice,
    .kt-tour-choice-scrim { animation: none !important; }
}

.kt-tour-btn:disabled { opacity: .6; cursor: wait; }
.kt-tour-resume { position: fixed; bottom: calc(var(--kt-nav-h, 64px) + 16px); inset-inline-end: 16px; pointer-events: auto; }

.kt-tour-page-space { display: block; width: 1px; pointer-events: none; }
.kt-tour-action-anchor { display: inline-block; }
.kt-tour-card__collapse { margin-inline-start: 4px; font-size: 12px; padding: 2px 6px; }
.kt-tour-card.is-collapsed .kt-tour-card__head { margin-bottom: 0; }

/* Keep decisions visible while a long explanation scrolls inside the card. */
.kt-tour-card { display: flex; flex-direction: column; overflow: hidden; }
.kt-tour-card__head, .kt-tour-card__actions { flex-shrink: 0; }
.kt-tour-card__expanded:not([hidden]) { display: flex; flex-direction: column; min-height: 0; }
.kt-tour-card__details { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.kt-tour-card__actions { background: var(--kt-surface); }
.kt-tour-card__body img { vertical-align: middle; margin-inline: 2px; }

/* Classic game chrome: quiet white panels, fine gray rules and green actions. */
.kt-tour-card, .kt-checklist { border-radius: 8px; }
.kt-tour-btn { border-radius: 5px; min-height: 36px; }
.kt-tour-card__hint { margin: 0 0 10px; padding: 7px 10px; border-inline-start: 3px solid #7c975e; background: #edf1e8; font-size: 12px; }
.kt-tour-choice-scrim { box-sizing: border-box; overflow-y: auto; backdrop-filter: none; }
.kt-tour-choice { max-width: 590px; max-height: calc(100dvh - 32px); overflow-y: auto; box-sizing: border-box; border-radius: 10px; padding: 26px; border-top: 3px solid #7b965b; }
.kt-tour-choice__eyebrow { color: #75816b; font-size: 12px; margin-bottom: 6px; }
.kt-tour-choice h3 { font-size: 25px; margin-bottom: 8px; }
.kt-tour-choice__opts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kt-tour-choice__opt { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 18px; border-radius: 7px; min-width: 0; background: #fff; }
.kt-tour-choice__opt:hover { border-color: #8b9f78; background: #f9faf7; }
.kt-tour-choice__opt:focus-visible { outline: 2px solid #60853e; outline-offset: 3px; }
.kt-tour-choice__opt:disabled { opacity: .65; cursor: wait; }
.kt-tour-choice__icon { width: 66px; height: 66px; flex: 0 0 66px; }
.kt-tour-choice__copy { flex: 1; }
.kt-tour-choice__copy strong { font-size: 17px; margin-bottom: 6px; }
.kt-tour-choice__copy > span { display: block; font-size: 13px; line-height: 1.8; }
.kt-tour-choice__opt .kt-tour-choice__cta { display: flex; align-items: center; justify-content: space-between; align-self: stretch; border-top: 1px solid #e4e7df; padding-top: 10px; color: #536c3b; font-weight: 700; font-size: 13px; }
.kt-tour-choice__cta b { font-size: 18px; }
.kt-tour-choice__later { line-height: 1.7; margin-top: 16px; }
@media (max-width: 480px) {
    .kt-tour-choice { padding: 18px; }
    .kt-tour-choice h3 { font-size: 22px; }
    .kt-tour-choice__opts { grid-template-columns: minmax(0, 1fr); }
    .kt-tour-choice__opt { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 8px 12px; padding: 13px; }
    .kt-tour-choice__icon { width: 56px; height: 56px; }
    .kt-tour-choice__opt .kt-tour-choice__cta { grid-column: 2; padding-top: 6px; }
    .kt-tour-choice__copy strong { font-size: 15px; margin-bottom: 2px; }
    .kt-tour-choice__copy > span { font-size: 12px; }
    .kt-tour-btn { min-height: 44px; }
}
