/* ══════════════ B2BStays portal shell: the Hotel and the Travel Agent portals share this look ══════════════
   Loaded after site.css by both portals' layouts (_HotelLayout.cshtml, _Layout.cshtml). Every content view already uses site.css's class vocabulary
   (.card, .stat-card, .badge-*, .table-wrap table ...) and every one of those rules reads color-role CSS variables, so re-theming is just redefining
   the variables on body.app-portal -- no changes to the views.

   Each portal has its own default colours (so the two are easy to tell apart) and every user can pick another theme under Settings: the choice is kept
   in the browser (portal-theme.js) and arrives here as --user-* variables set on <html> before the page paints.
     Hotel portal         : charcoal  #171b23 + blue accent
     Travel Agent portal  : navy      #0a265d + bright blue accent
*/
body.app-body--hotel {
  --module-navbar: #171b23;
  --module-hover: #20252f;
  --module-accent: #1976e0;
  --module-accent-dark: #125bb0;
  --module-accent-light: #eaf3ff;
}
body.app-body--agent {
  --module-navbar: #0a265d;
  --module-hover: #14397f;
  --module-accent: #2a74ec;
  --module-accent-dark: #1c5bc4;
  --module-accent-light: #e8f0ff;
}

body.app-portal {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --topbar-h: 58px;

  --blue: var(--user-accent, var(--module-accent));
  --blue-dark: var(--user-accent-dark, var(--module-accent-dark));
  --blue-light: var(--user-accent-light, var(--module-accent-light));
  --navbar: var(--user-navbar, var(--module-navbar));
  --navbar-hover: var(--user-navbar-hover, var(--module-hover));

  --purple: #4a3aa7;
  --purple-bg: #ece9f7;
  --green: #0ca30c;
  --green-bg: #e3f6e3;
  --orange: #eb6834;
  --orange-bg: #fdece5;
  --red: #d03b3b;
  --red-bg: #fbe7e6;

  --bg: #f4f5f7;
  --card: #fcfcfb;
  --border: rgba(11, 11, 11, 0.10);
  --muted: #898781;
  --text: #0b0b0b;
  --radius: 8px;
  background: var(--bg);
}

/* ---------- Topbar ---------- */
body.app-portal.app-body { display: block; }

body.app-portal .app-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--topbar-h);
  background: var(--navbar);
  color: #fff;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 8px rgba(0, 0, 0, 0.18);
}
body.app-portal .app-topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
body.app-portal .app-topbar .brand img { width: 28px; height: 28px; border-radius: 6px; background: #fff; display: block; }
body.app-portal .app-topbar .property-chip { font-size: 12.5px; color: rgba(255, 255, 255, 0.75); border-left: 1px solid rgba(255, 255, 255, 0.2); padding-left: 14px; margin-left: 4px; }
body.app-portal .app-topbar .property-chip strong { color: #fff; }
body.app-portal .app-topbar-right { display: flex; align-items: center; gap: 14px; }
body.app-portal .app-topbar .topbar-icon-btn { position: relative; width: 34px; height: 34px; border-radius: 8px; background: rgba(255, 255, 255, 0.12); border: none; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; transition: background-color .15s; }
body.app-portal .app-topbar .topbar-icon-btn:hover { background: rgba(255, 255, 255, 0.22); }
body.app-portal .app-topbar .badge-dot { position: absolute; top: -5px; right: -5px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
body.app-portal .app-topbar .topbar-user { display: flex; align-items: center; gap: 8px; cursor: pointer; color: #fff; font-size: 13px; border-radius: 8px; padding: 3px 6px; transition: background-color .15s; }
body.app-portal .app-topbar .topbar-user:hover { background: rgba(255, 255, 255, 0.10); }
body.app-portal .app-topbar .avatar { width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
body.app-portal .app-topbar .nav-toggle { display: none; width: 36px; height: 36px; border-radius: 8px; border: none; background: rgba(255, 255, 255, 0.12); color: #fff; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; }
body.app-portal .user-menu { display: none; position: absolute; top: 44px; right: 0; width: 190px; z-index: 50; color: var(--text); }
body.app-portal .user-menu.open { display: block; }
body.app-portal .user-menu .btn-ghost { justify-content: flex-start; width: 100%; margin-bottom: 4px; }

/* ---------- Sidebar ---------- */
body.app-portal .app-shell { display: flex; align-items: flex-start; }
body.app-portal .app-sidebar {
  background: var(--navbar);
  width: 236px;
  flex-shrink: 0;
  position: sticky;
  top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 16px 12px 12px;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
body.app-portal .app-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.66);
  border-radius: 8px;
  border-left: 3px solid transparent;
  padding: 9px 12px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 2px;
  transition: background-color .15s, color .15s;
}
body.app-portal .app-sidebar .nav-link i { width: 18px; text-align: center; font-size: 14px; }
body.app-portal .app-sidebar .nav-link:hover { background: var(--navbar-hover); color: #fff; }
body.app-portal .app-sidebar .nav-link.active { background: var(--navbar-hover); color: #fff; border-left-color: var(--blue); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04); }
body.app-portal .app-sidebar .nav-link .nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
body.app-portal .app-sidebar .nav-label { color: rgba(255, 255, 255, 0.38); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 14px 12px 6px; }
body.app-portal .app-sidebar .sidebar-foot { margin-top: auto; padding: 14px 12px 4px; color: rgba(255, 255, 255, 0.38); font-size: 11px; line-height: 1.5; }

body.app-portal .page-wrap { flex: 1; min-width: 0; }

/* ---------- Collapsible groups (native <details>, no script) ---------- */
body.app-portal .app-sidebar .nav-group { margin-bottom: 2px; }
body.app-portal .app-sidebar .nav-group > summary { list-style: none; cursor: pointer; user-select: none; margin-bottom: 0; }
body.app-portal .app-sidebar .nav-group > summary::-webkit-details-marker { display: none; }
body.app-portal .app-sidebar .nav-group > summary:focus-visible,
body.app-portal .app-sidebar .nav-children a:focus-visible,
body.app-portal .app-sidebar .nav-link:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
body.app-portal .app-sidebar .nav-group-title .nav-chevron { margin-left: auto; width: auto; font-size: 10px; transition: transform .15s; }
body.app-portal .app-sidebar .nav-group[open] > summary .nav-chevron { transform: rotate(90deg); }
body.app-portal .app-sidebar .nav-group[open] > summary { color: #fff; }
body.app-portal .app-sidebar .nav-children { margin: 2px 0 6px 21px; padding-left: 8px; border-left: 1px solid rgba(255, 255, 255, 0.14); }
body.app-portal .app-sidebar .nav-children a {
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.66);
  border-radius: 6px;
  border-left: 3px solid transparent;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 1px;
  transition: background-color .15s, color .15s;
}
body.app-portal .app-sidebar .nav-children a:hover { background: var(--navbar-hover); color: #fff; }
body.app-portal .app-sidebar .nav-children a.active { background: var(--navbar-hover); color: #fff; border-left-color: var(--blue); font-weight: 600; }

/* ---------- Page polish shared by both portals ---------- */
body.app-portal .card { box-shadow: 0 1px 2px rgba(11, 11, 11, 0.04); }
body.app-portal .page-title { letter-spacing: -0.2px; }
body.app-portal .footer-note { padding-top: 8px; }

/* ---------- Plain login card (both portals) ---------- */
.rm-login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: var(--bg, #f4f5f7);
  background: radial-gradient(1100px 520px at 50% -10%, color-mix(in srgb, var(--navbar, #171b23) 26%, #f4f5f7), var(--bg, #f4f5f7));
}
.rm-login-card { width: 100%; max-width: 410px; background: #fff; border: 1px solid rgba(11, 11, 11, 0.10); border-top: 4px solid var(--navbar, #171b23); border-radius: 10px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.09); padding: 30px 32px 30px; }
.rm-login-card .login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.rm-login-card .login-brand img { width: 34px; height: 34px; border-radius: 8px; border: 1px solid rgba(11, 11, 11, 0.10); background: #fff; }
.rm-login-card .login-brand strong { display: block; font-size: 15px; line-height: 1.2; }
.rm-login-card .login-brand span { display: block; font-size: 11.5px; color: #898781; letter-spacing: .02em; }
.rm-login-card h4 { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.rm-login-card .sub { color: #898781; font-size: 13px; margin-bottom: 22px; }
.rm-login-foot { text-align: center; margin-top: 16px; color: #898781; font-size: 12px; }

/* ---------- Theme picker (Settings > Appearance) ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.theme-swatch { border: 2px solid var(--border); border-radius: 10px; background: #fff; padding: 0; cursor: pointer; overflow: hidden; text-align: left; transition: border-color .15s, transform .1s; font: inherit; }
.theme-swatch:hover { transform: translateY(-1px); border-color: rgba(11, 11, 11, 0.28); }
.theme-swatch[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-light); }
.theme-swatch .preview { display: flex; height: 54px; }
.theme-swatch .preview .side { width: 34%; }
.theme-swatch .preview .main { flex: 1; background: #f4f5f7; padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.theme-swatch .preview .main i { display: block; height: 6px; border-radius: 3px; background: #dcdfe5; }
.theme-swatch .preview .main i.btn { width: 46%; height: 9px; }
.theme-swatch .name { padding: 7px 9px 8px; font-size: 12.5px; font-weight: 600; color: var(--text); display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.theme-swatch .name small { font-weight: 500; color: var(--muted); font-size: 11px; }
.theme-custom { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.theme-custom label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
.theme-custom input[type=color] { width: 56px; height: 36px; padding: 2px; border: 1.5px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; }

/* ---------- Small screens: the sidebar slides in over the page ---------- */
body.app-portal .nav-scrim { display: none; }
@media (max-width: 900px) {
  body.app-portal .app-topbar { padding: 8px 14px; }
  body.app-portal .app-topbar .nav-toggle { display: inline-flex; }
  body.app-portal .app-topbar .property-chip, body.app-portal .app-topbar .brand .brand-sub { display: none; }
  body.app-portal .app-topbar .topbar-user .who { display: none; }
  body.app-portal .app-sidebar {
    position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; width: 272px;
    min-height: 100vh; max-height: 100vh;
    transform: translateX(-102%); transition: transform .22s ease;
  }
  body.app-portal.nav-open .app-sidebar { transform: none; box-shadow: 8px 0 30px rgba(0, 0, 0, 0.35); }
  body.app-portal.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, 0.45); }
  body.app-portal .page-wrap { padding: 18px 14px 32px; }
}

/* ---------- Dark login background (Travel Agent portal): follows the portal's theme colour ---------- */
.rm-login-wrap.rm-login-wrap--dark {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--navbar, #0a265d) 48%, #000) 0%, var(--navbar, #0a265d) 52%, color-mix(in srgb, var(--navbar, #0a265d) 72%, #5b8cff) 100%);
}
.rm-login-wrap--dark::before, .rm-login-wrap--dark::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; }
.rm-login-wrap--dark::before { top: -190px; right: -150px; width: 540px; height: 540px; background: radial-gradient(circle, rgba(255, 255, 255, 0.13) 0%, transparent 70%); }
.rm-login-wrap--dark::after { bottom: -170px; left: -130px; width: 500px; height: 500px; background: radial-gradient(circle, rgba(255, 255, 255, 0.09) 0%, transparent 70%); }
.rm-login-wrap--dark > div { position: relative; z-index: 1; }
.rm-login-wrap--dark .rm-login-card { border-top-color: var(--blue, #2a74ec); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45); }
.rm-login-wrap--dark .rm-login-foot { color: rgba(255, 255, 255, 0.7); }

/* ---------- The agency's own logo in the top bar: a fixed-size slot, so any logo fits without moving anything ---------- */
body.app-portal .app-topbar .brand img.brand-logo-custom,
.brand-logo-custom {
  width: auto; height: 30px; max-width: 132px; min-width: 24px;
  object-fit: contain; object-position: center;
  background: #fff; border-radius: 6px; padding: 3px 6px;
  flex-shrink: 0; display: block;
}
@media (max-width: 900px) { body.app-portal .app-topbar .brand img.brand-logo-custom { max-width: 96px; } }
