/* ================================
   Celestial Layout + Sidebar CSS
   Shared across all app pages
================================== */

/* Theme tokens */
:root {
  --accent-indigo: #6b5bff;
  --accent-cyan:   #00c6ff;
  --accent-violet: #8a2be2;
  --accent-gold:   #f4c542;
  --accent-red:    #ff6b6b;

  --text-dark:  #11152a;
  --text-muted: #5e678a;

  --card-bg:   rgba(255, 255, 255, 0.74);
  --card-line: rgba(0, 0, 0, 0.05);
}



/* Make whole app a side-by-side layout */
body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  background: linear-gradient(180deg, #f9fbff 0%, #e9f3ff 50%, #f4f8ff 100%);
  color: #11152a;
  display: flex;          /* <-- important */
  min-height: 100vh;      /* <-- important */
  overflow-x: hidden;
}

/* Sidebar column should stretch full height */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0.52));
  border-right: 1px solid rgba(0,0,0,0.05);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.05);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;      /* <-- add this line */
}


.brand {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-dark);
}

.brand .logo {
  margin-right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.menu {
  /* no special styles needed; keep for clarity */
}

.menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem .8rem;
  color: var(--text-muted);
  border-radius: .5rem;
  text-decoration: none;
  margin-bottom: .3rem;
  transition: background 0.2s, color 0.2s;
}

.menu a span {
  display: inline-flex;
  align-items: center;
}

.menu a i {
  /* icon spacing comes from Bootstrap utilities (me-2 etc.) */
}

.menu a:hover,
.menu a.active {
  background: rgba(0,0,0,0.05);
  color: var(--text-dark);
}

/* Collapsible sections (Purchase / Sales / etc.) */
.menu a.has-submenu {
  /* same visual as normal menu item, but we keep the flex + chevron */
}

.menu a.has-submenu i.chevron {
  transition: transform 0.3s ease;
  font-size: 0.9rem;
}

.menu a.has-submenu.open i.chevron {
  transform: rotate(90deg);
}

.submenu {
  margin-left: 1.5rem;
  display: none;
}

.submenu.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

.submenu a {
  padding: 0.4rem 0.7rem;
  font-size: 0.92rem;
  display: block;
  color: var(--text-muted);
}

.submenu a:hover {
  color: var(--text-dark);
  background: rgba(0,0,0,0.03);
  border-radius: 0.4rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Main content & top bar ===== */

.main {
  flex: 1;
  padding: 2rem;
  background: transparent;
  overflow: auto;
  transition: filter .3s ease;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.title {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-dark);
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Generic card base (used in most pages) */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}

/* ===== Drawer overlay & mobile behavior ===== */

.menu-toggle {
  display: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--text-dark);
}

/* overlay used when sidebar is opened as drawer on mobile */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(3px);
  z-index: 1030;
  display: none;
  opacity: 0;
  transition: opacity .3s ease;
}

.overlay.active {
  display: block;
  opacity: 1;
}

/* Mobile / tablet: sidebar slides in as drawer */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .menu-toggle {
    display: inline-block;
  }

  .main {
    padding: 1.2rem;
  }
}

/* On larger screens, overlay should never show */
@media (min-width: 769px) {
  .overlay {
    display: none !important;
  }
}

.app-footer {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 2rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
}

/* Global full-screen loader */
.global-loader {
  position: fixed;
  inset: 0;
  z-index: 2000; /* Above sidebar, modals, etc. */
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.global-loader.d-none {
  display: none !important;
}

.global-loader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45); /* dark bluish overlay */
  backdrop-filter: blur(4px);
}

.global-loader-content {
  position: relative;
  background: var(--card-bg, #ffffff);
  border-radius: 16px;
  padding: 24px 32px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  text-align: center;
  min-width: 260px;
}

.global-loader .spinner-border {
  width: 3rem;
  height: 3rem;
}

/* Base style for the dashboard burger */
.menu-toggle {
  display: none; /* default hidden on desktop */
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-dark); /* make sure icon is visible on light topbar */
  outline: none;
}

.menu-toggle i {
  font-size: 1.6rem;
  line-height: 1;
  pointer-events: none; /* so whole button is clickable */
}

/* Show burger on tablet/mobile */
@media (max-width: 991.98px) {
  .menu-toggle {
    display: inline-flex;
    margin-right: 4px;
  }
}

/* Optional: subtle hover / active feedback */
.menu-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}

.menu-toggle:active {
  transform: scale(0.96);
}

/* Make sure overlay and drawer are above charts on mobile */
.overlay {
  z-index: 1040; /* above main content */
}

.sidebar {
  z-index: 1050;
}

/* Let clicks on the icon bubble to the span (.input-group-text) cleanly */
.input-group-text i {
  pointer-events: none;
}

/* ==========================================================================
   QUICK ADD PARTY — SHARED LIGHT THEME (MOBILE SAFE)
   ========================================================================== */

/* Backdrop */
#quickAddPartyDialogNative::backdrop,
dialog.quick-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  z-index: 9999;
}

/* Base dialog container – LIGHT THEME, fixed & centered */
dialog.quick-modal {
  position: fixed;
  inset: 0;                     /* top:0; right:0; bottom:0; left:0 */
  margin: auto;
  max-width: min(520px, 96vw);
  max-height: min(560px, 96vh);
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 0;
  border-radius: 14px;
  background: #ffffff;
  background-image: linear-gradient(145deg, #ffffff 0%, #f9fafb 45%, #eef2ff 100%);
  color: #111827;
  box-shadow:
    0 18px 45px rgba(15, 23, 42, 0.25),
    0 0 0 1px rgba(148, 163, 184, 0.25);
  overflow: hidden;
  z-index: 9999;                /* 🔥 sit above sidebar overlay etc. */
}

/* Ensure it behaves nicely when open */
dialog.quick-modal[open],
dialog.quick-modal.quick-modal--force-open {
  display: flex;
}

/* Variant hook */
.quick-modal--light {
  /* same theme for now */
}

/* Content wrapper */
.quick-modal__wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

/* Header */
.quick-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  background: linear-gradient(90deg, #eef2ff, #e0f2fe);
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
}

.quick-modal__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #0f172a;
}

/* Close (×) */
.quick-modal__close {
  border: none;
  background: transparent;
  font-size: 1.3rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  color: #6b7280;
  transition: color 0.18s ease, transform 0.18s ease;
}

.quick-modal__close:hover {
  color: #111827;
  transform: scale(1.05);
}

/* Body */
.quick-modal__body {
  padding: 0.9rem 1rem 0.75rem;
  max-height: calc(100% - 120px);  /* fit header+footer */
  overflow-y: auto;
}

/* Labels & inputs */
.quick-modal .form-label.small {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin-bottom: 0.2rem;
}

.quick-modal input.form-control,
.quick-modal select.form-select {
  font-size: 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  background-color: #f9fafb;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.quick-modal input.form-control::placeholder {
  color: #9ca3af;
  opacity: 0.85;
}

.quick-modal input.form-control:focus,
.quick-modal select.form-select:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.25);
  background-color: #ffffff;
}

/* WhatsApp label */
.quick-modal .form-check-label.small {
  font-size: 0.8rem;
  color: #4b5563;
}

/* Footer */
.quick-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem 0.9rem;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  background: #f9fafb;
}

.quick-modal__footer .btn {
  border-radius: 999px;
  font-size: 0.78rem;
  padding: 0.35rem 0.95rem;
}

.quick-modal__footer .btn-primary {
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.3);
}

.quick-modal__footer .btn-outline-secondary {
  border-color: rgba(148, 163, 184, 0.9);
  color: #4b5563;
}

/* Mobile tweaks */
@media (max-width: 576px) {
  dialog.quick-modal {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .quick-modal__body {
    max-height: calc(100vh - 140px);
  }
}

/* Keep modal light even if OS is in dark mode */
@media (prefers-color-scheme: dark) {
  dialog.quick-modal.quick-modal--light {
    background-image: linear-gradient(145deg, #ffffff 0%, #f9fafb 45%, #eef2ff 100%);
    color: #111827;
  }
}



