/*
 * Cookie banner, chat widget and form styling. Loaded after the theme's main.css.
 * Brand blue matches the header (#0055a7).
 *
 * NOTE: the theme gives every <a> and <button> "text-align: justify; word-spacing: 10px;
 * padding: 0; border: none; background: transparent". That is what pushed icons off-centre and
 * stretched button labels, so everything below resets those on our own elements.
 */
:root { --bd-blue: #0055a7; --bd-blue-dark: #003f7d; --bd-orange: #ff5900; }

.bd-cookie button, .bd-cookie a,
.bd-chat__toggle, .bd-chat__panel button, .bd-chat__panel a,
.bd-btn {
    word-spacing: normal;
    text-align: center;
}

/* ---------- forms ---------- */
.bd-form .form-label { font-weight: 600; }

/* Same height, border and corners for text boxes and dropdowns */
.bd-form .form-control,
.bd-form .form-select {
    height: 46px;
    padding: 10px 15px;
    font-size: var(--tj-fs-body, 16px);
    line-height: 1.5;
    color: var(--tj-color-common-black, #414141);
    background-color: #fff;
    border: 1px solid var(--tj-color-common-black, #414141);
    border-radius: 6px;
    box-shadow: none;
}
.bd-form .form-select { padding-right: 40px; cursor: pointer; }
.bd-form textarea.form-control { height: auto; min-height: 130px; }
.bd-form .form-control:focus,
.bd-form .form-select:focus { border-color: var(--bd-blue); box-shadow: 0 0 0 3px rgba(0, 85, 167, .18); }

.bd-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 46px; padding: 0 28px; border: 0; border-radius: 6px;
    background: var(--bd-blue); color: #fff; font-weight: 600; cursor: pointer;
}
.bd-btn:hover, .bd-btn:focus { background: var(--bd-blue-dark); color: #fff; }
/* honeypot field: off-screen, not display:none (some bots skip display:none) */
.bd-hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- cookie banner ---------- */
.bd-cookie {
    position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 10000;
    max-width: 880px; margin: 0 auto; padding: 16px 20px;
    background: #fff; color: #222; border: 1px solid #d9d9d9; border-top: 4px solid var(--bd-blue);
    border-radius: 6px; box-shadow: 0 8px 30px rgba(0, 0, 0, .18); font-size: 14px;
    max-height: calc(100vh - 32px); overflow-y: auto;
}
.bd-cookie[hidden], .bd-cookie [hidden] { display: none !important; }
.bd-cookie__main { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.bd-cookie__text { flex: 1 1 380px; }
.bd-cookie__text p { margin: 4px 0 0; line-height: 1.45; }
.bd-cookie a { color: var(--bd-blue); text-decoration: underline; word-spacing: normal; }
.bd-cookie__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bd-cookie__btn {
    display: inline-flex; align-items: center; justify-content: center; text-align: center; word-spacing: normal;
    background: var(--bd-blue); color: #fff; border: 2px solid var(--bd-blue);
    padding: 8px 18px; border-radius: 4px; cursor: pointer; font-weight: 600;
}
.bd-cookie__btn:hover { background: var(--bd-blue-dark); border-color: var(--bd-blue-dark); }
.bd-cookie__btn--ghost, .bd-cookie__btn--link { background: #fff; color: var(--bd-blue); }
.bd-cookie__btn--ghost:hover, .bd-cookie__btn--link:hover { background: #eef4fb; color: var(--bd-blue-dark); }
.bd-cookie__btn:focus-visible { outline: 3px solid var(--bd-orange); outline-offset: 2px; }
.bd-cookie__prefs > strong { display: block; margin-bottom: 8px; font-size: 16px; }
.bd-cookie__cat { margin: 0 0 10px; padding: 10px 12px; background: #f5f8fc; border-radius: 4px; }
.bd-cookie__cat label { display: flex; align-items: center; gap: 10px; margin: 0; cursor: pointer; }
.bd-cookie__cat input[type="checkbox"] { width: 18px; height: 18px; padding: 0; margin: 0; flex: 0 0 auto; accent-color: var(--bd-blue); }
.bd-cookie__cat em { margin-left: 8px; font-style: normal; font-size: 12px; color: #555; }
.bd-cookie__cat p { margin: 4px 0 0 28px; line-height: 1.4; color: #444; }
.bd-cookie__prefs .bd-cookie__actions { margin-top: 12px; justify-content: flex-end; }
.bd-cookie__links { margin: 10px 0 0; font-size: 13px; }
@media (max-width: 600px) {
    .bd-cookie__actions { width: 100%; }
    .bd-cookie__actions .bd-cookie__btn { flex: 1 1 100%; }
}

/* ---------- cookie policy page ---------- */
.bd-policy h2 { font-size: 24px; margin: 34px 0 12px; }
.bd-policy h3 { font-size: 19px; margin: 24px 0 10px; }
.bd-policy p { margin: 0 0 12px; line-height: 1.7; text-align: left; }
.bd-policy ul { list-style: disc; padding-left: 24px; margin: 0 0 14px; }
.bd-policy li { margin-bottom: 4px; line-height: 1.6; }
.bd-policy a { color: var(--bd-blue); text-decoration: underline; word-spacing: normal; }
.bd-policy__meta { padding-bottom: 14px; border-bottom: 1px solid #e3e3e3; }
.bd-policy__details { padding: 12px 16px; background: #f5f8fc; border-left: 4px solid var(--bd-blue); border-radius: 4px; }

/* ---------- chat widget (bottom-left so it never collides with back-to-top) ---------- */
.bd-chat__toggle {
    position: fixed; left: 20px; bottom: 20px; z-index: 9998;
    width: 58px; height: 58px; padding: 0; border: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;   /* true centring of the icon */
    background: var(--bd-blue); color: #fff; cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}
.bd-chat__toggle svg { display: block; width: 28px; height: 28px; }
.bd-chat__toggle:hover { background: var(--bd-blue-dark); }
.bd-chat__toggle:focus-visible { outline: 3px solid var(--bd-orange); outline-offset: 3px; }

.bd-chat__panel {
    /* sits above the cookie banner while it is open (--bd-cookie-h is set by cookie-consent.js) */
    position: fixed; left: 20px; bottom: calc(90px + var(--bd-cookie-h, 0px)); z-index: 9999;
    width: 370px; max-width: calc(100vw - 40px); height: 540px; max-height: calc(100vh - 120px - var(--bd-cookie-h, 0px));
    display: flex; flex-direction: column; overflow: hidden;
    background: #fff; border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
.bd-chat__panel[hidden] { display: none; }

.bd-chat__header {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    background: var(--bd-blue); color: #fff; padding: 10px 12px 10px 16px;
}
.bd-chat__title { font-weight: 600; font-size: 15px; line-height: 1.2; }
.bd-chat__tools { display: flex; align-items: center; gap: 6px; }
.bd-chat__menu {
    display: inline-flex; align-items: center; justify-content: center;
    height: 30px; padding: 0 12px; border: 1px solid rgba(255, 255, 255, .6); border-radius: 15px;
    background: transparent; color: #fff; font-size: 13px; line-height: 1; cursor: pointer;
}
.bd-chat__menu:hover { background: rgba(255, 255, 255, .15); }
.bd-chat__close {
    display: inline-flex; align-items: center; justify-content: center;   /* centred X */
    width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%;
    background: transparent; color: #fff; cursor: pointer;
}
.bd-chat__close svg { display: block; width: 18px; height: 18px; }
.bd-chat__close:hover { background: rgba(255, 255, 255, .15); }
.bd-chat__menu:focus-visible, .bd-chat__close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.bd-chat__log { position: relative; flex: 1; overflow-y: auto; padding: 14px 12px 6px; background: #f5f7fa; }
.bd-chat__msg {
    max-width: 88%; margin: 0 0 8px; padding: 9px 13px; border-radius: 12px;
    font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; text-align: left;
}
.bd-chat__msg--bot { background: #fff; color: #222; border: 1px solid #e1e5ea; border-bottom-left-radius: 3px; }
.bd-chat__msg--user { background: var(--bd-blue); color: #fff; margin-left: auto; border-bottom-right-radius: 3px; }
.bd-chat__typing { color: #888; letter-spacing: 2px; }
.bd-chat__msg a { color: var(--bd-blue); text-decoration: underline; word-break: break-all; }
.bd-chat__msg a:hover { color: var(--bd-blue-dark); }

/* menu buttons */
.bd-chat__opts { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.bd-chat__opt {
    display: block; width: 100%; padding: 9px 14px; border: 1px solid var(--bd-blue); border-radius: 8px;
    background: #fff; color: var(--bd-blue); font-size: 14px; font-weight: 500; line-height: 1.3;
    text-align: center; cursor: pointer;
}
.bd-chat__opt:hover, .bd-chat__opt:focus-visible { background: var(--bd-blue); color: #fff; outline: none; }

.bd-chat__cta {
    display: inline-flex; align-items: center; justify-content: center; margin: 0 0 10px;
    padding: 8px 16px; border-radius: 8px; background: var(--bd-orange); color: #fff;
    font-size: 14px; font-weight: 600; text-decoration: none;
}
.bd-chat__cta:hover { background: #d94a00; color: #fff; }

.bd-chat__form { display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid #e6e9ee; }
.bd-chat__form input {
    flex: 1; min-width: 0; height: 40px; padding: 0 12px; font-size: 14px;
    border: 1px solid #ccd2d9; border-radius: 6px;
}
.bd-chat__form input:focus { border-color: var(--bd-blue); outline: none; }
.bd-chat__send {
    display: inline-flex; align-items: center; justify-content: center;
    height: 40px; padding: 0 16px; border: 0; border-radius: 6px;
    background: var(--bd-blue); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}
.bd-chat__send:hover { background: var(--bd-blue-dark); }

/* On narrow screens the cookie banner spans the full width and would also cover the chat button,
   so the button lifts above it while the banner is open. */
@media (max-width: 960px) {
    .bd-chat__toggle { bottom: calc(20px + var(--bd-cookie-h, 0px)); }
}

@media (max-width: 480px) {
    .bd-chat__panel  { left: 10px; right: 10px; bottom: calc(84px + var(--bd-cookie-h, 0px)); width: auto; max-width: none; height: calc(100vh - 110px - var(--bd-cookie-h, 0px)); }
    .bd-chat__toggle { left: 14px; bottom: calc(14px + var(--bd-cookie-h, 0px)); }
}
