/* ═══════════════════════════════════════════════
   TutorialHelpInfo.Rcl — shared styles
   ═══════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════
   NAVBAR: Help (?) and Admin (+) buttons inline in nav
   ══════════════════════════════════════════════════ */

/* Navbar-inline tutorial buttons */
.thi-nav-btn {
    cursor: pointer;
    transition: color .15s, opacity .15s;
    opacity: .75;
    padding-left: .4rem !important;
    padding-right: .4rem !important;
}

.thi-nav-btn:hover {
    opacity: 1;
}

/* Help — standard nav-link style, inherits layout styling */
a.thi-nav-btn-help {
    cursor: pointer;
}

/* Admin (+) — amber tint */
.thi-nav-btn-edit {
    color: #f5deb3 !important;
}

.thi-nav-btn-edit:hover {
    color: #ffc107 !important;
}

/* Widget modal — vertical, mobile-first, auto-height */
.thi-widget-modal .modal-dialog.thi-widget-dialog {
    max-width: 500px;
    width: 100%;
    margin: 1rem auto;
    padding: 0;
    max-height: calc(100dvh - 2rem);
    min-height: 420px;
}

/* Override Bootstrap centering — allow free positioning when dragged */
.thi-widget-modal.thi-dragged .modal-dialog.thi-widget-dialog {
    margin: 0;
    position: absolute;
}

@media (min-width: 576px) {
    .thi-widget-modal .modal-dialog.thi-widget-dialog {
        margin: 1.75rem auto;
        max-height: calc(100dvh - 3.5rem);
        min-height: 460px;
    }
}

.thi-widget-content {
    border: none;
    border-radius: .75rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: calc(100dvh - 2rem);
    background: #1a1a1a;
}

@media (min-width: 576px) {
    .thi-widget-content {
        border-radius: 1rem;
        max-height: calc(100dvh - 3.5rem);
    }
}

/* Dark-green header — draggable */
.thi-widget-header {
    background: #155d35;
    color: #fff;
    padding: .65rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
}

.thi-widget-header-title {
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.thi-widget-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, .75);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color .15s, background .15s;
}

.thi-widget-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, .15);
}

/* Body — dark background, auto-height, scrollable when content overflows */
.thi-widget-body {
    flex: 0 1 auto;
    overflow-y: auto;
    padding: 0;
    background: #1a1a1a;
    -webkit-overflow-scrolling: touch;
}

/* Description sub-header inside loaded content */
.thi-modal-loaded-header {
    background: #1b4a2e;
    color: #c0e8ca;
    padding: .45rem 1rem;
    font-size: .82rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

/* Tabs inside widget — dark theme */
.thi-widget-body .thi-tabs {
    border-bottom: 2px solid #2d5a3d;
    padding: 0 .5rem;
    background: #1e3a28;
    flex-shrink: 0;
    margin: 0;
}

.thi-widget-body .thi-tabs .nav-link {
    font-size: .82rem;
    padding: .45rem .7rem;
    border: none;
    border-bottom: 2px solid transparent;
    color: #a0c8ac;
    margin-bottom: -2px;
    transition: border-color .15s, color .15s;
}

.thi-widget-body .thi-tabs .nav-link.active {
    font-weight: 700;
    color: #fff;
    border-bottom-color: #4caf50;
    background: transparent;
}

.thi-widget-body .thi-tabs .nav-link.disabled {
    color: #555;
}

.thi-tab-content {
    padding: 0;
    background: #111;
}

/* Video wrapper — 9:16 aspect for shorts / tall videos */
.thi-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* square-ish, good for shorts */
    background: #000;
}

@media (min-width: 576px) {
    .thi-video-wrapper {
        padding-bottom: 120%; /* taller on desktop for vertical shorts */
    }
}

.thi-video-wrapper .thi-video-frame,
.thi-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Empty state — dark theme */
.thi-widget-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #888;
}

.thi-widget-empty i {
    font-size: 2.5rem;
    color: #3a6b4a;
    display: block;
    margin-bottom: .75rem;
}

.thi-widget-empty p {
    margin: 0;
    font-size: .9rem;
}

/* Dark-theme overrides for help/document content inside widget */
.thi-widget-body .thi-help-content,
.thi-widget-body .thi-document-content {
    padding: 1rem;
    border: 1px solid #2d5a3d;
    border-radius: .5rem;
    background: #1e2e24;
    color: #c8dcc8;
    margin: .5rem;
}

.thi-widget-body .thi-help-content pre {
    color: #bbb;
}

.thi-widget-body .alert {
    border-radius: .5rem;
}

/* ══════════════════════════════════════════════════
   ADMIN: Preview modal (legacy, used from Index table)
   ══════════════════════════════════════════════════ */

/* Legacy .thi-modal class kept for admin preview if needed */
.thi-modal {
    --thi-border-color: rgba(31, 94, 58, 0.16);
    --thi-surface: #ffffff;
    --thi-surface-muted: #f7fbf8;
    --thi-text-color: #203126;
}

.thi-hidden {
    display: none !important;
}

.thi-modal .modal-content {
    border: 1px solid var(--thi-border-color);
    border-radius: 1rem;
    background: var(--thi-surface);
    box-shadow: 0 1.25rem 3rem rgba(17, 24, 39, 0.18);
}

.thi-tabs .nav-link {
    color: #203126;
}

.thi-tabs .nav-link.active {
    font-weight: 600;
}

.thi-video-frame {
    width: 100%;
    min-height: 420px;
    border: 0;
    border-radius: 0.875rem;
    background: #000;
}

.thi-help-content,
.thi-document-content {
    padding: 1rem;
    border: 1px solid var(--thi-border-color);
    border-radius: 0.875rem;
    background: var(--thi-surface-muted);
}

/* ── Index table ── */
.thi-table thead {
    background: #f0f9f2;
    color: #1f4d2f;
    font-weight: 600;
}

.thi-table thead th {
    border-bottom: 2px solid #c5e8cb;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: .5rem .4rem;
}

.thi-row-inactive {
    opacity: .55;
    background: #fafafa;
}

.thi-page-key {
    background: #eef6f0;
    color: #1b6035;
    padding: .1rem .35rem;
    border-radius: 4px;
    font-size: .8rem;
}

.thi-video-thumb {
    height: 36px;
    cursor: pointer;
    transition: transform .15s;
}

.thi-video-thumb:hover {
    transform: scale(1.15);
}

.thi-icon-help {
    color: #198754;
    font-size: 1rem;
}

.thi-icon-file {
    color: #0d6efd;
    font-size: 1rem;
}

.thi-badge-active {
    background: #198754;
    color: #fff;
    font-size: .72rem;
}

.thi-badge-inactive {
    background: #dc3545;
    color: #fff;
    font-size: .72rem;
}

/* Audit cell in table */
.thi-audit-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.25;
}

.thi-audit-date {
    color: #6c757d;
    font-size: .76rem;
}

.thi-audit-modified {
    color: #856404;
}

.thi-audit-user {
    color: #495057;
    font-size: .74rem;
}

/* Filter bar */
.thi-filter-bar {
    background: #f7fbf8;
    border: 1px solid #d4eed9;
    border-radius: .5rem;
    padding: .5rem .75rem;
}

/* ── CreateEdit form — colour-coded sections ── */
.thi-section {
    border: 1px solid #e0e0e0;
    border-radius: .625rem;
    overflow: hidden;
}

.thi-section-header {
    margin: 0;
    padding: .5rem .75rem;
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: .02em;
}

/* Classification — teal/green */
.thi-section-classify {
    border-color: #b0dfc4;
}

.thi-section-header-classify {
    background: #dff5e7;
    color: #155d35;
}

/* Content — warm amber */
.thi-section-content {
    border-color: #f5deb3;
}

.thi-section-header-content {
    background: #fff8e6;
    color: #7d5a00;
}

/* Video — soft red/YouTube */
.thi-section-video {
    border-color: #f5c6cb;
}

.thi-section-header-video {
    background: #fde8ea;
    color: #a71d2a;
}

/* Help Text — blue */
.thi-section-helptext {
    border-color: #b8d4f0;
}

.thi-section-header-helptext {
    background: #e8f2fd;
    color: #084298;
}

/* Document & Targeting — purple */
.thi-section-document {
    border-color: #d2b7e5;
}

.thi-section-header-document {
    background: #f2e8fc;
    color: #5a2d82;
}

/* Audit — neutral grey */
.thi-section-audit {
    border-color: #d6d6d6;
}

.thi-section-header-audit {
    background: #f0f0f0;
    color: #495057;
}

.thi-audit-label {
    font-size: .75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 2px;
}

.thi-audit-value {
    font-size: .85rem;
    color: #212529;
}

/* ══════════════════════════════════════════════════
   QUICK EDIT FORM (modal) — compact colour-coded sections
   ══════════════════════════════════════════════════ */

/* View & Edit modal header — light-blue with dark-blue text */
.thi-widget-header-view,
.thi-widget-header-edit {
    background: #d6eaf8;
    color: #1a3a5c;
    border-bottom: 2px solid #1b6035;
}
.thi-widget-header-view .thi-widget-header-title,
.thi-widget-header-edit .thi-widget-header-title {
    color: #1a3a5c;
}
.thi-widget-header-view .thi-widget-close,
.thi-widget-header-edit .thi-widget-close {
    color: #1a3a5c;
}
.thi-widget-header-view .thi-widget-close:hover,
.thi-widget-header-edit .thi-widget-close:hover {
    color: #0d2137;
    background: rgba(0,0,0,.08);
}

/* Light modal body with dark-green border */
.thi-widget-content-light {
    background: #ffffff;
    border: 2px solid #1b6035;
    border-radius: .75rem;
}

#thiEditWidgetModal .thi-widget-dialog {
    max-width: 560px;
}

#thiEditWidgetModal .thi-widget-content {
    min-height: min(78dvh, 760px);
}

#thiEditWidgetModal .thi-widget-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (max-width: 575.98px) {
    #thiEditWidgetModal .thi-widget-content {
        min-height: calc(100dvh - 2rem);
    }
}

.thi-widget-content-light .thi-widget-body {
    background: #ffffff;
}

/* Light-themed content modal overrides (view + edit) */
.thi-widget-content-light .thi-modal-loaded-header {
    background: #e8f4ed;
    color: #1b4a2e;
    border-bottom: 1px solid #c5e8cb;
}
.thi-widget-content-light .thi-tabs {
    background: #f0f9f2;
    border-bottom: 2px solid #1b6035;
}
.thi-widget-content-light .thi-tabs .nav-link {
    color: #495057;
}
.thi-widget-content-light .thi-tabs .nav-link.active {
    color: #1b6035;
    border-bottom-color: #1b6035;
}
.thi-widget-content-light .thi-tabs .nav-link.disabled {
    color: #adb5bd;
}
.thi-widget-content-light .thi-tab-content {
    background: #fff;
}
.thi-widget-content-light .thi-help-content,
.thi-widget-content-light .thi-document-content {
    background: #fff;
    color: #212529;
    border-color: #dee2e6;
}
.thi-widget-content-light .thi-help-content pre {
    color: #333;
}
.thi-widget-content-light .thi-help-content img {
    max-width: 100%;
    height: auto;
    border-radius: .375rem;
}

/* Quick-form tabs */
.thi-qf-tabs {
    border-bottom: 2px solid #1b6035;
    background: #f0f9f2;
    padding: 0 .5rem;
    margin: 0;
}
.thi-qf-tabs .nav-link {
    font-size: .8rem;
    padding: .4rem .65rem;
    border: none;
    border-bottom: 2px solid transparent;
    color: #495057;
    margin-bottom: -2px;
    transition: border-color .15s, color .15s;
}
.thi-qf-tabs .nav-link.active {
    font-weight: 700;
    color: #1b6035;
    border-bottom-color: #1b6035;
    background: transparent;
}
.thi-qf-tabs .nav-link:hover:not(.active) {
    color: #1b6035;
}
.thi-qf-tab-content {
    background: #fff;
    min-height: 200px;
}

/* Summernote overrides inside modal */
.thi-qf-tab-content .note-editor {
    border: 1px solid #b8d4f0 !important;
    border-radius: .375rem;
}
.thi-qf-tab-content .note-toolbar {
    background: #f5f9ff;
    border-bottom: 1px solid #b8d4f0;
}

.thi-qf-pagekey-badge {
    background: rgba(255, 255, 255, .2);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    letter-spacing: .02em;
}
/* Light variant of pagekey badge */
.thi-widget-header-edit .thi-qf-pagekey-badge {
    background: #1b6035;
    color: #fff;
}

/* Quick-form compact sections */
.thi-qf-section {
    border: 1px solid #e0e0e0;
    border-radius: .5rem;
    overflow: hidden;
}

.thi-qf-section-label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .3rem .6rem;
}

.thi-qf-section-green {
    border-color: #b0dfc4;
}

.thi-qf-section-green > .thi-qf-section-label {
    background: #dff5e7;
    color: #155d35;
}

.thi-qf-section-amber {
    border-color: #f5deb3;
}

.thi-qf-section-amber > .thi-qf-section-label {
    background: #fff8e6;
    color: #7d5a00;
}

.thi-qf-section-red {
    border-color: #f5c6cb;
}

.thi-qf-section-red > .thi-qf-section-label {
    background: #fde8ea;
    color: #a71d2a;
}

.thi-qf-section-blue {
    border-color: #b8d4f0;
}

.thi-qf-section-blue > .thi-qf-section-label {
    background: #e8f2fd;
    color: #084298;
}

.thi-qf-section-purple {
    border-color: #d2b7e5;
}

.thi-qf-section-purple > .thi-qf-section-label {
    background: #f2e8fc;
    color: #5a2d82;
}

/* ══════════════════════════════════════════════════
   Topic selector (legacy — kept for old partials)
   ══════════════════════════════════════════════════ */

.thi-topic-selector {
    padding: .5rem .75rem .25rem;
    border-bottom: 1px solid #dee2e6;
    background: #f8fbfa;
}

.thi-topic-btns {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.thi-topic-btns .thi-topic-btn {
    font-size: .78rem;
    padding: .2rem .55rem;
    border-radius: .4rem;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thi-topic-select {
    font-size: .82rem;
    max-width: 100%;
}

/* ══════════════════════════════════════════════════
   Topics List Screen — viewer & editor
   ══════════════════════════════════════════════════ */

.thi-topics-screen {
    padding: .5rem 0;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.thi-topics-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .5rem .75rem .4rem;
    border-bottom: 1px solid #dee2e6;
    background: #f8fbfa;
    gap: .5rem;
}

.thi-topics-header-title {
    font-size: .82rem;
    font-weight: 600;
    color: #155d35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thi-topics-count {
    font-size: .72rem;
    color: #6c757d;
    white-space: nowrap;
}

/* Topic cards grid */
.thi-topics-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: .4rem .5rem;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
}

/* Single topic card — viewer mode */
button.thi-topic-card {
    display: block;
    width: 100%;
    text-align: left;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: .5rem;
    margin-bottom: .4rem;
    padding: 0;
    cursor: pointer;
    transition: box-shadow .15s ease, transform .12s ease, border-color .15s ease;
}

button.thi-topic-card:hover {
    box-shadow: 0 4px 14px rgba(21, 93, 53, .13);
    transform: translateY(-1px);
    border-color: #a8d5b8;
}

button.thi-topic-card:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Editor card (div, not button) */
div.thi-topic-card {
    display: block;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: .5rem;
    margin-bottom: .4rem;
    transition: box-shadow .15s ease, border-color .15s ease;
}

div.thi-topic-card:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,.09);
    border-color: #c3d9e8;
}

div.thi-topic-card.thi-topic-inactive {
    opacity: .65;
    background: #f8f8f8;
}

.thi-topic-card-inner {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem .65rem;
}

.thi-topic-card-num {
    flex-shrink: 0;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    background: #d8f0e3;
    color: #155d35;
    font-size: .75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thi-topic-card-body {
    flex: 1;
    min-width: 0;
}

.thi-topic-card-title {
    font-size: .84rem;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: .1rem;
}

.thi-topic-card-desc {
    font-size: .72rem;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thi-topic-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin-top: .25rem;
}

.thi-topic-badge {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    font-size: .67rem;
    padding: .1rem .35rem;
    border-radius: .3rem;
    font-weight: 500;
}

.thi-badge-video   { background: #fff0f0; color: #c62828; border: 1px solid #f8c8c8; }
.thi-badge-help    { background: #eaf4ff; color: #1565c0; border: 1px solid #b3d4f5; }
.thi-badge-pdf     { background: #fff5e5; color: #e65100; border: 1px solid #ffcc80; }
.thi-badge-myvideo { background: #f3e5f5; color: #7b1fa2; border: 1px solid #d9b0e8; }
.thi-badge-empty   { background: #f5f5f5; color: #9e9e9e; border: 1px solid #e0e0e0; }

.thi-topic-card-arrow {
    flex-shrink: 0;
    color: #adb5bd;
    font-size: .8rem;
}

/* Editor-mode extra actions */
.thi-topic-card-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: .3rem;
}

.thi-delete-group {
    display: flex;
    align-items: center;
    gap: .25rem;
}

.thi-delete-confirm {
    display: flex;
    align-items: center;
    gap: .2rem;
    animation: thi-fade-in .1s ease;
}

/* Empty state */
.thi-topics-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #6c757d;
}

.thi-topics-empty i {
    font-size: 2rem;
    display: block;
    margin-bottom: .5rem;
    color: #adb5bd;
}

/* ══════════════════════════════════════════════════
   Topic Navigation Bar (in _TutorialHelpModal)
   Sticky at top of modal-body content
   ══════════════════════════════════════════════════ */

.thi-topic-nav-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .65rem;
    background: #f0f8f4;
    border-bottom: 1px solid #c8e6d6;
    min-height: 2.25rem;
}

.thi-back-to-topics {
    flex-shrink: 0;
    font-size: .75rem;
    color: #155d35 !important;
    padding: .1rem .3rem !important;
    text-decoration: none !important;
    white-space: nowrap;
}

.thi-back-to-topics:hover {
    color: #0a3d20 !important;
    text-decoration: underline !important;
}

.thi-topic-nav-title {
    flex: 1;
    font-size: .78rem;
    font-weight: 600;
    color: #1a1a1a;
    min-width: 0;
}

.thi-topic-nav-controls {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: .25rem;
}

.thi-topic-position {
    font-size: .7rem;
    color: #6c757d;
    white-space: nowrap;
    margin-right: .1rem;
}

.thi-topic-prev,
.thi-topic-next {
    padding: .1rem .3rem !important;
    font-size: .75rem !important;
    line-height: 1 !important;
}

/* ══════════════════════════════════════════════════
   QuickEditForm: back bar
   ══════════════════════════════════════════════════ */

.thi-qf-back-bar {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .3rem .75rem;
    background: #f0f8f4;
    border-bottom: 1px solid #c8e6d6;
    font-size: .78rem;
}

.thi-back-to-edit-list {
    font-size: .75rem !important;
    color: #155d35 !important;
    padding: .1rem .3rem !important;
    text-decoration: none !important;
    white-space: nowrap;
}

.thi-back-to-edit-list:hover {
    text-decoration: underline !important;
    color: #0a3d20 !important;
}

#thiQuickForm {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.thi-qf-tab-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* ══════════════════════════════════════════════════
   Fade-in animation for screen transitions
   ══════════════════════════════════════════════════ */

@keyframes thi-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
