/* ========================================
   サイドバー（左・右共通）
   ======================================== */

/* 左サイドバー */
.sidebar {
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-primary);
}

/* ナビゲーション */
.nav-menu {
    padding: 16px 12px;
    border-bottom: 1px solid var(--border-color);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 4px;
    background: none;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--accent-light);
    color: var(--accent-primary);
    font-weight: 600;
}

.nav-icon {
    width: 20px;
    height: 20px;
}

/* 会話履歴 */
.chat-history {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 4px;
}

.history-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.new-chat-btn {
    width: 32px;
    height: 32px;
    padding: 6px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    background-color: var(--bg-secondary);
    color: var(--accent-primary);
}

.new-chat-btn svg {
    width: 100%;
    height: 100%;
}

.history-search {
    margin-bottom: 12px;
}

.history-search input {
    width: 100%;
    padding: 8px 12px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    transition: all 0.2s;
}

.history-search input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.history-list {
    flex: 1;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.history-item:hover {
    background-color: var(--bg-secondary);
}

.history-item.active {
    background-color: var(--accent-light);
}

.history-item-icon {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
}

.history-item-content {
    flex: 1;
    min-width: 0;
}

.history-item-title {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-date {
    font-size: 11px;
    color: var(--text-tertiary);
}

.history-item-actions {
    display: none;
    gap: 4px;
}

.history-item:hover .history-item-actions {
    display: flex;
}

.history-action-btn {
    width: 24px;
    height: 24px;
    padding: 4px;
    background: none;
    border: none;
    border-radius: 4px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.2s;
}

.history-action-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* 右サイドバー */
.right-sidebar {
    background-color: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.right-sidebar .sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.right-sidebar .sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.reference-docs {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.no-references {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
    padding: 40px 20px;
}

.reference-card {
    padding: 16px;
    margin-bottom: 12px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.reference-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

.reference-card-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.reference-card-icon {
    width: 16px;
    height: 16px;
    color: var(--accent-primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.reference-card-title {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.reference-card-source {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 6px;
}

.reference-card-excerpt {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* メインコンテンツ */
.main-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page {
    display: none;
    flex: 1;
    overflow: hidden;
}

.page.active {
    display: flex;
    flex-direction: column;
}

.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
}

/* スクロールバー */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}
