/* 第1區塊：側邊欄功能 */
/* 側邊欄標題區 */
.sidebar-header {
    padding: var(--padding-xl);
    background: var(--sidebar-bg);
    border-bottom: 0px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    transition: all 0.3s ease;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.sidebar-title-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex: 0 0 auto;
}

.sidebar-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: var(--font-xxl);
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sidebar-toggle-btn:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.sidebar-app-title {
    font-size: var(--font-xxl);
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
}

.sidebar-app-title:hover {
    color: var(--primary-color);
}

.sidebar-app-title-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    display: inline-block;
}

.sidebar-app-title {
    cursor: pointer;
}

.sidebar-app-title-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.sidebar-app-subtitle {
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin: 2px 0 4px 0;
    line-height: 1.3;
    flex-basis: 100%;
    text-align: left;
}

.sidebar-app-version {
    padding: 0px 0px 0px 34px;
    font-size: 0.65em;
    color: var(--accent-color);
    font-weight: 500;
    display: block;
    flex-basis: 100%;
    text-align: left;
}

/* 側邊欄底部提示 */
.sidebar-footer {
    padding: 5px;
    background: transparent;
    border-top: 0px solid var(--border-color);
    margin-top: auto;
    flex-shrink: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    opacity: 1;
    transform: translateX(0);
}

.sidebar-footer-text {
    font-size: var(--font-xs);
    color: var(--text-muted);
    line-height: 1.3;
    text-align: left;
}

/* 側邊欄內容區 */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    transition: all 0.3s ease, opacity 0.25s ease, transform 0.25s ease;
    opacity: 1;
    transform: translateX(0);
}

/* 收合狀態的圖示列表 */
.sidebar-collapsed-icons {
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

/* 收合狀態的圖示按鈕 */
.collapsed-icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.collapsed-icon-btn:hover {
    background: var(--bg-color);
    color: var(--text-color);
    transform: translateX(2px);
}

.collapsed-icon-btn:active {
    transform: translateX(1px);
    background: var(--border-color);
}

.collapsed-icon-btn.unsaved-changes {
    color: var(--warning-color) !important;
    background-color: hsl(from var(--warning-color) h s l / 0.1);
        
}

/* 收合狀態下隱藏原本的側邊欄內容 */
.sidebar.collapsed .sidebar-content {
    display: none;
}

.sidebar.collapsed .sidebar-footer {
    display: none;
}

/* 收合狀態下顯示圖示列表 */
.sidebar.collapsed .sidebar-collapsed-icons {
    display: flex !important;
}

.sidebar.collapsed .sidebar-header {
    padding: var(--padding-xl);
    justify-content: center;
}

/* 隱藏標題但保留按鈕 */
.sidebar.collapsed .sidebar-app-title {
    display: none;
}

.sidebar.collapsed .sidebar-title-container {
    display: none;
}

/* 確保按鈕顯示 */
.sidebar.collapsed .sidebar-toggle-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 16px;
}

.sidebar-title-container {
    flex: 1;
    cursor: pointer;
    display: flex;
    justify-content: flex-end;
}

/* 側邊欄區段  */
.sidebar-section {
    border-bottom: 0px solid var(--border-color);
}

.sidebar-section:last-child {
    border-bottom: none;
}

/* 側邊欄母項目 */
.sidebar-section-header {
    padding: 12px 20px 12px 25px;
    background: transparent;
    cursor: pointer;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    transition: all 0.2s ease;
    border-bottom: 0px solid var(--border-color);
    border-top: 0px solid var(--border-color);
    gap: var(--spacing-sm);
}

.sidebar-section-header:hover {
    background: var(--bg-color);
}

.sidebar-section-title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 12px;
}

.search-section-title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 12px;
}

.sidebar-section-icon {
    font-size: var(--font-sm);
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.sidebar-section-content {
    padding: 2px var(--spacing-lg);
    transition: all 0.3s ease;
    overflow: hidden;
    background: transparent;
}

.sidebar-section-content.collapsed {
    max-height: 0;
    padding: 0 var(--spacing-lg);
}

/* 讓儲存區域在有變更時顯示警告樣式 */
.sidebar-section-header.unsaved-changes {
    background-color: hsl(from var(--warning-color) h s l / 0.1);
    border-radius: 4px;
}

.sidebar-section-header.unsaved-changes .sidebar-section-title {
    color: var(--warning-color) !important;
    font-weight: 500;
}

.sidebar-section-header.unsaved-changes svg {
    color: var(--warning-color) !important;
}

.sidebar-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
}

/* 第4區塊：角色管理功能 */
/* 側邊欄角色列表 */
.character-header {
    display: flex;
    align-items: center;
    padding: 10px 20px 10px 45px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: var(--font-lg);
    transition: all 0.2s ease;
    color: var(--text-color);
    margin-bottom: 0px;
    margin-left: -20px;
    margin-right: -20px;
    border-radius: 0;
}

.character-header:hover {
    background: var(--bg-color);
}

.character-header.active {
    background: var(--accent-color); /* 使用強調顏色作為背景 */
    color: white; /* 白色文字確保對比度 */
    font-weight: 600;
    box-shadow: none; /* 移除陰影，保持與區塊標題一致 */
}

.character-header.active .expand-icon {
    color: white; /* 確保圖示也是白色 */
}

.character-header .expand-icon {
    font-size: var(--font-sm);
    color: var(--text-muted);
    transition: all 0.2s ease;
    transform: rotate(0deg);
    margin-right: var(--spacing-sm);
}

.character-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
}

/* 側邊欄項目版本數量顯示 */
.character-version-count {
    font-size: 0.8em;
    opacity: 0.7;
}

.version-list {
    padding-left: -55px;
    padding-right: -15px;
    margin-top: 2px;
    display: none;
}

.version-list.expanded {
    display: block;
}
/* 側邊欄版本列表 */
.version-item {
    padding: 7px 8px 7px 55px;   /* 🔧 左padding從20px改為40px */
    margin: 0px -20px 0px -20px; /* 🔧 添加負邊距填滿寬度 */
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: var(--font-md);
    transition: all 0.2s ease;
    color: var(--text-muted);
    border-radius: 0px;
    position: relative;
    border-right: 1px transparent;
}

.version-item:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

.version-item.active {
    background: rgba(139, 115, 85, 0.1);
    color: var(--accent-color);
    font-weight: 600;
    border-right: 8px solid var(--accent-color);
}

.version-item.active.stats-text,
.version-item.active span[style*="italic"] {
    color: var(--accent-color) !important;
    opacity: 0.8;
}

.version-item.active:hover {
    background: rgba(139, 115, 85, 0.15);
}

/* 確保在暗色主題下也有良好的對比 */
.character-header.active:hover {
    background: var(--accent-color);
    filter: brightness(1.1);
}

.sidebar-add-btn {
    width: 100%;
    margin-top: var(--spacing-md);
    padding: var(--padding-lg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    font-size: var(--font-md);
    transition: all 0.2s ease;
    background: var(--surface-color);
    color: var(--text-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sidebar-add-btn:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-light);
}

/* 側邊欄版本項目內容容器 */
.version-item-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 2px;
}

/* 版本項目頂部信息行 */
.version-item-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 版本名稱樣式 */
.version-item-name {
    font-weight: 500;
    flex: 1;
    text-align: left;
}

/* 版本統計文字樣式 */
.version-item-stats {
    text-align: right;
    font-size: 0.7em;
    font-style: italic;
    color: var(--text-muted);
    opacity: 0.8;
    padding-right: 2px;
    transition: color 0.2s ease;
}

/* 選中狀態的版本統計文字 */
.version-item.active .version-item-stats {
    color: var(--accent-color);
}

/* 總覽控制列 */
/* 資料夾小長條卡片樣式 */

/* 資料夾網格響應式調整 */
#folders-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

@media (max-width: 768px) {
    #folders-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1200px) {
    #folders-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* 頂部控制欄按鈕 */
.top-control-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    outline: none;
}

.top-control-btn:hover {
    background: var(--bg-color);
}

/* SAVE 按鈕未儲存狀態 */
.top-control-btn.unsaved-changes {
    background: var(--warning-color) !important;
    height: 28px;
    color: white !important;
    border-color: var(--warning-color) !important;
}

.top-control-btn.unsaved-changes:hover {
    background: var(--warning-color) !important;
    opacity: 0.9;
    transform: translateY(-1px);
}

/* SAVE 按鈕正常狀態（確保透明背景） */
.top-control-btn.saved-state {
    background: transparent !important;
    color: var(--text-muted) !important;
    border: none !important;
}

.top-control-btn.saved-state:hover {
    background: var(--border-color) !important;
}

/* 第6區塊：箭頭與圖示  */
/* 線條箭頭樣式 */
.arrow-icon {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transition: transform 0.2s ease;
}

.arrow-right {
    transform: rotate(-45deg);
}

.arrow-down {
    transform: rotate(45deg);
}

.arrow-left {
    transform: rotate(135deg);
}

.arrow-up {
    transform: rotate(-135deg);
}

/* 側邊欄折疊按鈕的箭頭 */
.sidebar-toggle-btn .arrow-icon {
    width: 10px;
    height: 10px;
    border-width: 2px;
}

/* 版本項目統計文字的基本樣式 */
.version-item div[style*="font-style: italic"] {
    color: var(--text-muted) !important;
    transition: color 0.2s ease;
}

/* 選中狀態的版本統計文字 */
.version-item.active div[style*="font-style: italic"] {
    color: var(--accent-color) !important;
}

/* ===== 總覽頁卡片樣式系統 ===== */
/* 通用卡片容器 */
.overview-card {
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

/* 卡片主體 (圖片容器) */
.overview-card-body {
    flex: 1 1 auto;
    width: 100%;
    border-radius: 5px;
    overflow: hidden;
    background: transparent;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    position: relative;
}

/* 卡片圖片 */
.overview-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 卡片名稱 */
.overview-card-name-container {
    text-align: center;
    padding: 0 8px;
}

.overview-card-name {
    font-size: 1em;
    color: var(--text-color);
    font-weight: 500;
    line-height: 1.3;
    display: block;
}

/* 資料夾卡片堆疊效果 */
.overview-folder-card-stack {
    position: absolute;
    width: 100%;
    border-radius: 5px;
    background: transparent;
    border: 1px solid var(--border-color);
    pointer-events: none;
    background-size: cover;
    background-position: center;
}

.overview-folder-card-stack.stack-2 {
    transform: rotate(2deg) translate(5px, -4px);
    z-index: 2;
    opacity: 0.7;
}

.overview-folder-card-stack.stack-3 {
    transform: rotate(-3deg) translate(-8px, 3px);
    z-index: 1;
    opacity: 0.5;
}

/* 資料夾卡片主體 */
.overview-folder-card-body {
    position: relative;
    width: 100%;
    border-radius: 5px;
    background: transparent;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    background-size: cover;
    background-position: center;
}

/* 資料夾名稱 */
.overview-folder-name-container {
    text-align: center;
    padding: 0 8px;
    margin-top: 12px;
}

.overview-folder-name {
    font-size: 1em;
    color: var(--text-color);
    font-weight: 600;
    line-height: 1.3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* 總覽頁卡片列表容器 */
.overview-card-list-container {
    padding: 0px 32px 32px 32px;
    background: transparent;
    border-radius: 12px;
}

/* 卡片網格預設間距 */
.character-grid,
.userpersona-grid {
    gap: 60px;
    margin-top: 15px;
}

/* ===== 總覽頁「新增」卡片樣式 ===== */
.overview-create-card {
    cursor: pointer;
}

.overview-create-card-body {
    width: 100%;
    height: 100%;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

/* ✨ 用 CSS :hover 替代 onmouseover/onmouseout */
.overview-create-card:hover .overview-create-card-body {
    border-color: var(--accent-color);
    background-color: var(--bg-color);
}

.overview-create-card-plus {
    color: var(--text-muted);
    font-size: 3em;
    margin-bottom: 8px;
    opacity: 0.7;
    line-height: 1; /* 確保 + 號不會有額外行高 */
}

.overview-create-card-text {
    font-size: 0.9em;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
    line-height: 1.4; /* 稍微減小行高 */
    opacity: 0.7;
    padding: 0 4px; /* 增加一點內邊距防止文字貼邊 */
}

/* 第7區塊：總覽列表頁樣式 */
/* =================================
   總覽列表頁 (List Page) 樣式
   ================================= */

/* 列表項基礎容器 */
.list-item {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
}

.list-item:hover {
    border-color: var(--accent-color);
    background-color: var(--bg-color);
}

.list-item:hover .list-item-actions .delete-btn {
    opacity: 1;
    visibility: visible;
}

/* 資料夾列表項的特殊 hover 效果 */
.folder-list-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* 選擇框容器 */
.list-item-selection-box {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.list-item:not(:has(.list-selection-checkbox)) .list-item-selection-box {
    display: none;
}

/* 主要內容容器 */
.list-item-content {
    flex: 1;
    min-width: 0; /* 確保內容可以被壓縮 */
}

/* 內容頭部（名稱、標籤等） */
.list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

/* 項目名稱 */
.list-item-name {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 內容底部（時間、統計） */
.list-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    color: var(--text-muted);
}

.list-item-stats {
    white-space: nowrap;
}

.list-item-timestamp {
    white-space: nowrap;
}

/* 操作按鈕容器（刪除等） */
.list-item-actions {
    position: absolute;
    top: 12px;
    right: 12px;
}

.list-item-actions .delete-btn {
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

/* 新增項目卡片 */
.add-item-card {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 80px;
}

.add-item-card:hover {
    border-color: var(--accent-color);
    background-color: var(--bg-color);
}

.add-item-icon {
    color: var(--text-muted);
    opacity: 0.8;
}

.add-item-text {
    color: var(--text-muted);
    font-size: 0.9em;
    font-weight: 500;
}

/* 列表選中覆蓋層 */
.list-item .selection-overlay {
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: rgba(92, 193, 255, 0.4);
    border: 3px solid #66b3ff;
    border-radius: 10px;
    z-index: 5;
    pointer-events: none;
    box-sizing: border-box;
    display: none;
}

/* 總覽頁容器佈局 */
.card-page-container,
.list-page-container {
    margin: 0 auto;
}

.card-page-container {
    max-width: 100%;
}

.list-page-container {
    max-width: 70%;
}

/* 麵包屑外層容器 */
.breadcrumb-container {
    padding: 0 32px;
    margin-bottom: 8px;
}

/* 麵包屑導航主體 */
.breadcrumb-nav {
    padding: 20px 5px;
    font-size: 1.1em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    height: 32px;
    line-height: 16px;
    box-sizing: border-box;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0px;
    overflow: hidden;
}

/* 可點擊的麵包屑樣式 */
.breadcrumb-nav.clickable {
    cursor: pointer;
}

/* 不可點擊的麵包屑樣式 */
.breadcrumb-nav.non-clickable {
    cursor: default;
}

/* 麵包屑數量標籤 */
.breadcrumb-count {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-left: 4px;
    margin-top: 3px;
}

/* 麵包屑分隔符 */
.breadcrumb-separator {
    color: var(--text-muted);
    margin: 0 3px;
}

/* ===== 圖片庫 ===== */

/* 圖片庫工具列 */
.image-library-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    flex-wrap: wrap;
}

.image-library-toolbar .filter-btn {
    padding: 4px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s ease;
}

.image-library-toolbar .filter-btn:hover {
    border-color: var(--accent-color);
    color: var(--text-color);
}

.image-library-toolbar .filter-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* 圖片庫網格 */
.image-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding: 8px 0;
}

/* 圖片庫卡片 */
.image-library-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-library-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.image-library-card.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-color);
}

/* 圖片庫縮圖 */
.image-library-thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    position: relative;
    background-color: var(--bg-secondary);
    background-image:
        linear-gradient(45deg, var(--border-color) 25%, transparent 25%),
        linear-gradient(-45deg, var(--border-color) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--border-color) 75%),
        linear-gradient(-45deg, transparent 75%, var(--border-color) 75%);
    background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
}

.image-library-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 比例標籤 */
.image-library-ratio-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.7em;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

/* 卡片資訊 */
.image-library-card-info {
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.image-library-card-name {
    font-size: 0.8em;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.image-library-card-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-library-card:hover .image-library-card-actions {
    opacity: 1;
}

.image-library-card-actions button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.image-library-card-actions button:hover {
    color: var(--danger-color);
    background: var(--bg-color);
}

/* 頭像來源選單 */
.avatar-source-menu {
    position: fixed;
    z-index: 10001;
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-large);
    padding: 4px;
    min-width: 180px;
    animation: fadeInUp 0.15s ease;
}

.avatar-source-menu .menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    color: var(--text-color);
    font-size: 0.9em;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.avatar-source-menu .menu-item:hover {
    background: var(--bg-secondary);
}

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

/* 空狀態 */
.image-library-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: var(--text-muted);
    text-align: center;
    gap: 12px;
}

.image-library-empty-icon {
    font-size: 3em;
    opacity: 0.3;
}

.image-library-empty-text {
    font-size: 1em;
    font-weight: 500;
}

.image-library-empty-desc {
    font-size: 0.85em;
    max-width: 300px;
}

/* 比例選擇器 */
.ratio-chooser {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 16px;
}

.ratio-chooser-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
}

.ratio-chooser-option:hover {
    border-color: var(--accent-color);
}

.ratio-chooser-option .ratio-preview {
    border: 2px solid var(--text-muted);
    border-radius: 4px;
}

.ratio-chooser-option .ratio-label {
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-color);
}