[data-bs-theme="dark"] .tdtext{
  color: var(--bs-color-white) !important;
}

[data-bs-theme="dark"] .box-list-populars img{
  background-color: var(--bs-color-white) !important;
}

[data-bs-theme="dark"] {
  --bs-neutral-100: #1b1d20; /* surface-2 */
}

.widthfix{
  width: 40% !important;
}

[data-bs-theme=dark] .alrttext {
  color: var(--bs-color-white) !important;
}

/* === Hero banner spacing fix when H1 wraps (FR/DE etc.) === */
@media (min-width: 992px) {
  /* Reserve more space for the overlaid search module on desktop */
  .box-banner-home7 .item-banner-slide {
    /* was: padding: 120px 0 180px 0; */
    padding-bottom: clamp(230px, 18vh, 300px);
    /* optional but helps on short viewports */
    min-height: 820px;
  }

  /* Make sure there's always a little space under the subheading */
  .box-banner-home7 .item-banner-slide h6 {
    margin-bottom: 12px;
  }
}

/* keep the badge as a single pill even with long words */
.card-popular .card-info .card-meta .meta-links a {
  display: inline-flex;       /* ensure the content stays inline */
  align-items: center;
  white-space: nowrap;        /* no internal wrapping */
  gap: .35rem;                /* space between number and label */
}

.card-popular .card-info .card-meta .meta-links {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

/* Filter action buttons: adapt to long labels */
.block-filter .filter-actions{
  display:flex;
  flex-wrap:wrap;          /* allow wrapping on narrow sidebars */
  gap:12px;                /* space between buttons */
}

/* Let each button share the line; fall back to stacked on very narrow widths */
.block-filter .filter-actions .btn{
  flex:1 1 calc(50% - 6px); /* two columns by default */
  min-width:0;              /* allow shrinking instead of overflow */
  white-space:nowrap;       /* keep label on one line */
  padding-inline:clamp(12px, 1.6vw, 22px); /* trim padding slightly on small screens */
}

/* On very narrow screens, stack them */
@media (max-width: 380px){
  .block-filter .filter-actions .btn{ flex-basis:100%; }
}

@media (max-width: 380px){
  .card-program .card-price h6{ 
    font-size: 18px !important;
    line-height: 28px !important;
  }
}

/* Kill the forced overflow from the header on small screens */
@media (max-width: 575.98px) {
  .header .main-header .header-right{
    min-width: 0;          /* allow it to shrink */
    padding-right: 0;      /* remove the 50px push */
    flex: 0 1 auto;        /* don't force growth */
  }
  /* Optional: standard small padding for the container */
  .header .container-fluid {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* --- Header: keep both mobile icons visible & prevent overflow --- */

/* Restore enough space for both icons and place them inline */
@media (max-width: 575.98px) {
  .header .main-header .header-right{
    /* allow shrink, but not below 2 icons (~2×42px + gap) */
    min-width: 110px;          /* was 150px in main.css */
    flex: 0 0 auto;
    padding-right: 8px;        /* small breathing room at the edge */
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  /* Put the hamburger in normal flow (so it doesn't overlap/cover the green icon) */
  .header .main-header .header-right .burger-icon{
    position: relative;        /* was absolute in main.css */
    right: auto;
    top: auto;
    margin-left: 8px;          /* gap between the two icons */
  }

  /* Remove any large desktop spacing on the green icon at mobile */
  .header .main-header .header-right .burger-icon-2{
    margin-right: 0;
  }

  .header .container-fluid{
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* Ensure header-right is never hidden in this desktop range */
@media screen and (min-width: 1200px) and (max-width: 1440px){
  .header .main-header .header-right{ display: flex !important; }
}

/* Keep the belt-and-suspenders horizontal overflow guard */
html, body{ overflow-x: hidden; }


/* Desktop “tablet-ish” width: keep both icons visible side by side */
@media screen and (min-width: 1200px) and (max-width: 1399.98px) {
  .header .main-header .header-right{
    display: flex !important;       /* defeats main.css hiding */
    align-items: center;
    justify-content: flex-end;
    gap: 8px;                       /* space between the two buttons */
    min-width: 110px;               /* room for 2×42px buttons + gap */
  }

  /* Put hamburger into normal flow so it doesn't cover the green button */
  .header .main-header .header-right .burger-icon{
    position: relative;             /* override absolute from main.css */
    right: auto;
    top: auto;
    display: block;                 /* ensure it shows in this range */
    margin-left: 0;
  }

  /* Guard: ensure the green square button is shown */
  .header .main-header .header-right .burger-icon-2{
    display: block;
  }
}


/* ===== Invoice micro-breakpoint: ≤350px (iPhone 5, etc.) ===== */
@media (max-width: 349.98px){

  /* Keep everything inside the invoice flexible */
  main[data-invoice-id]{
    overflow-x: hidden;
  }

  /* Header row inside the invoice card */
  main[data-invoice-id] .card-header .gap-3{
    gap: .5rem !important; /* tighter spacing between logo & title */
  }
  main[data-invoice-id] .image-logo{
    width: 48px !important;
    min-width: 48px !important;
    height: auto !important;
  }
  main[data-invoice-id] .text-24-bold{
    font-size: clamp(18px, 5.5vw, 20px) !important;
    line-height: 1.25 !important;
    word-break: break-word;
  }
  /* Status chips */
  main[data-invoice-id] [data-status-badge],
  main[data-invoice-id] [data-secure-chip]{
    font-size: 11px !important;
    padding: 4px 6px !important;
    white-space: nowrap;
  }

  /* “Secure payment” banner: allow wrapping instead of pushing wide */
  main[data-invoice-id] .background-3.d-flex{
    flex-wrap: wrap;
    row-gap: 8px;
  }
  main[data-invoice-id] .background-3.d-flex > *{
    min-width: 0; /* allow shrinking */
  }
  /* Put the right-side chip onto a new line if needed */
  main[data-invoice-id] .background-3.d-flex > :last-child{
    flex: 1 1 100%;
    display: flex;
    justify-content: flex-start;
  }

  /* Generic text: allow long tokens (IBAN, invoice id, crypto addr) to wrap */
  main[data-invoice-id] .card-body p,
  main[data-invoice-id] .card-body strong,
  main[data-invoice-id] #cryptoAddress{
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Buttons: slightly smaller and allow wrapping into multiple rows */
  main[data-invoice-id] .btn{
    padding: 8px 12px !important;
    font-size: 14px !important;
  }
  /* Button groups (footer links and crypto/bank actions) */
  main[data-invoice-id] .card-body .d-flex.gap-2{
    flex-wrap: wrap;
  }
  main[data-invoice-id] .card-body .d-flex.gap-2 > *{
    flex: 1 1 auto;
    min-width: 130px;          /* wrap to next row on ultra-narrow screens */
  }

  /* QR box: keep it comfy but never overflow */
  main[data-invoice-id] img[alt="QR Code"]{
    width: 160px !important;
    max-width: 100% !important;
    height: auto !important;
  }
}


/* ==== Messages page: full-height split layout (desktop & mobile) ==== */

/* parent wrappers must permit children to shrink so scrollbars can exist */
#messages-container,
#messages-container > .col-xl-12,
#messages-container > .col-xl-12 > .row {
  min-height: calc(100dvh - var(--header-h));
}
#messages-container > .col-xl-12 > .row > [class*="col-"] {
  min-height: 0; /* CRITICAL for flex children to scroll instead of grow */
}

/* Cards fill the column, body scrolls, footer stays visible */
.discussion-container .card,
.messages-container   .card {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  contain: layout paint; /* micro-optimisation */
}

/* The two scrollable panes */
.discussion-panel,
.messages-panel {
  flex: 1 1 auto;
  min-height: 0;          /* required for overflow to work inside flex */
  overflow-y: auto;
  overscroll-behavior: contain; /* no viewport bounce when reaching edges */
}

/* Mobile niceties */
@media (max-width: 999.98px){
  .discussion-panel,
  .messages-container .card{
    max-height: calc(100dvh - var(--header-h));
    -webkit-overflow-scrolling: touch;
  }
}

/* Optional: smoother feel without snapping */
.messages-panel { scroll-behavior: smooth; }


/* Context menu (Delete) — make it readable & contained on mobile */
.msg-context-menu {
  position: fixed;
  z-index: 2000;
  display: none;
  min-width: 220px;
}
@media (max-width: 999.98px){
  .msg-context-menu { min-width: 70vw; }
  .msg-context-menu .list-group-item { padding: 14px 16px; }
}

/* Discussion rows: harden against native long-press sheets */
.discussion-link {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.discussion-link img {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none; /* taps go to the row, not the <img> itself */
}

/* keyboard offset default */
:root { --kb: 0px; }

@media (min-width: 1000px) {
  .discussion-container{
    padding-right:0px;
  }
}

@media (max-width: 575.98px){
  .discussion-container, .messages-container {
    padding-right : 3px !important;
    padding-left : 3px !important;
  }
}

[data-messages]{
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  padding-bottom: calc(12px + var(--kb, 0px));
}

[data-messages]::before{
  content: "";
  flex: 1 0 0;                           /* grows to push content down, collapses to 0 when long */
}

/* Safety: if [data-messages] is the actual scroll container, let it scroll */
[data-messages].is-scroller{
  min-height: 0;
  overflow-y: auto;
}

/* ==== OTP stage (Register + Reset) ======================================= */
/* Shared tiny helper line for “code sent to … — Change” */
[data-otp-info]{
  font-size: 13px;
  color: var(--bs-neutral-600);
}
[data-bs-theme="dark"] [data-otp-info]{
  color: var(--bs-neutral-800);
}
[data-otp-info] a{
  text-decoration: underline;
}

/* --- Reset page (keeps wrapper pattern) --- */
[data-reset-root] [data-info-fields]{
  overflow: hidden;
  max-height: 1000px;                 /* large enough for form */
  opacity: 1;
  transition: max-height .35s ease, opacity .25s ease;
}
[data-reset-root].is-otp [data-info-fields]{
  max-height: 0;
  opacity: 0;
}

/* --- Register page (per-element, no wrapper) --- */
[data-register-root] .otp-hideable{
  overflow: hidden;
  max-height: var(--otp-el-max, 140px); /* tall enough for any form-group */
  opacity: 1;
  transition:
    max-height .35s ease,
    opacity .25s ease,
    padding .2s ease,
    margin .2s ease;
}
[data-register-root].is-otp .otp-hideable{
  max-height: 0 !important;
  opacity: 0;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  pointer-events: none;
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce){
  [data-reset-root] [data-info-fields],
  [data-register-root] .otp-hideable{
    transition: none;
  }
}

/* Let the textarea grow; keep the send button fixed */
[data-send-form]{
  display: flex;
  align-items: flex-end; /* button sits on the baseline */
  gap: 8px;
}

textarea[data-input]{
  flex: 1 1 auto;
  min-height: 44px;                 /* comfortable single line */
  line-height: 1.4;
  overflow-y: hidden;               /* JS toggles to auto at cap */
  resize: none;
}

/* Whatever you use for the send button */
[data-send-form] .btn,
[data-send-form] [data-send]{
  flex: 0 0 auto;
  align-self: flex-end;
}


@supports (-webkit-touch-callout: none){
  .messages-container .card{ contain: initial; }
}

.image-preview.is-dragging { opacity: .6 }

.dnd-overlay { pointer-events: none; }

/* Grey-out failed image and show overlays clearly */
.image-preview.is-failed img {
  filter: grayscale(100%);
  opacity: 0.6;
}

/* Small badge bottom-left */
.badge-upload-failed {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 4px 8px;
  font-size: 12px;
  background: rgba(220, 53, 69, 0.9); /* bootstrap danger-ish */
  color: #fff;
  border-radius: 6px;
  pointer-events: none;
}

/* Retry button top-right */
.btn-retry-image {
  position: absolute;
  top: 8px;
  right: 36px; /* leave room for delete btn */
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0d6efd; /* bootstrap primary-ish */
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.btn-retry-image:hover { background: #fff; }


.confirm-modal{position:fixed;inset:0;background:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;z-index:2000}
.confirm-modal[hidden]{display:none}
.confirm-modal__dialog{background:var(--bs-body-bg,#fff);color:var(--bs-body-color,#111);border-radius:12px;width:min(420px,calc(100% - 2rem));padding:16px;box-shadow:0 10px 30px rgba(0,0,0,.25)}



/* === Discover-only: multi-line, ellipsized titles === */
#discover_root, #discover-root { /* support either id by mistake */
}

#discover-root .card-journey-small .card-info .card-title {
  min-width: 0; /* guard against flex overflow */
}

#discover-root .card-journey-small .card-info .card-title a.card-title-text {
  display: -webkit-box;          /* required for -webkit-line-clamp */
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;         /* two lines on normal screens */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;           /* undo any nowrap */
  line-height: 1.25;
  max-height: calc(2 * 1.25em);  /* consistent card height */
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Tiny phones: allow 3 lines so it doesn't feel cramped */
@media (max-width: 380px) {
  #discover-root .card-journey-small .card-info .card-title a.card-title-text {
    -webkit-line-clamp: 3;
    max-height: calc(3 * 1.25em);
  }
}


/* ===== Discover - mobile filters drawer ===== */

/* Filter toggle button (next to items count) */
.btn-filter-toggle {
  display: none; /* hidden by default, shown on mobile */
  width: 40px;
  height: 40px;
  border-radius: 999px;
  padding: 0;
  border: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
  align-items: center;
  justify-content: center;
}

.btn-filter-toggle svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: var(--bs-neutral-700);
}

/* Desktop behavior: normal sidebar, no overlay */
@media (min-width: 992px) {
  .filters-panel {
    position: static;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  .filters-panel__header {
    display: none !important;
  }

  .filters-panel__body {
    margin-top: 0;
    max-height: none;
    overflow: visible;
  }

  .filters-backdrop {
    display: none !important;
  }
}

/* Mobile behavior: toggle button + slide-in drawer */
@media (max-width: 991.98px) {
  .btn-filter-toggle {
    display: inline-flex;
    margin-right: 8px;
  }

  .filters-panel {
    position: fixed;
    inset: 0 auto 0 0; /* left side drawer */
    width: min(320px, 85vw);
    max-width: 100%;
    background: var(--bs-body-bg);
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.04), 0 18px 40px rgba(15, 23, 42, 0.35);
    padding: 16px 14px 24px 16px;
    overflow-y: auto;
  }

  .filters-panel.is-open {
    transform: translateX(0);
  }

  .filters-panel__header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
  }

  .filters-panel__close {
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid var(--bs-border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--bs-neutral-700);
  }

  .filters-panel__body {
    margin-top: 4px;
  }

  .filters-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease-out;
    z-index: 1040;
  }

  .filters-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  body.filters-open {
    overflow: hidden;
  }
}
