/**
 * NotesAi unified workspace shell styles.
 */

html,
body.notesai-workspace {
    height: 100%;
    max-height: 100%;
    margin: 0;
    overflow: hidden;
}

#notesaiWorkspace {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.notesai-workspace {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --notesai-accent: #4f9e90;
    --notesai-accent-bright: #7ec8e3;
    --notesai-accent-deep: #3a7a8c;
}

.notesai-top-accent {
    height: 1px;
    flex-shrink: 0;
    background: linear-gradient(
        90deg,
        var(--notesai-accent-deep) 0%,
        var(--notesai-accent) 28%,
        var(--notesai-accent-bright) 50%,
        var(--notesai-accent) 72%,
        var(--notesai-accent-deep) 100%
    );
    background-size: 200% 100%;
    /* Slow, even breath — same ease in and out, no rush between cycles */
    animation: notesai-accent-breathe 9.5s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
    z-index: 10001;
}

@keyframes notesai-accent-breathe {
    /* Exhale / rest — dimmer, highlight on the left */
    0%,
    100% {
        background-position: 100% 50%;
        filter: brightness(0.72) saturate(0.88);
        opacity: 0.62;
    }
    /* Inhale peak — warmer glow as highlight drifts right */
    50% {
        background-position: 0% 50%;
        filter: brightness(1.06) saturate(1.06);
        opacity: 1;
    }
}

.notesai-shell-header {
    display: grid;
    /* minmax(0, 1fr), not bare 1fr: forces the outer columns to be exactly
       equal width regardless of how much content (brand text vs. toolbar +
       hamburger) each side holds, so the middle column — and the tabs
       centered within it — stays on the true viewport center. Bare 1fr still
       respects each track's min-content size, which pulls the center off
       whenever the two sides are unequal widths. */
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    height: 44px;
    flex-shrink: 0;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    z-index: 10000;
}

.notesai-shell-brand {
    font-size: 0.875rem;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: 0.02em;
    justify-self: start;
    white-space: nowrap;
}

.notesai-view-tabs {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-self: center;
}

.notesai-view-tab {
    appearance: none;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.notesai-view-tab:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
}

.notesai-view-tab.is-active {
    background: rgba(102, 126, 234, 0.25);
    color: #e2e8f0;
}

.notesai-shell-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    justify-self: end;
}

.notesai-shell-nav {
    display: flex;
    align-items: center;
    min-width: 40px;
}

/* Canvas toolbar docked into the notesai header: the legacy canvas engine
   builds #canvasToolbar as a floating glass pill (position: fixed, top-right
   of the canvas surface). Relocated here (see canvas_view.js) it should sit
   inline with the view tabs and hamburger toggle instead of floating over
   the canvas. */
.notesai-shell-toolbar-host {
    display: flex;
    align-items: center;
}

.canvas-toolbar.notesai-header-toolbar {
    position: static;
    top: auto;
    right: auto;
    z-index: auto;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    gap: 2px;
}

.notesai-header-toolbar .toolbar-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: #94a3b8;
}

.notesai-header-toolbar .canvas-toolbar-zoom-label {
    min-width: 40px;
    height: 32px;
    padding: 0 6px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    line-height: 1;
    border-radius: 6px;
}

.notesai-header-toolbar .canvas-toolbar-zoom-label:hover,
.notesai-header-toolbar .canvas-toolbar-zoom-label.is-open {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.notesai-header-toolbar .canvas-toolbar-zoom-menu {
    right: 0;
    left: auto;
}

.notesai-header-toolbar .toolbar-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.notesai-header-toolbar .toolbar-icon i {
    font-size: 14px;
}

@media (max-width: 900px) {
    /* Beats the unconditional `.canvas-toolbar { display: flex }` in
       ai_canvas_enhanced.css (same specificity, but that file loads after
       this one, so an equal-specificity selector here would lose). */
    #notesaiCanvasToolbarHost .canvas-toolbar.notesai-header-toolbar {
        display: none;
    }
}

/* Hamburger toggle docked into the notesai header: sit inline like the view
   tabs instead of floating fixed top-right (the default .canvas-app-nav
   position), and recolor for the dark header — glass style matching the
   Today dashboard's dark-header treatment. */
.canvas-app-nav.ln-app-nav--notesai-header-toggle {
    position: static;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
    pointer-events: none;
    top: auto;
    right: auto;
    z-index: auto;
}

.canvas-app-nav.ln-app-nav--notesai-header-toggle .canvas-nav-panel {
    pointer-events: auto;
}

#lnNotesAiNavToggleHost .canvas-nav-toggle {
    position: relative;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    box-shadow: none;
}

#lnNotesAiNavToggleHost .canvas-nav-toggle:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #e2e8f0;
    box-shadow: none;
}

#lnNotesAiNavToggleHost .canvas-nav-toggle svg {
    width: 16px;
    height: 16px;
}

.notesai-main {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.notesai-view-panel {
    position: absolute;
    inset: 0;
    overflow: hidden;
    display: none;
}

.notesai-view-panel.is-active {
    display: block;
}

/* Canvas view fills workspace below shell — panel itself must not scroll.
   Only #notesaiCanvasRoot is the intentional board scroller (see canvas_view.css).
   Dual overflow:auto (panel + root) let scrollIntoView walk past the board and
   nudge document scroll, which shoves .notesai-shell-header off-screen. */
#notesaiViewCanvas {
    background: var(--ln-canvas-bg, #334155);
    overflow: hidden;
}

#notesaiCanvasRoot {
    min-height: 0;
    height: 100%;
    display: none;
}

#notesaiCanvasRoot.is-visible {
    display: block;
}

/* Document view — slate workspace (card chrome in document_view.css) */
#notesaiViewDocument {
    background: var(--ln-canvas-bg, #334155);
}

#notesaiViewDocument .document-shell {
    height: 100%;
}

#notesaiViewDocument.document-mode-page,
.notesai-workspace #notesaiViewDocument {
    height: 100%;
}

/* Explorer — navy workspace (card chrome in explorer_view.css) */
#notesaiViewExplorer {
    background: linear-gradient(165deg, #243854 0%, #2e4465 55%, #334155 100%);
    overflow: auto;
}

/* Hide document explorer tab in notesai (Explorer is a top-level view) */
#notesaiViewDocument [data-view="explorer"] {
    display: none !important;
}

#notesaiViewDocument #documentExplorerHost {
    display: none !important;
}

.notesai-workspace .canvas-brand .brand-logo,
.notesai-workspace #notesaiCanvasRoot .canvas-brand .brand-logo {
    display: none !important;
}

/* Hide Canvas / Nav mode icons next to board title (shell tabs replace them) */
.notesai-workspace #canvasViewModeCanvas,
.notesai-workspace #canvasViewModeNav {
    display: none !important;
}

/* Boards grid icon duplicates Page history on notesai — hide it; history stays visible. */
.notesai-workspace .canvas-toolbar .boards-icon {
    display: none !important;
}

/* BD-110: New Canvas (+) lives in the Board dropdown header, not the top bar. */
.notesai-workspace .canvas-toolbar .clear-icon {
    display: none !important;
}

/* Remove "Save all notes" toolbar icon */
.notesai-workspace .canvas-toolbar .save-icon {
    display: none !important;
}

/* Title + drop strip live in #notesaiCanvasTitleRow (see canvas_view.css) —
   no overlay padding needed on the canvas surface.
   Override legacy #noteCanvas { min-height: 100vh } — that alone is taller
   than the flex slot under the shell header + title row, so document content
   overflows the viewport and scrollIntoView can still scroll html/body. */
.notesai-workspace #notesaiCanvasRoot #noteCanvas {
    padding-top: 0;
    min-height: 100%;
    height: auto;
    box-sizing: border-box;
}

/* Permanently hide Scheduled results system card on notesai canvas */
.notesai-workspace .ln-scheduled-results-panel,
.notesai-workspace .content-block[data-ln-panel="scheduled_results"] {
    display: none !important;
}

@media (max-width: 768px) {
    .notesai-shell-header {
        padding: 0 8px;
    }

    .notesai-view-tab {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}
