/* ==========================================
   MangaStudio - Sidebar Component
   ========================================== */

/* Generic Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Right Sidebar (Editor) */
.right-sidebar {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-light);
    overflow-y: auto;
}

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

.sidebar-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

/* Chapters Sidebar */
.chapters-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-light);
    padding: 24px;
    overflow-y: auto;
}

.chapters-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.chapters-sidebar-title {
    font-size: 14px;
    font-weight: 600;
}

/* Chapter Navigation Item */
.chapter-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 8px;
}

.chapter-nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.chapter-nav-item.active {
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

.chapter-nav-number {
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.chapter-nav-item:not(.active) .chapter-nav-number {
    background: var(--border);
    color: var(--text-secondary);
}

.chapter-nav-title {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
}

.chapter-nav-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34c759;
}

.chapter-nav-status.draft {
    background: #ff9500;
}

.chapter-nav-status.empty {
    background: var(--border);
}

/* Character Tabs */
.character-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: var(--bg-primary);
    padding: 4px;
    border-radius: var(--radius-md);
}

.character-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.character-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.character-tab.active {
    color: var(--text-primary);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
}

.character-tab .tab-count {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 10px;
}

.character-tab.active .tab-count {
    background: var(--accent);
    color: white;
}

/* Character List (Sidebar) */
.character-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.character-list.character-tab-content {
    display: flex;
}

.character-list.character-tab-content[style*="display: none"] {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* NPC Sheet Generate Button */
.btn-generate-npc-sheet {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.btn-generate-npc-sheet:hover {
    background: var(--accent);
    color: white;
}

.character-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.character-list-item:hover {
    transform: translateX(4px);
}

.character-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #e8e8ed 0%, #d2d2d7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-avatar svg {
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
}

.character-details {
    flex: 1;
}

.character-list-name {
    font-size: 13px;
    font-weight: 500;
}

.character-list-role {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Images Grid (Sidebar) */
.images-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.image-thumb {
    aspect-ratio: 1;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.image-thumb:hover {
    transform: scale(1.05);
}

.image-thumb svg {
    width: 24px;
    height: 24px;
    color: var(--text-tertiary);
}

.add-image-btn {
    border: 2px dashed var(--border);
    background: transparent;
}

/* Stats Grid (Sidebar) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* Responsive */
@media (max-width: 1200px) {
    .right-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .chapters-sidebar {
        display: none;
    }
}
