/* bea.expert - night mode. Loaded after bootstrap.css, style.css and responsive.css and changes nothing
   in the light design: every colour rule below only applies while <html> has data-theme="dark".
   template.php sets that attribute before the page is painted: the visitor's choice (button in the
   menu, remembered in localStorage "bx-theme") wins, otherwise the system setting decides.
   The colours and the look of the shared parts (buttons, top section, callouts, footer) are those of
   lexitanon.com's night mode (assets/css/lexitanon.css there): light teal #3cc2b5 with dark text on it.
   style.css sets many colours with !important, so the rules here need it as well.
   Everything is inside "@media screen": a printed page always has the light design. */

@media screen {

    /* ---- the button in the menu (both designs). 36 px wide and no extra margin: with more, the menu
       entries no longer fit on one line on a 1200 px screen */
    .bx-theme-toggle { background: none; border: 1px solid #d0d6dd; border-radius: 8px; width: 36px; height: 36px; padding: 0;
        display: inline-flex; align-items: center; justify-content: center; color: #313943; cursor: pointer; vertical-align: middle; }
    .bx-theme-toggle:hover, .bx-theme-toggle:focus { border-color: #009385; color: #009385; outline: none; }
    .bx-theme-toggle svg { width: 18px; height: 18px; }
    .bx-theme-toggle .bx-sun { display: none; }
    /* 992-1199 px: the menu is tight there. Entries a little closer and smaller, so the whole menu
       (with the button, and with the bold entry of the current page) stays on one line */
    @media (min-width: 992px) and (max-width: 1199.98px) {
        .navbar-brand { font-size: 32px; }
        .text-navbar li a { margin-right: 13px; font-size: 15px; }
        .text-navbar li a.navbtn { font-size: 14px; }
        .navbtn2 { padding-left: 14px !important; padding-right: 14px !important; }
    }
    html[data-theme="dark"] .bx-theme-toggle { border-color: var(--bx-line); color: var(--bx-ink); }
    html[data-theme="dark"] .bx-theme-toggle:hover, html[data-theme="dark"] .bx-theme-toggle:focus { border-color: var(--bx-teal); color: var(--bx-teal); }
    html[data-theme="dark"] .bx-theme-toggle .bx-sun { display: block; }
    html[data-theme="dark"] .bx-theme-toggle .bx-moon { display: none; }

    /* ---- colours */
    html[data-theme="dark"] {
        --bx-teal: #3cc2b5; --bx-teal-strong: #5fd3c7; --bx-tint: #16302e; --bx-tint-line: #2c4a48;
        --bx-ink: #e6eaee; --bx-muted: #a9b4c0; --bx-line: #2e363e; --bx-bg: #14191e; --bx-field: #262d34;
        --bx-surface: #1d2329; --bx-on-teal: #0b1a19; --bx-shadow: rgba(0, 0, 0, .35);
        --bx-warn-bg: #3a3214; --bx-warn: #f2d27a; --bx-warn-line: #c9a227; --bx-error: #f0a3a3;
        color-scheme: dark;
    }

    /* ---- page, text, links */
    html[data-theme="dark"] body { background-color: var(--bx-surface); color: var(--bx-ink); }
    html[data-theme="dark"] a { color: var(--bx-teal) !important; }
    html[data-theme="dark"] a:hover { color: var(--bx-teal-strong) !important; }
    html[data-theme="dark"] hr { border-top-color: var(--bx-line); }
    html[data-theme="dark"] pre { color: var(--bx-ink); }
    html[data-theme="dark"] code { background: var(--bx-tint); color: var(--bx-ink); padding: 0 4px; border-radius: 4px; }
    html[data-theme="dark"] pre code { background: none; padding: 0; }
    html[data-theme="dark"] mark, html[data-theme="dark"] .mark { background-color: #4a4420; color: var(--bx-ink); }
    html[data-theme="dark"] .text-bea-expert { color: var(--bx-teal) !important; }
    html[data-theme="dark"] .text-dark, html[data-theme="dark"] .text-body { color: var(--bx-ink) !important; }
    html[data-theme="dark"] .text-muted, html[data-theme="dark"] .text-secondary, html[data-theme="dark"] .text-black-50 { color: var(--bx-muted) !important; }
    html[data-theme="dark"] .text-primary { color: #7fb2ff !important; }
    html[data-theme="dark"] .text-success { color: #63d08c !important; }
    html[data-theme="dark"] .text-danger, html[data-theme="dark"] .notactive, html[data-theme="dark"] .invalid-feedback { color: var(--bx-error) !important; }
    html[data-theme="dark"] .text-info { color: #5fcfe3 !important; }
    html[data-theme="dark"] .resource-text { color: var(--bx-muted); }
    html[data-theme="dark"] .highlight-container { color: var(--bx-ink); }
    html[data-theme="dark"] .highlight-container span.active { color: var(--bx-teal); }

    /* ---- buttons as on lexitanon.com: light teal with dark text, outline buttons on the page colour.
       The link colour above must not reach any button, so every button colour is stated again here. */
    html[data-theme="dark"] .btn-green, html[data-theme="dark"] .navbtn, html[data-theme="dark"] .text-navbar li a.navbtn, html[data-theme="dark"] .txt-green { background-color: var(--bx-teal) !important; border-color: var(--bx-teal); color: var(--bx-on-teal) !important; }
    html[data-theme="dark"] .btn-green:hover, html[data-theme="dark"] .navbtn:hover, html[data-theme="dark"] .text-navbar li a.navbtn:hover { background-color: var(--bx-teal-strong) !important; border-color: var(--bx-teal-strong); color: var(--bx-on-teal) !important; }
    html[data-theme="dark"] a.btn-toggle-active, html[data-theme="dark"] a.btn-toggle-active:hover { color: var(--bx-on-teal) !important; }
    html[data-theme="dark"] .btn-outline-green { background-color: var(--bx-surface); color: var(--bx-teal) !important; border-color: var(--bx-tint-line); }
    html[data-theme="dark"] .btn-outline-green:hover { background-color: var(--bx-tint); color: var(--bx-teal) !important; border-color: var(--bx-teal); }
    html[data-theme="dark"] .btn-outline-green:not(:disabled):not(.disabled):active, html[data-theme="dark"] .btn-outline-green:not(:disabled):not(.disabled).active,
    html[data-theme="dark"] .show > .btn-outline-green.dropdown-toggle { background-color: var(--bx-teal); color: var(--bx-on-teal) !important; border-color: var(--bx-teal); }
    html[data-theme="dark"] .btn-link { color: var(--bx-teal) !important; }
    /* buttons that keep white text on their own colour */
    html[data-theme="dark"] .btn-nonactive, html[data-theme="dark"] .btn-linkedin, html[data-theme="dark"] .learnbtn, html[data-theme="dark"] .hire-menu a,
    html[data-theme="dark"] a.btn-primary, html[data-theme="dark"] a.btn-secondary, html[data-theme="dark"] a.btn-success, html[data-theme="dark"] a.btn-danger, html[data-theme="dark"] a.btn-info, html[data-theme="dark"] a.btn-dark,
    html[data-theme="dark"] a.badge-primary, html[data-theme="dark"] a.badge-success, html[data-theme="dark"] a.badge-danger, html[data-theme="dark"] .contact-banner a { color: #fff !important; }
    html[data-theme="dark"] a.btn-warning, html[data-theme="dark"] a.btn-light { color: #212529 !important; }
    html[data-theme="dark"] .btn-outline-secondary { color: var(--bx-muted); border-color: #5b6672; }
    html[data-theme="dark"] .btn-outline-secondary:hover, html[data-theme="dark"] .btn-outline-secondary:not(:disabled):not(.disabled).active,
    html[data-theme="dark"] .btn-outline-secondary:not(:disabled):not(.disabled):active { color: #fff; background-color: #5b6672; border-color: #5b6672; }
    html[data-theme="dark"] .btn-outline-secondary.onerror { border-color: var(--bx-error); }
    html[data-theme="dark"] .btn-outline-dark { color: var(--bx-ink); border-color: var(--bx-muted); }
    html[data-theme="dark"] .btn-default { color: var(--bx-ink); }
    html[data-theme="dark"] .close { color: var(--bx-ink); text-shadow: none; }
    /* highlighted words (inverted-box, used inline for product names): like lexitanon.com's labels */
    html[data-theme="dark"] .inverted-box { background-color: var(--bx-tint); color: var(--bx-teal-strong); }

    /* ---- menu */
    html[data-theme="dark"] .text-navbar li a { color: var(--bx-ink) !important; }
    html[data-theme="dark"] .text-navbar li.active a { color: var(--bx-teal) !important; }
    html[data-theme="dark"] .navbar-brand { color: var(--bx-teal) !important; }
    html[data-theme="dark"] .navbar-toggler { color: var(--bx-teal); }
    html[data-theme="dark"] #xdisp1 { border-bottom: 1px solid var(--bx-line); }
    html[data-theme="dark"] .dropdown-menu { background-color: var(--bx-surface); border-color: var(--bx-line); border-top: 3px solid var(--bx-teal); color: var(--bx-ink); }
    html[data-theme="dark"] .dropdown-item { color: var(--bx-ink); }
    html[data-theme="dark"] .dropdown-item:hover, html[data-theme="dark"] .dropdown-item:focus { background-color: var(--bx-field); color: var(--bx-teal); }
    html[data-theme="dark"] .dropdown-divider, html[data-theme="dark"] .dropdown-menu .separator { border-color: var(--bx-line); }

    /* ---- surfaces */
    html[data-theme="dark"] .bg-light { background-color: var(--bx-bg) !important; }
    html[data-theme="dark"] .sliderpart { background: linear-gradient(180deg, var(--bx-tint) 0%, var(--bx-surface) 100%) !important; }
    html[data-theme="dark"] .bg-white { background-color: var(--bx-surface) !important; }
    html[data-theme="dark"] .border, html[data-theme="dark"] .border-top, html[data-theme="dark"] .border-bottom,
    html[data-theme="dark"] .border-left, html[data-theme="dark"] .border-right { border-color: var(--bx-line) !important; }
    html[data-theme="dark"] .border-success { border-color: #2f7d4f !important; }
    html[data-theme="dark"] .border-danger { border-color: #a34750 !important; }
    html[data-theme="dark"] .border-warning { border-color: #a8872a !important; }
    html[data-theme="dark"] .border-primary { border-color: #3f6fb5 !important; }
    html[data-theme="dark"] .border-secondary { border-color: #5b6672 !important; }
    html[data-theme="dark"] .card { background-color: var(--bx-surface); border-color: var(--bx-line); }
    html[data-theme="dark"] .bg-light .card, html[data-theme="dark"] .card.bg-light { background-color: var(--bx-surface) !important; }
    html[data-theme="dark"] .card-header, html[data-theme="dark"] .card-footer { background-color: var(--bx-field); border-color: var(--bx-line); }
    html[data-theme="dark"] .list-group-item { background-color: var(--bx-surface); border-color: var(--bx-line); color: var(--bx-ink); }
    html[data-theme="dark"] .modal-content { background-color: var(--bx-surface); border-color: var(--bx-line); }
    html[data-theme="dark"] .modal-header, html[data-theme="dark"] .modal-footer { border-color: var(--bx-line); }
    html[data-theme="dark"] .bd-callout { border-color: var(--bx-line); background-color: var(--bx-surface); }
    html[data-theme="dark"] .bd-callout-warning { border-left-color: #f0ad4e; }
    html[data-theme="dark"] .bd-callout-green { border-left-color: var(--bx-teal); }
    html[data-theme="dark"] .help-part { background-color: var(--bx-bg); }
    html[data-theme="dark"] .help-part .help-part-b { background-color: var(--bx-field); }
    html[data-theme="dark"] .pencil-banner { background-color: var(--bx-tint); }
    html[data-theme="dark"] .link-pencil-banner:hover .pencil-banner span { color: var(--bx-teal-strong) !important; }
    html[data-theme="dark"] .foot-part1 { background: var(--bx-bg); border-top: 1px solid var(--bx-line); }
    html[data-theme="dark"] .foot-part1 p { color: var(--bx-ink); }
    html[data-theme="dark"] .foot-part1 li { color: var(--bx-muted); }
    html[data-theme="dark"] .foot-part2 { background-color: var(--bx-surface); border-top: 1px solid var(--bx-line); color: var(--bx-muted); }
    html[data-theme="dark"] .foot-part1 a, html[data-theme="dark"] .foot-part2 a { color: var(--bx-muted) !important; }
    html[data-theme="dark"] .foot-part1 a:hover, html[data-theme="dark"] .foot-part2 a:hover { color: var(--bx-teal) !important; }
    html[data-theme="dark"] .faicon { border-color: var(--bx-muted); color: var(--bx-muted); }
    html[data-theme="dark"] .shadow-sm { box-shadow: 0 .125rem .25rem var(--bx-shadow) !important; }
    html[data-theme="dark"] .shadow, html[data-theme="dark"] .shadow-lg { box-shadow: 0 8px 28px var(--bx-shadow) !important; }

    /* ---- tables */
    html[data-theme="dark"] .table { color: var(--bx-ink); }
    html[data-theme="dark"] .table th, html[data-theme="dark"] .table td, html[data-theme="dark"] .table thead th,
    html[data-theme="dark"] .table-bordered, html[data-theme="dark"] .table-bordered th, html[data-theme="dark"] .table-bordered td { border-color: var(--bx-line); }
    html[data-theme="dark"] .table .thead-light th { background-color: var(--bx-field); color: var(--bx-ink); border-color: var(--bx-line); }
    html[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) { background-color: rgba(255, 255, 255, .04); }
    html[data-theme="dark"] .table-hover tbody tr:hover { background-color: rgba(255, 255, 255, .07); color: var(--bx-ink); }
    html[data-theme="dark"] .table-active, html[data-theme="dark"] .table-active > th, html[data-theme="dark"] .table-active > td { background-color: rgba(255, 255, 255, .07); }
    html[data-theme="dark"] .table-light, html[data-theme="dark"] .table-light > th, html[data-theme="dark"] .table-light > td,
    html[data-theme="dark"] .table-secondary, html[data-theme="dark"] .table-secondary > th, html[data-theme="dark"] .table-secondary > td { background-color: var(--bx-field); color: var(--bx-ink); }
    html[data-theme="dark"] .table-success, html[data-theme="dark"] .table-success > th, html[data-theme="dark"] .table-success > td { background-color: #1e3a2a; color: var(--bx-ink); }
    html[data-theme="dark"] .table-warning, html[data-theme="dark"] .table-warning > th, html[data-theme="dark"] .table-warning > td { background-color: #3a3214; color: var(--bx-ink); }
    html[data-theme="dark"] .table-danger, html[data-theme="dark"] .table-danger > th, html[data-theme="dark"] .table-danger > td { background-color: #3d2326; color: var(--bx-ink); }
    html[data-theme="dark"] .table-info, html[data-theme="dark"] .table-info > th, html[data-theme="dark"] .table-info > td,
    html[data-theme="dark"] .table-primary, html[data-theme="dark"] .table-primary > th, html[data-theme="dark"] .table-primary > td { background-color: #1c2f4a; color: var(--bx-ink); }

    /* ---- notices */
    html[data-theme="dark"] .alert-danger { background-color: #3d2326; border-color: #5a2e33; color: var(--bx-error); }
    html[data-theme="dark"] .alert-warning { background-color: var(--bx-warn-bg); border-color: #5c4f1f; color: var(--bx-warn); }
    html[data-theme="dark"] .alert-success { background-color: #1e3a2a; border-color: #2c5540; color: #a6e0b8; }
    html[data-theme="dark"] .alert-info { background-color: #16323a; border-color: #23505c; color: #a5dbe8; }
    html[data-theme="dark"] .alert-primary { background-color: #1c2f4a; border-color: #2b4670; color: #a9c7f5; }
    html[data-theme="dark"] .alert-secondary, html[data-theme="dark"] .alert-light { background-color: var(--bx-field); border-color: var(--bx-line); color: var(--bx-ink); }
    html[data-theme="dark"] .alert-dark { background-color: #0f1317; border-color: var(--bx-line); color: var(--bx-ink); }
    html[data-theme="dark"] .alert hr { border-top-color: rgba(255, 255, 255, .15); }

    /* ---- forms */
    html[data-theme="dark"] .form-control, html[data-theme="dark"] .custom-select { background-color: var(--bx-field); color: var(--bx-ink); border-color: var(--bx-line); }
    html[data-theme="dark"] .form-control:focus, html[data-theme="dark"] .custom-select:focus { background-color: var(--bx-field); color: var(--bx-ink); border-color: var(--bx-teal); box-shadow: 0 0 0 .15rem var(--bx-tint-line); }
    html[data-theme="dark"] .form-control::placeholder { color: var(--bx-muted); opacity: .75; }
    html[data-theme="dark"] .form-control:disabled, html[data-theme="dark"] .form-control[readonly] { background-color: #20262c; color: var(--bx-muted); }
    html[data-theme="dark"] .form-control.is-invalid, html[data-theme="dark"] .form-control.onerror { border-color: var(--bx-error); }
    html[data-theme="dark"] .input-group-text { background-color: #20262c; color: var(--bx-ink); border-color: #414b55; }
    html[data-theme="dark"] .custom-control-label::before { background-color: var(--bx-field); border-color: #5b6672; }
    html[data-theme="dark"] .custom-control-input:checked ~ .custom-control-label::before { background-color: var(--bx-teal); border-color: var(--bx-teal); }

    /* ---- an inline light background (style="background-color:#...") keeps dark text on it */
    html[data-theme="dark"] [style*="background-color:#"], html[data-theme="dark"] [style*="background-color: #"] { color: #313943; }

    /* ---- coloured labels: Bootstrap 5 names used in some pages (badge bg-success ...) and yellow areas */
    html[data-theme="dark"] .badge.bg-success, html[data-theme="dark"] .badge.bg-primary, html[data-theme="dark"] .badge.bg-danger,
    html[data-theme="dark"] .badge.bg-secondary, html[data-theme="dark"] .badge.bg-info, html[data-theme="dark"] .badge.bg-dark { color: #fff; }
    html[data-theme="dark"] .bg-warning, html[data-theme="dark"] .bg-warning.text-dark, html[data-theme="dark"] .badge-warning,
    html[data-theme="dark"] .badge-light { color: #212529 !important; }

    /* ---- product banner (bea_banner.inc.php): the white button keeps its dark green text */
    html[data-theme="dark"] a.bex-banner-btn { color: #0f6c44 !important; }
    html[data-theme="dark"] a.bex-banner-btn:hover { color: #148a57 !important; }

    /* ---- /image2pdf/ (own style block in content/image2pdf.php) */
    html[data-theme="dark"] .upload-zone { background-color: var(--bx-field); border-color: #5b6672; }
    html[data-theme="dark"] .upload-zone:hover, html[data-theme="dark"] .upload-zone.dragover { background-color: #1c2f4a; border-color: #7fb2ff; }
    html[data-theme="dark"] .pdf-zone { background-color: var(--bx-bg); border-color: var(--bx-line); }
    html[data-theme="dark"] .instruction-card { background-color: var(--bx-field); border-color: var(--bx-line); }
    html[data-theme="dark"] .example-image { border-color: var(--bx-line); }
    html[data-theme="dark"] .tips-box { background-color: #1c2f4a; }
    html[data-theme="dark"] .warning-box { background-color: var(--bx-warn-bg); }

    /* ---- /llm/ (own style block in content/llm.php) */
    html[data-theme="dark"] #phrase { background: var(--bx-field); border-color: #4f86b8; color: var(--bx-ink); }
    html[data-theme="dark"] #suggestions { background: #1c2f4a; }
    html[data-theme="dark"] .suggestion { background: var(--bx-surface); border-color: #414b55; color: var(--bx-ink); }
    html[data-theme="dark"] .suggestion:hover { border-color: #7fb2ff; }
    html[data-theme="dark"] .suggestion .prob { color: var(--bx-muted); }
    html[data-theme="dark"] #explications { background: #3a3214; }
    html[data-theme="dark"] #glossaire { background: #1e3a2a; }
    html[data-theme="dark"] #glossaire strong { color: #f2d27a; }
    html[data-theme="dark"] #glossaire em { color: #7fd9a4; }

    /* ---- single-colour black icons used as <img> (they cannot take the text colour): shown light */
    html[data-theme="dark"] img[src*="/windows-brands.svg"], html[data-theme="dark"] img[src*="/apple-brands.svg"] { filter: invert(1) brightness(.9); }

    /* ---- QR code of /qrtoken/: black on white with a white frame around it, so a phone can still scan it */
    html[data-theme="dark"] canvas#qrcode { background: #fff; padding: 16px; border-radius: 6px; }


}
