/*
 * DealWorthIt app-shell skin (Phase 2A).
 *
 * Re-skins the authenticated shell (layout2.html) to match the primary
 * reference docs/design/dealworthit-app.html: 212px white sidebar, 58px
 * topbar, emerald-tinted active nav, page background from tokens, neutral
 * wallet pill, coral avatar, rail upgrade card, quiet feedback link.
 *
 * Loaded ONLY when data-brand=dealworthit, after common_styles.css, so it
 * overrides the shared .dwi-shell-modern skin there by cascade order —
 * white-label brands keep the existing shell untouched. Shell CSS only:
 * nothing inside {% yield body %} is restyled here except the generic
 * card surface treatment. All colors come from the --dwi-* tokens
 * (themes/tokens.css + theme-dealworthit.css); no hardcoded values.
 */

/* ── Page canvas ────────────────────────────────────────────── */
.dwi-shell-modern { background: var(--dwi-color-page) !important; }
.dwi-shell-modern .wrapper { background: var(--dwi-color-page); }

/* ── Sidebar geometry: 240px -> 212px ─────────────────────────
   The collapse script in layout2.html writes INLINE width/padding-left
   ('96px' / '240px') on the aside and wrapper, so every offset here
   needs !important to beat the inline style. State tracks the
   data-kt-aside-minimize attribute that same script toggles, keeping
   collapse/expand working. :not(.p-0) leaves the aside-less pages
   (success / account setup / embedded) unpadded as before. */
.dwi-shell-modern.aside-secondary-disabled .aside,
.dwi-shell-modern.aside-secondary-disabled .aside.aside-extended { width: 212px !important; }
.dwi-shell-modern.aside-secondary-disabled .aside .aside-primary { width: 212px !important; }
@media (min-width: 992px) {
  .dwi-shell-modern:not([data-kt-aside-minimize="on"]).aside-secondary-disabled.aside-fixed .wrapper:not(.p-0) { padding-left: 212px !important; }
  .dwi-shell-modern[data-kt-aside-minimize="on"].aside-secondary-disabled.aside-fixed .wrapper:not(.p-0) { padding-left: 96px !important; }
  .dwi-shell-modern.aside-fixed.aside-secondary-disabled[data-kt-sticky-header=on] .header { left: 212px !important; }
  /* minimized (96px) geometry is unchanged */
  .dwi-shell-modern[data-kt-aside-minimize="on"].aside-fixed.aside-secondary-disabled[data-kt-sticky-header=on] .header { left: 96px !important; }
}
@media (max-width: 991.98px) {
  .dwi-shell-modern.aside-secondary-disabled.aside-fixed .wrapper { padding-left: 0 !important; }
}

/* ── Sidebar surface ────────────────────────────────────────── */
.dwi-shell-modern .aside {
  background: var(--dwi-color-surface) !important;
  border-right: 1px solid var(--dwi-color-line) !important;
  box-shadow: none !important;
}
.dwi-shell-modern .aside-nav { padding: 14px 12px 4px !important; }

/* Logo wordmark */
.dwi-shell-modern .dwi-logo-text { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.dwi-shell-modern .dwi-logo-text-primary { color: var(--dwi-color-primary); }
.dwi-shell-modern .dwi-logo-text-secondary { color: var(--dwi-color-text); }

/* ── Sidebar nav rows ───────────────────────────────────────── */
.dwi-shell-modern .menu-link.menu-center {
  padding: 9px 11px !important;
  border-radius: 9px !important;
  margin: 1px 0;
}
.dwi-shell-modern .menu-link.menu-center .menu-icon .svg-icon { gap: 11px !important; }
.dwi-shell-modern .menu-link.menu-center .menu-icon [class*="bi-"]:not(.svg-icon),
.dwi-shell-modern .menu-link.menu-center .menu-icon [class*="fa-"] {
  font-size: 17px !important;
  width: 17px;
  color: var(--dwi-color-muted);
}
.dwi-shell-modern .menu-link.menu-center .menu-icon .svg-icon svg {
  width: 17px;
  height: 17px;
  color: var(--dwi-color-muted);
}
.dwi-shell-modern .menu-link.menu-center .menu-icon .svg-icon > div {
  font-size: 13.5px !important;
  font-weight: 500;
  color: var(--dwi-color-text-secondary);
  letter-spacing: 0;
}
/* Active: emerald tint */
.dwi-shell-modern .menu-link.menu-center.active { background: var(--dwi-color-primary-soft) !important; }
.dwi-shell-modern .menu-link.menu-center.active .menu-icon [class*="bi-"]:not(.svg-icon),
.dwi-shell-modern .menu-link.menu-center.active .menu-icon [class*="fa-"],
.dwi-shell-modern .menu-link.menu-center.active .menu-icon .svg-icon svg { color: var(--dwi-color-primary) !important; }
.dwi-shell-modern .menu-link.menu-center.active .svg-icon > div { color: var(--dwi-color-primary) !important; font-weight: 500; }
/* Hover */
.dwi-shell-modern .menu-link.menu-center:not(.active):hover { background: var(--dwi-color-hover) !important; }
.dwi-shell-modern .menu-link.menu-center:not(.active):hover .menu-icon [class*="bi-"]:not(.svg-icon),
.dwi-shell-modern .menu-link.menu-center:not(.active):hover .menu-icon [class*="fa-"] { color: var(--dwi-color-text-secondary); }
.dwi-shell-modern .menu-link.menu-center:not(.active):hover .svg-icon > div { color: var(--dwi-color-text); }
/* Group separators */
.dwi-shell-modern #kt_aside_menu > .menu-item:nth-child(5)::after { background: var(--dwi-color-line-soft); margin: 11px 8px; }
.dwi-shell-modern .menu-item.dwi-menu-group-start::before { background: var(--dwi-color-line-soft); }

/* ── Upgrade card (reference .up) ───────────────────────────── */
.dwi-shell-modern .aside-footer { padding: 12px 12px 14px !important; }
.dwi-upgrade-card {
  background: var(--dwi-color-rail);
  border: 1px solid var(--dwi-color-line);
  border-radius: 12px;
  padding: 14px;
}
.dwi-upgrade-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--dwi-color-primary-soft);
  color: var(--dwi-color-primary);
  font-size: 17px;
}
.dwi-upgrade-icon i { font-size: 17px !important; }
.dwi-upgrade-title { font-size: 13.5px; font-weight: 600; color: var(--dwi-color-text); }
.dwi-upgrade-sub { font-size: 11.5px; color: var(--dwi-color-muted); margin: 3px 0 11px; }
.dwi-upgrade-btn {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--dwi-color-primary);
  font-size: 12.5px;
  font-weight: 600;
}
.dwi-upgrade-btn:hover { background: var(--dwi-color-primary-strong); }
/* The CTA is a <button> for a live subscriber (it opens the plan-change quote
 * rather than navigating) and an <a> for everyone else. These keep the two
 * indistinguishable: a button brings its own font, border and width, and an
 * anchor brings none of them. */
button.dwi-upgrade-icon,
button.dwi-upgrade-btn {
  border: 0;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
}
button.dwi-upgrade-icon { width: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.dwi-upgrade-btn[disabled], .dwi-upgrade-btn.disabled,
.dwi-upgrade-icon[disabled], .dwi-upgrade-icon.disabled { opacity: .7; pointer-events: none; }
/* While the change is being quoted the shared handler swaps the label for
 * "<spinner> Updating…"; the spinner's own styles live on the pricing
 * stylesheet, which the app shell does not load. */
.dwi-upgrade-btn .pr-cta-spinner {
  display: inline-block; width: 12px; height: 12px; margin-right: 6px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  opacity: .9; vertical-align: -1px;
  animation: dwi-upgrade-spin .6s linear infinite;
}
@keyframes dwi-upgrade-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .dwi-upgrade-btn .pr-cta-spinner { animation-duration: 2s; } }

/* Feedback: quiet centered link */
.dwi-feedback-btn {
  border: none;
  background: transparent;
  color: var(--dwi-color-muted);
  font-size: 12.5px;
  font-weight: 500;
  padding: 10px 8px 2px;
}
.dwi-feedback-btn svg { color: var(--dwi-color-primary); }
.dwi-feedback-btn:hover { background: transparent; color: var(--dwi-color-text); }

/* ── Topbar ─────────────────────────────────────────────────── */
.dwi-shell-modern #kt_header.header {
  /* Keep header menus above sticky workspace controls. */
  z-index: 100;
  background: var(--dwi-color-surface) !important;
  border-bottom: 1px solid var(--dwi-color-line-soft) !important;
  box-shadow: none;
  height: 58px;
  min-height: 58px;
  padding: 0 12px;
}
.dwi-shell-modern #kt_header.header.header-sticky { box-shadow: 0 4px 12px -8px rgba(16, 24, 40, 0.08); }

/* Breadcrumbs */
.dwi-shell-modern .breadcrumb { font-size: 13.5px; }
.dwi-shell-modern .breadcrumb .breadcrumb-item.text-muted { color: var(--dwi-color-muted) !important; }
.dwi-shell-modern .breadcrumb .breadcrumb-item.text-muted a { color: var(--dwi-color-muted) !important; }
.dwi-shell-modern .breadcrumb .breadcrumb-item.text-muted a:hover { color: var(--dwi-color-primary) !important; }
.dwi-shell-modern .breadcrumb .breadcrumb-item.text-dark { color: var(--dwi-color-text) !important; font-weight: 500; }
.dwi-shell-modern .breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: var(--dwi-color-line); }

/* Deal search */
.dwi-shell-modern #kt_header .form-control-solid {
  background: var(--dwi-color-surface) !important;
  border: 1px solid var(--dwi-color-line) !important;
  border-radius: 9px !important;
  height: 36px !important;
  font-size: 13px;
  color: var(--dwi-color-text);
  box-shadow: none !important;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.dwi-shell-modern #kt_header .form-control-solid::placeholder { color: var(--dwi-color-muted-soft); }
.dwi-shell-modern #kt_header .form-control-solid:focus {
  border-color: var(--dwi-color-primary) !important;
  box-shadow: 0 0 0 3px rgba(var(--dwi-color-primary-rgb), 0.07) !important;
}

/* Topbar icon buttons: quiet */
.dwi-shell-modern #kt_header .btn-icon i,
.dwi-shell-modern #kt_header .btn.btn-active-light-primary i { color: var(--dwi-color-muted); }
.dwi-shell-modern #kt_header .btn-icon:hover,
.dwi-shell-modern #kt_header .btn.btn-active-light-primary:hover { background: var(--dwi-color-hover) !important; }

/* Wallet: neutral mono pill (reference .wallet) */
.dwi-shell-modern #kt_header .view_wallet .badge-light-success {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px !important;
  background: var(--dwi-color-surface) !important;
  border: 1px solid var(--dwi-color-line) !important;
  border-radius: 8px !important;
  color: var(--dwi-color-text) !important;
}
.dwi-shell-modern #kt_header .view_wallet .badge-light-success i { color: var(--dwi-color-muted) !important; font-size: 15px !important; }
.dwi-shell-modern #kt_header .view_wallet .wallet_balance {
  font-family: var(--dwi-font-mono);
  font-size: 13px !important;
  font-weight: 600;
  color: var(--dwi-color-text) !important;
  font-variant-numeric: tabular-nums;
}

/* Avatar: coral circle (reference .av) */
.dwi-shell-modern #kt_header_user_menu_toggle .symbol > .symbol-label {
  background: var(--dwi-color-avatar) !important;
  color: #fff !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}
.dwi-shell-modern #kt_header_user_menu_toggle .symbol > .symbol-label,
.dwi-shell-modern #kt_header_user_menu_toggle .symbol > img { border-radius: 50% !important; }
.dwi-shell-modern #kt_header_user_menu_toggle:hover .symbol { box-shadow: 0 0 0 2px var(--dwi-color-primary-soft); }

/* Aside toggle buttons */
.dwi-shell-modern #kt_aside_toggle:hover,
.dwi-shell-modern .dwi-aside-desktop-toggle:hover { background: var(--dwi-color-hover) !important; color: var(--dwi-color-text) !important; }

/* ── Cards: white surface, soft border, flat (reference .card) ─ */
.dwi-shell-modern .card {
  background-color: var(--dwi-color-surface);
  /* border: 1px solid var(--dwi-color-line); */
  box-shadow: none;
  border-radius: var(--dwi-radius-lg);
}

/* Footer: quiet */
.dwi-shell-modern .footer { background: transparent; }

/* ── Returned-from-upgrade highlight ─────────────────────────────────────────
 * Flashed on the control a customer was blocked on, once they are put back on
 * it after upgrading. Outline + soft fill rather than a colour change, so it
 * reads on a button, a card or a table row without knowing which it is. The
 * class is removed on a timer, so a page that never animates still clears it. */
.dwi-upgraded-flash {
  animation: dwi-upgraded-flash 2.4s ease-out 1;
  border-radius: 10px;
}
@keyframes dwi-upgraded-flash {
  0%   { box-shadow: 0 0 0 0 rgba(14, 110, 89, 0); }
  10%  { box-shadow: 0 0 0 3px rgba(14, 110, 89, .55), 0 0 0 9px rgba(14, 110, 89, .12); }
  65%  { box-shadow: 0 0 0 3px rgba(14, 110, 89, .55), 0 0 0 9px rgba(14, 110, 89, .12); }
  100% { box-shadow: 0 0 0 0 rgba(14, 110, 89, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .dwi-upgraded-flash { animation: none; box-shadow: 0 0 0 3px rgba(14, 110, 89, .55); }
}

/* Keep both workspace rails aligned independently of their footer content. */
.dwi-shell-modern #kt_aside_menu_wrapper { justify-content:flex-start !important; }
.dwi-shell-modern #kt_aside_menu { margin-top:clamp(24px, 12vh, 140px) !important; margin-bottom:0 !important; }
.dwi-shell-modern .dwi-workspace-trigger {
  flex-shrink:0; width:auto; height:36px; padding:0 12px !important;
  border:1px solid var(--dwi-color-line) !important; border-radius:8px;
  background:var(--dwi-color-surface); color:var(--dwi-color-text-secondary);
  font-size:13px; font-weight:500; white-space:nowrap;
}
.dwi-shell-modern .dwi-workspace-trigger i { flex-shrink:0; padding:0; margin:0; }
.dwi-shell-modern .dwi-workspace-option {
  min-height:40px; padding:10px 12px !important; border:0;
  font-family:inherit; font-size:13.5px; font-weight:500;
  color:var(--dwi-color-text-secondary) !important; line-height:20px; border-radius:8px;
}
.dwi-shell-modern .dwi-workspace-option[aria-current] {
  background:var(--dwi-color-primary-soft); color:var(--dwi-color-primary) !important; opacity:1;
}
.dwi-shell-modern .dwi-workspace-option:hover { background:var(--dwi-color-hover); }
@media(max-width:991.98px) {
  .dwi-shell-modern #kt_aside_menu { margin-top:24px !important; }
  .dwi-shell-modern .dwi-workspace-trigger { padding:0 8px !important; font-size:12px; }
}

.dwi-shell-modern .dwi-workspace-option i,
.dwi-shell-modern .dwi-workspace-option .menu-title { color:inherit !important; }

/* Align the brand row with the app header without shifting the wordmark. */
.dwi-shell-modern .aside-logo {
  height: 58px !important;
  min-height: 58px;
  padding: 0 20px !important;
  justify-content: center !important;
  border-bottom: 1px solid var(--dwi-color-line);
}
.dwi-shell-modern .dwi-logo-link { width: 100%; justify-content: center; }
.dwi-shell-modern .dwi-logo-img--full {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-height: 38px;
  margin: 0 !important;
  object-fit: contain;
  object-position: center;
}
