/* Eagle panel — small additions on top of AdminLTE 4. */

@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('../vendor/fonts/cairo-arabic-400-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url('../vendor/fonts/cairo-arabic-600-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('../vendor/fonts/cairo-arabic-700-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('../vendor/fonts/cairo-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url('../vendor/fonts/cairo-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('../vendor/fonts/cairo-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bs-body-font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
}

/* Amounts, ids and dates line up in tables. */
.table td,
.small-box h3,
.info-box-number {
  font-variant-numeric: tabular-nums;
}

/* Left-to-right fragments (amounts, emails, ids) inside RTL pages. */
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
}

.detail-table th {
  width: 35%;
  font-weight: 600;
  color: var(--bs-secondary-color);
}

/*
 * Long URLs and tokens break anywhere: "break-word" does not lower a table's minimum width, so an
 * unbroken webhook URL would widen the page on a phone. Set on the cell's children too: Bootstrap
 * gives <code> and .text-break (!important) their own "break-word".
 */
.detail-table td,
.detail-table td *,
.table-wrap td,
.table-wrap td * {
  overflow-wrap: anywhere !important;
}

.detail-table pre,
.cell-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
}

/*
 * Phones: a label beside its value in a 35% column wrapped the labels over three or four lines, so
 * each row of a .detail-table-stack becomes one line holding the label at the start and the value
 * at the end, like a receipt. A value too long for the room the label leaves (an address, a pasted
 * text) moves under its label, full width, and starts where the label starts: the inner paddings
 * are set with !important, like the .ps-3 / .pe-3 utilities that give the outer ones, and over
 * AdminLTE's 1.5rem on the cells of a table in a .card-body.p-0. Rows a page leaves out on phones
 * (.detail-row-empty) are hidden, and the lines between rows skip them.
 */
@media (max-width: 575.98px) {
  .detail-table-stack,
  .detail-table-stack > tbody {
    display: block;
    width: auto;
  }

  .detail-table-stack > tbody > tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.75rem;
    row-gap: 0.125rem;
    padding-block: 0.375rem;
    background-color: var(--bs-table-bg);
  }

  .detail-table-stack > tbody > tr:not(.detail-row-empty) ~ tr:not(.detail-row-empty) {
    border-top: var(--bs-border-width) solid var(--bs-table-border-color);
  }

  .detail-table-stack > tbody > tr.detail-row-empty {
    display: none;
  }

  .detail-table-stack > tbody > tr > th,
  .detail-table-stack > tbody > tr > td {
    width: auto;
    min-width: 0;
    max-width: 100%;
    padding-block: 0;
    border-bottom-width: 0;
  }

  .detail-table-stack > tbody > tr > th {
    flex: 1 1 auto;
    padding-inline-end: 0 !important;
    font-size: 0.8125rem;
  }

  .detail-table-stack > tbody > tr > td {
    flex: 0 1 auto;
    margin-inline-start: auto;
  }

  .detail-table-stack > tbody > tr > td.pe-3 {
    padding-inline-start: 1rem !important;
  }

  .detail-table-stack > tbody > tr > td.pe-0 {
    padding-inline-start: 0 !important;
  }
}

.grid-actions {
  white-space: nowrap;
}

/*
 * The scroller must hold the absolutely positioned bits of its table (.visually-hidden labels):
 * otherwise they belong to the card, escape the clipping and, in RTL, widen the whole page on a
 * phone, so the page scrolls sideways and the off-canvas sidebar shows as if fixed.
 */
.table-responsive {
  position: relative;
}

.table th a.sort-link {
  color: inherit;
  text-decoration: none;
}

/* Auth pages: the QR code needs a light background in dark mode too. */
.qr-box {
  display: flex;
  justify-content: center;
  background: #fff;
  border-radius: 0.5rem;
  padding: 0.5rem;
}

.qr-box svg {
  width: 220px;
  height: 220px;
}

/* QR code of an account to pay to (withdrawal payout): scanned with the wallet app. */
.qr-box.qr-box-sm {
  display: inline-flex;
}

.qr-box.qr-box-sm svg {
  width: 160px;
  height: 160px;
}

/*
 * The account to pay to when it is a long address (ShamCash: 32 characters): as large as a short
 * one (.fs-5) from 576px up, smaller on a phone so that it keeps to one line there.
 */
.payout-account-long {
  font-size: clamp(0.75rem, 3.9vw, 1.25rem);
}

.code-input {
  font-size: 1.5rem;
  letter-spacing: 0.4rem;
  text-align: center;
  direction: ltr;
}

/* Profile picture (layout/_avatar.html.twig): always a circle, never stretched. */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--bs-secondary-bg);
}

/* Admin "add bot" guide: readable step lists next to the form. */
.guide-list > li + li {
  margin-top: 0.4rem;
}

.bot-guide .accordion-button {
  font-weight: 600;
}

/* Technical support: inbox rows and chat bubbles (customer at the start, accountant at the end). */
.support-row-unread {
  background: var(--bs-primary-bg-subtle);
}

.support-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--bs-secondary-bg);
  color: var(--bs-secondary-color);
  font-size: 1.25rem;
}

.min-w-0 {
  min-width: 0;
}

.support-thread {
  height: min(60vh, 36rem);
  overflow-y: auto;
  background: var(--bs-tertiary-bg);
}

.support-msg {
  display: flex;
  margin-bottom: 0.6rem;
}

.support-msg-in {
  justify-content: flex-start;
}

.support-msg-out {
  justify-content: flex-end;
}

.support-bubble {
  max-width: min(80%, 32rem);
  padding: 0.5rem 0.75rem;
  border-radius: 0.9rem;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color-translucent);
  box-shadow: 0 1px 1px rgb(0 0 0 / 5%);
}

.support-msg-out .support-bubble {
  background: var(--bs-primary-bg-subtle);
  border-color: var(--bs-primary-border-subtle);
}

.support-text {
  white-space: normal;
  word-break: break-word;
}

.support-meta {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--bs-secondary-color);
}

.support-photo {
  display: block;
  max-width: 100%;
  max-height: 18rem;
  border-radius: 0.5rem;
  margin-bottom: 0.25rem;
}

.support-audio {
  max-width: 100%;
}

.support-bell-menu {
  min-width: 18rem;
}

.support-bell-item {
  white-space: normal;
}

/* Notification bell and «Notifications» page (accountant/notification_center). */
.notification-bell-menu {
  width: 24rem;
  max-width: calc(100vw - 1rem);
}

.notification-bell-list {
  max-height: min(65vh, 30rem);
  overflow-y: auto;
}

.notification-bell-list .notification-item {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.notification-bell-list .notification-item + .notification-item {
  border-top: 1px solid var(--bs-border-color-translucent);
}

.notification-unread {
  background-color: var(--bs-primary-bg-subtle);
}

.notification-dot {
  flex: 0 0 0.5rem;
  height: 0.5rem;
  margin-top: 0.45rem;
  border-radius: 50%;
}

.notification-unread .notification-dot {
  background-color: var(--bs-primary);
}

.notification-text {
  min-width: 0;
}

.notification-body {
  white-space: pre-line;
}

.notification-bell-list .notification-body {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.notification-bell-ring {
  animation: notification-bell-ring 0.9s ease-in-out;
  transform-origin: 50% 0;
}

@keyframes notification-bell-ring {
  0%, 100% { transform: rotate(0); }
  15%, 45%, 75% { transform: rotate(14deg); }
  30%, 60%, 90% { transform: rotate(-14deg); }
}

@media (prefers-reduced-motion: reduce) {
  .notification-bell-ring {
    animation: none;
  }
}

/* Phones: the list spans the screen under the navbar instead of hanging off the bell. */
@media (max-width: 575.98px) {
  #notification-bell {
    position: static;
  }

  .app-header .navbar-nav .notification-bell-menu[data-bs-popper] {
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    max-width: none;
  }
}

/* Account statement: printable on its own (no panel chrome, every column visible). */
@media print {
  .app-sidebar,
  .app-header,
  .app-footer,
  .app-content-header,
  .no-print,
  .toast-container,
  .alert-dismissible {
    display: none !important;
  }

  .app-main,
  .app-wrapper {
    margin: 0 !important;
    padding: 0 !important;
  }

  .statement-table {
    font-size: 11px;
  }

  .statement-table .d-none {
    display: table-cell !important;
  }
}

/* Installed app (public/js/pwa.js): no link previews or "open in Safari" callouts on iPhone. */
.pwa-standalone a {
  -webkit-touch-callout: none;
}

/*
 * Dialogs: AdminLTE's reduced-motion rule (.fade { opacity: 1 !important }) would turn the dim
 * backdrop solid black on devices with "reduce motion" on.
 */
.modal-backdrop.show {
  opacity: var(--bs-backdrop-opacity) !important;
}

/* Corner button to install the app (layout/_pwa_install.html.twig), under dialogs and alerts. */
.pwa-install-fab {
  position: fixed;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  inset-inline-end: 1rem;
  z-index: 1035;
}

/*
 * Auth screens (layout/auth.html.twig): brand artwork behind the card. The template hands the file
 * over in --login-bg so the URL still goes through Twig's asset(). The scrim on top of it keeps the
 * card and the corner toggles readable whatever the artwork happens to show.
 */
.login-page-bg {
  background-color: #1a1a1a;
  background-image: linear-gradient(rgba(10, 10, 10, 0.55), rgba(10, 10, 10, 0.55)), var(--login-bg);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.login-page-bg .login-box .card {
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.5);
}

/* The toggles sit straight on the artwork, where the body link colour has no contrast left. */
.login-page-bg .nav-link {
  color: rgba(255, 255, 255, 0.85);
}

.login-page-bg .nav-link:hover,
.login-page-bg .nav-link:focus {
  color: #fff;
}

