/**
 * Redstone / Bulsho Finance — cohesive blue shell (main area, sidebar, header, footer, auth).
 * Loaded after assets/css/styles.css
 */

/* ----- Logged-in app (Metronic demo1 body) ----- */
html:not(.dark) body.demo1 {
  background: linear-gradient(180deg, #d8e6fb 0%, #e4eefb 42%, #edf3fd 100%) !important;
  background-color: #e4eefb !important;
}

html.dark body.demo1 {
  background: linear-gradient(180deg, #0a1220 0%, #0f1b2e 45%, #0c1526 100%) !important;
  background-color: #0f1b2e !important;
}

html:not(.dark) body.demo1 .kt-wrapper {
  background: transparent;
}

html:not(.dark) body.demo1 header#header.kt-header,
html:not(.dark) body.demo1 header.kt-header {
  background: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid rgba(185, 204, 232, 0.55) !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 10px 32px -20px rgba(30, 64, 175, 0.18);
}

html.dark body.demo1 header#header.kt-header,
html.dark body.demo1 header.kt-header {
  background: rgba(15, 27, 46, 0.96) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(56, 189, 248, 0.14) !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 12px 36px -16px rgba(0, 0, 0, 0.5);
}

html:not(.dark) body.demo1 .kt-footer {
  background: rgba(255, 255, 255, 0.55);
  border-top: 1px solid #c5d8f0;
  margin-top: auto;
}

html.dark body.demo1 .kt-footer {
  background: rgba(10, 18, 32, 0.6);
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

/* Fade content top into header — avoids a flat “lavender strip” under the toolbar */
html:not(.dark) body.demo1 main#content {
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.97) 0%,
    rgba(255, 255, 255, 0.55) 1.5rem,
    rgba(255, 255, 255, 0.12) 3rem,
    rgba(255, 255, 255, 0) 5rem
  );
  background-repeat: no-repeat;
}

html.dark body.demo1 .kt-wrapper {
  background: transparent;
}

html.dark body.demo1 main#content {
  background-image: linear-gradient(
    180deg,
    rgba(15, 27, 46, 0.95) 0%,
    rgba(15, 27, 46, 0.5) 1.5rem,
    rgba(15, 27, 46, 0.12) 3rem,
    rgba(15, 27, 46, 0) 5.25rem
  );
  background-repeat: no-repeat;
}

/* Sidebar + mobile drawer: always dark (independent of page light/dark theme) */
#sidebar.redstone-sidebar-surface,
.kt-drawer #sidebar.redstone-sidebar-surface {
  background: linear-gradient(
    180deg,
    #000000 0%,
    #03060c 22%,
    #061018 48%,
    #0a1628 72%,
    #0f2342 100%
  ) !important;
  background-color: #0a1628 !important;
  border-right-color: rgba(255, 255, 255, 0.08) !important;
  --foreground: 0 0% 98%;
  --muted-foreground: 0 0% 72%;
  --border: 0 0% 100% / 0.12;
  --accent: 210 40% 22%;
  --primary: 199 89% 58%;
}

#sidebar_header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Sidebar company logo — must stay visible (custom PNG + Metronic collapse rules) */
#sidebar_header {
  min-height: 8.25rem;
  padding: 0.75rem 0.5rem 0.55rem;
  overflow: visible;
  align-items: center;
  justify-content: center;
}

#sidebar_header .kt-sidebar-brand {
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-height: 7.25rem;
  padding-inline: 0.5rem;
  text-decoration: none;
}

#sidebar_header .kt-sidebar-brand .default-logo {
  display: block;
  width: auto;
  height: auto;
  max-height: 7rem;
  max-width: min(16rem, 100%);
  margin-inline: auto;
  object-fit: contain;
  object-position: center center;
  background: #fff;
  border-radius: 0.65rem;
  padding: 0.2rem 0.35rem;
}

#sidebar_header .kt-sidebar-brand .small-logo {
  display: block;
  width: auto;
  height: auto;
  max-height: 3.25rem;
  max-width: 3.25rem;
  margin-inline: auto;
  object-fit: contain;
  object-position: center center;
  background: #fff;
  border-radius: 0.4rem;
  padding: 0.1rem;
}

.demo1 .kt-sidebar .small-logo {
  display: none !important;
}

.demo1.kt-sidebar-collapse .kt-sidebar:not(:hover) .default-logo {
  display: none !important;
}

.demo1.kt-sidebar-collapse .kt-sidebar:not(:hover) .small-logo {
  display: block !important;
}

.demo1.kt-sidebar-collapse .kt-sidebar:hover .default-logo {
  display: block !important;
}

.demo1.kt-sidebar-collapse .kt-sidebar:hover .small-logo {
  display: none !important;
}

.demo1.kt-sidebar-collapse .kt-sidebar:not(:hover) #sidebar_header .kt-sidebar-brand {
  padding-inline: 0.35rem;
}

/* Sidebar menu — white text on dark surface */
#sidebar.redstone-sidebar-surface .kt-menu-title,
#sidebar.redstone-sidebar-surface .kt-menu-link,
#sidebar.redstone-sidebar-surface .kt-menu-label {
  color: rgba(255, 255, 255, 0.9) !important;
}

#sidebar.redstone-sidebar-surface .kt-menu-icon,
#sidebar.redstone-sidebar-surface .kt-menu-arrow,
#sidebar.redstone-sidebar-surface .kt-menu-icon i,
#sidebar.redstone-sidebar-surface .kt-menu-arrow i {
  color: rgba(255, 255, 255, 0.62) !important;
}

#sidebar.redstone-sidebar-surface .kt-menu-bullet::before {
  background-color: rgba(255, 255, 255, 0.35) !important;
}

#sidebar.redstone-sidebar-surface .kt-menu-item:hover > .kt-menu-link .kt-menu-title,
#sidebar.redstone-sidebar-surface .kt-menu-item:hover > .kt-menu-link .kt-menu-icon,
#sidebar.redstone-sidebar-surface .kt-menu-item:hover > .kt-menu-link .kt-menu-arrow,
#sidebar.redstone-sidebar-surface .kt-menu-link:hover .kt-menu-title {
  color: #ffffff !important;
}

#sidebar.redstone-sidebar-surface .kt-menu-item-active > .kt-menu-link,
#sidebar.redstone-sidebar-surface .kt-menu-item.kt-menu-item-active > .kt-menu-link,
#sidebar.redstone-sidebar-surface a.kt-menu-link.kt-menu-item-active,
#sidebar.redstone-sidebar-surface .kt-menu-item-active > a.kt-menu-link {
  background: rgba(255, 255, 255, 0.1) !important;
  border-radius: 0.5rem;
}

#sidebar.redstone-sidebar-surface .kt-menu-item-active .kt-menu-title,
#sidebar.redstone-sidebar-surface .kt-menu-item-active .kt-menu-icon,
#sidebar.redstone-sidebar-surface .kt-menu-item-active .kt-menu-arrow,
#sidebar.redstone-sidebar-surface .kt-menu-item-show > .kt-menu-link .kt-menu-title,
#sidebar.redstone-sidebar-surface .kt-menu-item-show > .kt-menu-link .kt-menu-icon {
  color: #ffffff !important;
}

#sidebar.redstone-sidebar-surface .kt-menu-item-active .kt-menu-bullet::before,
#sidebar.redstone-sidebar-surface .kt-menu-link:hover .kt-menu-bullet::before {
  background-color: #38bdf8 !important;
}

#sidebar.redstone-sidebar-surface .kt-menu-link,
#sidebar.redstone-sidebar-surface .kt-menu-label,
#sidebar.redstone-sidebar-surface .kt-menu-item,
#sidebar.redstone-sidebar-surface .kt-menu-accordion {
  border: none !important;
  box-shadow: none !important;
}

#sidebar.redstone-sidebar-surface .kt-menu-accordion::before {
  display: none !important;
  border: none !important;
}

#sidebar.redstone-sidebar-surface #sidebar_toggle {
  border-color: rgba(255, 255, 255, 0.22) !important;
  background: rgba(10, 22, 40, 0.95) !important;
  color: rgba(255, 255, 255, 0.9) !important;
}

/* ----- Auth pages (login, forgot password, etc.) — always dark ----- */
.page-bg {
  background-image: none !important;
  background-size: auto !important;
}

html.auth-page-dark,
html.auth-page-dark body {
  background-color: #0a1628 !important;
  color: rgba(255, 255, 255, 0.92);
}

html.auth-page-dark .page-bg {
  background: linear-gradient(
    180deg,
    #000000 0%,
    #03060c 22%,
    #061018 48%,
    #0a1628 72%,
    #0f2342 100%
  ) !important;
}

html.auth-page-dark .kt-card {
  background: rgba(10, 20, 38, 0.92) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.55) !important;
  --foreground: 0 0% 98%;
  --muted-foreground: 0 0% 72%;
  --secondary-foreground: 0 0% 78%;
  --border: 0 0% 100% / 0.12;
}

html.auth-page-dark .text-mono,
html.auth-page-dark h3,
html.auth-page-dark .kt-form-label {
  color: rgba(255, 255, 255, 0.95) !important;
}

html.auth-page-dark .text-secondary-foreground,
html.auth-page-dark .text-muted-foreground,
html.auth-page-dark .kt-checkbox-label {
  color: rgba(255, 255, 255, 0.65) !important;
}

html.auth-page-dark .kt-link {
  color: #5eb8ff !important;
}

html.auth-page-dark .kt-link:hover {
  color: #93d0ff !important;
}

html.auth-page-dark .kt-input,
html.auth-page-dark .kt-input input {
  background: rgba(0, 0, 0, 0.35) !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
}

html.auth-page-dark .kt-input input::placeholder {
  color: rgba(255, 255, 255, 0.4) !important;
}

html.auth-page-dark .kt-btn-outline {
  border-color: rgba(255, 255, 255, 0.22) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  background: transparent !important;
}

html:not(.dark):not(.auth-page-dark) .page-bg {
  background: linear-gradient(150deg, #d2e2fb 0%, #e2ebfc 45%, #eef4fe 100%) !important;
}

html.dark:not(.auth-page-dark) .page-bg,
.dark:not(.auth-page-dark) .page-bg {
  background: linear-gradient(155deg, #0b1526 0%, #111f38 50%, #0a1322 100%) !important;
}

/* Company logo preview on Settings (matches sidebar size) */
.settings-logo-preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16rem;
  min-height: 4.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(185, 204, 232, 0.65);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.85);
  overflow: hidden;
}
.settings-logo-preview-box img {
  display: block;
  width: auto;
  height: auto;
  max-height: 5rem;
  max-width: 100%;
  margin-inline: auto;
  object-fit: contain;
  object-position: center center;
}

/* Top bar image preview on Settings */
.settings-topbar-preview-box {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  max-width: 32rem;
  min-height: 3rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(185, 204, 232, 0.65);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.85);
  overflow: hidden;
}
.settings-topbar-preview-box img {
  display: block;
  width: auto;
  height: auto;
  max-height: 2.5rem;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}

/* Top bar brand / banner in header */
body.demo1 #megaMenuContainer .app-topbar-brand {
  flex-shrink: 0;
  align-self: center;
  max-width: min(28rem, 42vw);
  margin-inline-end: 0.5rem;
}
body.demo1 .app-topbar-brand-img {
  display: block;
  width: auto;
  height: auto;
  max-height: 3.25rem;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}

/* Customers KPI + filter bar: see inline <style> in customers.php (avoids missing styles when only that file is synced) */

/* ----- Main content width (#contentContainer — dashboard, customers, cashier, …) ----- */
/* Default Metronic .kt-container-fixed caps at ~80rem; widen app content to ~96rem. */
@media (min-width: 80rem) {
  body.demo1 main#content #contentContainer.kt-container-fixed {
    max-width: 96rem !important;
    width: 100%;
    margin-inline: auto;
  }
}
