/*
 * White-label Admin Theme
 *
 * Unfold resolves UNFOLD["COLORS"]["primary"] per-request from the current
 * tenant's Client.primary_color (apps.core.sidebar.get_tenant_primary_colors)
 * and injects it as --color-primary-{weight} custom properties before this
 * stylesheet loads (see unfold/layouts/skeleton.html's #unfold-theme-colors
 * <style> block). The aliases below just give those tenant-driven values
 * short names for the selector overrides further down — nothing here is
 * tied to any one tenant's brand color.
 */

:root {
  --tenant-primary:        rgb(var(--color-primary-600));   /* tenant brand color, falls back to the platform default navy */
  --tenant-primary-dark:   rgb(var(--color-primary-700));   /* hover / active */
  --tenant-primary-deeper: rgb(var(--color-primary-800));   /* deep accent    */
  --tenant-success:        rgb(153 199 128);                /* platform success green, not tenant-specific */
}

/* ═══════════════════════════════════════════════════════════════════
   SIDEBAR LOGO — white pill so the colored logo is legible on blue
   The logo PNG has an opaque white background + a stacked layout
   (mark above text). Wrapping in a pill surfaces the logo's own
   colors and bumps the height so both elements are readable.
   ═══════════════════════════════════════════════════════════════════ */

#nav-sidebar-inner a:has(> img) {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  padding: 4px 12px;
}

#nav-sidebar-inner a:has(> img) img {
  height: 40px !important;
  width: auto !important;
  max-width: none !important;
  object-fit: contain;
  margin-right: 0 !important;
}

/* ═══════════════════════════════════════════════════════════════════
   SIDEBAR — override Unfold's bg-base-50 with the tenant brand color
   ═══════════════════════════════════════════════════════════════════ */

/* Sidebar panel and inner nav background */
#nav-sidebar,
#nav-sidebar .bg-base-50,
#nav-sidebar-inner {
  background-color: var(--tenant-primary) !important;
}

/* Sidebar right-edge border */
#nav-sidebar {
  border-right-color: var(--tenant-primary-dark) !important;
}

/* Sidebar header bottom-border and all inner dividers / hr */
#nav-sidebar .border-b,
#nav-sidebar .border-t,
#nav-sidebar hr {
  border-color: rgba(255, 255, 255, 0.15) !important;
}

/* ── Section headings (e.g. "Plateforme", "Paiements") ─────────── */
#nav-sidebar h2 {
  color: rgba(255, 255, 255, 0.55) !important;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

#nav-sidebar h2 .material-symbols-outlined {
  color: rgba(255, 255, 255, 0.55) !important;
}

/* ── Nav item links — default state ────────────────────────────── */
#nav-sidebar-inner a {
  color: rgba(255, 255, 255, 0.8) !important;
}

#nav-sidebar-inner a .material-symbols-outlined {
  color: rgba(255, 255, 255, 0.6) !important;
}

/* ── Nav item links — hover ────────────────────────────────────── */
#nav-sidebar-inner a:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: rgb(255, 255, 255) !important;
}

#nav-sidebar-inner a:hover .material-symbols-outlined {
  color: rgb(255, 255, 255) !important;
}

/* ── Nav item links — active ───────────────────────────────────── */
#nav-sidebar-inner a.active {
  background-color: rgba(255, 255, 255, 0.18) !important;
  color: rgb(255, 255, 255) !important;
  box-shadow: inset 3px 0 0 rgb(255, 255, 255);
}

#nav-sidebar-inner a.active .material-symbols-outlined {
  color: rgb(255, 255, 255) !important;
}

/* ── Search box wrapper (exclude the account popup nav) ────────── */
#nav-sidebar .bg-white:not(nav),
#nav-sidebar-inner .bg-white:not(nav) {
  background-color: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

/* ── Search dropdown — appear above sidebar menu ─────────────── */
#search-results {
  z-index: 9999 !important;
  background-color: rgb(255, 255, 255) !important;
  opacity: 1 !important;
}

#search-results > div,
#search-results [data-simplebar] {
  background-color: rgb(255, 255, 255) !important;
  opacity: 1 !important;
  max-height: 300px !important;
  overflow-y: auto !important;
}

#search-results .simplebar-content {
  background-color: rgb(255, 255, 255) !important;
  opacity: 1 !important;
}

#search-results > div:first-child {
  z-index: 9999 !important;
  position: fixed !important;
  margin-top: 50px !important;
  left: 0 !important;
  width: 100% !important;
  background-color: rgb(255, 255, 255) !important;
  opacity: 1 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2) !important;
  max-height: 300px !important;
  overflow-y: auto !important;
}

/* Search result items — black text on white background */
#search-results a,
#search-results a span,
#search-results .mx-1 {
  color: rgb(0, 0, 0) !important;
}

#search-results a:hover {
  background-color: rgb(240, 240, 240) !important;
  color: rgb(0, 0, 0) !important;
}

/* Sidebar nav items — lower z-index so dropdown appears above */
#nav-sidebar-inner a,
#nav-sidebar-inner > div {
  z-index: 1 !important;
}

/* Ensure search results dropdown has proper background */
#nav-sidebar .bg-white.rounded-lg,
#nav-sidebar .bg-white.shadow-lg,
#nav-sidebar [role="dialog"],
#nav-sidebar [role="listbox"] {
  background-color: rgb(255, 255, 255) !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2) !important;
}

/* ── Account / profile popup — restore solid white bg + dark text ─ */
#nav-sidebar-inner nav.bg-white,
#nav-sidebar-inner nav[x-show] {
  background-color: rgb(255, 255, 255) !important;
  border-color: rgb(226, 232, 240) !important;
}

#nav-sidebar-inner nav.bg-white a,
#nav-sidebar-inner nav[x-show] a,
#nav-sidebar-inner nav.bg-white button,
#nav-sidebar-inner nav[x-show] button {
  color: rgb(30, 41, 59) !important;
}

#nav-sidebar-inner nav.bg-white a .material-symbols-outlined,
#nav-sidebar-inner nav[x-show] a .material-symbols-outlined {
  color: rgb(100, 116, 139) !important;
}

#nav-sidebar-inner nav.bg-white .border-t,
#nav-sidebar-inner nav[x-show] .border-t {
  border-color: rgb(226, 232, 240) !important;
}

#nav-sidebar input,
#nav-sidebar-inner input {
  color: rgb(255, 255, 255) !important;
  background-color: transparent !important;
}

#nav-sidebar input::placeholder,
#nav-sidebar-inner input::placeholder {
  color: rgba(255, 255, 255, 0.45) !important;
}

#nav-sidebar .material-symbols-outlined.text-base-400 {
  color: rgba(255, 255, 255, 0.45) !important;
}

/* ── User section at bottom ────────────────────────────────────── */
#nav-sidebar-inner .text-important {
  color: rgb(255, 255, 255) !important;
}

#nav-sidebar-inner .text-subtle {
  color: rgba(255, 255, 255, 0.6) !important;
}

#nav-sidebar-inner .text-font-default-light {
  color: rgba(255, 255, 255, 0.7) !important;
}

#nav-sidebar-inner .hover\:bg-base-100:hover,
#nav-sidebar-inner [class*="hover:bg-base"]:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* ═══════════════════════════════════════════════════════════════════
   TOP NAVBAR / HEADER BAR
   ═══════════════════════════════════════════════════════════════════ */

#header {
  background-color: var(--tenant-primary) !important;
  border-bottom-color: var(--tenant-primary-dark) !important;
}

#header a,
#header button,
#header .text-font-default-light {
  color: rgba(255, 255, 255, 0.85) !important;
}

/* ═══════════════════════════════════════════════════════════════════
   BUTTONS — primary action buttons
   ═══════════════════════════════════════════════════════════════════ */

.bg-primary-600 {
  background-color: var(--tenant-primary) !important;
}

.bg-primary-600:hover,
.hover\:bg-primary-700:hover {
  background-color: var(--tenant-primary-dark) !important;
}

/* ═══════════════════════════════════════════════════════════════════
   STATUS — success uses the platform secondary green
   ═══════════════════════════════════════════════════════════════════ */

.text-success-600,
.text-green-600 {
  color: var(--tenant-success) !important;
}

/* ═══════════════════════════════════════════════════════════════════
   LOGIN PAGE — form side logo
   ═══════════════════════════════════════════════════════════════════ */

.login-form-logo {
  height: 52px;
  width: auto;
  background: white;
  border-radius: 8px;
  padding: 6px 12px;
  border: 1px solid rgb(226 232 240);
  display: block;
}

/* ═══════════════════════════════════════════════════════════════════
   LOGIN PAGE — branded right panel
   ═══════════════════════════════════════════════════════════════════ */

.login-panel {
  background: linear-gradient(150deg, var(--tenant-primary) 0%, var(--tenant-primary-deeper) 55%, color-mix(in srgb, var(--tenant-primary-deeper) 70%, black) 100%);
  position: relative;
  overflow: hidden;
}

/* decorative circles */
.login-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 15%, rgba(153, 199, 128, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 20% 85%, rgba(255, 255, 255, 0.06) 0%, transparent 40%);
  pointer-events: none;
}

.login-panel__content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem;
}

.login-panel__logo {
  width: 200px;
  height: auto;
  background: white;
  border-radius: 12px;
  padding: 16px 28px;
  margin: 0 auto 2rem;
  display: block;
}

.login-panel__tagline {
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
}

.login-panel__divider {
  width: 40px;
  height: 3px;
  background: rgba(153, 199, 128, 0.7);
  border-radius: 2px;
  margin: 0 auto 1.25rem;
}

.login-panel__caption {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════════════
   DASHBOARD ICONS — 6 cards: #9bb68e
   ═══════════════════════════════════════════════════════════════════ */

.dashboard-card-icon .material-symbols-outlined.text-base-300 {
  color: #9bb68e !important;
  transform: translateY(-50%) translateX(20px) !important;
  font-size: 1rem !important;
}

.dashboard-card-icon .material-symbols-outlined.text-red-400 {
  color: #ef4444 !important;
  font-size: 1rem !important;
}

/* ═══════════════════════════════════════════════════════════════════
   TRANSACTION SUMMARY CARD — dark mode override
   The card uses bg-primary-50 which stays white in dark mode.
   Force proper dark background only when in dark mode.
   ═══════════════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
  .dark .bg-primary-50,
  .dark [class*="bg-primary-50"],
  [data-theme="dark"] .bg-primary-50 {
    background-color: #00103d !important;
    border-color: #001640 !important;
  }
}

.dark .bg-primary-50,
.dark [class*="bg-primary-50"]:not(#nav-sidebar):not(#header) {
  background-color: #00103d !important;
  border-color: #001640 !important;
}

/* ═══════════════════════════════════════════════════════════════════
   CREATE CAMPAIGN FORM — CSV Requirements box dark mode
   ═══════════════════════════════════════════════════════════════════ */

.dark .bg-blue-50 {
  background-color: rgba(0, 16, 61, 0.5) !important;
  border-color: rgba(0, 22, 64, 0.8) !important;
}

.dark .text-blue-800 {
  color: #93c5fd !important;
}

.dark .text-blue-700 {
  color: #a5b8fc !important;
}

