
/* OneHub Department→Role Agent UI v2.0 */
/* Redesigned: reference-style input bar + dept grid below */

/* === Department Grid Below Input === */
.dept-below-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
    width: 100%;
}
.dept-below-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(12px);
    color: var(--text2);
    border: 1px solid rgba(0,0,0,0.06);
    white-space: nowrap;
    user-select: none;
}
.dept-below-item:hover {
    background: rgba(255,255,255,0.85);
    border-color: rgba(139, 92, 246, 0.3);
    color: var(--text);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139,92,246,0.1);
}
.dept-below-item.active {
    background: rgba(139, 92, 246, 0.12);
    color: #8B5CF6;
    border-color: rgba(139, 92, 246, 0.35);
    font-weight: 600;
}
.dept-below-item .dept-emoji {
    font-size: 15px;
}

/* === Role pills shown when dept is expanded === */
.role-pills-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    justify-content: center;
    width: 100%;
    animation: fadeIn 0.2s ease;
}
.role-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(139, 92, 246, 0.06);
    color: var(--text3);
    border: 1px solid transparent;
    white-space: nowrap;
}
.role-pill:hover {
    background: rgba(139, 92, 246, 0.12);
    color: var(--text2);
}
.role-pill.active {
    background: rgba(139, 92, 246, 0.18);
    color: #8B5CF6;
    border-color: rgba(139, 92, 246, 0.25);
    font-weight: 600;
}
.role-pill .role-emoji {
    font-size: 13px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Redesigned Input Bar (reference image style) === */
.chat-input-container-v2 {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    position: relative;
}
.chat-input-bar {
    display: flex;
    align-items: center;
    background: #FFFFFF;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 24px;
    padding: 6px 8px 6px 6px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
    transition: all 0.2s;
}
.chat-input-bar:focus-within {
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 2px 12px rgba(139,92,246,0.08);
}
.chat-input-bar .plus-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #F3F3F3;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    margin-right: 4px;
}
.chat-input-bar .plus-btn:hover {
    background: #E8E8E8;
}
.chat-input-bar .plus-btn svg {
    width: 18px;
    height: 18px;
    color: #666;
}
.chat-input-bar textarea {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    line-height: 1.6;
    font-family: inherit;
    color: var(--text);
    padding: 6px 4px;
}
.chat-input-bar textarea::placeholder {
    color: #B0B0B0;
}
.chat-input-bar .right-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 4px;
}
.chat-input-bar .model-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--text2);
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    background: transparent;
}
.chat-input-bar .model-btn:hover {
    background: #F5F5F5;
}
.chat-input-bar .model-btn .model-label {
    font-weight: 500;
}
.chat-input-bar .model-btn .arrow-down {
    font-size: 10px;
    color: var(--text3);
}
.chat-input-bar .send-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1A1A1A;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}
.chat-input-bar .send-btn:hover {
    background: #8B5CF6;
}
.chat-input-bar .send-btn:disabled {
    background: #CCC;
    cursor: not-allowed;
}
.chat-input-bar .send-btn svg {
    width: 16px;
    height: 16px;
    color: #fff;
}

/* Model dropdown (positioned relative to input bar) */
.model-dropdown-v2 {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    right: 40px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    z-index: 100;
    min-width: 160px;
    padding: 4px;
}
.model-dropdown-v2.show {
    display: block;
}
.model-dropdown-v2 .model-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.1s;
    color: var(--text2);
}
.model-dropdown-v2 .model-opt:hover {
    background: #F5F5F5;
}
.model-dropdown-v2 .model-opt.active {
    color: var(--brand);
    font-weight: 600;
}
.model-dropdown-v2 .model-opt .check-icon {
    width: 16px;
    font-size: 12px;
    color: var(--brand);
}

/* === Department cards grid for welcome state === */
.dept-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 16px;
}
@media (max-width: 900px) {
    .dept-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
    .dept-grid { grid-template-columns: repeat(2, 1fr); }
}

.dept-card {
    padding: 16px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0,0,0,0.06);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.dept-card:hover {
    background: rgba(255,255,255,0.7);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.1);
}
.dept-card-icon { font-size: 28px; margin-bottom: 6px; }
.dept-card h4 { font-size: 14px; font-weight: 600; margin: 4px 0; color: var(--text); }
.dept-card p { font-size: 11px; color: var(--text3); margin: 2px 0; line-height: 1.4; }
.dept-card-count { font-size: 10px; color: #8B5CF6; background: rgba(139,92,246,0.1); padding: 1px 6px; border-radius: 10px; }

/* Department roles view */
.dept-roles-view { padding: 8px 0; }
.dept-back-btn {
    background: none; border: none; color: var(--text3); font-size: 13px;
    cursor: pointer; padding: 4px 8px; margin-bottom: 12px; border-radius: 6px;
}
.dept-back-btn:hover { background: rgba(0,0,0,0.05); color: var(--text); }
.dept-roles-header { text-align: center; margin-bottom: 16px; }
.dept-roles-header h3 { font-size: 18px; margin: 4px 0; }
.dept-roles-header p { font-size: 12px; color: var(--text3); }

.dept-roles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
@media (max-width: 768px) {
    .dept-roles-grid { grid-template-columns: repeat(2, 1fr); }
}

.role-card {
    padding: 14px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.role-card:hover {
    background: rgba(255,255,255,0.7);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-1px);
}
.role-card-icon { font-size: 24px; margin-bottom: 4px; }
.role-card h5 { font-size: 13px; font-weight: 600; margin: 2px 0; color: var(--text); }
.role-card p { font-size: 11px; color: var(--text3); margin: 2px 0; line-height: 1.3; }

.dept-welcome { text-align: center; grid-column: 1 / -1; margin-bottom: 8px; }

/* 宽内容防截断 */
.msg-bubble { overflow-x: auto; }
.msg-bubble pre, .msg-bubble code { overflow-x: auto; max-width: 100%; }
.file-card { max-width: 100%; box-sizing: border-box; }
/* My Files button in input bar */
.chat-input-bar .myfiles-btn {
    width: 32px; height: 32px; border-radius: 50%;
    background: transparent; border: 1px solid rgba(0,0,0,0.08);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.15s;
}
.chat-input-bar .myfiles-btn:hover { background: #F5F5F5; border-color: rgba(0,0,0,0.15); }
.chat-input-bar .myfiles-btn svg { width: 16px; height: 16px; color: #888; }

/* My Files panel */
.myfiles-panel {
    display: none; position: absolute; bottom: calc(100% + 8px); right: 0;
    width: 380px; max-height: 500px; background: #fff;
    border: 1px solid rgba(0,0,0,0.08); border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12); z-index: 200;
    overflow: hidden; animation: mfIn 0.2s ease;
}
.myfiles-panel.show { display: flex; flex-direction: column; }
@keyframes mfIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.myfiles-header { padding: 16px 16px 12px; border-bottom: 1px solid #F0F0F0; }
.myfiles-header h3 { font-size: 14px; font-weight: 600; margin: 0 0 10px; }
.myfiles-search { width: 100%; padding: 8px 12px; border: 1px solid #E5E5E5; border-radius: 8px; font-size: 13px; outline: none; }
.myfiles-search:focus { border-color: rgba(139,92,246,0.4); }
.myfiles-filters { display: flex; gap: 6px; padding: 8px 16px; border-bottom: 1px solid #F0F0F0; flex-wrap: wrap; }
.myfiles-filter { padding: 3px 10px; border-radius: 12px; font-size: 11px; cursor: pointer; border: 1px solid #E5E5E5; background: #fff; color: #666; transition: all 0.12s; }
.myfiles-filter:hover { border-color: #CCC; }
.myfiles-filter.active { background: #7C3AED; color: #fff; border-color: #7C3AED; }
.myfiles-list { flex: 1; overflow-y: auto; padding: 8px; }
.myfiles-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; cursor: pointer; transition: background 0.12s; }
.myfiles-item:hover { background: #F5F5F5; }
.myfiles-item .mf-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; background: #F8F8F8; }
.myfiles-item .mf-info { flex: 1; min-width: 0; }
.myfiles-item .mf-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.myfiles-item .mf-meta { font-size: 11px; color: #999; margin-top: 2px; }
.myfiles-item .mf-actions { display: flex; gap: 4px; }
.myfiles-item .mf-actions button { width: 28px; height: 28px; border-radius: 6px; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #999; transition: all 0.12s; }
.myfiles-item .mf-actions button:hover { background: #EFEFEF; color: #333; }
.myfiles-empty { text-align: center; padding: 40px 20px; color: #999; font-size: 13px; }
