/**
 * Copernica Law — navy and gold 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, #f7f4ef 0%, #f5f3ef 42%, #f3efe8 100%) !important;
  background-color: #f5f3ef !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: white, same as the logo background */
#sidebar.redstone-sidebar-surface,
.kt-drawer #sidebar.redstone-sidebar-surface {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border-right-color: rgba(15, 23, 42, 0.08) !important;
  --foreground: 215 28% 17%;
  --muted-foreground: 215 16% 40%;
  --border: 214 32% 91%;
  --accent: 40 45% 94%;
  --primary: 214 52% 12%;
}

#sidebar_header {
  border-bottom: 1px solid rgba(15, 23, 42, 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: transparent;
  border-radius: 0;
  padding: 0;
}

#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: transparent;
  border-radius: 0;
  padding: 0;
}

.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 — dark text on the white logo background */
#sidebar.redstone-sidebar-surface .kt-menu-title,
#sidebar.redstone-sidebar-surface .kt-menu-link,
#sidebar.redstone-sidebar-surface .kt-menu-label {
  color: #1e293b !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: #475569 !important;
}

#sidebar.redstone-sidebar-surface .kt-menu-bullet::before {
  background-color: #94a3b8 !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: #0F1D2F !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: #f8f1e3 !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: #0F1D2F !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: #D4A853 !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(15, 23, 42, 0.16) !important;
  background: #ffffff !important;
  color: #1e293b !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: #080F1A !important;
  color: rgba(255, 255, 255, 0.92);
}

html.auth-page-dark .page-bg {
  background: linear-gradient(
    180deg,
    #080F1A 0%,
    #0F1D2F 55%,
    #15263c 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-btn-primary {
  background: #D4A853 !important;
  border-color: #c4963f !important;
  color: #0F1D2F !important;
}

html.auth-page-dark .kt-btn-primary:hover {
  background: #E8C97A !important;
  color: #0F1D2F !important;
}

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

html.auth-page-dark .kt-link:hover {
  color: #D4A853 !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, #f7f4ef 0%, #f5f3ef 45%, #efeae2 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;
  }
}
