/*
 * In-app page help — topbar "?" trigger and the help / tutorial modal.
 * Loaded on every page (including POS, which skips theme.css) so the panel
 * looks the same everywhere.
 */

/* ---------- topbar trigger ---------- */
.app-topbar-action--help i {
    font-size: 16px;
}

/* POS header uses its own white pill buttons; match them instead of the
   AdminLTE topbar so the button does not look bolted on. */
.pos-help-trigger {
    box-shadow: rgba(17, 17, 26, 0.1) 0 0 16px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    width: 40px;
    height: 40px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4b5563;
    cursor: pointer;
    transition: transform .1s ease;
}
.pos-help-trigger:hover { background: rgba(255, 255, 255, .6); }
.pos-help-trigger:active { transform: scale(.95); }
.pos-help-trigger i { color: #646ee4; font-size: 18px; }

/* ---------- modal shell ---------- */
/* Bootstrap 3 has no centered-modal helper: it pins the dialog to the top with
   `margin: 30px auto`. Flex on the shown modal centres it both ways instead.
   `!important` is needed because .modal('show') writes display:block inline. */
.page-help-modal.in {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.page-help-modal .modal-dialog {
    width: 78%;
    max-width: 78%;
    max-height: 100%;
    margin: 0;
}

/* Bootstrap slides the dialog in with translate(0,-25%) and is meant to undo it
   via `.modal.in .modal-dialog`, but in this build the reset loses the cascade —
   the dialog keeps the offset and sits 25% of its height above centre. Zero it
   here; the modal itself still fades in via its own opacity transition. */
.page-help-modal.in .modal-dialog {
    -webkit-transform: none !important;
    transform: none !important;
}

.page-help-modal .modal-content {
    border: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(15, 23, 42, .25);
}

.page-help__header {
    background: #1f6fd0;
    color: #fff;
    border-bottom: 0;
    padding: 14px 18px;
}
.page-help__header .modal-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
}
.page-help__header .modal-title i { margin-right: 6px; opacity: .9; }
.page-help__header .modal-title small {
    display: block;
    color: rgba(255, 255, 255, .75);
    font-size: 12px;
    margin-top: 2px;
}
.page-help__header .close {
    color: #fff;
    opacity: .8;
    text-shadow: none;
    font-size: 26px;
    margin-top: -2px;
}
.page-help__header .close:hover { opacity: 1; }

/* Header (~66px) + footer (~62px) + the modal's own 20px padding on each side.
   Capping the body keeps a centred modal from ever running off-screen. */
.page-help__body {
    padding: 18px;
    max-height: calc(100vh - 190px);
    overflow-y: auto;
    background: #f7f9fc;
}

/* ---------- sections ---------- */
.page-help__block {
    background: #fff;
    border: 1px solid #e6ebf2;
    border-left: 4px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
.page-help__block p { margin: 0; line-height: 1.85; color: #253449; }

.page-help__block--what     { border-left-color: #1f6fd0; }
.page-help__block--why      { border-left-color: #f0a020; }
.page-help__block--how      { border-left-color: #00935f; }
.page-help__block--settings { border-left-color: #7c5cd6; }
.page-help__block--tips     { border-left-color: #ef4b53; }

.page-help__q {
    font-weight: 700;
    font-size: 14px;
    color: #0f172a;
    margin-bottom: 8px;
}
.page-help__q-badge {
    display: inline-block;
    background: #eef2f7;
    color: #334155;
    border-radius: 4px;
    padding: 1px 8px;
    margin-right: 6px;
    font-size: 12px;
    font-weight: 700;
}
.page-help__block--what     .page-help__q-badge { background: #e3eefb; color: #1f6fd0; }
.page-help__block--why      .page-help__q-badge { background: #fdf1dd; color: #a8690a; }
.page-help__block--how      .page-help__q-badge { background: #e0f3ec; color: #00734a; }
.page-help__block--settings .page-help__q-badge { background: #eee9fb; color: #5b3fb5; }
.page-help__block--tips     .page-help__q-badge { background: #fde8e9; color: #c0323a; }

.page-help__steps {
    margin: 0;
    padding-left: 22px;
    color: #253449;
}
.page-help__steps > li {
    line-height: 1.85;
    margin-bottom: 6px;
}
.page-help__steps > li:last-child { margin-bottom: 0; }

.page-help__links,
.page-help__tips {
    list-style: none;
    margin: 0;
    padding: 0;
}
.page-help__links > li,
.page-help__tips > li {
    line-height: 1.8;
    margin-bottom: 5px;
    color: #253449;
}
.page-help__links > li:last-child,
.page-help__tips > li:last-child { margin-bottom: 0; }
.page-help__links a { color: #1f6fd0; font-weight: 500; }
.page-help__links i { font-size: 11px; margin-right: 5px; }
.page-help__tips i { color: #f0a020; margin-right: 5px; }

.page-help__guide-link {
    display: inline-block;
    margin-top: 4px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #1f6fd0;
    border-radius: 6px;
    color: #1f6fd0;
    font-weight: 600;
}
.page-help__guide-link:hover {
    background: #1f6fd0;
    color: #fff;
    text-decoration: none;
}

/* ---------- tutorial mode ---------- */
.page-help__progress { margin-bottom: 18px; }
.page-help__progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}
.page-help__progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: #00935f;
    border-radius: 3px;
    transition: width .25s ease;
}
.page-help__progress-text {
    margin-top: 7px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.page-help__tut-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: #fff;
    border: 1px solid #e6ebf2;
    border-radius: 8px;
    padding: 22px 20px;
    min-height: 150px;
}
.page-help__tut-num {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #00935f;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.page-help__tut-text {
    flex: 1 1 auto;
    font-size: 16px;
    line-height: 1.95;
    color: #17233a;
    padding-top: 4px;
}

/* ---------- footer ---------- */
.page-help__footer {
    background: #fff;
    border-top: 1px solid #e6ebf2;
    padding: 12px 18px;
}

/* ---------- small screens ---------- */
@media (max-width: 767px) {
    /* 78% is too cramped on a phone — take almost the whole screen instead. */
    .page-help-modal.in { padding: 10px; }
    .page-help-modal .modal-dialog { width: 100%; max-width: 100%; }
    .page-help__body { max-height: calc(100vh - 170px); padding: 12px; }
    .page-help__tut-step { flex-direction: column; align-items: center; text-align: center; }
    .page-help__tut-text { padding-top: 0; font-size: 15px; }
    .page-help__footer .btn { margin-bottom: 6px; }
}

@media print {
    .page-help-modal { display: none !important; }
}
