/* ThinkReal platform shell — Dynamics 365 "modern look" tokens.
   Loaded by app's App.razor via:
     <link rel="stylesheet" href="_content/ThinkReal.Platform.Shell/platform-shell.css" />
   Sits *after* the FluentUI design-system stylesheet so its rules win. */

/* === Brand tokens === Dark Microsoft-blue palette ("edler" / Dynamics Sales Hub).
   Override FluentUI v4's accent tokens so every Color="Color.Accent" usage and
   every <FluentButton Appearance="Accent"> automatically picks up the new brand.
   Also remap --accent-fill-rest etc. so our own .platform-* CSS uses the same color. */
:root {
    --tr-brand-dark:        #0F3268;
    --tr-brand-dark-hover:  #1A4584;
    --tr-brand-dark-active: #0A2552;
    --tr-brand-dark-on-bg:  #FFFFFF;
    --tr-brand-tint-50:     rgba(15, 50, 104, 0.05);
    --tr-brand-tint-100:    rgba(15, 50, 104, 0.10);
}

:root,
:host {
    --accent-fill-rest:     var(--tr-brand-dark);
    --accent-fill-hover:    var(--tr-brand-dark-hover);
    --accent-fill-active:   var(--tr-brand-dark-active);
    --accent-fill-focus:    var(--tr-brand-dark);
    --accent-foreground-rest:   var(--tr-brand-dark);
    --accent-foreground-hover:  var(--tr-brand-dark-hover);
    --accent-foreground-active: var(--tr-brand-dark-active);
    --accent-foreground-focus:  var(--tr-brand-dark);
}

.platform-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.platform-brand-stripe {
    height: 4px;
    background: var(--accent-fill-rest);
    width: 100%;
    flex-shrink: 0;
}

.platform-header {
    background: var(--neutral-layer-1);
    color: var(--neutral-foreground-rest);
    height: 48px;
    border-bottom: 1px solid var(--neutral-stroke-rest);
    /* No left padding here — the .topbar-left box must start exactly at x=0
       so its right border lines up with the sidebar's right edge below.
       Right padding stays so the action cluster doesn't kiss the edge. */
    padding: 0 12px 0 0;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.platform-main {
    display: flex;
    flex-direction: row;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    /* viewport - brand stripe (4) - header (48) - footer (32) = 84 px reserved */
    height: calc(100vh - 84px);
}

.platform-nav,
fluent-nav-menu.platform-nav {
    background: var(--neutral-layer-1) !important;
    border-right: 1px solid var(--neutral-stroke-rest);
    height: 100%;
    overflow-y: auto;
    padding-top: 8px;
    flex-shrink: 0;
    /* Force the sidebar's total rendered width to exactly 245 px so its
       right border lines up pixel-perfect with the topbar-left's right border
       above. Without this, FluentNavMenu's Width="240" param plus its internal
       4 px padding + 0.67 px border would render at ~244.67 px (content-box),
       leaving a sub-pixel offset visible on high-DPI displays. */
    width: 245px !important;
    box-sizing: border-box !important;
}

.platform-workspace-wrap {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}

.platform-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 20px;
    background: var(--neutral-layer-2);
    min-width: 0;
}

.platform-footer {
    height: 32px;
    background: var(--neutral-layer-1);
    border-top: 1px solid var(--neutral-stroke-rest);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    font-size: 12px;
    color: var(--neutral-foreground-hint);
}

.platform-footer-spacer {
    flex: 1 1 auto;
}

/* === Nav rail === FluentNavLink renders as <a class="fluent-nav-link"> with an
   <fluent-icon> child. We force-override the colors to our brand dark-blue —
   FluentUI's own "Color.Accent" resolves to a medium #036ac4 that we don't want. */

/* All nav icons (active or not) get dark-blue fill so the rail reads cohesive. */
.platform-nav .fluent-nav-link svg {
    fill: var(--tr-brand-dark) !important;
}

/* Disabled / muted items get a softer treatment. */
.platform-nav .fluent-nav-link.disabled svg,
.platform-nav .fluent-nav-link[aria-disabled="true"] svg {
    fill: var(--neutral-foreground-hint) !important;
    opacity: 0.6;
}

/* Active nav item: 3 px blue bar on the left + bolder dark-blue text. */
.platform-nav a.fluent-nav-link.active {
    position: relative !important;
    font-weight: 600 !important;
    color: var(--tr-brand-dark) !important;
    background: var(--tr-brand-tint-50) !important;
}

.platform-nav a.fluent-nav-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--tr-brand-dark);
    border-radius: 0 2px 2px 0;
}

/* === Card === Subtle elevated container — Dynamics 365 modern-look style.
   Use <div class="platform-card"> instead of <FluentCard> when you need predictable
   styling that's not overridden by FluentUI's web-component CSS. */
.platform-card {
    background: var(--neutral-layer-1);
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.04);
    padding: 24px;
    margin-bottom: 16px;
}

.platform-card.platform-card-flush {
    padding: 0;
    overflow: hidden;
}

/* === Logo === ThinkReal logo, recolored at render time via CSS mask-image.
   The original SVG paths are white-on-transparent (designed for dark backgrounds).
   Using mask-image, only the SVG's alpha channel is used as a stencil; the visible
   color is whatever background-color we set. So one SVG file → any color we want.
   No frame, no surrounding box — pure shape in the brand color. */
.platform-logo {
    display: inline-block;
    width: 36px;
    height: 36px;
    background-color: var(--tr-brand-dark);
    -webkit-mask: url('think-real-logo.svg') no-repeat center / contain;
    mask: url('think-real-logo.svg') no-repeat center / contain;
    flex-shrink: 0;
    vertical-align: middle;
}

/* Launcher modifier: bigger click target + bigger logo for the header
   app-platform icon that opens the app switcher. The text "ThinkReal"
   no longer sits next to the logo, so the mark itself takes more weight. */
.platform-logo-launcher {
    width: 44px;
    height: 44px;
}

/* Button-wrapper around the launcher logo: a clickable shell that gives the
   logo a nice hover/focus state. */
.platform-logo-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 44px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    font-family: inherit;
}

.platform-logo-button:hover {
    background: var(--tr-brand-tint-50);
}

.platform-logo-button:focus-visible {
    outline: 2px solid var(--tr-brand-dark);
    outline-offset: 1px;
}

/* === Toolbar === Microsoft "command bar" pattern: row of icon+text buttons
   directly under the header, separated by light dividers. Sticky-feel via
   border-bottom. Render order in the layout: Header → Toolbar → Breadcrumb → Body. */
.platform-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 40px;
    padding: 0 12px;
    background: var(--neutral-layer-1);
    border-bottom: 1px solid var(--neutral-stroke-rest);
    flex-shrink: 0;
    overflow-x: auto;
}

.platform-toolbar-spacer {
    flex: 1 1 auto;
    min-width: 0;
}

.platform-toolbar-separator {
    width: 1px;
    height: 20px;
    background: var(--neutral-stroke-rest);
    margin: 0 4px;
    flex-shrink: 0;
}

.platform-toolbar-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--neutral-foreground-rest);
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
    font-family: inherit;
    white-space: nowrap;
    transition: background 80ms ease, color 80ms ease;
}

.platform-toolbar-button:hover:not(:disabled) {
    background: var(--tr-brand-tint-50);
    color: var(--tr-brand-dark);
}

.platform-toolbar-button:active:not(:disabled),
.platform-toolbar-button.is-active {
    background: var(--tr-brand-tint-100);
    color: var(--tr-brand-dark);
    font-weight: 600;
}

.platform-toolbar-button:focus-visible {
    outline: 2px solid var(--tr-brand-dark);
    outline-offset: 1px;
}

.platform-toolbar-button:disabled,
.platform-toolbar-button.is-disabled {
    color: var(--neutral-foreground-hint);
    cursor: not-allowed;
    opacity: 0.6;
}

.platform-toolbar-button.is-primary {
    background: var(--tr-brand-dark);
    color: var(--tr-brand-dark-on-bg);
    border-color: var(--tr-brand-dark);
}

.platform-toolbar-button.is-primary:hover:not(:disabled) {
    background: var(--tr-brand-dark-hover);
    border-color: var(--tr-brand-dark-hover);
    color: var(--tr-brand-dark-on-bg);
}

.platform-toolbar-button-icon {
    display: inline-flex;
    align-items: center;
    width: 16px;
    height: 16px;
}

/* === Breadcrumb === Navigation trail rendered inside the workspace as a
   white card on the gray surface (same treatment as <PlatformCard>) — so it
   visually anchors the page chrome and matches the rest of the content. */
.platform-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 36px;
    padding: 8px 16px;
    margin-bottom: 16px;
    background: var(--neutral-layer-1);
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.04);
    font-size: 12px;
    color: var(--neutral-foreground-hint);
    flex-shrink: 0;
    overflow-x: auto;
    white-space: nowrap;
}

.platform-breadcrumb-link {
    color: var(--tr-brand-dark);
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 2px;
    transition: background 80ms ease;
}

.platform-breadcrumb-link:hover {
    background: var(--tr-brand-tint-50);
    text-decoration: underline;
}

.platform-breadcrumb-current {
    color: var(--neutral-foreground-rest);
    font-weight: 500;
    padding: 2px 4px;
}

.platform-breadcrumb-separator {
    color: var(--neutral-foreground-hint);
    user-select: none;
}

/* === Header search placeholder === Cmd-K style search trigger pill.
   Phase 1: visual only — clicking it does nothing. Phase 2: opens a Cmd-K palette. */
.topbar-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    min-width: 320px;
    max-width: 480px;
    padding: 0 12px;
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: 16px;
    background: var(--neutral-layer-2);
    color: var(--neutral-foreground-hint);
    font-size: 13px;
    cursor: text;
    transition: background 80ms ease, border-color 80ms ease;
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
}

.topbar-search:hover {
    background: var(--neutral-layer-1);
    border-color: var(--accent-fill-rest);
}

.topbar-search-shortcut {
    margin-left: auto;
    padding: 1px 6px;
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: 3px;
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--neutral-foreground-hint);
    background: var(--neutral-layer-1);
}

/* Mobile: tighter body padding for narrow viewports. */
@media (max-width: 768px) {
    .platform-body {
        padding: 12px;
    }
}
