/* Veila App - Sidebar Component */

/* Main Sidebar */
.sidebar {
    width: 320px;
    background: var(--glass-primary);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    display: flex;
    flex-direction: column;
    height: 100%;
    border-right: 1px solid var(--border-glass);
    box-shadow: var(--shadow-glass);
    position: relative;
    margin-top: 0;
    transition: all var(--transition-magnetic);
}

.sidebar:hover {
    box-shadow: var(--shadow-glass), 0 0 30px rgba(139, 92, 246, 0.1);
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(76, 29, 149, 0.03) 0%, rgba(107, 28, 62, 0.02) 100%);
    pointer-events: none;
}

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
    gap: 1rem;
}

.sidebar-header .agent-selector {
    flex: 1;
    min-width: 0;
}

.sidebar-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Action Buttons */
.new-conversation-btn,
.edit-prompt-btn {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-electric) 100%);
    color: white;
    border: none;
    border-radius: 50%;
    padding: 0.875rem;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all var(--transition-magnetic);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    box-shadow: var(--shadow-subtle), 0 0 15px rgba(124, 58, 237, 0.4);
    position: relative;
    overflow: hidden;
}

.edit-prompt-btn {
    background: var(--glass-secondary);
    backdrop-filter: var(--blur-subtle);
    -webkit-backdrop-filter: var(--blur-subtle);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    font-size: 1.1rem;
}

.new-conversation-btn:hover,
.edit-prompt-btn:hover {
    transform: translateY(-3px) scale(1.08);
    box-shadow: var(--shadow-glow), 0 0 25px rgba(124, 58, 237, 0.5);
}

.new-conversation-btn::before,
.edit-prompt-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.new-conversation-btn:hover::before,
.edit-prompt-btn:hover::before {
    left: 100%;
}

/* Conversations List */
.conversations-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: visible;
    padding: 1rem 0;
    position: relative;
    z-index: 1;
}

/* Allow dropdowns to overflow the container */
.conversations-list:has(.dropdown-menu:not([style*="display: none"])) {
    overflow: visible;
}

/* Conversation Item */
.conversation-item {
    padding: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-magnetic);
    border-bottom: 1px solid rgba(120, 80, 120, 0.08);
    margin: 0 1rem;
    border-radius: var(--radius-lg);
    margin-bottom: 0.75rem;
    position: relative;
    z-index: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.conversation-item.dropdown-open {
    z-index: 10000;
    pointer-events: none;
}

.conversation-item.dropdown-open .conversation-dropdown {
    pointer-events: auto;
}

.conversation-item:hover {
    background: var(--glass-hover);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.1);
}

.conversation-item.active {
    background: var(--glass-secondary);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-subtle), 0 0 20px rgba(139, 92, 246, 0.15);
    margin-left: 6px;
}

.conversation-content {
    flex: 1;
    min-width: 0;
}

.conversation-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.conversation-meta {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 400;
}

.conversation-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

/* Dropdown */
.conversation-dropdown {
    position: relative;
    z-index: 999998;
}

.dropdown-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-tertiary);
    opacity: 0;
    transition: all var(--transition-base);
    font-size: 1rem;
    border-radius: var(--radius-sm);
}

.conversation-item:hover .dropdown-btn {
    opacity: 1;
}

.dropdown-btn:hover {
    background: var(--glass-hover);
    color: var(--text-primary);
}

.dropdown-menu {
    position: absolute;
    top: 0;
    left: 100%;
    background: var(--glass-primary);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-deep);
    min-width: 140px;
    z-index: 999999;
    display: none;
    margin-left: 0.5rem;
}

.dropdown-menu.active {
    display: block;
    animation: dropdownSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown-menu button {
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: background var(--transition-fast);
    font-weight: 300;
    border-radius: var(--radius-lg);
}

.dropdown-menu button:hover {
    background: var(--glass-hover);
}

/* Favorite Indicator */
.favorite-indicator {
    color: var(--accent-rose-gold);
    font-size: 0.9rem;
    margin-right: 0.5rem;
    text-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
}

/* Title Edit Input */
.conversation-title-input {
    background: var(--glass-secondary);
    backdrop-filter: var(--blur-subtle);
    -webkit-backdrop-filter: var(--blur-subtle);
    border: 1px solid var(--accent-electric);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    font-size: 0.9rem;
    width: 100%;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 300;
}

.conversation-title-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}

/* Agent Selector */
.agent-selector {
    position: relative;
}

.agent-selector select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--glass-secondary);
    backdrop-filter: var(--blur-subtle);
    -webkit-backdrop-filter: var(--blur-subtle);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 400;
    cursor: pointer;
    appearance: none;
    padding-right: 2.5rem;
    transition: all var(--transition-base);
}

.agent-selector select:hover {
    background: var(--glass-hover);
    border-color: var(--border-active);
}

.agent-selector select:focus {
    outline: none;
    border-color: var(--accent-electric);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Agent selector arrow now handled in agent-selector.css */

/* Conversation dropdown fix */
.conversation-dropdown.active {
    display: block !important;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-glass);
    background: var(--glass-secondary);
    position: relative;
    z-index: 1;
}

/* Empty State */
.sidebar-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.sidebar-empty-icon {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.sidebar-empty-text {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    line-height: 1.5;
}