/* ═══════════════════════════════════════════════════════════════
   Lumen — Shared chrome (top nav, drawer, embedded search)
   ServiceNow palette. Loaded on every page via _base.html.
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;600;700&display=swap');

:root {
    --bg-darkest:   #181826;
    --bg-dark:      #1A1A2E;
    --bg-panel:     #021E2F;
    --surface:      #032D42;
    --surface-2:    #043B57;
    --surface-3:    #054A6E;
    --purple:       #4F52BD;
    --deep-purple:  #302F4B;
    --green:        #62D84E;
    --green-hover:  #4EC43C;
    --green-dark:   #3AAE2A;
    --blue-accent:  #32ADEE;
    --blue-hover:   #2691D1;
    --rose:         #D56B7C;
    --rose-hover:   #C15569;
    --danger:       #FF6B6B;
    --warning:      #F59E0B;
    --red-accent:   #FF0000;
    --text-primary: #FFFFFF;
    --text-body:    #E0E0E0;
    --text-muted:   rgba(255,255,255,0.55);
    --text-faint:   rgba(255,255,255,0.30);
    --border:       rgba(255,255,255,0.10);
    --shadow-md:    0 2px 8px rgba(0,0,0,0.35);
    --shadow-lg:    0 4px 16px rgba(0,0,0,0.40);
    --radius-card:  12px;
    --radius-input: 8px;
    --radius-pill:  999px;
}

/* ── Top nav ──────────────────────────────────────────────────── */

.lm-topnav {
    background: var(--bg-darkest);
    border-bottom: 2px solid var(--green);
    height: 56px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    font-family: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--text-body);
}

.lm-topnav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.2px;
}

.lm-topnav-brand img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.lm-topnav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
}

.lm-topnav-link {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    position: relative;
}

.lm-topnav-link:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}

.lm-topnav-link.active {
    color: var(--text-primary);
}

.lm-topnav-link.active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 4px;
    height: 2px;
    background: var(--green);
    border-radius: 2px;
}

.lm-topnav-spacer { flex: 1; }

.lm-topnav-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    min-width: 220px;
    margin-right: -10px;
}

.lm-topnav-search:hover {
    background: var(--surface-2);
    border-color: var(--green);
}

.lm-topnav-search svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.lm-topnav-search kbd {
    margin-left: auto;
    background: var(--bg-darkest);
    border: 1px solid var(--border);
    color: var(--text-faint);
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: inherit;
}

.lm-topnav-icon-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-body);
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    margin-left: -10px;
}

.lm-topnav-icon-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
    color: var(--text-primary);
}

.lm-topnav-icon-btn svg {
    width: 16px;
    height: 16px;
}

/* ── Data freshness indicator ────────────────────────────────── */

.lm-freshness-btn { color: rgba(255,255,255,0.25); }
.lm-freshness-btn[data-freshness="green"] { color: #FFFFFF; }
.lm-freshness-btn[data-freshness="yellow"] { color: #E89B4A; }
.lm-freshness-btn[data-freshness="red"] { color: #D56B7C; }

/* Slot for page-specific extras */
.lm-topnav-extras {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 12px;
}

/* ── Server-health indicator (client-mode only) ──────────────── */

.lm-server-health {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
    color: #D56B7C;
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.02em;
    user-select: none;
}

.lm-server-health[hidden] {
    display: none;
}

.lm-topnav-icon-btn[hidden] {
    display: none;
}

.lm-server-health-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #D56B7C;
    box-shadow: 0 0 0 0 rgba(213, 107, 124, 0.6);
    animation: lm-server-health-pulse 2s ease-out infinite;
}

@keyframes lm-server-health-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(213, 107, 124, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(213, 107, 124, 0); }
    100% { box-shadow: 0 0 0 0 rgba(213, 107, 124, 0); }
}

/* ── Auth user display in nav ────────────────────────────────── */

.lm-topnav-auth-user {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lm-topnav-logout {
    color: var(--text-body);
}

.lm-topnav-logout:hover {
    color: var(--text-primary);
}

/* ── Content wrap + chatbot drawer ───────────────────────────── */

.lm-content-wrap {
    display: flex;
    height: calc(100vh - 56px);
    overflow: hidden;
}

main.lm-page {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}

.lm-drawer {
    flex-shrink: 0;
    width: 0;
    height: 100%;
    overflow: hidden;
    transition: width 0.25s ease;
    background: var(--bg-panel);
    border-left: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    color: var(--text-body);
    font-family: 'Source Sans 3', system-ui, sans-serif;
}

.lm-drawer.active {
    width: 360px;
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.lm-drawer-header {
    height: 56px;
    padding: 0 12px 0 16px;
    display: flex;
    align-items: center;
    gap: 4px;
    border-bottom: 1px solid var(--border);
}

.lm-drawer-title {
    flex: 1;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.lm-drawer-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.lm-drawer-close:hover { color: var(--text-primary); background: var(--surface); }

.lm-drawer-body {
    flex: 1;
    padding: 24px 16px;
    overflow-y: auto;
}

.lm-drawer-placeholder {
    color: var(--text-faint);
    font-size: 13px;
    text-align: center;
    padding: 40px 16px;
    border: 1px dashed var(--border);
    border-radius: 8px;
}

/* ── Page surface defaults ───────────────────────────────────── */

body.lm-app {
    margin: 0;
    background: var(--bg-panel);
    color: var(--text-body);
    font-family: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
    min-height: 100vh;
}

/* ── Search palette (mounted globally; consumed by portfolio-search.js) ── */

.search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 300;
    justify-content: center;
    align-items: flex-start;
    padding-top: 80px;
}
.search-overlay.active { display: flex; }

.search-palette {
    background: var(--bg-panel);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 720px;
    max-height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Source Sans 3', system-ui, sans-serif;
}

.search-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1.5px solid var(--border);
}

.search-icon { color: var(--text-muted); flex-shrink: 0; }

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 16px;
    font-family: inherit;
    color: var(--text-primary);
}
.search-input::placeholder { color: var(--text-faint); }

.search-kbd {
    font-size: 10px;
    font-weight: 700;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    color: var(--text-faint);
    flex-shrink: 0;
}

.search-results {
    overflow-y: auto;
    max-height: calc(100vh - 260px);
    padding: 8px 0;
}
.search-results::-webkit-scrollbar { width: 6px; }
.search-results::-webkit-scrollbar-track { background: transparent; }
.search-results::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.search-hint { padding: 24px; text-align: center; }
.search-hint-title { font-size: 14px; color: var(--text-muted); margin-bottom: 14px; }
.search-hint-examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.search-example {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 4px 12px;
    font-size: 12px;
    color: var(--text-body);
    cursor: pointer;
    transition: border-color 0.15s ease;
}
.search-example:hover { border-color: var(--green); }
.search-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 14px; }

.search-group { margin-bottom: 4px; }
.search-group-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 18px 4px;
}
.search-result { display: flex; align-items: flex-start; gap: 10px; padding: 8px 18px; cursor: pointer; transition: background 0.1s ease; }
.search-result:hover { background: rgba(255,255,255,0.04); }
.search-result-alert { border-left: 3px solid var(--danger); }
.search-result-icon {
    width: 24px; height: 24px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: white;
    flex-shrink: 0; margin-top: 2px;
}
.search-result-body { flex: 1; min-width: 0; }
.search-result-text { font-size: 13px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-text mark { background: rgba(98,216,78,0.30); color: var(--text-primary); border-radius: 2px; padding: 0 1px; }
.search-result-detail { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

/* Mobile / narrow viewport */
@media (max-width: 900px) {
    .lm-topnav { gap: 8px; padding: 0 12px; }
    .lm-topnav-search { min-width: 0; flex: 1; }
    .lm-topnav-search span { display: none; }
    .lm-topnav-links { display: none; }
}

/* ── Editor page layout override ──────────────────────────────── */
/* The demo-pages editor is full-viewport; it must not inherit     */
/* the lm-page scroll/padding behavior.                            */
body.lm-editor-page .lm-page {
    padding: 0;
    overflow: hidden;
    height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
}

body.lm-editor-page #es-app {
    flex: 1;
    overflow: hidden;
}
