/* ============================================================================
   Workspace portal design system — self-contained and namespaced.

   Every rule is scoped under .vw-portal so it cannot affect the legacy
   Bootstrap/SmartAdmin pages. Design tokens are declared on .vw-portal
   itself (not :root) so they cascade only to opted-in subtrees. Extracted
   from the Customer Portal mockup (tokens / base typography / card / buttons
   / pills / avatar / spinner / workspace / hero / shell), WITHOUT the global
   reset, @layer framework, or Bootstrap shim that would break legacy pages.
   ============================================================================ */

@import url('https://api.fontshare.com/v2/css?f[]=satoshi@400,500,600,700&f[]=jet-brains-mono@400,500,700&display=swap');

/* ── Tokens (scoped to the portal subtree) ──────────────────────────────── */
.vw-portal {
    --tango:        #EA6424;
    --tango-600:    #d4571a;
    --tango-100:    #fdeadd;

    --accent:       var(--tango);
    --accent-600:   var(--tango-600);
    --accent-100:   var(--tango-100);

    --thunder:      #211D1E;
    --wild-sand:    #F7F7F7;

    --bg:           #ffffff;
    --bg-soft:      var(--wild-sand);
    --bg-subtle:    #fafafa;
    --surface:      #ffffff;
    --border:       #e8e6e4;
    --border-strong:#d4d1ce;

    --text:         var(--thunder);
    --text-muted:   #6b6663;
    --text-faint:   #9a9591;

    --radius-sm:    6px;
    --radius:       10px;
    --radius-md:    10px;
    --radius-lg:    14px;
    --radius-xl:    20px;

    --shadow-sm:    0 1px 2px rgba(33,29,30,0.04), 0 1px 1px rgba(33,29,30,0.03);
    --shadow:       0 4px 12px rgba(33,29,30,0.06), 0 1px 3px rgba(33,29,30,0.04);
    --shadow-lg:    0 24px 48px -12px rgba(33,29,30,0.18), 0 8px 16px -8px rgba(33,29,30,0.08);

    --row-h:        56px;

    --font-ui:      'Satoshi', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-mono:    'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;

    --danger:       #c1271f;
    --success:      #22a35d;

    font-family: var(--font-ui);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.vw-portal *,
.vw-portal *::before,
.vw-portal *::after { box-sizing: border-box; }

.vw-portal button {
    cursor: pointer;
    border: 0;
    background: none;
    padding: 0;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
}

.vw-portal a { color: var(--accent); text-decoration: none; }
.vw-portal a:hover { color: var(--accent-600); text-decoration: underline; }

/* ── Typography ─────────────────────────────────────────────────────────── */
.vw-portal .h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.02em;  line-height: 1.1; margin: 0; }
.vw-portal .h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; margin: 0; }
.vw-portal .h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em;  margin: 0; }

.vw-portal .eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.vw-portal .mono {
    font-family: var(--font-mono);
    font-feature-settings: 'tnum';
}

/* ── Card ───────────────────────────────────────────────────────────────── */
.vw-portal .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.vw-portal .card-padded   { padding: 24px; }
.vw-portal .card-divider  { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }

/* CollapsedPanel (shared MSPControl.Core.WebPortal.Components.FormControls) renders
   its "accordion-clean" style, whose rule in app.bundle.css forcibly zeroes
   .card-title/.card-body left/right padding (and body top padding) with !important
   - relying on the component's own `pl-3 pr-3` classes on the outer .card div to add
   the gutter back. Those Bootstrap utility classes are defined in bs.css, which is
   NOT linked in WebDavPortal's _Host.cshtml, so the compensation never applied here
   - fields end up flush against the panel edge instead of getting a left/right
   gutter like the header text. Restore it here rather than touching the shared
   component (used across the whole product) or resurrecting the dead pl-3/pr-3
   classes globally.
   NOTE: the app.bundle.css selector includes :not(.accordion-outline):not(.accordion-hover),
   which counts toward specificity same as extra classes - the override below must
   repeat those :not() clauses (not just add .vw-portal) or it loses to the original
   rule despite both using !important, since higher specificity wins regardless of
   source order. */
.vw-portal .accordion.accordion-clean:not(.accordion-outline):not(.accordion-hover) .card-title,
.vw-portal .accordion.accordion-clean:not(.accordion-outline):not(.accordion-hover) .card-body {
    padding-left: 16px !important;
    padding-right: 16px !important;
}

.vw-portal .accordion.accordion-clean:not(.accordion-outline):not(.accordion-hover) .card-body {
    padding-top: 16px !important;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.vw-portal .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 14px;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
    white-space: nowrap;
    border: 1px solid transparent;
    color: var(--text);
    background: transparent;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
}

.vw-portal .btn:disabled { opacity: 0.5; cursor: not-allowed; }

.vw-portal .btn-primary { background: var(--accent); color: white; }
.vw-portal .btn-primary:hover:not(:disabled)  { background: var(--accent-600); color: white; text-decoration: none; }
.vw-portal .btn-primary:focus-visible         { box-shadow: 0 0 0 3px var(--accent-100); }

.vw-portal .btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.vw-portal .btn-secondary:hover:not(:disabled) {
    border-color: var(--border-strong);
    background: var(--bg-soft);
    color: var(--text);
    text-decoration: none;
}

.vw-portal .btn-ghost { color: var(--text-muted); }
.vw-portal .btn-ghost:hover:not(:disabled) { background: var(--bg-soft); color: var(--text); text-decoration: none; }

.vw-portal .btn-danger { background: var(--danger); color: white; }
.vw-portal .btn-danger:hover:not(:disabled) { filter: brightness(0.92); }

.vw-portal .btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.vw-portal .btn-lg { padding: 14px 22px; font-size: 15px; }

.vw-portal .icon-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--text-muted);
    background: transparent;
    border: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
    cursor: pointer;
}
.vw-portal .icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.vw-portal .icon-btn.icon-btn-sm { width: 24px; height: 24px; }

/* ── Avatar ─────────────────────────────────────────────────────────────── */
.vw-portal .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    line-height: 1;
}

.vw-portal .avatar.tech     { background: var(--thunder);     color: white; }
.vw-portal .avatar.customer { background: var(--accent-100);  color: var(--accent-600); }

/* ── App shell ──────────────────────────────────────────────────────────── */
.vw-portal.portal-shell,
.vw-portal .portal-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.vw-portal .portal-content { flex: 1; width: 100%; }

.vw-portal .portal-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 32px 20px;
}

/* ── Topbar / header ────────────────────────────────────────────────────── */
.vw-portal .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    /* No backdrop-filter here: it makes .topbar a CSS containing block for
       position:fixed descendants (see user-menu-backdrop below), which shrinks
       the fixed, inset:0 click-outside-to-close overlay down to the topbar's own
       box instead of the full viewport - so clicking anywhere in the page body
       below the header wouldn't close the user menu. */
}

.vw-portal .topbar-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.vw-portal .topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
    flex: 1; /* left wing — logo stays left, search centres naturally */
}

.vw-portal .topbar-brand img { height: 32px; width: auto; display: block; }

.vw-portal .topbar-wordmark { display: flex; flex-direction: column; line-height: 1.1; text-align: start; }
.vw-portal .topbar-wordmark-1 { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.vw-portal .topbar-wordmark-2 { font-size: 11px; color: var(--text-faint); letter-spacing: 0.04em; text-transform: uppercase; }

.vw-portal .topbar-nav { display: flex; align-items: center; gap: 4px; }

.vw-portal .topbar-actions { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: flex-end; }

/* ── Topbar search ──────────────────────────────────────────────────────── */
.vw-portal .topbar-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    width: clamp(240px, 36vw, 520px); /* responsive fixed width — truly centred between brand and actions */
}

.vw-portal .topbar-search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-faint);
    pointer-events: none;
    font-size: 13px;
}

.vw-portal .topbar-search-input {
    width: 100%;
    padding: 7px 12px 7px 32px;
    background: var(--bg-soft);
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text);
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.vw-portal .topbar-search-input::placeholder { color: var(--text-faint); }

.vw-portal .topbar-search-input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-100);
}

.vw-portal .topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .vw-portal .topbar-search { display: none; }
    .vw-portal .topbar-new-ticket-label { display: none; }
}

/* ── User menu ──────────────────────────────────────────────────────────── */
.vw-portal .user-menu { position: relative; }

.vw-portal .user-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    background: transparent;
    border: 0;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text);
    transition: background 0.12s;
}

.vw-portal .user-menu-trigger:hover { background: var(--bg-subtle); }

.vw-portal .user-meta { display: inline-flex; flex-direction: column; line-height: 1.2; text-align: start; }
.vw-portal .user-meta-name { font-size: 13px; font-weight: 600; }
.vw-portal .user-meta-role { font-size: 11px; color: var(--text-faint); }

/* position:fixed + inset:0 only covers the full viewport as long as no ancestor
   (e.g. .topbar) has filter/backdrop-filter/transform/will-change/contain - any
   of those would make that ancestor the containing block instead, shrinking this
   click-outside-to-close overlay down to the ancestor's box. */
.vw-portal .user-menu-backdrop { position: fixed; inset: 0; z-index: 60; }

.vw-portal .user-menu-panel {
    position: absolute;
    inset-inline-end: 0;
    top: calc(100% + 8px);
    z-index: 61;
    min-width: 220px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.vw-portal .user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--text);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    text-align: start;
    transition: background 0.12s;
}

.vw-portal .user-menu-item:hover { background: var(--bg-subtle); text-decoration: none; }

.vw-portal .user-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Hero band ──────────────────────────────────────────────────────────── */
.vw-portal .hero {
    padding: 8px 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.vw-portal .hero-text { min-width: 0; }

.vw-portal .hero-title {
    margin: 4px 0 6px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.vw-portal .hero-sub { margin: 0; color: var(--text-faint); font-size: 14px; }
.vw-portal .hero-sub strong { font-weight: 600; color: var(--text); }
.vw-portal .hero-critical { font-weight: 600; color: var(--danger); }

.vw-portal .btn-hero { padding: 13px 22px; font-size: 15px; font-weight: 600; flex-shrink: 0; }

@media (max-width: 640px) { .vw-portal .btn-hero { display: none; } }

/* ── Shared workspace-card chrome (used by all workspace cards) ──────────── */
.vw-portal .workspace-card { padding: 24px; }

.vw-portal .workspace-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.vw-portal .workspace-card-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.005em;
    color: var(--text);
}

.vw-portal .workspace-card-sub { margin: 2px 0 0; font-size: 12px; color: var(--text-faint); }

.vw-portal .workspace-card-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-faint);
    text-decoration: none;
}

.vw-portal .workspace-card-link:hover { color: var(--text); text-decoration: none; }

.vw-portal .workspace-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: var(--text-faint);
    font-size: 13px;
}

/* App grid styles → co-located in RemoteAppsCard.razor.css / AppIcon.razor.css */

/* ── Device list (ManagedDevicesCard + MobileDevicesCard) ───────────────── */
.vw-portal .device-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.vw-portal .device-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.vw-portal .device-row:last-child { border-bottom: 0; }

.vw-portal .device-row-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.vw-portal .device-row-side {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.vw-portal .device-status {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.vw-portal .device-dot { width: 8px; height: 8px; border-radius: 50%; }
.vw-portal .device-dot.is-online  { background: #4FAE6A; box-shadow: 0 0 0 4px rgba(79,174,106,0.16); }
.vw-portal .device-dot.is-offline { background: var(--border); }

.vw-portal .device-platform {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-soft);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.vw-portal .device-meta { min-width: 0; }
.vw-portal .device-name {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vw-portal .device-sub {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-faint);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.vw-portal .device-status-label { font-size: 11px; color: var(--text-faint); }

/* Profile card styles → co-located in ProfileCard.razor.css / ProfileField.razor.css */

/* Empty state styles → co-located in Shared/Ui/EmptyState.razor (<style>) */

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .vw-portal .user-meta { display: none; }
    .vw-portal .hide-md { display: none; }
}
