.sidebar {
  width: 400px;
  background: #f5f5f5;
  border-right: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
  height: calc(100vh - 60px);
}

.sidebar.desktop-hidden {
  margin-left: -400px;
}

.nav-container {
  display: flex;
  justify-content: space-around;
  padding: 12px;
  background: transparent;
  gap: 8px;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 400px;
  z-index: 999;
  transition: left 0.3s ease;
}

.nav-container.sidebar-hidden {
  left: -320px;
}

.nav-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9333ea;
  transition: background 0.2s;
  flex: 1;
  position: relative;
}

.nav-btn:hover {
  background: rgba(147, 51, 234, 0.1);
}

.conversations {
  flex: 1;
  overflow-y: auto;
  border-radius: 12px 12px 0 0;
  padding-top: 12px;
}

.conversation {
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
}

.conversation:hover {
  background: #e8e8e8;
}

.conversation.active {
  background: #9333ea;
  color: white;
  border-left: 3px solid #9333ea;
}

.conversation.active .conversation-phone,
.conversation.active .conversation-number,
.conversation.active .conversation-meta {
  color: white;
}

.conversation-phone {
  font-weight: 600;
  margin-bottom: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.conversation-number {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.conversation-summary {
  font-size: 12px;
  color: #888;
  margin-top: 8px;
  font-style: italic;
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.conversation-summary.collapsed {
  max-height: 0;
  margin-top: 0;
}

.summary-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #9333ea;
  margin-top: 6px;
  cursor: pointer;
  font-weight: 500;
}

.summary-toggle svg {
  transition: transform 0.2s;
}

.summary-toggle.expanded svg {
  transform: rotate(180deg);
}

.summary-toggle-crm svg {
  transition: transform 0.2s;
}

.summary-toggle-crm.expanded svg {
  transform: rotate(180deg);
}

body.dark-mode .summary-toggle {
  color: #9333ea;
}

.conversation-meta {
  font-size: 12px;
  color: #888;
  position: absolute;
  right: 16px;
  top: 16px;
}

.conversation-badges {
  display: flex;
  flex-wrap: wrap;
  margin-top: 4px;
  margin-bottom: 4px;
}

.conversation-badges .status-badge {
  font-size: 10px;
}

.status-sent {
  background: #6b7280;
  color: white;
}

.unread-badge {
  display: inline-block;
  background: #9333ea;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 8px;
  min-width: 18px;
  text-align: center;
}

body.dark-mode .unread-badge {
  background: #9333ea;
}

.conversation-swipe-actions {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 12px;
  opacity: 0;
  pointer-events: none;
}

.conversation-swipe-actions.visible {
  opacity: 1;
  pointer-events: auto;
}

.swipe-action-btn {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.swipe-action-btn.delete {
  background: #e11d48;
  color: white;
}

.swipe-action-btn.summary {
  background: #3b82f6;
  color: white;
}

body.dark-mode .swipe-action-btn.delete {
  background: #e11d48;
}

body.dark-mode .swipe-action-btn.summary {
  background: #60a5fa;
}

.context-menu {
  position: fixed;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 4px 0;
  z-index: 9999;
  min-width: 150px;
  display: none;
}

.context-menu.active {
  display: block;
}

.context-menu-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 10px;
}

.context-menu-item:hover {
  background: #f5f5f5;
}

.context-menu-item.danger {
  color: #e11d48;
}

body.dark-mode .context-menu {
  background: #2c2c2e;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

body.dark-mode .context-menu-item {
  color: #fff;
}

body.dark-mode .context-menu-item:hover {
  background: #3a3a3c;
}

body.dark-mode .context-menu-item.danger {
  color: #e11d48;
}

body.dark-mode .sidebar {
  background: #1c1c1e;
  border-right-color: #38383a;
}

body.dark-mode .nav-container {
  border-top-color: #000000;
}

body.dark-mode .nav-btn {
  color: #9333ea;
}

body.dark-mode .nav-btn:hover {
  background: rgba(147, 51, 234, 0.2);
}

body.dark-mode .conversation {
  border-bottom-color: #38383a;
}

body.dark-mode .conversation:hover {
  background: #2c2c2e;
}

body.dark-mode .conversation.active {
  background: #9333ea;
  color: white;
}

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

  .sidebar {
    transition: transform 0.3s ease-out;
  }

  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70vh;
    z-index: 150;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    overflow-y: auto;
    margin-left: 0;
    display: flex;
    flex-direction: column;
  }

  .sidebar.open {
    transform: translateY(0);
  }

  .sidebar .search-box {
    order: 0;
    border-top: none;
    border-bottom: 1px solid #3a3a3c;
    position: sticky;
    top: 0;
    background: #1c1c1e;
    z-index: 10;
  }

  .sidebar .conversations {
    order: 1;
    flex: 1;
    overflow-y: auto;
  }

  .conversation {
    padding: 12px;
  }

  .conversation-phone {
    font-size: 14px;
  }
}
