* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  overflow-x: hidden;
}

body {
  height: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  position: relative;
  overscroll-behavior: none;
}

body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(to bottom right, #312c85, #59168b, #a3004c);
  z-index: -1;
}

/* Main Container */
.conversations-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 3rem;
  min-height: calc(100vh - 5rem);
}

/* Header */
.conversations-header {
  margin-bottom: 2rem;
  animation: slideDown 0.5s ease;
}

.header-content {
  margin-bottom: 1.5rem;
  text-align: center;
}

.header-content h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.8);
  font-weight: 400;
}

.search-container {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.search-container input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  border-radius: 50px;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.search-container input:focus {
  outline: none;
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.2);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.search-container input::placeholder {
  color: rgba(255,255,255,0.6);
}

.search-container svg {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  stroke: rgba(255,255,255,0.6);
}

/* Conversations List */
.conversations-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
  gap: 1.5rem;
  animation: fadeIn 0.6s ease;
}

@media (min-width: 1400px) {
  .conversations-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1800px) {
  .conversations-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Conversation Card */
.conversation-card {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 1rem;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  color: #fff;
  display: block;
  position: relative;
  overflow: hidden;
}

.conversation-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(to right, #9b5de5, #f15bb5, #00c950);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.conversation-card:hover::before {
  opacity: 1;
}

.conversation-card:hover {
  background: rgba(255,255,255,0.25);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  border-color: rgba(255,255,255,0.3);
}

.conversation-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.avatar {
  position: relative;
  height: 56px;
  width: 56px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to bottom right, #9b5de5, #f15bb5);
  color: #fff;
  font-weight: bold;
  font-size: 1.2rem;
  margin-right: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

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

.initials {
  display: inline-block;
  max-width: 4ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.agent-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.7);
}

.conversation-date {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.conversation-date svg {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.conversation-preview {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.message-count {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.message-count svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: rgba(255,255,255,0.8);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: #fff;
}

.empty-state p {
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.empty-state a {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: rgba(255,255,255,0.2);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.3s ease;
  border: 1px solid rgba(255,255,255,0.3);
}

.empty-state a:hover {
  background: rgba(255,255,255,0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Loading Notification */
.loading-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 2rem 3rem;
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

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

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive Design */
@media (max-width: 1200px) {
  .conversations-container {
    max-width: 900px;
    padding: 2rem;
  }

  .conversations-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .conversations-container {
    padding: 1.5rem 1rem;
  }

  .header-content h1 {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .conversations-list {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .conversation-card {
    padding: 1.25rem;
  }

  .avatar {
    height: 48px;
    width: 48px;
    font-size: 1rem;
  }

  .agent-name {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .conversations-header {
    margin-bottom: 1.5rem;
  }

  .header-content h1 {
    font-size: 1.75rem;
  }

  .search-container input {
    padding: 0.875rem 0.875rem 0.875rem 2.5rem;
    font-size: 0.9rem;
  }

  .conversation-card {
    padding: 1rem;
  }

  .conversation-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}