/*
 * bs3-compat.css - temporary Bootstrap 3 compatibility for pages already running on Bootstrap 5.3.8.
 * Loaded right after styles/bs5/bootstrap.min.css by the Bootstrap 5 layouts (tpl_2026_*).
 * Shared with the JA Sensei app later (phase 3). Every rule says when it can be removed.
 * Milestone B of the migration plan: this file is emptied during the redesign, then deleted.
 */

/* --- Base metrics --------------------------------------------------------------------------------------- */
/* Bootstrap 3 base font (Helvetica/Arial) and line height; Bootstrap 5 uses the system-ui stack (Segoe UI on
   Windows), whose taller line boxes enlarge text and native inputs where no site stylesheet sets the font
   (member detail window, lot 1.4).
   Bootstrap 3 links were #337ab7 (hover #23527c) and not underlined; Bootstrap 5 links are #0d6efd and underlined.
   Body text at 14px like Bootstrap 3 (tool pages without default_admin.css, member detail window). The root
   size stays 16px: default_admin.css sets body to 0.8em of it, and changing the root would shrink that text
   (pilot 0.4).
   Remove when: the redesign defines its own typography. */
:root {
    --bs-body-line-height: 1.428571429;
    --bs-body-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    --bs-body-font-size: 14px;
    --bs-link-color: #337ab7;
    --bs-link-color-rgb: 51, 122, 183;
    --bs-link-hover-color: #23527c;
    --bs-link-hover-color-rgb: 35, 82, 124;
}

a {
    text-decoration: none;
}

a:hover,
a:focus {
    text-decoration: underline;
}

.btn:hover,
.btn:focus {
    text-decoration: none;
}

/* Bootstrap 3 contextual text colours, darker than the Bootstrap 5 ones (text-warning is bright yellow #ffc107
   in Bootstrap 5, hard to read on white; text-info is cyan). About 220 uses in the views (lot 1.5).
   Remove when: the redesign defines its own colours. */
.text-primary { color: #337ab7 !important; }
.text-success { color: #3c763d !important; }
.text-info { color: #31708f !important; }
.text-warning { color: #8a6d3b !important; }
.text-danger { color: #a94442 !important; }
.text-muted { color: #777 !important; }

/* Bootstrap 3 coloured every <a>; the Bootstrap 5 Reboot makes an <a> without href nor class inherit the text
   colour (info icons of the lab quiz settings, <a id="aide_..."> handled by script, lot 1.5).
   Remove when: the redesign defines its own typography. */
a:not([href]):not([class]) {
    color: var(--bs-link-color);
}

a:not([href]):not([class]):hover {
    color: var(--bs-link-hover-color);
}

/* --- Grid --------------------------------------------------------------------------------------------- */
/* Bootstrap 3 containers: full width below 768px, then 750 / 970 / 1170px with no wider step, and 30px gutters.
   Bootstrap 5: 540 / 720 / 960 / 1140 / 1320px and 24px gutters, so the public pages were 30px narrower at 1280px
   (titles wrapping, lot 1.5) and 150px wider from 1400px. No view uses the Bootstrap 5 g-* gutter classes,
   which this rule would override.
   Remove when: the redesign defines its grid. */
.container,
.container-fluid,
.row {
    --bs-gutter-x: 30px;
}

@media (min-width: 576px) {
    .container {
        max-width: none;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 750px;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 970px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1170px;
    }
}

/* --- Headings ------------------------------------------------------------------------------------------- */
/* Bootstrap 3 headings: fixed px sizes, 20px/10px margins for h1-h3 and 10px/10px for h4-h6, line height 1.1.
   Bootstrap 5 headings are larger and responsive (h3 28px at 1280px) with no top margin. The site stylesheets
   still win where they style headings (they load after this file).
   Remove when: the redesign defines its typography. */
h1, .h1 { font-size: 36px; }
h2, .h2 { font-size: 30px; }
h3, .h3 { font-size: 24px; }
h4, .h4 { font-size: 18px; }
h5, .h5 { font-size: 14px; }
h6, .h6 { font-size: 12px; }

h1, h2, h3, .h1, .h2, .h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    line-height: 1.1;
}

h4, h5, h6, .h4, .h5, .h6 {
    margin-top: 10px;
    margin-bottom: 10px;
    line-height: 1.1;
}

/* Bootstrap 3 secondary text in headings (<h1>Title <small>by X</small></h1>): smaller, grey, normal weight.
   Remove when: the redesign defines its typography. */
h1 small, h2 small, h3 small, .h1 small, .h2 small, .h3 small {
    font-size: 65%;
}

h4 small, h5 small, h6 small, .h4 small, .h5 small, .h6 small {
    font-size: 75%;
}

h1 small, h2 small, h3 small, h4 small, h5 small, h6 small,
.h1 small, .h2 small, .h3 small, .h4 small, .h5 small, .h6 small {
    font-weight: 400;
    line-height: 1;
    color: #777;
}

/* --- Form controls and buttons -------------------------------------------------------------------------- */
/* Bootstrap 3 sized controls and buttons in px (14px, 12px small, 18px large); Bootstrap 5 uses 1rem (16px),
   which makes forms bigger and wraps button groups (pilot 0.4: context buttons of marketing/create).
   Remove when: the redesign defines its own control sizes. */
.form-control,
.form-select {
    font-size: 14px;
}

.form-control-sm,
.form-select-sm {
    font-size: 12px;
}

.form-control-lg,
.form-select-lg {
    font-size: 18px;
}

.btn {
    --bs-btn-font-size: 14px;
}

.btn-sm,
.btn-group-sm > .btn {
    --bs-btn-font-size: 12px;
}

.btn-lg,
.btn-group-lg > .btn {
    --bs-btn-font-size: 18px;
}

/* btn-default became btn-outline-secondary, whose grey text makes enabled buttons look disabled (marketing
   filter button, lot 1.4). Bootstrap 3 colours: white background (transparent in Bootstrap 5: the home page
   "Plus d infos" button sat on a red box), #333 text, #ccc border, #e6e6e6 when hovered or active.
   Remove when: the redesign defines its button styles. */
.btn-outline-secondary {
    --bs-btn-bg: #fff;
    --bs-btn-color: #333;
    --bs-btn-border-color: #ccc;
    --bs-btn-hover-color: #333;
    --bs-btn-hover-bg: #e6e6e6;
    --bs-btn-hover-border-color: #adadad;
    --bs-btn-active-color: #333;
    --bs-btn-active-bg: #e6e6e6;
    --bs-btn-active-border-color: #adadad;
}

/* default_admin.css colours every a:link blue, which wins over the button text colour of link buttons
   (<a class="btn ...">). Bootstrap 3's lighter button colours kept that blue text readable; Bootstrap 5's darker
   ones do not (btn-success, btn-primary: member detail activation buttons, lot 1.4).
   Remove when: the redesign rewrites default_admin.css link colours. */
a.btn:link,
a.btn:visited {
    color: var(--bs-btn-color);
}

/* Bare link buttons (<a class="btn">, Bootstrap 2 habit: "btn btn-mini", ~90 in the ManagerBox): Bootstrap 3's
   .btn set no colour, so they kept the link colour; Bootstrap 5 gives them the body text colour.
   Remove when: those links get a button variant or the redesign restyles them. */
a.btn:not(.btn-primary, .btn-secondary, .btn-success, .btn-info, .btn-warning, .btn-danger, .btn-light, .btn-dark,
    .btn-link, .btn-outline-primary, .btn-outline-secondary, .btn-outline-success, .btn-outline-info,
    .btn-outline-warning, .btn-outline-danger, .btn-outline-light, .btn-outline-dark) {
    color: rgba(var(--bs-link-color-rgb), var(--bs-link-opacity, 1));
}

/* Bootstrap 3 help blocks used the page text size; Bootstrap 5 form-text is 0.875em, too small on top of
   default_admin.css (body 0.8em).
   Remove when: the redesign styles help texts. */
.form-text {
    font-size: inherit;
}

/* Bootstrap 3 placeholders were light grey (#999); the Bootstrap 5 ones are dark enough to look like typed values
   (app registration form: "John", "Doe").
   Remove when: the redesign styles its form controls. */
.form-control::placeholder {
    color: #999;
}

/* --- Code blocks ---------------------------------------------------------------------------------------- */
/* Bootstrap 3 boxed <pre> blocks (grey background, border, padding); Bootstrap 5 only sets their font. Used by
   the ManagerBox audit tools (testfurigana, testphrasesvoc, testkanjiphrases, lot 1.4).
   Remove when: the redesign styles code blocks. */
pre {
    padding: 9.5px;
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.428571429;
    color: #333;
    word-break: break-all;
    word-wrap: break-word;
    background-color: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* --- Cards (Bootstrap 3 panels) ------------------------------------------------------------------------- */
/* Bootstrap 3 panel padding: 15px body, 10px 15px heading/footer; Bootstrap 5 cards use 16px and 8px 16px. The
   extra pixel wrapped the labels of the lab quiz settings (horizontal form in a panel, lot 1.5).
   Remove when: the redesign styles its cards. */
.card {
    --bs-card-spacer-y: 15px;
    --bs-card-spacer-x: 15px;
    --bs-card-cap-padding-y: 10px;
    --bs-card-cap-padding-x: 15px;
}

/* --- Thumbnails ----------------------------------------------------------------------------------------- */
/* Bootstrap 3 .thumbnail frames (now .img-thumbnail d-block) kept their image inside: block, max-width 100%,
   centred. Bootstrap 5 .img-thumbnail only limits the frame itself, so lesson and culture book illustrations and
   the "other articles" pictures overflowed the column (and the page sideways on mobile).
   Remove when: the redesign rewrites the illustration and thumbnail blocks. */
.img-thumbnail > img,
.img-thumbnail a > img {
    display: block;
    max-width: 100%;
    height: auto;
    margin-left: auto;
    margin-right: auto;
}

/* Bootstrap 3 thumbnail captions (culture book "other articles"): 9px padding and dark text, not the link colour.
   Remove when: the redesign rewrites the thumbnail blocks. */
.img-thumbnail .caption {
    padding: 9px;
    color: #333;
}

/* --- Modals --------------------------------------------------------------------------------------------- */
/* Bootstrap 3 modal widths: 600px (900px for .modal-lg from 992px); Bootstrap 5 uses 500px and 800px, which
   wrapped the titles and lengthened the sheets of the vocabulary, counters and situations labs (lot 1.5).
   Remove when: the redesign sizes its modals. */
.modal {
    --bs-modal-width: 600px;
}

@media (min-width: 992px) {
    .modal-lg {
        --bs-modal-width: 900px;
    }
}

/* --- Forms ---------------------------------------------------------------------------------------------- */
/* Bootstrap 3 labels were bold (checkbox labels excepted); Bootstrap 5 labels use the body weight.
   Remove when: the redesign styles its form labels. */
label {
    font-weight: 700;
}

.form-check-label {
    font-weight: 400;
}

/* Bootstrap 3 (normalize.css + forms.less) gave unclassed inputs a normal line height and native checkboxes and
   radios a 4px top margin only; Bootstrap 5 Reboot makes inputs inherit the body line height and leaves the
   browser margins. Plain forms (members list and detail, lot 1.4) grow taller without these rules. Classed
   controls (.form-control, .form-check-input, .btn) keep their Bootstrap 5 metrics.
   Remove when: the redesign styles those forms. */
input {
    line-height: normal;
}

input[type="checkbox"]:not(.form-check-input),
input[type="radio"]:not(.form-check-input) {
    margin: 4px 0 0;
}

/* Bootstrap 3 inline forms (.form-inline, kept in the migrated views): from 768px the controls are inline-block
   with an automatic width, below they stack full width. Bootstrap 5 has no .form-inline; rewriting these forms
   with flex utilities breaks the ones whose labels wrap their control or that use <br/> (news search, lot 1.5).
   Remove when: the redesign rewrites the inline forms. */
@media (min-width: 768px) {
    .form-inline .form-group {
        display: inline-block;
        margin-bottom: 0;
        vertical-align: middle;
    }

    .form-inline .form-control,
    .form-inline .form-select {
        display: inline-block;
        width: auto;
        vertical-align: middle;
    }

    .form-inline .input-group {
        display: inline-flex;
        width: auto;
        vertical-align: middle;
    }

    .form-inline .control-label,
    .form-inline label {
        margin-bottom: 0;
        vertical-align: middle;
    }

    .form-inline .form-check {
        display: inline-block;
        margin-top: 0;
        margin-bottom: 0;
        vertical-align: middle;
    }
}

/* <select class="form-control">: Bootstrap 3 kept the native drop-down arrow; Bootstrap 5 .form-control sets
   appearance: none, which removes it. The Zend_Form elements (library/My/Form/.../Element) put form-control on
   their selects too, and are shared by Bootstrap 3 and 5 pages (contact form, lot 1.5).
   Remove when: those elements use form-select. */
select.form-control {
    -webkit-appearance: auto;
    -moz-appearance: auto;
    appearance: auto;
}

/* Bootstrap 3 greyed read-only fields; Bootstrap 5 only greys disabled ones. The marketing form relies on it
   to show that a date is not editable ("disponible immediatement", "sans expiration").
   Remove when: the redesign styles read-only fields. */
.form-control[readonly] {
    background-color: var(--bs-secondary-bg);
}

/* --- Tables --------------------------------------------------------------------------------------------- */
/* Bootstrap 3 "active" cells (the label column of the ManagerBox detail tables) were #f5f5f5; Bootstrap 5
   table-active is 10% black, much darker.
   Remove when: the redesign styles its tables. */
.table {
    --bs-table-active-bg: rgba(0, 0, 0, 0.04);
}

/* Bootstrap 3 (normalize.css) set the padding of every cell to 0, which overrode the cellpadding attribute;
   Bootstrap 5 Reboot sets the border width of every cell to 0, which hides the border="1" attribute. About 30
   ManagerBox tables use <table border="1" cellpadding="4"> (lot 1.4: Facebook list). Classed tables (.table)
   and the site stylesheets keep their own padding and borders, since they are more specific or load later.
   Remove when: those tables use .table classes or the redesign styles them. */
td,
th {
    padding: 0;
}

table[border]:not([border="0"]) > * > tr > td,
table[border]:not([border="0"]) > * > tr > th {
    border-width: 1px;
    border-style: inset;
}

/* Bootstrap 3 responsive tables below 768px: cells on one line (the table scrolls sideways), a grey border and a
   15px bottom margin. Bootstrap 5 lets the cells wrap, which made the store comparison table 17% taller on
   mobile (store/credits, store/unlimited, lot 1.5).
   Remove when: the redesign styles its tables. */
@media (max-width: 767.98px) {
    .table-responsive {
        margin-bottom: 15px;
        overflow-y: hidden;
        border: 1px solid #ddd;
    }

    .table-responsive > .table {
        margin-bottom: 0;
    }

    .table-responsive > .table > * > tr > th,
    .table-responsive > .table > * > tr > td {
        white-space: nowrap;
    }
}

/* Bootstrap 3 .table cells: 8px padding (5px in .table-condensed, now .table-sm) through ".table > tbody > tr >
   td" selectors, which beat the cell rules of the site stylesheets (td.quiz_choix: 2px 4px). The Bootstrap 5
   selector is weaker and loses to them, which squeezed the read-along and lesson quizzes (lot 1.5).
   Remove when: the redesign styles its tables. */
.table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th,
.table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td {
    padding: 8px;
}

.table-sm > thead > tr > th, .table-sm > tbody > tr > th, .table-sm > tfoot > tr > th,
.table-sm > thead > tr > td, .table-sm > tbody > tr > td, .table-sm > tfoot > tr > td {
    padding: 5px;
}

/* --- Progress bars -------------------------------------------------------------------------------------- */
/* Bootstrap 3 progress bars were 20px high with 12px text and a 20px bottom margin (ManagerBox translation
   pages); Bootstrap 5 bars are 16px high without margin.
   Remove when: the redesign styles its progress bars. */
.progress {
    --bs-progress-height: 20px;
    --bs-progress-font-size: 12px;
    margin-bottom: 20px;
}
