mgzon-app / static /css /chat /sidebar.css
Mark-Lasfar
Fix: Sidebar fully class-based with proper overlay and desktop support
169ad0d
/* ============================================================
CHAT SIDEBAR - FULLY RESPONSIVE WITH TOUCH SUPPORT
============================================================ */
/* Sidebar container */
#sidebar {
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: 280px;
max-width: 85%;
background: linear-gradient(135deg, rgba(17, 24, 39, 0.98), rgba(20, 78, 85, 0.98));
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
z-index: 1000;
transform: translateX(-100%);
transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
border-right: 1px solid rgba(255, 255, 255, 0.1);
}
/* When sidebar is open */
#sidebar.open {
transform: translateX(0) !important;
}
/* Sidebar header */
.sidebar-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-logo {
display: flex;
align-items: center;
gap: 0.75rem;
}
.sidebar-logo img {
width: 32px;
height: 32px;
border-radius: 50%;
}
.sidebar-logo h2 {
font-size: 1.1rem;
font-weight: 600;
color: white;
}
/* Close button */
#closeSidebarBtn {
background: rgba(255, 255, 255, 0.1);
border: none;
border-radius: 50%;
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.2s ease;
}
#closeSidebarBtn:hover {
background: rgba(239, 68, 68, 0.8);
transform: scale(1.05);
}
#closeSidebarBtn svg {
width: 18px;
height: 18px;
stroke: white;
}
/* Sidebar navigation */
#sidebar nav {
padding: 1rem;
}
#sidebar nav ul {
list-style: none;
padding: 0;
margin: 0;
}
#sidebar nav ul li {
margin-bottom: 0.5rem;
}
#sidebar nav ul li a,
#sidebar nav ul li button {
display: flex;
align-items: center;
gap: 0.75rem;
width: 100%;
padding: 0.7rem 1rem;
border-radius: 0.5rem;
color: #e5e7eb;
text-decoration: none;
background: transparent;
border: none;
cursor: pointer;
transition: all 0.2s ease;
font-size: 0.9rem;
}
#sidebar nav ul li a:hover,
#sidebar nav ul li button:hover {
background: rgba(59, 130, 246, 0.2);
color: white;
}
#sidebar nav ul li a svg,
#sidebar nav ul li button svg {
width: 20px;
height: 20px;
stroke: currentColor;
}
/* Conversations section */
.conversations-section {
margin-top: 1rem;
padding-top: 1rem;
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.conversations-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.5rem 1rem;
margin-bottom: 0.5rem;
}
.conversations-header h3 {
font-size: 0.8rem;
font-weight: 600;
color: #9ca3af;
text-transform: uppercase;
letter-spacing: 0.5px;
}
#newConversationBtn {
background: rgba(59, 130, 246, 0.2);
border: none;
border-radius: 50%;
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.2s ease;
}
#newConversationBtn:hover {
background: #3b82f6;
transform: scale(1.05);
}
#conversationList {
list-style: none;
padding: 0;
margin: 0;
max-height: calc(100vh - 280px);
overflow-y: auto;
}
#conversationList li {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.6rem 1rem;
border-radius: 0.5rem;
cursor: pointer;
transition: all 0.2s ease;
margin-bottom: 0.25rem;
}
#conversationList li:hover {
background: rgba(255, 255, 255, 0.1);
}
#conversationList li.active {
background: rgba(59, 130, 246, 0.3);
}
#conversationList li .truncate {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 0.85rem;
color: #e5e7eb;
}
.delete-conversation-btn {
background: transparent;
border: none;
border-radius: 50%;
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
opacity: 0;
transition: all 0.2s ease;
color: #ef4444;
}
#conversationList li:hover .delete-conversation-btn {
opacity: 1;
}
.delete-conversation-btn:hover {
background: rgba(239, 68, 68, 0.2);
transform: scale(1.1);
}
/* History toggle button (mobile) */
#historyToggle {
display: flex;
align-items: center;
gap: 0.5rem;
width: 100%;
padding: 0.7rem 1rem;
background: transparent;
border: none;
color: #e5e7eb;
cursor: pointer;
border-radius: 0.5rem;
transition: all 0.2s ease;
}
#historyToggle:hover {
background: rgba(255, 255, 255, 0.1);
}
/* Swipe hint */
#swipeHint {
position: fixed;
top: 50%;
left: 10px;
transform: translateY(-50%);
z-index: 1001;
animation: swipePulse 1.5s ease-in-out infinite;
cursor: pointer;
}
@keyframes swipePulse {
0%, 100% {
transform: translateY(-50%) translateX(0);
opacity: 0.7;
}
50% {
transform: translateY(-50%) translateX(10px);
opacity: 1;
}
}
/* Overlay when sidebar is open on mobile */
.sidebar-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 999;
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
}
.sidebar-overlay.active {
opacity: 1;
visibility: visible;
}
/* Light theme support */
html.light #sidebar {
background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(240, 248, 255, 0.98));
border-right-color: rgba(0, 0, 0, 0.1);
}
html.light #sidebar nav ul li a,
html.light #sidebar nav ul li button,
html.light .conversations-header h3,
html.light #historyToggle,
html.light #conversationList li .truncate {
color: #1f2937;
}
html.light #sidebar nav ul li a:hover,
html.light #sidebar nav ul li button:hover,
html.light #historyToggle:hover {
background: rgba(0, 0, 0, 0.05);
}
html.light #conversationList li:hover {
background: rgba(0, 0, 0, 0.05);
}
html.light #conversationList li.active {
background: rgba(59, 130, 246, 0.1);
}
/* Responsive */
@media (min-width: 768px) {
#sidebar {
transform: translateX(0) !important;
}
.sidebar-overlay {
display: none;
}
#closeSidebarBtn {
display: none;
}
#swipeHint {
display: none;
}
}
@media (max-width: 767px) {
.main-content {
margin-left: 0 !important;
}
}
#sidebar {
transform: translateX(-100%);
transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}
#sidebar.open {
transform: translateX(0) !important;
}