/* Narpavi Groups additions on top of the Foodlytix template — domain-specific
   status badges and dark-theme-friendly alerts (Bootstrap's default .alert
   colors assume a light background). */

/* Bootstrap's own component color variables (--bs-card-color, --bs-body-color,
   etc.) default to light-theme values (near-black) and are MORE specific than
   our body{color:...} rule, so any plain text inside .card-body/.modal/.toast
   with no explicit text-* class renders as barely-visible dark-on-dark.
   Force them to our theme's text color everywhere. */
:root {
  --bs-body-color: var(--text-primary);
  --bs-card-color: var(--text-primary);
  --bs-card-cap-color: var(--text-primary);
  --bs-card-title-color: var(--text-primary);
  --bs-card-subtitle-color: var(--text-secondary);
  --bs-modal-color: var(--text-primary);
  --bs-toast-color: var(--text-primary);
  --bs-emphasis-color: var(--text-primary);
  --bs-secondary-color: var(--text-secondary);
  --bs-heading-color: var(--text-primary);
}

/* The vendored template defines three separate, unscoped .status-badge rules
   for unrelated components (a food-order badge, an absolutely-positioned
   restaurant-card corner badge, and a generic pill) that all collide on the
   same bare class name. The restaurant-card one's `position: absolute` wins
   the cascade and silently yanks every status badge in this app out of its
   table cell, making it invisible. Re-assert the correct static/inline layout
   here since this file loads last. */
.status-badge {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.approved,
.status-badge.active,
.status-badge.paid {
  background-color: rgba(46, 204, 113, 0.1);
  color: var(--success);
}

.status-badge.rejected {
  background-color: rgba(231, 76, 60, 0.1);
  color: var(--danger);
}

.status-badge.completed {
  background-color: rgba(52, 152, 219, 0.1);
  color: var(--info);
}

.status-badge.capped {
  background-color: rgba(155, 89, 182, 0.1);
  color: #9b59b6;
}

.status-badge.suspended {
  background-color: rgba(160, 164, 184, 0.15);
  color: var(--text-secondary);
}

/* Sidebar nav pending-count badges (e.g. "3 pending deposits") */
.nav-badge {
  margin-left: auto;
  background: var(--danger, #e74c3c);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.nav-link.active .nav-badge {
  background: rgba(255, 255, 255, 0.3);
}

.alert {
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 14px;
}

.alert-success {
  background-color: rgba(46, 204, 113, 0.1);
  border-color: rgba(46, 204, 113, 0.3);
  color: var(--success);
}

.alert-danger {
  background-color: rgba(231, 76, 60, 0.1);
  border-color: rgba(231, 76, 60, 0.3);
  color: var(--danger);
}

.alert-warning {
  background-color: rgba(243, 156, 18, 0.1);
  border-color: rgba(243, 156, 18, 0.3);
  color: var(--warning);
}

.alert-info {
  background-color: rgba(52, 152, 219, 0.1);
  border-color: rgba(52, 152, 219, 0.3);
  color: var(--info);
}

/* Leave-day banner: a full-width scrolling strip, same color tokens as .alert-warning.
   The track is duplicated-content-free — width is driven by padding-left:100% pushing
   the text fully off-screen right at rest, then animated to translateX(-100%) so it
   travels the full width and off the left edge, looping. */
.leave-day-banner {
  background-color: rgba(243, 156, 18, 0.1);
  border-bottom: 1px solid rgba(243, 156, 18, 0.3);
  color: var(--warning);
  overflow: hidden;
  white-space: nowrap;
  padding: 10px 0;
}

.leave-day-banner__track {
  display: inline-block;
  padding-left: 100%;
  font-weight: 600;
  animation: leave-day-marquee 18s linear infinite;
}

@keyframes leave-day-marquee {
  to {
    transform: translateX(-100%);
  }
}

/* Admin-set announcement bar (see Admin > Announcements) — same right-to-left marquee
   technique as the leave-day banner above, but pinned to the bottom of the viewport with
   `position: fixed` so it stays put regardless of scroll position, rather than scrolling
   away with the page like the leave-day banner does. body.has-announcement-banner (set
   server-side in components/layouts/user.blade.php, since only that layout shows this)
   reserves matching space at the bottom of the page so the footer is never hidden behind it. */
.announcement-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1080;
  background-color: var(--info);
  color: #ffffff;
  overflow: hidden;
  white-space: nowrap;
  padding: 6px 0;
  font-size: 14px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.25);
}

.announcement-banner__track {
  display: inline-block;
  padding-left: 100%;
  font-weight: 600;
  animation: announcement-marquee 25s linear infinite;
}

@keyframes announcement-marquee {
  to {
    transform: translateX(-100%);
  }
}

body.has-announcement-banner {
  padding-bottom: 30px;
}

/* Fixed-height wrapper for every Chart.js canvas on the dashboards. Chart.js's
   `responsive: true` alone still derives height from the canvas's *aspect
   ratio* against however wide its column happens to be — on a full-width
   column that produces a huge, unprofessional-looking chart. Pairing this
   wrapper with `maintainAspectRatio: false` in each chart's JS options makes
   the chart fill this fixed box instead, regardless of column width. */
.chart-container {
  position: relative;
  height: 280px;
}

.chart-container-sm {
  position: relative;
  height: 200px;
}

/* Bootstrap's contextual .badge bg-* utilities read fine on dark as solid
   chips, but text-bg-* pairs need a touch more contrast for badge text. */
.badge {
  font-weight: 600;
}

/* Alpine's x-cloak (calculators use it before Alpine hydrates) */
[x-cloak] {
  display: none !important;
}

/* Card/table polish for pages ported from Tailwind that use plain <table> markup */
.table-card .custom-table td,
.table-card .custom-table th {
  vertical-align: middle;
}

.empty-row td {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 24px;
}

.avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  font-size: 13px;
  flex-shrink: 0;
}

.notify-dropdown .media-primary {
  background: rgba(255, 107, 53, 0.15) !important;
  color: var(--primary-color);
}

/* Network tree visualization */
.network-tree-wrapper {
  background: linear-gradient(180deg, #0f172a, #1a1d29);
  border-radius: var(--radius);
  padding: 32px 20px;
}

.network-node-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  position: relative;
  transition: all 0.2s;
  width: 220px;
  flex-shrink: 0;
}

.network-node-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.network-node-card.is-root {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 1px var(--primary-color);
}

.network-node-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 107, 53, 0.12);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  margin: 0 auto 10px;
  position: relative;
}

.network-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  right: 2px;
  border: 2px solid var(--card-bg);
}

.network-status-dot.active {
  background-color: var(--success);
}

.network-status-dot.inactive {
  background-color: var(--danger);
}

.network-node-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.network-node-meta {
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 10px;
}

.network-node-stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 12px;
  margin-bottom: 10px;
}

.network-node-stats strong {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
}

.network-level-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
}

.network-level-divider::before,
.network-level-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
  max-width: 120px;
}

.network-level-pill {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Multi-generation tree: flat, independent rows (one per depth) instead of
   nesting each parent's children beneath it — nesting made a column's width
   depend on how many descendants it had, which pulled wide branches out of
   alignment with their siblings. Flat rows can't drift like that; each one
   just centers on its own, with scroll handling overflow either way. */
.network-tree-scroll {
  overflow: auto;
  max-height: 640px;
  padding-bottom: 8px;
}

/* Rows themselves stay in normal flow (so their height/width is real and
   scrollable); the SVG overlay sits behind them at the same coordinates,
   sized and positioned in JS from each card's actual rendered offsets. */
.network-tree-canvas {
  position: relative;
}

.network-tree-connectors {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 0;
}

.network-connector-line {
  fill: none;
  stroke: rgba(255, 107, 53, 0.4);
  stroke-width: 2;
}

.network-level-divider,
.network-children {
  position: relative;
  z-index: 1;
}

/* Deliberately flush-left (no justify-content/margin centering here) — rows
   always lay out left-to-right from x=0 with zero ambiguity, so any native
   overflow only ever grows rightward, which an overflow:auto ancestor can
   always reach by scrolling. Visual centering (including keeping
   parent-relative groups from drifting left of x=0) is handled entirely in
   JS below, since it already has to compute exact pixel positions to align
   child groups under their real parent — doing it there means the two
   concerns can't fight each other. */
.network-children {
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  margin-bottom: 20px;
}

/* ===== 3D / interactive card treatment (Dashboard pages + landing page) ===== */
.card-3d {
  position: relative;
  transform-style: preserve-3d;
  perspective: 1000px;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.35s ease;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.24),
    0 8px 16px -4px rgba(0, 0, 0, 0.35),
    0 20px 40px -12px rgba(0, 0, 0, 0.45);
  will-change: transform;
}

.card-3d::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 40%);
  pointer-events: none;
  opacity: 0.8;
  transition: opacity 0.35s ease;
}

.card-3d:hover {
  transform: translateY(-6px) rotateX(2deg) rotateY(-2deg) scale(1.015);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.28),
    0 12px 24px -4px rgba(0, 0, 0, 0.4),
    0 32px 64px -16px rgba(0, 0, 0, 0.55);
}

.card-3d:hover::before {
  opacity: 1;
}

.card-3d .stat-icon,
.card-3d .network-node-avatar {
  box-shadow: 0 6px 14px -4px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

@media (prefers-reduced-motion: reduce) {
  .card-3d,
  .card-3d:hover {
    transform: none;
    transition: none;
  }
}

/* Sidebar brand mark (admin/user layouts). The crest's own colors (navy/gold)
   sit too close to the dark sidebar background to read clearly, so it sits
   on a white rounded-rectangle well for contrast. */
.logo-img {
  height: 48px;
  width: 48px;
  padding: 4px;
  border-radius: 10px;
  background: #ffffff;
  object-fit: contain;
  flex-shrink: 0;
}

/* Guest/login card's icon well — same contrast problem as the sidebar mark,
   against the dark login card background, so it keeps a white well behind
   it, just sized for the real logo instead of a single glyph. */
.logo-icon {
  width: 140px;
  height: 140px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.logo-icon img {
  width: 80%;
  height: 80%;
  object-fit: contain;
}

