/*
 * ezHelp: Help dialog, written guide and driver.js tour skin.
 * SAME FILE in src/AdminUI.STS.Identity/wwwroot/help/ and src/Skoruba.IdentityServer4.Admin.UI/wwwroot/help/.
 * Colours are --ezh-* tokens; each app may override them in its own stylesheet (Admin: ezadmin.css).
 * Defaults = DESIGN.md tokens of the STS.
 */
:root {
    --ezh-primary: #186FF4;
    --ezh-primary-strong: #0d5ed4;
    --ezh-primary-soft: #E1E9FF;
    --ezh-text: #4B465C;
    --ezh-heading: #2f2b3d;
    --ezh-muted: #8E8B99;
    --ezh-border: #DBDADE;
    --ezh-canvas: #F8F7FA;
    --ezh-surface: #ffffff;
    --ezh-ok: #28c76f;
    --ezh-shadow: 0 12px 32px rgba(47, 43, 61, 0.18), 0 4px 10px rgba(47, 43, 61, 0.08);
    --ezh-backdrop: rgba(15, 23, 42, 0.45);
    --ezh-font: "Public Sans", "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Vuexy dark theme */
.dark-layout {
    --ezh-text: #b6bee3;
    --ezh-heading: #d0d4f1;
    --ezh-muted: #7983bb;
    --ezh-border: #3b4253;
    --ezh-canvas: #161d31;
    --ezh-surface: #283046;
    --ezh-primary-soft: rgba(24, 111, 244, 0.18);
    --ezh-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    --ezh-backdrop: rgba(2, 6, 15, 0.7);
}

html.ezh-lock, html.ezh-lock body { overflow: hidden; }

.ezh-ico { width: 18px; height: 18px; flex-shrink: 0; display: block; }
.ezh-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header "?" button (markup in each layout) ---------- */
.ezh-open-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; padding: 0;
    border: 1px solid var(--ezh-border); border-radius: 10px;
    background: var(--ezh-surface); color: var(--ezh-muted);
    cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.ezh-open-btn:hover, .ezh-open-btn:focus-visible {
    border-color: var(--ezh-primary); color: var(--ezh-primary); background: var(--ezh-primary-soft); outline: none;
}
.ezh-open-btn .ezh-ico { width: 19px; height: 19px; }

/* Floating button on pages without a header (sign-in, register...): top-right over the gradient. */
.ezh-fab {
    position: fixed; top: 16px; right: 16px; z-index: 1030;
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 14px 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 999px;
    background: rgba(255, 255, 255, 0.12); color: #fff;
    font-family: var(--ezh-font); font-size: 13.5px; font-weight: 600;
    cursor: pointer; backdrop-filter: blur(6px);
    transition: background .15s, border-color .15s;
}
.ezh-fab:hover, .ezh-fab:focus-visible { background: rgba(255, 255, 255, 0.22); border-color: #fff; outline: none; }

/* ---------- backdrop ---------- */
.ezh-backdrop {
    position: fixed; inset: 0; z-index: 2000;
    background: var(--ezh-backdrop);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 9vh 16px 16px;
    font-family: var(--ezh-font);
    animation: ezh-fade .14s ease-out;
}
.ezh-backdrop[hidden] { display: none; }
@keyframes ezh-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Help dialog ---------- */
.ezh-dialog {
    width: 100%; max-width: 600px;
    max-height: calc(100vh - 9vh - 16px);
    display: flex; flex-direction: column;
    background: var(--ezh-surface); color: var(--ezh-text);
    border: 1px solid var(--ezh-border); border-radius: 16px;
    box-shadow: var(--ezh-shadow);
    overflow: hidden;
}
.ezh-dialog-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 14px; }
.ezh-badge {
    width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--ezh-primary-soft); color: var(--ezh-primary);
}
.ezh-dialog-heading { flex: 1; min-width: 0; }
.ezh-dialog-heading h2 { margin: 0; font-size: 18px; font-weight: 600; color: var(--ezh-heading); line-height: 1.3; }
.ezh-dialog-heading p { margin: 2px 0 0; font-size: 13.5px; color: var(--ezh-muted); }
.ezh-x {
    width: 32px; height: 32px; flex-shrink: 0; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 8px; background: transparent; color: var(--ezh-muted); cursor: pointer;
}
.ezh-x:hover, .ezh-x:focus-visible { background: var(--ezh-primary-soft); color: var(--ezh-heading); outline: none; }

.ezh-search {
    display: flex; align-items: center; gap: 8px;
    margin: 0 20px; height: 44px; padding: 0 12px;
    border: 1.5px solid var(--ezh-border); border-radius: 8px;
    background: var(--ezh-surface); color: var(--ezh-muted);
    transition: border-color .18s, box-shadow .18s;
}
.ezh-search:focus-within { border-color: var(--ezh-primary); box-shadow: 0 0 0 3px rgba(24, 111, 244, 0.15); }
.ezh-search input {
    flex: 1; min-width: 0; height: 100%;
    border: 0; outline: none; background: transparent;
    font: inherit; font-size: 14px; color: var(--ezh-heading);
}
.ezh-search input::placeholder { color: var(--ezh-muted); }
.ezh-search input::-webkit-search-cancel-button { cursor: pointer; }

.ezh-list { flex: 1; overflow-y: auto; padding: 6px 12px 14px; outline: none; }
.ezh-group { padding-top: 10px; }
.ezh-group h3 {
    margin: 0; padding: 0 8px 4px;
    font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ezh-muted);
}
.ezh-group ul { list-style: none; margin: 0; padding: 0; }
.ezh-row { display: flex; align-items: stretch; gap: 2px; border-radius: 10px; }
.ezh-row:hover { background: var(--ezh-canvas); }
.ezh-row-main {
    flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 10px;
    padding: 9px 8px; border: 0; border-radius: 10px; background: transparent;
    text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.ezh-row-main:focus-visible, .ezh-row-read:focus-visible { outline: 2px solid var(--ezh-primary); outline-offset: -2px; }
.ezh-row-ico { color: var(--ezh-primary); padding-top: 1px; }
.ezh-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ezh-row-text b { font-size: 14px; font-weight: 600; color: var(--ezh-heading); }
.ezh-row-text span { font-size: 12.5px; color: var(--ezh-muted); line-height: 1.45; }
.ezh-row-done { color: var(--ezh-ok); padding-top: 1px; }
.ezh-row-read {
    width: 38px; flex-shrink: 0; border: 0; border-radius: 10px; background: transparent;
    color: var(--ezh-muted); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.ezh-row-read:hover { color: var(--ezh-primary); background: var(--ezh-primary-soft); }

.ezh-empty { padding: 32px 8px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.ezh-empty b { color: var(--ezh-heading); font-size: 14px; }
.ezh-empty span { color: var(--ezh-muted); font-size: 13px; }

.ezh-dialog-foot {
    padding: 10px 20px; border-top: 1px solid var(--ezh-border);
    font-size: 12px; color: var(--ezh-muted); background: var(--ezh-canvas);
}
.ezh-dialog-foot strong {
    display: inline-block; padding: 0 6px; border: 1px solid var(--ezh-border); border-radius: 4px;
    background: var(--ezh-surface); font-family: ui-monospace, Menlo, monospace; font-size: 11px; font-weight: 500;
    color: var(--ezh-text);
}

/* ---------- written guide: right sheet (bottom sheet on phones) ---------- */
.ezh-backdrop-sheet { padding: 0; justify-content: flex-end; align-items: stretch; }
.ezh-sheet {
    width: 100%; max-width: 480px; height: 100%;
    display: flex; flex-direction: column;
    background: var(--ezh-surface); color: var(--ezh-text);
    box-shadow: var(--ezh-shadow);
    animation: ezh-slide .18s ease-out;
    overflow-y: auto; overscroll-behavior: contain;
}
@keyframes ezh-slide { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.ezh-sheet-head {
    position: sticky; top: 0; z-index: 1;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--ezh-surface); border-bottom: 1px solid var(--ezh-border);
}
.ezh-sheet-body { padding: 18px 22px 32px; font-size: 14px; line-height: 1.6; }
.ezh-sheet-body h2 { margin: 0 0 6px; font-size: 20px; font-weight: 600; color: var(--ezh-heading); line-height: 1.3; }
.ezh-sheet-body h3 {
    margin: 22px 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ezh-muted);
}
.ezh-sheet-body strong { color: var(--ezh-heading); font-weight: 600; }
.ezh-lead { margin: 0 0 14px; }
.ezh-steps { margin: 0; padding: 0; list-style: none; counter-reset: ezh; }
.ezh-steps li { position: relative; padding: 0 0 10px 34px; counter-increment: ezh; }
.ezh-steps li::before {
    content: counter(ezh); position: absolute; left: 0; top: 1px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--ezh-primary-soft); color: var(--ezh-primary);
    font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center;
}
.ezh-tips { margin: 0; padding-left: 20px; }
.ezh-tips li { margin-bottom: 6px; }
.ezh-faq details { border: 1px solid var(--ezh-border); border-radius: 8px; margin-bottom: 8px; background: var(--ezh-surface); }
.ezh-faq summary { padding: 10px 12px; cursor: pointer; font-weight: 600; color: var(--ezh-heading); }
.ezh-faq details[open] summary { border-bottom: 1px solid var(--ezh-border); }
.ezh-faq p { margin: 0; padding: 10px 12px; }
.ezh-related { margin: 0; padding: 0; list-style: none; }
.ezh-related li { margin-bottom: 4px; }

.ezh-link {
    padding: 0; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 500;
    color: var(--ezh-primary); cursor: pointer; text-align: left;
}
.ezh-link:hover { color: var(--ezh-primary-strong); text-decoration: underline; }
.ezh-btn {
    display: inline-flex; align-items: center; gap: 8px;
    height: 38px; padding: 0 16px; border-radius: 8px;
    font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
    border: 1.5px solid var(--ezh-border); background: var(--ezh-surface); color: var(--ezh-heading);
}
.ezh-btn-primary { background: var(--ezh-primary); border-color: var(--ezh-primary); color: #fff; }
.ezh-btn-primary:hover { background: var(--ezh-primary-strong); border-color: var(--ezh-primary-strong); }
.ezh-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(24, 111, 244, 0.30); }
.ezh-btn:active { transform: scale(0.98); }

/* ---------- fallback toasts (apps without toastr) ---------- */
.ezh-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100001; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.ezh-toast {
    padding: 10px 14px; border-radius: 8px; font-family: var(--ezh-font); font-size: 13.5px;
    background: var(--ezh-heading); color: #fff; box-shadow: var(--ezh-shadow);
}
.ezh-toast-warning, .ezh-toast-error { background: #b42318; }

/* ---------- driver.js tour skin ---------- */
.driver-popover.ezh-tour-popover {
    font-family: var(--ezh-font);
    color: var(--ezh-text); background: var(--ezh-surface);
    border: 1px solid var(--ezh-border); border-radius: 16px;
    padding: 18px 18px 14px; width: 340px; min-width: 0; max-width: calc(100vw - 32px);
    box-shadow: var(--ezh-shadow);
}
.ezh-tour-popover .driver-popover-title { font-size: 16px; font-weight: 600; line-height: 1.35; color: var(--ezh-heading); padding-right: 28px; }
.ezh-tour-popover .driver-popover-description { font-size: 14px; line-height: 1.55; color: var(--ezh-text); }
.ezh-tour-popover .driver-popover-description strong { font-weight: 600; color: var(--ezh-heading); }
.ezh-tour-popover .driver-popover-close-btn {
    top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 8px; color: var(--ezh-muted);
}
.ezh-tour-popover .driver-popover-close-btn:hover, .ezh-tour-popover .driver-popover-close-btn:focus-visible {
    color: var(--ezh-heading); background: var(--ezh-primary-soft);
}
.ezh-tour-popover .driver-popover-footer { margin-top: 14px; gap: 8px; flex-wrap: wrap; }
.ezh-tour-popover .driver-popover-progress-text { font-size: 12px; font-weight: 600; color: var(--ezh-muted); font-variant-numeric: tabular-nums; }
.ezh-tour-popover .driver-popover-navigation-btns { gap: 6px; flex-wrap: wrap; }
.ezh-tour-popover .driver-popover-navigation-btns button + button { margin-left: 0; }
.ezh-tour-popover .driver-popover-footer-btn {
    font-family: var(--ezh-font); font-size: 13px; font-weight: 600; line-height: 1;
    height: 34px; padding: 0 12px; border-radius: 8px;
    display: inline-flex; align-items: center;
    color: var(--ezh-text); background: var(--ezh-surface); border: 1.5px solid var(--ezh-border); text-shadow: none;
}
.ezh-tour-popover .driver-popover-footer-btn:hover, .ezh-tour-popover .driver-popover-footer-btn:focus-visible {
    border-color: var(--ezh-primary); background: var(--ezh-primary-soft); color: var(--ezh-primary);
}
.ezh-tour-popover .driver-popover-next-btn { background: var(--ezh-primary); border-color: var(--ezh-primary); color: #fff; }
.ezh-tour-popover .driver-popover-next-btn:hover, .ezh-tour-popover .driver-popover-next-btn:focus-visible {
    background: var(--ezh-primary-strong); border-color: var(--ezh-primary-strong); color: #fff;
}
.ezh-tour-popover .ezh-tour-article-btn { flex-basis: 100%; justify-content: center; color: var(--ezh-primary); }
.ezh-tour-popover .driver-popover-arrow { border-color: var(--ezh-surface); }
.ezh-tour-popover .driver-popover-arrow-side-left { border-top-color: transparent; border-bottom-color: transparent; border-right-color: transparent; }
.ezh-tour-popover .driver-popover-arrow-side-right { border-top-color: transparent; border-bottom-color: transparent; border-left-color: transparent; }
.ezh-tour-popover .driver-popover-arrow-side-top { border-bottom-color: transparent; border-left-color: transparent; border-right-color: transparent; }
.ezh-tour-popover .driver-popover-arrow-side-bottom { border-top-color: transparent; border-left-color: transparent; border-right-color: transparent; }
.driver-active .driver-active-element { outline: 2px solid var(--ezh-primary); outline-offset: 4px; }

@media (max-width: 640px) {
    .ezh-backdrop { padding: 16px; align-items: flex-start; }
    .ezh-dialog { max-height: calc(100vh - 32px); }
    .ezh-dialog-foot { display: none; }
    .ezh-backdrop-sheet { padding: 0; align-items: flex-end; }
    .ezh-sheet { max-width: none; height: auto; max-height: 88vh; border-radius: 16px 16px 0 0; animation-name: ezh-rise; }
    @keyframes ezh-rise { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}

@media (prefers-reduced-motion: reduce) {
    .ezh-backdrop, .ezh-sheet, .driver-fade .driver-overlay, .driver-fade .driver-popover { animation: none; }
}
