/* Quiet UI pass: keep the app useful while removing repeated explanatory copy. */

/* Chats: keep the page title contextual and let the history remain visible. */
#chatsListView .library-header {
    padding-bottom: 18px !important;
}

#chatsListView {
    min-height: 0;
    overflow: hidden !important;
}

#chatsListView > .library-header {
    flex: 0 0 auto;
}

#chatsListView .section-title-icon--plain {
    display: inline-flex !important;
}

#chatsListView .section-title-row {
    font-size: clamp(28px, 2.8vw, 34px) !important;
}

#chatsListView .chats-list-content {
    position: relative;
    display: flex !important;
    flex: 1 1 0;
    min-height: 0;
    /* The search bar already owns the vertical rhythm below it. Keeping a
       second flex gap pushes the first chat farther down than Library cards. */
    gap: 0;
    padding: 18px 20px 24px !important;
    border: 1px solid var(--logicum-border, var(--border-color));
    border-radius: 16px;
    background: var(--logicum-surface, var(--input-bg));
    box-sizing: border-box;
    overflow: hidden;
}

#chatsListView .chats-pull-refresh {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    height: 0;
    margin: 0;
    overflow: hidden;
    opacity: 0;
    transition: height 150ms ease, margin 150ms ease, opacity 150ms ease;
    pointer-events: none;
}

#chatsListView .chats-pull-refresh-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid color-mix(in srgb, var(--text-secondary) 24%, transparent);
    border-top-color: var(--accent-color, #7c6ef5);
    border-radius: 50%;
    animation: chats-pull-refresh-spin 700ms linear infinite;
}

#chatsListView .chats-list-content.is-pulling-to-refresh .chats-pull-refresh,
#chatsListView .chats-list-content.is-refreshing-chats .chats-pull-refresh {
    height: 30px;
    margin-bottom: 8px;
    opacity: 1;
}

@keyframes chats-pull-refresh-spin {
    to { transform: rotate(360deg); }
}

#chatsListView .library-actions {
    gap: 8px;
}

#chatsListView .library-search-bar {
    flex: 0 0 auto;
    width: 38px !important;
    min-height: 38px !important;
    height: 38px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    border: 1px solid var(--logicum-border, var(--border-color)) !important;
    border-radius: 11px;
    background: var(--input-bg) !important;
    box-shadow: none !important;
    transition: width 160ms ease, border-color 160ms ease;
}

#chatsListView .chats-list-search-toggle {
    display: inline-flex;
    flex: 0 0 38px;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    color: var(--text-secondary);
    background: transparent;
    cursor: pointer;
}

#chatsListView .chats-list-search-toggle:hover,
#chatsListView .chats-list-search-toggle:focus-visible {
    color: var(--text-primary);
    background: var(--bg-hover);
    outline: none;
}

#chatsListView .chats-list-search-toggle .search-icon {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

#chatsListView .library-search-bar input {
    min-width: 0;
    width: 0 !important;
    height: 36px;
    margin-left: -38px;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    opacity: 0;
    transition: width 160ms ease, opacity 120ms ease, padding 160ms ease;
}

#chatsListView .library-search-bar.is-open,
#chatsListView .library-search-bar:focus-within {
    width: min(260px, calc(100vw - 64px)) !important;
}

#chatsListView .library-search-bar.is-open input,
#chatsListView .library-search-bar:focus-within input {
    width: calc(100% - 38px) !important;
    margin-left: -38px;
    padding: 0 12px 0 44px !important;
    opacity: 1;
}

#chatsListView .project-chats-grid {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

#chatsListView #emptyChatsListState {
    display: none !important;
    flex: 1 1 auto;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    background: transparent !important;
}

#libraryView .library-content {
    position: relative;
    flex: 1 1 0 !important;
    min-height: 0;
    border: 1px solid var(--logicum-border, var(--border-color));
    border-radius: 16px;
    background: var(--logicum-surface, var(--input-bg));
    box-sizing: border-box;
}

#libraryView .library-search-bar {
    position: absolute;
    top: 12px;
    left: 24px;
    z-index: 4;
    display: flex;
    align-items: center;
    width: 36px !important;
    height: 36px !important;
    max-width: none;
    min-height: 36px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    border: 1px solid var(--border-color) !important;
    border-radius: 999px;
    background: var(--input-bg) !important;
    box-shadow: none !important;
    transition: width 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

#libraryView .library-search-toggle {
    position: relative;
    z-index: 2;
    display: inline-flex;
    flex: 0 0 36px;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--text-secondary);
    background: transparent;
    cursor: pointer;
}

#libraryView .library-search-toggle:hover,
#libraryView .library-search-toggle:focus-visible {
    color: var(--text-primary);
    outline: none;
    background: var(--bg-hover);
}

#libraryView .library-search-toggle .search-icon {
    position: static;
    width: 17px;
    height: 17px;
    transform: none;
    pointer-events: none;
}

#libraryView .library-search-bar input {
    min-width: 0;
    width: 0 !important;
    height: 34px;
    margin-left: -36px;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0;
    background: transparent !important;
    box-shadow: none !important;
    transition: width 160ms ease, opacity 120ms ease, padding 160ms ease;
}

#libraryView .library-search-bar.is-open,
#libraryView .library-search-bar:focus-within {
    width: min(240px, calc(100vw - 64px)) !important;
    border-color: var(--border-color) !important;
}

#libraryView .library-search-bar.is-open input,
#libraryView .library-search-bar:focus-within input {
    width: calc(100% - 36px) !important;
    margin-left: -36px;
    padding: 0 12px 0 42px !important;
    opacity: 1;
}

#libraryView .documents-grid {
    padding-top: 60px !important;
}

/* Library empty state: a quiet landing area that still explains where files go. */
#libraryView .library-empty-upload {
    display: flex;
    align-self: center;
    align-items: center;
    gap: 14px;
    width: min(460px, 100%);
    min-height: 132px !important;
    margin: auto;
    padding: 24px 28px;
    text-align: center;
    border: 1px dashed var(--logicum-border-strong, var(--border-color));
    border-radius: 14px !important;
    background: var(--logicum-surface-raised, var(--input-bg));
    color: var(--text-primary);
    box-sizing: border-box;
}

#libraryView .library-empty-upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border: 1px solid var(--logicum-border, var(--border-color));
    border-radius: 11px;
    color: var(--text-secondary);
}

#libraryView .library-empty-upload-icon svg {
    width: 18px;
    height: 18px;
}

#libraryView .library-empty-upload-copy {
    min-width: 0;
    flex: 1;
}

#libraryView .library-empty-upload-copy h3 {
    margin: 0 0 3px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

#libraryView .library-empty-upload-copy p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

#libraryView .library-empty-upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    gap: 6px;
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid var(--logicum-border-strong, var(--border-color));
    border-radius: 9px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease;
}

#libraryView .library-empty-upload-btn:hover,
#libraryView .library-empty-upload-btn:focus-visible {
    background: var(--logicum-surface-hover, var(--bg-hover));
    border-color: var(--logicum-border-strong, var(--border-color));
    outline: none;
}

#libraryView .library-empty-upload-btn svg {
    width: 14px;
    height: 14px;
}

/* Study Helper home: tools stay scannable as compact choices. */
#studyHubView .study-tool-card-desc,
#studyHubView .study-tool-card-tag,
#studyHubView .projects-subtitle {
    display: none !important;
}

#studyHubView .study-hub-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 0;
}

#studyHubView .study-tool-card {
    min-height: 96px;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    border-radius: 12px;
    background: var(--study-surface) !important;
    border-color: var(--study-border) !important;
    box-shadow: none !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

#studyHubView .study-tool-card::before,
#studyHubView .study-tool-card::after,
#studyHubView .study-tool-card:hover::before,
#studyHubView .study-tool-card:hover::after {
    display: none !important;
    opacity: 0 !important;
    background: none !important;
}

#studyHubView .study-tool-card:hover {
    transform: none;
    background: var(--study-surface-raised) !important;
    border-color: var(--study-border) !important;
}

#studyHubView .study-tool-card-icon {
    width: 34px;
    height: 34px;
    margin: 0;
    border-radius: 9px;
    background: var(--study-surface-raised) !important;
    border-color: var(--study-border) !important;
    box-shadow: none !important;
}

#studyHubView .study-tool-card:hover .study-tool-card-icon {
    transform: none;
    box-shadow: none !important;
}

/* Upload/source areas: a single quiet fill, never a centre glow or gradient. */
.study-upload-dropzone,
.interrog-drop-zone,
body.study-workspace-active #quizEditor .study-upload-dropzone,
#chatView .chat-main-area .chat-input-area {
    background: var(--study-surface-raised, var(--input-bg)) !important;
    background-image: none !important;
    box-shadow: none !important;
}

.study-upload-dropzone::before,
.study-upload-dropzone::after,
body.study-workspace-active #quizEditor .study-upload-dropzone::before,
body.study-workspace-active #quizEditor .study-upload-dropzone::after {
    display: none !important;
    content: none !important;
}

.study-upload-dropzone:hover,
.interrog-drop-zone:hover,
body.study-workspace-active #quizEditor .study-upload-dropzone:hover,
#chatView .chat-main-area .chat-input-area:hover,
#chatView .chat-main-area .chat-input-area:focus-within {
    background: var(--study-surface-raised, var(--input-bg)) !important;
    background-image: none !important;
    box-shadow: none !important;
}

/* The helper workspace needs only the action labels. Keep the controls,
   remove the repeated explanation around them. */
body.study-workspace-active .study-module-header-block .header-subtitle,
body.study-workspace-active .study-upload-dropzone .upload-subtitle {
    display: none !important;
}

body.study-workspace-active .study-module-header-block {
    margin-bottom: 14px !important;
    padding-bottom: 14px !important;
}

body.study-workspace-active .study-upload-dropzone {
    min-height: 124px !important;
    padding: 18px !important;
    gap: 8px !important;
}

.study-upload-dropzone .file-name-display:empty,
.interrog-drop-zone .file-name-display:empty {
    display: none !important;
}

/* Use a restrained outline cog instead of the oversized Unicode wheel glyph. */
.sidebar-footer .settings-btn {
    color: var(--text-secondary);
}

.sidebar-footer .settings-btn::before {
    content: none;
}

.sidebar-footer .settings-btn svg {
    display: none;
}

.sidebar-footer .settings-btn .settings-icon-minimal {
    display: block !important;
    width: 18px;
    height: 18px;
    stroke-width: 1.7;
}

.sidebar-footer .settings-btn:hover,
.sidebar-footer .settings-btn:focus-visible {
    color: var(--text-primary);
    background: var(--bg-hover);
    outline: none;
}

@media (max-width: 600px) {
    #chatsListView .chats-list-content {
        min-height: 0;
        padding: 14px !important;
    }

    #chatsListView .library-search-bar {
        width: 38px !important;
    }

    #libraryView .library-content {
        min-height: 0;
    }

    #libraryView .library-search-bar {
        left: 16px;
    }

    #studyHubView .study-hub-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #libraryView .library-empty-upload {
        align-items: center;
        flex-wrap: wrap;
        padding: 16px;
        width: min(100%, 360px);
    }

    #libraryView .library-empty-upload-copy {
        flex-basis: calc(100% - 52px);
    }

    #libraryView .library-empty-upload-btn {
        margin-left: 50px;
    }
}
