/* InfoHub custom styles — complements Tailwind CDN */

/* Header: horizontal scroll on narrow screens (room for more controls later) */
.header-h-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
}

.header-h-scroll-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    width: max-content;
    min-width: 100%;
    box-sizing: border-box;
}

.header-toolbar {
    height: 3.5rem;
}

.header-nav-scroll .header-h-scroll-inner {
    padding-top: 0;
    padding-bottom: 0;
}

/* PC: align header rows with Notes tree column (lg:w-80) + detail pane gap-6 */
@media (min-width: 1024px) {
    .header-toolbar-row.header-h-scroll,
    .header-nav-scroll.header-h-scroll {
        overflow: visible;
    }

    .header-toolbar.header-h-scroll-inner {
        display: grid;
        grid-template-columns: 20rem 1fr;
        column-gap: 1.5rem;
        align-items: center;
        width: 100%;
        min-width: 0;
        max-width: none;
        padding-left: 0;
        padding-right: 0;
    }

    .header-brand {
        grid-column: 1;
    }

    .header-toolbar-end {
        grid-column: 2;
        justify-content: flex-end;
        width: 100%;
    }

    .header-nav-inner.header-h-scroll-inner {
        display: grid;
        grid-template-columns: 20rem 1fr;
        column-gap: 1.5rem;
        width: 100%;
        min-width: 0;
        max-width: none;
        padding-left: 0;
        padding-right: 0;
    }

    .header-nav-tabs {
        grid-column: 1;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

.header-action-btn {
    font-size: 0.875rem;
    color: #94a3b8;
    transition: color 0.15s;
    padding: 0.375rem 0.5rem;
}

.header-action-btn:hover {
    color: #fff;
}

/* ~30 visible characters on phone; grows on larger screens */
.global-search-wrap {
    flex-shrink: 0;
}

.global-search-input {
    width: 30ch;
    max-width: 30ch;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* Fixed so results are not clipped by header horizontal scroll (overflow-y: hidden) */
#search-results.global-search-results {
    position: fixed;
    z-index: 9999;
    width: min(24rem, calc(100vw - 1rem));
    max-width: 24rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

@media (min-width: 640px) {
    .global-search-input {
        width: 36ch;
        max-width: 36ch;
    }
}

@media (min-width: 1024px) {
    .global-search-input {
        width: 100%;
        max-width: 28rem;
        min-width: 16rem;
    }

    .global-search-wrap {
        flex: 1 1 auto;
        max-width: 28rem;
    }
}

.nav-tab {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #94a3b8;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.15s;
}

.nav-tab:hover {
    color: #e2e8f0;
}

.nav-tab.active {
    color: #60a5fa;
    border-bottom-color: #3b82f6;
}

.section-panel {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.search-result-item:hover {
    background: rgba(51, 65, 85, 0.5);
}

.search-result-item:last-child {
    border-bottom: none;
}

.calendar-day {
    min-height: 100px;
    padding: 0.25rem;
    border: 1px solid #1e293b;
    background: rgba(15, 23, 42, 0.5);
}

.calendar-day.today {
    box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.event-pill {
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.attachment-thumb {
    width: 4rem;
    height: 4rem;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid #475569;
}

/* Notes: iPhone / narrow screens — full-screen detail when a node is selected */
#section-notes.notes-section-active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.notes-layout {
    height: calc(100dvh - 11rem);
    max-height: calc(100dvh - 11rem);
}

@supports not (height: 100dvh) {
    .notes-layout {
        height: calc(100vh - 11rem);
        max-height: calc(100vh - 11rem);
    }
}

@media (max-width: 1023px) {
    .notes-layout.notes-show-detail #notes-tree-pane {
        display: none;
    }

    .notes-layout.notes-show-detail #notes-detail-pane {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .notes-layout.notes-show-detail #node-detail {
        flex: 1 1 auto;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }

    .notes-layout:not(.notes-show-detail) #notes-detail-pane {
        display: none;
    }

    .tree-row {
        min-height: 2.75rem;
    }

    #notes-tree,
    #node-detail {
        -webkit-overflow-scrolling: touch;
    }
}
