/* ==========================================
   Chat Switchboard — Notes Surface CSS
   ==========================================
   v0.37.11: Preact notes surface layout.
   sw-notes-surface__ prefixed, no legacy conflicts.
   ========================================== */

/* ── Root Layout ──────────────────────────── */

.sw-notes-surface {
    display: flex;
    width: 100%;
    height: 100%;
    flex: 1 1 0%;
    overflow: hidden;
    background: var(--bg, #0e0e10);
}

/* ── Sidebar ──────────────────────────────── */

.sw-notes-surface__sidebar {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary, #151517);
    border-right: 1px solid var(--border, #2a2a2e);
    overflow: hidden;
    z-index: 20;
}

.sw-notes-surface__sidebar-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px 6px;
    flex-shrink: 0;
}

.sw-notes-surface__new-note-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    padding: 8px 12px;
    background: var(--accent-dim, rgba(179, 138, 78, 0.1));
    border: 1px solid var(--accent, #b38a4e);
    border-radius: 8px;
    color: var(--accent, #b38a4e);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.sw-notes-surface__new-note-btn:hover {
    background: rgba(179, 138, 78, 0.2);
}

.sw-notes-surface__collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-3, #555);
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.sw-notes-surface__collapse-btn:hover {
    color: var(--text, #eee);
    background: var(--bg, #0e0e10);
}

/* ── Search ───────────────────────────────── */

.sw-notes-surface__search-wrap {
    position: relative;
    padding: 4px 12px 8px;
    flex-shrink: 0;
}

.sw-notes-surface__search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3, #555);
    pointer-events: none;
    display: flex;
}

.sw-notes-surface__search {
    width: 100%;
    padding: 6px 8px 6px 30px;
    background: var(--bg, #0e0e10);
    border: 1px solid var(--border, #2a2a2e);
    border-radius: 6px;
    color: var(--text, #eee);
    font-size: 12px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}

.sw-notes-surface__search:focus {
    border-color: var(--accent, #b38a4e);
}

/* ── Sidebar Body (scrollable) ────────────── */

.sw-notes-surface__sidebar-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding-bottom: 8px;
}

/* ── Section ──────────────────────────────── */

.sw-notes-surface__section {
    margin-top: 4px;
}

.sw-notes-surface__section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 6px 12px;
    background: none;
    border: none;
    color: var(--text-2, #999);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: color 0.15s;
}

.sw-notes-surface__section-header:hover {
    color: var(--text, #eee);
}

.sw-notes-surface__chevron {
    display: flex;
    transition: transform 0.15s;
}

.sw-notes-surface__chevron--open {
    transform: rotate(90deg);
}

.sw-notes-surface__section-count {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-3, #555);
    font-weight: 400;
}

.sw-notes-surface__section-body {
    padding: 0 4px;
}

.sw-notes-surface__empty {
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-3, #555);
}

/* ── Sidebar Item ─────────────────────────── */

.sw-notes-surface__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 12px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-2, #999);
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s, color 0.1s;
    position: relative;
}

.sw-notes-surface__item:hover {
    background: var(--bg, #0e0e10);
    color: var(--text, #eee);
}

.sw-notes-surface__item--active {
    background: var(--accent-dim, rgba(179, 138, 78, 0.1));
    color: var(--text, #eee);
}

.sw-notes-surface__item-icon {
    display: flex;
    flex-shrink: 0;
    color: var(--text-3, #555);
}

.sw-notes-surface__item-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sw-notes-surface__item-count {
    font-size: 10px;
    color: var(--text-3, #555);
    flex-shrink: 0;
}

/* ── Tag Cloud ───────────────────────────── */

.sw-notes-surface__tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 8px;
}

.sw-notes-surface__tag-chip {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg, #0e0e10);
    border: 1px solid var(--border, #2a2a2e);
    border-radius: 12px;
    color: var(--text-2, #999);
    font-size: 11px;
    cursor: pointer;
    transition: background 0.1s, color 0.1s, border-color 0.1s;
    user-select: none;
}

.sw-notes-surface__tag-chip:hover {
    color: var(--text, #eee);
    border-color: var(--text-3, #555);
}

.sw-notes-surface__tag-chip--active {
    background: var(--accent-dim, rgba(179, 138, 78, 0.1));
    border-color: var(--accent, #b38a4e);
    color: var(--accent, #b38a4e);
}

/* ── Sidebar Footer ──────────────────────── */

.sw-notes-surface__sidebar-footer {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid var(--border, #2a2a2e);
    flex-shrink: 0;
    position: relative;
}

/* ── Main Area ───────────────────────────── */

.sw-notes-surface__main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

/* ── Workspace ───────────────────────────── */

.sw-notes-surface__workspace {
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    position: relative;
    overflow: hidden;
}

.sw-notes-surface__workspace-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
    border-bottom: 1px solid var(--border, #2a2a2e);
    background: var(--bg-secondary, #151517);
    flex-shrink: 0;
    min-height: 40px;
}

.sw-notes-surface__workspace-header-left,
.sw-notes-surface__workspace-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sw-notes-surface__sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-3, #555);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.sw-notes-surface__sidebar-toggle:hover {
    color: var(--text, #eee);
    background: var(--bg, #0e0e10);
}

/* ── NotesPane Container ─────────────────── */

.sw-notes-surface__notes-pane {
    flex: 1 1 0%;
    min-height: 0;
    min-width: 0;
}

/* ── Sidebar Overlay (mobile) ────────────── */

.sw-notes-surface__sidebar-overlay {
    display: none; /* Hidden on desktop */
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 15;
}

/* ── Responsive: Mobile ──────────────────── */

@media (max-width: 768px) {
    .sw-notes-surface__sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 120;
    }

    .sw-notes-surface__sidebar-overlay {
        display: block;
        z-index: 110;
    }

    .sw-notes-surface__collapse-btn {
        display: none;
    }

    /* Touch targets */
    .sw-notes-surface__item {
        min-height: 44px;
    }

    /* Prevent iOS zoom */
    .sw-notes-surface__search {
        font-size: 16px;
    }
}
