/* BURIDA Prospection - custom styles on top of Bootstrap 5.3 (light + dark themes) */

:root {
  /* Couleurs du logo BURIDA : orange #dd7231, vert #398d41 */
  --bp-logo-orange: #dd7231;
  --bp-logo-green: #398d41;
  --bp-brand: #b85a20;          /* orange approfondi : contraste AA avec le texte blanc */
  --bp-brand-hover: #9c4c1b;
  --bp-brand-text: #b85a20;
  --bp-brand-soft: rgba(221, 114, 49, .13);
  --bp-green-soft: rgba(57, 141, 65, .12);
}

[data-bs-theme="dark"] {
  --bp-brand: #b85a20;
  --bp-brand-hover: #cf6a2b;
  --bp-brand-text: #f0955a;     /* orange eclairci pour le texte sur fond sombre */
  --bp-brand-soft: rgba(240, 149, 90, .14);
  --bp-green-soft: rgba(87, 178, 96, .12);
}

html { scroll-padding-top: 80px; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bs-tertiary-bg);
}

main { flex: 1 0 auto; }

.bp-navbar { background-color: var(--bs-body-bg); }
.bp-navbar .nav-link.active { color: var(--bp-brand-text); font-weight: 600; }
.bp-navbar .navbar-brand { padding-top: .2rem; padding-bottom: .2rem; }

/* Logo : version claire / sombre selon le theme */
.bp-logo { height: 40px; width: auto; }
.bp-logo-auth { height: 100px; width: auto; }
.bp-logo-dark { display: none; }
[data-bs-theme="dark"] .bp-logo-light { display: none; }
[data-bs-theme="dark"] .bp-logo-dark { display: inline-block; }
.bp-brand-sep { width: 1px; height: 24px; margin: 0 .65rem 0 .75rem; background-color: var(--bs-border-color); }

/* Pastille "B" conservee pour d'autres usages eventuels */
.bp-logo-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--bp-brand); color: #fff; font-weight: 800;
}

.text-brand { color: var(--bp-brand-text) !important; }

.btn-brand {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--bp-brand);
  --bs-btn-border-color: var(--bp-brand);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--bp-brand-hover);
  --bs-btn-hover-border-color: var(--bp-brand-hover);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--bp-brand-hover);
  --bs-btn-active-border-color: var(--bp-brand-hover);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--bp-brand);
  --bs-btn-disabled-border-color: var(--bp-brand);
  --bs-btn-focus-shadow-rgb: 221, 114, 49;
}

.card { border-color: var(--bs-border-color-translucent); }

.hero {
  border-radius: 1rem;
  background: linear-gradient(135deg, var(--bp-brand-soft), var(--bp-green-soft));
}

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 1.25rem;
  background-color: var(--bs-secondary-bg);
}
.stat-icon-lg { width: 56px; height: 56px; font-size: 1.6rem; border-radius: 14px; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }

.action-card { transition: transform .15s ease, box-shadow .15s ease; }
.action-card:hover { transform: translateY(-2px); box-shadow: var(--bs-box-shadow); }

.table thead th {
  white-space: nowrap;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--bs-secondary-color);
}

.auth-wrap { max-width: 440px; margin: 2rem auto; }
.auth-wrap-wide { max-width: 560px; }
.bp-narrow { max-width: 560px; }

.otp-input {
  font-size: 1.6rem;
  letter-spacing: .6em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Honeypot (hidden from humans, visible to naive bots) */
.bp-hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.dup-panel { top: 84px; }
.bp-sticky { top: 84px; }
.dup-item { border-left: 4px solid var(--bs-warning) !important; }
.dup-item.dup-high { border-left-color: var(--bs-danger) !important; }

.photo-thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: .5rem; }
.preview-grid img { width: 88px; height: 88px; object-fit: cover; border-radius: .5rem; border: 1px solid var(--bs-border-color); }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: .8rem;
  font-weight: 700;
  background-color: var(--bs-secondary-bg);
}
.bp-bronze { color: #b87333; }

.text-pre-line { white-space: pre-line; }

.bp-theme-btn i { pointer-events: none; }

@media (max-width: 991.98px) {
  .dup-panel, .bp-sticky { position: static !important; }
}

/* ---------- Application shell : sidebar + topbar (logged-in users) ---------- */
.bp-shell { flex: 1 0 auto; display: flex; min-height: 100vh; }
.bp-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.bp-main main { flex: 1 0 auto; }
.bp-content { width: 100%; max-width: 1400px; margin: 0 auto; padding: 1.5rem 1rem; }
@media (min-width: 768px) { .bp-content { padding: 1.75rem 2rem; } }

.bp-topbar {
  display: flex; align-items: center; gap: .75rem;
  min-height: 56px; padding: .5rem 1rem;
  background-color: var(--bs-body-bg);
}
@media (min-width: 768px) { .bp-topbar { padding: .5rem 2rem; } }

.bp-sidebar { --bs-offcanvas-width: 270px; }
/* Column layout: brand on top, menu scrolls on its own, user block always visible at the bottom */
.bp-sidebar .offcanvas-body { display: flex; flex-direction: column; padding: .75rem .65rem 0; min-height: 0; }
@media (min-width: 992px) {
  .bp-sidebar.offcanvas-lg {
    position: sticky; top: 0; align-self: flex-start;
    width: 260px; height: 100vh; flex-shrink: 0;
    border-right: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg) !important;
    display: flex; flex-direction: column;
  }
  .bp-sidebar .offcanvas-body { flex: 1 1 auto; overflow: hidden; padding: .75rem .65rem 0; }
}
.bp-sidebar-brand { flex-shrink: 0; padding: .1rem .5rem .6rem; text-decoration: none; }

.bp-sidenav { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; padding-bottom: .5rem; }
.bp-sidenav .nav-link {
  display: flex; align-items: center; gap: .55rem;
  padding: .42rem .7rem; margin-bottom: 1px; font-size: .925rem;
  border: 0; border-radius: .5rem; background: none; text-align: left;
  color: var(--bs-body-color);
}
.bp-sidenav .nav-link .bi { width: 1.2rem; text-align: center; margin-right: 0 !important; }
.bp-sidenav .nav-link:hover { background-color: var(--bs-secondary-bg); }
.bp-sidenav .nav-link.active { background-color: var(--bp-brand-soft); color: var(--bp-brand-text); font-weight: 600; }
.bp-sidenav .nav-link .badge { margin-left: auto; }
.bp-sidenav .bp-chevron { font-size: .7rem; transition: transform .2s ease; }
.bp-sidenav .nav-link:not(.collapsed) .bp-chevron { transform: rotate(180deg); }
.bp-subnav { padding-left: .9rem; }
.bp-subnav .nav-link { padding-top: .32rem; padding-bottom: .32rem; font-size: .875rem; }
/* Group titles are toggles */
.bp-nav-heading {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  margin: .55rem 0 .15rem; padding: .3rem .7rem; border: 0; border-radius: .4rem; background: none;
  font-size: .68rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--bs-secondary-color);
}
.bp-nav-heading:hover { color: var(--bs-body-color); background-color: var(--bs-secondary-bg); }
.bp-nav-heading .bp-chevron { color: inherit; }
.bp-nav-heading.collapsed .bp-chevron { transform: rotate(-90deg); }
.bp-sidebar-user {
  flex-shrink: 0; display: flex; align-items: center; gap: .5rem;
  border-top: 1px solid var(--bs-border-color); padding: .6rem .25rem; background-color: var(--bs-body-bg);
}
.bp-sidebar-user .bp-avatar { width: 36px; height: 36px; font-size: 1rem; border-radius: 10px; }
.bp-sidebar-user .btn { padding: .3rem .45rem; }
.min-w-0 { min-width: 0; }

/* Test mode banner: text takes the free width, button wraps below on phones */
.bp-test-text { flex: 1 1 320px; min-width: 0; }

/* ---------- Discovery forms ---------- */
.bp-text-none { text-transform: none; }
/* Works exploited: neutral when off, logo green when selected */
.bp-oeuvre {
  display: flex; align-items: center; gap: .5rem;
  border: 1px solid var(--bs-border-color); background-color: var(--bs-body-bg); color: var(--bs-body-color);
}
.bp-oeuvre:hover { border-color: #398d41; color: var(--bs-body-color); }
.bp-oeuvre .bp-oeuvre-on { display: none; }
.bp-oeuvre .bp-oeuvre-off { color: var(--bs-secondary-color); }
.btn-check:checked + .bp-oeuvre,
.btn-check:checked + .bp-oeuvre:hover { background-color: #398d41; border-color: #398d41; color: #fff; font-weight: 600; }
.btn-check:checked + .bp-oeuvre .bp-oeuvre-on { display: inline-block; }
.btn-check:checked + .bp-oeuvre .bp-oeuvre-off { display: none; }
.btn-check:focus-visible + .bp-oeuvre { box-shadow: 0 0 0 .25rem rgba(57, 141, 65, .3); }

/* Searchable select */
.bp-combo { position: relative; }
.bp-combo-trigger { cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bp-combo-trigger.bp-combo-placeholder { color: var(--bs-secondary-color); }
.bp-combo.open .bp-combo-trigger { border-color: var(--bp-logo-orange); box-shadow: 0 0 0 .25rem rgba(221, 114, 49, .2); }
.bp-combo-menu {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 1050;
  background-color: var(--bs-body-bg); border: 1px solid var(--bs-border-color);
  border-radius: .5rem; box-shadow: var(--bs-box-shadow);
}
.bp-combo-list { max-height: 260px; overflow-y: auto; padding: .25rem 0; }
.bp-combo-option { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem .85rem; cursor: pointer; }
.bp-combo-option .bi { visibility: hidden; color: var(--bp-brand-text); }
.bp-combo-option.active { background-color: var(--bp-brand-soft); }
.bp-combo-option.selected { font-weight: 600; color: var(--bp-brand-text); }
.bp-combo-option.selected .bi { visibility: visible; }
.bp-combo-empty { padding: .6rem .85rem; color: var(--bs-secondary-color); font-size: .875rem; }

/* Location map */
.bp-geo-map { border: 1px solid var(--bs-border-color); border-radius: .5rem; overflow: hidden; }
.bp-geo-map iframe { display: block; width: 100%; height: 240px; border: 0; }

/* ---------- Message and confirmation modals ---------- */
.bp-flash-icon { display: inline-flex; font-size: 2.75rem; line-height: 1; }
.modal-content { border-radius: 1rem; }
@media (max-width: 575.98px) {
  /* Phones: modal docked at the bottom, full width, easy to reach with the thumb */
  .modal-dialog.modal-dialog-centered { align-items: flex-end; min-height: 100%; margin: 0; max-width: none; }
  .modal-dialog.modal-dialog-centered .modal-content { border-radius: 1rem 1rem 0 0; }
  .modal-footer .btn { flex: 1 1 0; }
}

/* ---------- Error and maintenance pages ---------- */
.bp-error { max-width: 540px; margin: 4vh auto 0; text-align: center; }
/* Maintenance page: two meshing gears turning in opposite directions */
.bp-gears { position: relative; width: 112px; height: 92px; margin: 0 auto; }
.bp-gears .bi { position: absolute; line-height: 1; }
.bp-gear-big { left: 0; top: 0; font-size: 72px; color: var(--bp-logo-orange); animation: bp-spin 6s linear infinite; }
.bp-gear-small { right: 0; bottom: 0; font-size: 44px; color: var(--bp-logo-green); animation: bp-spin-reverse 3.6s linear infinite; }
@keyframes bp-spin { to { transform: rotate(360deg); } }
@keyframes bp-spin-reverse { to { transform: rotate(-360deg); } }
@media (prefers-reduced-motion: reduce) { .bp-gear-big, .bp-gear-small { animation: none; } }

.bp-error-code { font-size: 3.5rem; font-weight: 800; line-height: 1; letter-spacing: .02em; margin-bottom: .5rem; }

/* ---------- Notification bell ---------- */
.bp-bell-count {
  position: absolute; top: -.45rem; right: -.55rem;
  font-size: .65rem; padding: .25em .45em; border: 2px solid var(--bs-body-bg);
}
.bp-notif-menu { width: min(380px, calc(100vw - 2rem)); }
.bp-notif-list { max-height: min(420px, 70vh); overflow-y: auto; }
.bp-notif-item {
  display: flex; gap: .65rem; align-items: flex-start;
  padding: .7rem 1rem; text-decoration: none; color: var(--bs-body-color);
  border-bottom: 1px solid var(--bs-border-color-translucent);
}
.bp-notif-item:last-child { border-bottom: 0; }
.bp-notif-item:hover { background-color: var(--bs-secondary-bg); }
.bp-notif-item > .bi { font-size: 1.05rem; margin-top: .1rem; }
.bp-notif-item.unread { background-color: var(--bp-brand-soft); }
.bp-notif-item.unread:hover { background-color: var(--bs-secondary-bg); }
.bp-notif-item .min-w-0 { min-width: 0; overflow-wrap: anywhere; }
.bp-notif-date { font-size: .7rem; color: var(--bs-secondary-color); margin-top: .15rem; }
@keyframes bp-ring {
  0%, 100% { transform: rotate(0); }
  15%, 45%, 75% { transform: rotate(14deg); }
  30%, 60%, 90% { transform: rotate(-14deg); }
}
.bp-bell.ringing .bi-bell { display: inline-block; animation: bp-ring 1s ease-in-out; transform-origin: 50% 10%; }
@media (prefers-reduced-motion: reduce) { .bp-bell.ringing .bi-bell { animation: none; } }

/* ---------- Charts (sizes set by app.js from data-h / data-w) ---------- */
/* Series colours validated for colour-blind separation, light and dark */
.bp-s-ev { --bp-series: #dd7231; }
.bp-s-et { --bp-series: #2a78d6; }
[data-bs-theme="dark"] .bp-s-ev { --bp-series: #d95926; }
[data-bs-theme="dark"] .bp-s-et { --bp-series: #3987e5; }

.bp-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .8rem; color: var(--bs-secondary-color); }
.bp-legend > span { display: inline-flex; align-items: center; gap: .4rem; }
.bp-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background-color: var(--bp-series); }

.bp-plot { position: relative; height: 200px; margin-top: .6rem; }
.bp-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--bs-border-color); }
.bp-grid span { position: absolute; left: 0; top: -.65rem; font-size: .7rem; line-height: 1; color: var(--bs-secondary-color); }
.bp-grid-top { top: 0; }
.bp-grid-mid { top: 50%; }
.bp-grid-base { top: 100%; border-top-style: solid; }
.bp-cols { position: absolute; top: 0; right: 0; bottom: 0; left: 2rem; display: flex; align-items: stretch; gap: 2px; }
.bp-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column-reverse; gap: 2px; border-radius: 4px 4px 0 0; }
.bp-col:hover { background-color: var(--bs-secondary-bg); }
.bp-col .bp-seg { display: block; flex: 0 0 auto; height: 0; background-color: var(--bp-series); }
.bp-col .bp-seg:last-child { border-radius: 4px 4px 0 0; }
.bp-xlabels { display: flex; gap: 2px; margin: .35rem 0 0 2rem; }
.bp-xlabels span { flex: 1 1 0; min-width: 0; font-size: .7rem; color: var(--bs-secondary-color); white-space: nowrap; overflow: visible; }
.bp-xlabels span:last-child { direction: rtl; }

.bp-hbars li { padding: .35rem 0; border-radius: .35rem; }
.bp-hbars li:hover { background-color: var(--bs-secondary-bg); }
.bp-hbar { display: flex; gap: 2px; height: 8px; margin-top: .3rem; }
.bp-hbar .bp-seg { display: block; height: 100%; width: 0; background-color: var(--bp-series); }
.bp-hbar .bp-seg:last-child { border-radius: 0 4px 4px 0; }

.bp-tip {
  position: absolute; z-index: 1080; pointer-events: none;
  transform: translate(-50%, -100%);
  padding: .4rem .6rem; border-radius: .4rem;
  font-size: .8rem; line-height: 1.35; white-space: pre-line;
  color: var(--bs-body-color); background-color: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color); box-shadow: var(--bs-box-shadow-sm);
}
