.sidebar {
    width: 280px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    animation: slideInLeft 0.5s ease;
    z-index: 100;
    box-shadow: none;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 1rem;
    background: transparent;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
    animation: fadeIn 0.6s ease 0.2s both;
}

.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1rem;
    right: 1rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(88, 166, 255, 0.5), transparent);
}

.sidebar-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #00d4ff, #9d4edd, #58a6ff);
    background-size: 200% 200%;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 16px;
    animation: gradientShift 3s ease infinite;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
    transition: all 0.3s ease;
}

.sidebar-icon:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 20px rgba(157, 78, 221, 0.4);
}

.sidebar-title {
    font-size: 1.5rem;
    font-weight: 800 !important;
    background: linear-gradient(45deg, #00d4ff, #9d4edd);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    letter-spacing: normal;
    font-style: normal;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.new-chat-btn {
    background: linear-gradient(135deg, #238636, #2ea043);
    border: none;
    border-radius: 12px;
    color: white;
    padding: 0.8rem 1.2rem;
    margin: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.6s ease 0.3s both;
}

.new-chat-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3), transparent);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.new-chat-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(46, 160, 67, 0.4);
}

.new-chat-btn:hover::before {
    width: 300px;
    height: 300px;
}

.new-chat-btn:active {
    transform: translateY(0) scale(0.98);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 1rem;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-title {
    color: #8b949e;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1.2rem;
    margin: 0.3rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(88, 166, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.nav-item:hover {
    background: rgba(88, 166, 255, 0.08);
    color: #f0f6fc;
    transform: translateX(5px);
}

.nav-item:hover::before {
    left: 100%;
}

.nav-item.active {
    background: rgba(88, 166, 255, 0.15);
    color: #58a6ff;
    border-left: 3px solid #58a6ff;
    margin-left: 1rem;
    padding-left: calc(1.2rem - 3px);
    box-shadow: 0 4px 15px rgba(88, 166, 255, 0.2);
}

.nav-item.active::before {
    left: 100%;
}

.nav-icon {
    width: 16px;
    height: 16px;
    opacity: 0.8;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    color: #e6edf3;
    margin-bottom: 0.25rem;
    position: relative;
}

.chat-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.chat-item.active {
    background: rgba(88, 166, 255, 0.15);
    color: #58a6ff;
}

.chat-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time {
    font-size: 0.75rem;
    color: #8b949e;
}

.chat-menu {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-item:hover .chat-menu {
    opacity: 1;
}

.menu-btn {
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f0f6fc;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #21262d;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    margin: 0.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
    position: relative;
    animation: fadeIn 0.6s ease 0.4s both;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(88, 166, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(88, 166, 255, 0.3);
}

.user-avatar-container {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.user-avatar-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(45deg, #58a6ff, #1f6feb);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    position: absolute;
    top: 0;
    left: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #58a6ff, #1f6feb);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(88, 166, 255, 0.3);
}

.user-profile:hover .user-avatar {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(88, 166, 255, 0.4);
}

.user-info {
    flex: 1;
    min-width: 0; 
    overflow: hidden;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #f0f6fc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.user-plan {
    font-size: 0.75rem;
    color: #8b949e;
    white-space: nowrap;
}

.user-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.logout-btn {
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #8b949e;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-btn:hover {
    background: #30363d;
    border-color: #58a6ff;
    color: #58a6ff;
}

.script-item {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.script-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(88, 166, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(88, 166, 255, 0.2);
}

.script-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.script-title {
    font-weight: 600;
    color: #f0f6fc;
    font-size: 0.9rem;
    line-height: 1.3;
}

.script-time {
    color: #8b949e;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.script-description {
    color: #8b949e;
    font-size: 0.8rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

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

.script-item:hover .script-actions {
    opacity: 1;
}

.script-action-btn {
    background: rgba(139, 148, 158, 0.2);
    border: none;
    border-radius: 4px;
    color: #8b949e;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.script-action-btn:hover {
    background: rgba(88, 166, 255, 0.2);
    color: #58a6ff;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}
