/* ChatGPT-Style Sidebar Layout with Avatar Support */

/* Character Picker Modal Styles */
#character-picker-modal {
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

#character-picker-modal .bg-white {
    animation: slideUp 0.3s ease-out;
}

.character-picker-item {
    transition: all 0.2s ease;
}

.character-picker-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.dark .character-picker-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.character-avatar-small {
    flex-shrink: 0;
    font-size: 0.875rem;
}

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

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

/* Reset button next to send - removed header styles */

/* Character Reply Toggle Styles */
.character-reply-toggle, #bot-reply-toggle {
    appearance: none;
    width: 1rem;
    height: 1rem;
    border: 2px solid #d1d5db;
    border-radius: 0.25rem;
    background: white;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.dark .character-reply-toggle, .dark #bot-reply-toggle {
    border-color: #6b7280;
    background: #374151;
}

.character-reply-toggle:checked, #bot-reply-toggle:checked {
    background: #10b981;
    border-color: #10b981;
}

.character-reply-toggle:checked::after, #bot-reply-toggle:checked::after {
    content: '✓';
    position: absolute;
    top: -2px;
    left: 1px;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Prevent body scrolling */
body {
    margin: 0;
    padding: 0;
}

/* Main layout container */
.app-container {
    display: flex;
    height: 100vh;
    position: relative;
}

/* Unified Main Sidebar */
.main-sidebar {
    width: clamp(220px, 70%, 320px);
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 30;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
    overflow: hidden;
}

.dark .main-sidebar {
    background: #1f2937;
    border-right-color: #374151;
}

/* Minimized state - floating button only */
.main-sidebar.minimized {
    width: 0;
    border: none;
    background: transparent;
    overflow: visible;
}

/* Hide all content when minimized */
.main-sidebar.minimized .sidebar-content,
.main-sidebar.minimized .sidebar-title {
    display: none;
}

/* Show content when expanded */
.main-sidebar:not(.minimized) .sidebar-content,
.main-sidebar:not(.minimized) .sidebar-title {
    display: block;
}

/* Floating button when minimized */
.main-sidebar.minimized .sidebar-header {
    position: fixed;
    top: 1rem;
    left: 1rem;
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 50;
}

.dark .main-sidebar.minimized .sidebar-header {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Normal header when expanded */
.main-sidebar:not(.minimized) .sidebar-header {
    position: relative;
    justify-content: space-between;
    padding: 1rem;
    width: auto;
    height: auto;
    border-radius: 0;
    box-shadow: none;
}

/* Minimize button styles */
.sidebar-minimize-btn {
    flex-shrink: 0;
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
}

/* Floating button when minimized */
.main-sidebar.minimized .sidebar-minimize-btn {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    padding: 0;
    border-radius: 8px;
}

.main-sidebar.minimized .sidebar-minimize-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

.dark .main-sidebar.minimized .sidebar-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.main-sidebar.minimized #chat-history-section::before {
    content: '💬';
    font-size: 1.5rem;
    text-align: center;
    display: block;
}

.main-sidebar.minimized #current-chat-section::before {
    content: '⚙️';
    font-size: 1.5rem;
    text-align: center;
    display: block;
}

.main-sidebar.minimized #character-library-section::before {
    content: '👤';
    font-size: 1.5rem;
    text-align: center;
    display: block;
}

/* Sidebar minimize button */
.sidebar-minimize-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.sidebar-minimize-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #374151;
    transform: translateX(-1px);
}

.dark .sidebar-minimize-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #9ca3af;
}

.dark .sidebar-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f3f4f6;
}

/* Rotate arrow when minimized with smooth transition */
.sidebar-minimize-btn svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-sidebar.minimized .sidebar-minimize-btn svg {
    transform: rotate(180deg);
}

.main-sidebar:not(.minimized) .sidebar-minimize-btn svg {
    transform: rotate(0deg);
}

/* Body padding adjustment with smooth transitions */
body {
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body.has-sidebar {
    margin-left: clamp(220px, 70%, 320px);
}


/* When minimized, content takes full width */
body.has-sidebar-minimized {
    margin-left: 0;
}

body.has-sidebar-minimized .chat-input-container {
    left: 0;
}




/* Sidebar header */
.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.dark .sidebar-header {
    border-bottom-color: #374151;
}

.dark .sidebar-title {
    color: #f3f4f6;
}


/* Sidebar content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.sidebar-section {
    border-bottom: 1px solid #e5e7eb;
}

.dark .sidebar-section {
    border-bottom-color: #374151;
}

.sidebar-section-header {
    padding: 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.dark .sidebar-section-header {
    color: #d1d5db;
    background: #111827;
    border-bottom-color: #374151;
}

.sidebar-section-content {
    overflow-y: auto;
    transition: max-height 0.3s ease;
    background: white;
}

.dark .sidebar-section-content {
    background: #1f2937;
}

.sidebar-section-content.chat-history {
    max-height: 350px;
}

.sidebar-section-content.character-library {
    max-height: 250px;
}

.sidebar-section-content.character-setup {
    max-height: 300px;
}

.sidebar-section.collapsed .sidebar-section-content {
    max-height: 0;
    overflow: hidden;
}

/* Chat History Header */
.chat-history-header {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.dark .chat-history-header {
    border-bottom-color: #374151;
}

/* Chat history items - ChatGPT style */
.chat-history-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 2px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    group: hover;
    background: white;
}

.dark .chat-history-item {
    background: #1f2937;
}

.chat-history-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem 0;
    margin: 0;
}

.chat-history-item:hover {
    background: #f3f4f6;
}

.dark .chat-history-item:hover {
    background: #374151;
}

.chat-history-item.active {
    background: #e0f2fe;
    border-left: 3px solid #0ea5e9;
}

.dark .chat-history-item.active {
    background: #0c4a6e;
    border-left-color: #38bdf8;
}

/* Chat content area */
.chat-content {
    flex: 1;
    min-width: 0;
    padding-right: 0.5rem;
}

.chat-title {
    font-size: 0.875rem;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    line-height: 1.25;
}

.dark .chat-title {
    color: #e5e7eb;
}

.chat-date {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.125rem;
}

.dark .chat-date {
    color: #9ca3af;
}

/* Chat actions */
.chat-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.chat-history-item:hover .chat-actions {
    opacity: 1;
}

.chat-action-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    border-radius: 4px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-action-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.dark .chat-action-btn {
    color: #9ca3af;
}

.dark .chat-action-btn:hover {
    background: #4b5563;
    color: #f3f4f6;
}

/* Expanded sections by default */
.sidebar-section.expanded .sidebar-section-content {
    max-height: none;
}

/* Character setup in sidebar */
.character-setup {
    padding: 1rem;
}

/* Character library items with avatar support */
.character-library-item {
    padding: 0.75rem 1rem;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: white;
}

.dark .character-library-item {
    border-bottom-color: #374151;
    background: #1f2937;
}

.character-library-item:hover {
    background: #f3f4f6;
}

.dark .character-library-item:hover {
    background: #374151;
}

.character-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
    flex-shrink: 0;
}

.character-avatar.has-image {
    background: none;
    overflow: hidden;
}

.character-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.character-info {
    flex: 1;
    min-width: 0;
}

.character-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .character-name {
    color: #f3f4f6;
}

.character-description {
    font-size: 0.75rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.125rem;
}

.dark .character-description {
    color: #9ca3af;
}

.character-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.character-library-item:hover .character-actions {
    opacity: 1;
}

.character-action-btn {
    background: none;
    border: none;
    padding: 0.375rem;
    border-radius: 4px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-action-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.dark .character-action-btn {
    color: #9ca3af;
}

.dark .character-action-btn:hover {
    background: #4b5563;
    color: #f3f4f6;
}

.character-quick-setup {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.setup-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.setup-field label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #374151;
}

.dark .setup-field label {
    color: #d1d5db;
}

.setup-field input,
.setup-field textarea {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    background: white;
    color: #374151;
    resize: vertical;
}

.dark .setup-field input,
.dark .setup-field textarea {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

.setup-field textarea {
    min-height: 60px;
    max-height: 120px;
}

/* Main content area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark .main-content {
    background: #111827;
}

/* Chat area - structured layout */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    margin: 20px;
    margin-bottom: 20px;
    position: relative;
}

.dark .chat-container {
    background: #111827;
}

/* Floating toggle removed - using sidebar minimize button instead */

/* Chat messages with avatar support */
.message {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}

.message.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
}

.message-avatar.user-avatar {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.message-avatar.character-avatar {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
}

.message-avatar.has-image {
    background: none;
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    flex: 1;
    max-width: calc(100% - 50px);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.message-author {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.dark .message-author {
    color: #f3f4f6;
}

.message-time {
    font-size: 0.75rem;
    color: #6b7280;
}

.dark .message-time {
    color: #9ca3af;
}

.message-text {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #374151;
}

.dark .message-text {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

.user-message .message-text {
    background: #3b82f6;
    border-color: #2563eb;
    color: white;
}

.dark .user-message .message-text {
    background: #1d4ed8;
    border-color: #1e40af;
}

/* Typing indicator */
.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;
    animation: typing 1.5s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Old chat header styles removed */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.dark .chat-messages {
    background: #1f2937;
    border-color: #374151;
}

.chat-input-container {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.dark .chat-input-container {
    background: #1f2937;
    border-color: #374151;
}


/* Mobile menu button */
.mobile-menu-button {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 40;
    background: white;
    border: 1px solid #e5e7eb;
    padding: 0.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.dark .mobile-menu-button {
    background: #1f2937;
    border-color: #374151;
}

.mobile-menu-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .mobile-menu-button {
        display: block;
    }
    /* Remove body margin on mobile */
    body.has-sidebar,
    body.has-sidebar-minimized {
        margin-left: 0 !important;
    }
    
    .chat-input-container {
        left: 0 !important;
    }
    
    /* Make chat take more space on mobile */
    .chat-container {
        height: calc(100vh - 40px) !important;
        margin: 10px !important;
        margin-bottom: 10px !important;
    }
    
    .main-sidebar {
        transform: translateX(-100%);
        z-index: 50;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    }
    
    .main-sidebar.mobile-open {
        transform: translateX(0);
    }
    
    /* Overlay for mobile */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 40;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* Hidden sidebar state */
.main-sidebar.hidden {
    transform: translateX(-100%);
}

/* Smooth animations */
* {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Scrollbar styling */
.sidebar-content::-webkit-scrollbar,
.sidebar-section-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track,
.sidebar-section-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb,
.sidebar-section-content::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.dark .sidebar-content::-webkit-scrollbar-thumb,
.dark .sidebar-section-content::-webkit-scrollbar-thumb {
    background: #4b5563;
}

/* Hide traditional setup panel */
.traditional-setup {
    display: none;
}

/* Character slot styling */
.character-slot {
    position: relative;
    transition: all 0.2s ease-in-out;
}

.character-slot:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.character-card {
    transition: all 0.2s ease-in-out;
}

.character-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.template-card {
    transition: all 0.2s ease-in-out;
}

.template-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Collapsible sections */
.section-toggle-icon {
    transition: transform 0.2s ease;
}

.sidebar-section.collapsed .section-toggle-icon {
    transform: rotate(-90deg);
}

/* Scene Builder - Steve Jobs Style Design */
#scene-builder {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Scene Chips - Premium Button Design */
.scene-chip {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.025em;
    text-align: center;
    min-width: 0;
    white-space: nowrap;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.dark .scene-chip {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    border-color: #4b5563;
    color: #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.scene-chip:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-color: #94a3b8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dark .scene-chip:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    border-color: #6b7280;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.scene-chip.selected {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-color: #2563eb;
    color: white;
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.dark .scene-chip.selected {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    border-color: #3b82f6;
    box-shadow: 0 4px 16px rgba(29, 78, 216, 0.4);
}

.scene-chip:active {
    transform: scale(0.98);
}

/* Generate Button - Premium Gradient */
#generate-character-btn {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-weight: 600;
    letter-spacing: 0.025em;
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.25);
    position: relative;
    overflow: hidden;
}

#generate-character-btn:hover:not(:disabled) {
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.35);
    transform: translateY(-1px);
}

#generate-character-btn:disabled {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    color: #94a3b8;
    box-shadow: none;
}

.dark #generate-character-btn:disabled {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    color: #6b7280;
}

/* Manual Setup Toggle */
#manual-setup-toggle {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    transition: all 0.2s ease;
}

#manual-setup-toggle:hover {
    background: rgba(59, 130, 246, 0.05);
    border-radius: 6px;
    padding: 8px;
    margin: -8px;
}

.dark #manual-setup-toggle:hover {
    background: rgba(59, 130, 246, 0.1);
}

#manual-setup-toggle.expanded svg {
    transform: rotate(180deg);
}

/* Premium Input Styling */
#manual-setup-content input,
#manual-setup-content textarea {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    transition: all 0.2s ease;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#manual-setup-content input:focus,
#manual-setup-content textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Sidebar Header Enhancement */
.sidebar-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
}

.dark .sidebar-header {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-bottom-color: #374151;
}


/* Section Headers Enhancement */
.sidebar-section-header {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-weight: 600;
    letter-spacing: 0.025em;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.dark .sidebar-section-header {
    background: linear-gradient(135deg, #111827 0%, #0f172a 100%);
}

/* Character role badges */
.character-role-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.character-role-badge.user {
    background: #dbeafe;
    color: #1e40af;
}

.dark .character-role-badge.user {
    background: #1e3a8a;
    color: #93c5fd;
}

.character-role-badge.bot {
    background: #dcfce7;
    color: #166534;
}

.dark .character-role-badge.bot {
    background: #14532d;
    color: #86efac;
}

.character-role-badge.additional {
    background: #fef3c7;
    color: #92400e;
}

.dark .character-role-badge.additional {
    background: #78350f;
    color: #fcd34d;
}

/* Character Library Items Enhancement */
.character-library-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    margin: 4px 8px;
    padding: 12px;
}

.character-library-item:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.dark .character-library-item:hover {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Character Reply Toggle Styles */
.character-reply-toggle, #bot-reply-toggle {
    appearance: none;
    width: 1rem;
    height: 1rem;
    border: 2px solid #d1d5db;
    border-radius: 0.25rem;
    background: white;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.dark .character-reply-toggle, .dark #bot-reply-toggle {
    border-color: #6b7280;
    background: #374151;
}

.character-reply-toggle:checked, #bot-reply-toggle:checked {
    background: #10b981;
    border-color: #10b981;
}

.character-reply-toggle:checked::after, #bot-reply-toggle:checked::after {
    content: '\2713';
    position: absolute;
    top: -2px;
    left: 1px;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Enhanced UI Polish */
/* Reset button next to send button */
#reset-chat-button {
    transition: all 0.2s ease;
}

#reset-chat-button:hover {
    background-color: #ef4444 !important;
    color: white !important;
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Message animations */
.message {
    animation: slideInUp 0.3s ease-out;
}

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

/* Improved chat input */
#chat-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Send button improvements */
#send-button:hover:not(:disabled) {
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

#send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

