/* Learner tools: progress bar, lesson toolbar, self-check, pager, dashboard. Site palette. */

/* ---------- readability ---------- */
.topic-content p,
.topic-content li { text-align: left !important; hyphens: manual; }
.topic-content { max-width: 78ch; margin-left: auto; margin-right: auto; }
.topic-content h2 { scroll-margin-top: 90px; }

/* ---------- lesson toolbar ---------- */
.study-bar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
    margin: -0.4rem 0 1.4rem; padding: 10px 12px; border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 14px; background: #f8fbfd;
}
.study-pos { display: flex; flex-direction: column; gap: 6px; min-width: 180px; flex: 1 1 200px; font-size: .8rem; color: var(--text-light, #6b7280); }
.study-track { display: block; height: 6px; border-radius: 3px; background: #e6eef4; overflow: hidden; }
.study-track i { display: block; height: 100%; border-radius: 3px; background: var(--primary, #3CB4E5); transition: width .3s; }
.study-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.study-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px;
    border: 1px solid #d5e3ec; background: #fff; color: var(--secondary-color, #1a365d); font: inherit; font-size: .82rem;
    font-weight: 600; cursor: pointer; text-decoration: none !important; border-bottom-width: 1px !important; white-space: nowrap;
}
.study-btn svg { width: 16px; height: 16px; flex: none; }
.study-btn:hover { border-color: var(--primary, #3CB4E5); color: var(--secondary-color, #1a365d) !important; }
.study-btn.on { background: var(--secondary-color, #1a365d); border-color: var(--secondary-color, #1a365d); color: #fff !important; }
.study-done.on { background: #16a34a; border-color: #16a34a; }

/* ---------- self-check on the exam box ---------- */
.quiz-hint { display: none; margin: -.25rem 0 .75rem; font-size: .85rem; color: #9a6700; }
.exam-box.quiz-mode .quiz-hint { display: block; }
.exam-box.quiz-mode li {
    cursor: pointer; border-radius: 6px; color: transparent; background: repeating-linear-gradient(90deg, #f3dfb0 0 10px, #f7e8c4 10px 20px);
    user-select: none; transition: color .2s, background .2s; margin-bottom: .45rem; padding: 2px 6px;
}
.exam-box.quiz-mode li::marker { color: #9a6700; }
.exam-box.quiz-mode li.revealed { color: inherit; background: #fff3d6; }

/* ---------- pager ---------- */
.lesson-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 2rem 0 1.5rem; }
.pager-done {
    grid-column: 1 / -1; height: 48px; border: 0; border-radius: 999px; font: inherit; font-weight: 700; font-size: .95rem;
    color: #fff; cursor: pointer; background: linear-gradient(135deg, var(--primary, #3CB4E5) 0%, var(--primary-dark, #2898c8) 100%);
    box-shadow: 0 6px 16px rgba(60, 180, 229, .3);
}
.pager-done:hover { filter: brightness(1.05); }
.content-article a.pager-link, .pager-link {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border-color, #e5e7eb) !important;
    border-radius: 12px; background: #fff; color: var(--secondary-color, #1a365d); text-decoration: none; min-width: 0;
}
.pager-link:hover { border-color: var(--primary, #3CB4E5) !important; }
.pager-link svg { width: 20px; height: 20px; flex: none; color: var(--primary-dark, #2898c8); }
.pager-link span { display: flex; flex-direction: column; min-width: 0; font-weight: 600; font-size: .9rem; line-height: 1.3; }
.pager-link small { font-weight: 500; font-size: .74rem; color: var(--text-light, #6b7280); margin-bottom: 2px; }
.pager-link.next { justify-content: flex-end; text-align: right; }

/* ---------- sidebar badges ---------- */
.nav-progress {
    margin-left: auto; padding: 1px 8px; border-radius: 999px; font-size: .68rem; font-weight: 700;
    background: #eef6fb; color: var(--primary-dark, #2898c8); font-variant-numeric: tabular-nums; flex: none;
}
.nav-progress.complete { background: #dcfce7; color: #166534; }
.nav-item.is-done > a { color: #166534; }
.nav-item.is-done > a::after {
    content: ""; flex: none; width: 14px; height: 14px; margin-left: auto; border-radius: 50%;
    background: #16a34a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 10px no-repeat;
}

/* ---------- welcome dashboard ---------- */
.study-dash { margin: 1.5rem 0 2rem; padding: 1.25rem; border-radius: 16px; background: #fff; border: 1px solid var(--border-color, #e5e7eb); box-shadow: 0 4px 14px rgba(15, 23, 42, .05); }
.dash-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 1rem; }
.dash-head h2 { margin: 0 0 .15rem !important; font-size: 1.2rem; color: var(--secondary-color, #1a365d); border: 0 !important; padding: 0 !important; }
.dash-head p { margin: 0; color: var(--text-light, #6b7280); font-size: .9rem; }
.dash-resume {
    display: flex; flex-direction: column; align-items: flex-start; max-width: 100%; padding: 10px 18px; border: 0; border-radius: 14px;
    font: inherit; font-weight: 700; color: #fff; text-align: left; cursor: pointer;
    background: linear-gradient(135deg, var(--primary, #3CB4E5) 0%, var(--primary-dark, #2898c8) 100%);
}
.dash-resume small { font-weight: 500; font-size: .74rem; opacity: .9; }
.dash-modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.dash-mod {
    display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border-color, #e5e7eb); border-radius: 12px;
    background: #fbfdff; font: inherit; text-align: left; cursor: pointer; color: inherit;
}
.dash-mod:hover { border-color: var(--primary, #3CB4E5); }
.dash-mod.complete { background: #f0fdf4; border-color: #bbf7d0; }
.dash-num { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: #e8f4f8; color: var(--primary-dark, #2898c8); font-weight: 800; }
.dash-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.dash-body strong { font-size: .86rem; line-height: 1.3; color: var(--secondary-color, #1a365d); }
.dash-meta { font-size: .75rem; color: var(--text-light, #6b7280); }
.dash-note { margin: .9rem 0 0 !important; font-size: .82rem; color: var(--text-light, #6b7280); }

/* ---------- header: instructor link ---------- */
.header-instructor-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px; flex: none;
    border: 1px solid #cfe3ee; background: #fff; color: var(--secondary-color, #1a365d); font-weight: 600; font-size: .85rem; text-decoration: none;
}
.header-instructor-btn svg { width: 18px; height: 18px; }
.header-instructor-btn:hover { border-color: var(--primary, #3CB4E5); }

@media (max-width: 1400px) {
    .header-instructor-btn span { display: none; }
    .header-instructor-btn { width: 38px; padding: 0; justify-content: center; }
}
@media (max-width: 640px) {
    .study-btn span { display: none; }
    .study-btn { width: 36px; padding: 0; justify-content: center; }
    .study-done span { display: inline; }
    .study-done { width: auto; padding: 0 12px; }
    .lesson-pager { grid-template-columns: 1fr; }
    .pager-link.next { order: -1; }
    .pager-done { order: -2; }
}

/* ---------- print a lesson cleanly ---------- */
@media print {
    .main-header, .sidebar-nav, .library-sidebar, .mobile-bottom-nav, .main-footer, .horizontal-submenu,
    .study-bar, .lesson-pager, .textbook-attribution, .mobile-overlay, .pwa-install-hint { display: none !important; }
    .app-container { display: block !important; }
    .main-content, .content-article { overflow: visible !important; height: auto !important; box-shadow: none !important; padding: 0 !important; }
    .exam-box.quiz-mode li { color: inherit !important; background: none !important; }
}

/* ---------- phones: more room for the text ---------- */
@media (max-width: 640px) {
    .main-content { padding-left: 8px !important; padding-right: 8px !important; }
    .content-article { padding: 20px 16px !important; }
    .topic-content h1 { font-size: 1.55rem !important; line-height: 1.25 !important; }
    .study-bar { margin-top: -0.2rem; }
}

.fmt-mini { display: inline-grid; place-items: center; min-width: 22px; height: 18px; padding: 0 4px; border-radius: 4px; color: #fff; font-size: .62rem; font-weight: 800; }
.fmt-mini.w { background: #2b579a; }
.fmt-mini.p { background: #c43e1c; }
@media (max-width: 640px) { a.study-btn .fmt-mini { display: inline-grid; } }

/* ---------- FAA figures, part of the lesson ---------- */
.topic-content .faa-figure {
    margin: 1.4rem 0 1.6rem; padding: 0; background: #fff; border: 1px solid #e3ebf1; border-radius: 14px;
    overflow: hidden; box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.topic-content .faa-figure .fig-zoom {
    display: block; background: #fff; padding: 14px 14px 6px; border: 0 !important; cursor: zoom-in; text-align: center;
}
.topic-content .faa-figure img {
    display: inline-block; width: auto !important; max-width: 100%; height: auto; max-height: 420px; object-fit: contain;
    border-radius: 6px; background: #fff;
}
.topic-content .faa-figure figcaption {
    display: flex; flex-direction: column; gap: 4px; padding: 10px 16px 12px; border-top: 1px solid #eef3f7; background: #fafcfe;
    text-align: left;
}
.topic-content .faa-figure .figure-title { font-size: .92rem; line-height: 1.45; color: var(--text-color, #1f2937); font-weight: 500; }
.topic-content .faa-figure .figure-title b { color: var(--secondary-color, #1a365d); }
.topic-content .faa-figure .figure-credit { font-size: .74rem; color: var(--text-light, #6b7280); }
.topic-content .faa-figure .figure-credit a { color: inherit !important; border-bottom: 1px dotted currentColor !important; }

.fig-lightbox {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 3000; background: rgba(10, 20, 35, .88); display: flex; flex-direction: column;
    align-items: center; justify-content: center; padding: 16px; cursor: zoom-out;
}
.fig-lightbox img { max-width: 100%; max-height: calc(100vh - 120px); background: #fff; border-radius: 8px; object-fit: contain; }
.fig-lightbox p { color: #e2e8f0; font-size: .9rem; margin-top: 12px; max-width: 900px; text-align: center; }
.fig-lightbox button {
    position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 50%; border: 0;
    background: rgba(255,255,255,.15); color: #fff; font-size: 20px; cursor: pointer;
}
@media print { .faa-figure img { max-height: 110mm; } }
.content-article .faa-figure figcaption, .topic-content .faa-figure figcaption { font-style: normal !important; margin: 0 !important; }
.topic-content .faa-figure img { border: 0 !important; max-height: 460px; }
.topic-content .faa-figure .figure-title { color: var(--text-color, #1f2937) !important; font-weight: 500 !important; margin: 0 !important; }
.library-faa { margin: 12px 10px 16px; padding: 12px; border: 1px solid #cfe3ee; border-radius: 12px; background: #f6fbfe; }
.library-faa h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--primary-dark, #2898c8); margin: 0 0 8px; }
.library-faa ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.library-faa a { display: flex; flex-direction: column; padding: 7px 9px; border-radius: 8px; background: #fff; border: 1px solid #e3ebf1; text-decoration: none; color: var(--secondary-color, #1a365d); font-size: .82rem; }
.library-faa a:hover { border-color: var(--primary, #3CB4E5); }
.library-faa a span { font-size: .7rem; color: var(--text-light, #6b7280); margin-top: 2px; }
.library-faa p { margin: 8px 0 0; font-size: .72rem; color: var(--text-light, #6b7280); }

/* ---------- footer: only in the middle column on desktop, never under the fixed side menus ---------- */
@media (min-width: 1401px) and (min-height: 601px) {
    .main-footer {
        margin-left: var(--sidebar-width) !important;
        margin-right: var(--library-width) !important;
        border-radius: 14px 14px 0 0;
        padding-left: 1.5rem !important; padding-right: 1.5rem !important;
    }
    .app-container:has(.sidebar-nav.collapsed) .main-footer { margin-left: 0 !important; }
    .app-container:has(.library-sidebar.collapsed) .main-footer { margin-right: 0 !important; }
}
.app-container { grid-template-rows: var(--header-height) 1fr auto !important; }
.main-footer { height: auto !important; min-height: 0 !important; overflow: visible !important; }
.main-footer .footer-content p { margin: 0 0 .25rem !important; }

/* popular lesson link (Уроци по авиация) */
.popular-lesson { display: flex; gap: 12px; align-items: flex-start; margin: 1.6rem 0 0; padding: 14px 16px; border-radius: 14px; background: #fff8e8; border: 1px solid #f0d7a0; }
.popular-lesson .pl-ico { font-size: 1.5rem; line-height: 1; }
.popular-lesson strong { display: block; color: #9a6700; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.popular-lesson a { display: block; font-weight: 600; color: var(--secondary-color, #1a365d) !important; border: 0 !important; margin: 2px 0; }
.popular-lesson small { display: block; color: var(--text-light, #6b7280); margin-top: 4px; }

/* ---------- речник на термините ---------- */
.header-glossary-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px; flex: none; cursor: pointer;
    border: 1px solid #cfe3ee; background: #fff; color: var(--secondary-color, #1a365d); font: 600 .85rem inherit; font-family: inherit;
}
.header-glossary-btn:hover { border-color: var(--primary, #3CB4E5); }
@media (max-width: 1400px) { .header-glossary-btn .hg-label { display: none; } .header-glossary-btn { padding: 0 11px; } }
dfn.gl-term { font-style: normal; border-bottom: 1.5px dotted #3CB4E5; cursor: help; text-decoration: none; }
dfn.gl-term:hover, dfn.gl-term:focus { background: #e8f6fc; outline: none; border-bottom-style: solid; }
.gl-tip {
    position: fixed; z-index: 10000; display: none; max-width: 320px; padding: 10px 12px; border-radius: 10px;
    background: #1a365d; color: #fff; font-size: .82rem; line-height: 1.4; box-shadow: 0 8px 24px rgba(15, 42, 74, .28); pointer-events: none;
}
.gl-tip strong { display: block; font-size: .9rem; }
.gl-tip .gl-en { display: block; color: #9fd8f2; font-style: italic; margin: 2px 0 4px; }
.gl-sym { display: inline-block; font: 600 .75rem/1.4 ui-monospace, Menlo, monospace; padding: 0 5px; border-radius: 5px; background: rgba(60, 180, 229, .18); color: inherit; }
.gl-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 0; border-radius: 16px; padding: 0; box-shadow: 0 20px 60px rgba(15, 42, 74, .35); }
.gl-dialog::backdrop { background: rgba(15, 42, 74, .45); }
.gl-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; background: #1a365d; color: #fff; position: sticky; top: 0; }
.gl-head h2 { margin: 0; font-size: 1.1rem; color: #fff; }
.gl-close { background: none; border: 0; color: #fff; font-size: 1.2rem; cursor: pointer; }
.gl-search { display: block; width: calc(100% - 40px); margin: 14px 20px 6px; padding: 10px 14px; border: 1px solid #cfe3ee; border-radius: 10px; font: inherit; }
.gl-src { margin: 0 20px 6px; font-size: .78rem; color: #6b7280; }
.gl-list { padding: 0 20px 20px; }
.gl-list h3 { margin: 18px 0 6px; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: #3CB4E5; }
.gl-list dl { margin: 0; }
.gl-list dt { font-weight: 700; color: #1a365d; margin-top: 10px; }
.gl-list dt .gl-en { font-weight: 400; font-style: italic; color: #6b7280; margin-left: 4px; }
.gl-list dt .gl-sym { background: #e8f6fc; color: #1a365d; }
.gl-list dd { margin: 2px 0 0; font-size: .9rem; color: #374151; }
.gl-empty { color: #6b7280; }
a.header-glossary-btn { text-decoration: none; }
.library-full-link { display: block; margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: #e8f6fc; border: 1px solid #cfe3ee; color: #1a365d; text-decoration: none; }
.library-full-link small { display: block; font-size: .72rem; color: #475569; margin-top: 2px; }
.library-full-link:hover { border-color: #3CB4E5; }

/* ---------- начална страница ---------- */
.welcome-page { max-width: 1000px; margin: 0 auto; }
.welcome-page .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.whero { border-radius: 18px; background-size: cover; background-position: center right; color: #fff; padding: clamp(28px, 5vw, 56px) clamp(22px, 4vw, 48px); margin: 0 0 18px; box-shadow: 0 10px 30px rgba(15, 42, 74, .25); }
.whero-in { max-width: 620px; }
.whero-k { display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #9fd8f2; margin-bottom: 12px; }
.whero h2 { color: #fff !important; font-size: clamp(1.5rem, 3.4vw, 2.3rem) !important; line-height: 1.15; margin: 0 0 12px !important; border: 0 !important; padding: 0 !important; }
.whero p { color: #dbeaf5; font-size: 1rem; line-height: 1.55; margin: 0 0 20px; }
.whero-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.wbtn { display: inline-flex; align-items: center; padding: 11px 20px; border-radius: 999px; font-weight: 700; font-size: .92rem; text-decoration: none !important; }
.wbtn.primary { background: #3CB4E5; color: #fff !important; }
.wbtn.primary:hover { background: #2898c8; }
.wbtn.ghost { border: 1.5px solid rgba(255,255,255,.55); color: #fff !important; }
.wbtn.ghost:hover { background: rgba(255,255,255,.12); }
.wstats { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.wstats li { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px 10px; text-align: center; }
.wstats strong { display: block; font-size: 1.5rem; color: #1a365d; line-height: 1.1; }
.wstats span { font-size: .74rem; color: #6b7280; }
#welcomeDash .study-dash { margin: 0 0 22px; }
.wsec { margin: 6px 0 24px; }
.wsec h2 { font-size: 1.3rem !important; color: #1a365d; margin: 0 0 6px !important; border: 0 !important; padding: 0 !important; }
.wsub { color: #6b7280; font-size: .92rem; margin: 0 0 14px; }
.wmods { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.wm { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 14px; text-decoration: none !important; color: inherit; transition: border-color .15s, transform .15s, box-shadow .15s; }
.wm:hover { border-color: #3CB4E5; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15, 42, 74, .08); }
.wm-ico { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; background: #e8f6fc; }
.wm-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wm-num { font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; color: #2898c8; font-weight: 700; }
.wm strong { font-size: .95rem; color: #1a365d; line-height: 1.3; }
.wm-desc { font-size: .8rem; color: #6b7280; line-height: 1.4; }
.wm-prog { height: 5px; border-radius: 3px; background: #e5e7eb; overflow: hidden; margin-top: 6px; }
.wm-prog i { display: block; height: 100%; background: #3CB4E5; }
.wtools { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.wt { display: block; background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 16px; text-decoration: none !important; color: inherit; transition: border-color .15s; }
.wt:hover { border-color: #3CB4E5; }
.wt-ico { display: block; font-size: 1.5rem; margin-bottom: 8px; color: #1a365d; font-weight: 800; }
.wt strong { display: block; color: #1a365d; margin-bottom: 4px; }
.wt span:not(.wt-ico) { font-size: .82rem; color: #6b7280; line-height: 1.45; }
.whow ol { margin: 0; padding-left: 1.3rem; display: grid; gap: 8px; font-size: .92rem; color: #374151; }
.whow li::marker { color: #2898c8; font-weight: 700; }
.wreq { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 4px 16px; margin: 0 0 18px; }
.wreq summary { cursor: pointer; font-weight: 700; color: #1a365d; padding: 10px 0; }
.wreq table { width: 100%; border-collapse: collapse; font-size: .88rem; margin: 4px 0 12px; }
.wreq th { text-align: left; width: 32%; padding: 8px 10px 8px 0; color: #1a365d; vertical-align: top; border-top: 1px solid #f1f5f9; }
.wreq td { padding: 8px 0; border-top: 1px solid #f1f5f9; color: #374151; }
.wnote { background: #fff8e1; border: 1px solid #ffe08a; border-left: 4px solid #f5a623; border-radius: 10px; padding: 12px 16px; font-size: .9rem; color: #5b4300; margin: 0 0 24px; }
@media (max-width: 640px) { .whero { background-position: 70% center; } .wstats { grid-template-columns: repeat(3, 1fr); } .wreq th { width: 40%; } }
#welcomeDash .dash-modules, #welcomeDash .dash-note { display: none; }
#welcomeDash .dash-head { margin-bottom: 0; }
@media (max-width: 640px) { .whero-k2 { display: none; } .whero p { font-size: .92rem; } .whero h2 { font-size: 1.45rem !important; } .whero { padding: 24px 20px; } }
/* скрито ляво/дясно меню на голям екран: съдържанието заема мястото */
@media (min-width: 1401px) {
    .app-container:has(.sidebar-nav.collapsed) { grid-template-columns: 0 1fr var(--library-width); }
    .app-container:has(.library-sidebar.collapsed) { grid-template-columns: var(--sidebar-width) 1fr 0; }
    .app-container:has(.sidebar-nav.collapsed):has(.library-sidebar.collapsed) { grid-template-columns: 0 1fr 0; }
    .app-container:has(.sidebar-nav.collapsed) .main-footer { margin-left: 0 !important; }
    .app-container:has(.library-sidebar.collapsed) .main-footer { margin-right: 0 !important; }
    .mobile-menu-btn, .mobile-library-btn { display: inline-flex !important; }
}
