:root {
  --primary-color: #28a745;
  --primary-dark: #00A041;
  --secondary-color: #F8F9FA;
  --text-primary: #1A1A1A;
  --text-secondary: #6C757D;
  --text-muted: #9CA3AF;
  --border-color: #E5E7EB;
  --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-heavy: 0 10px 15px rgba(0, 0, 0, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 20px;
  --spacing-2xl: 24px;
  --gradient-primary: linear-gradient(135deg, #00C851 0%, #00A041 100%);
  --gradient-bg: linear-gradient(180deg, #FAFBFC 0%, #F8F9FA 100%);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gradient-bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Header Styles */
.header {
  background: #fff;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 40px;
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title {
  font-size: 24px;
  font-weight: 700;
  color: #28a745;
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.profile-avatar {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  transition: all 0.2s ease;
  cursor: pointer;
}

.profile-avatar:hover {
  border-color: var(--primary-color);
  transform: scale(1.05);
}

.search-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--secondary-color);
  border: 1px solid #28a745;
  display: flex;
  color: #28a745;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.search-btn:hover {
  background: #28a745;
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-medium);
}

/* Main App Layout */
.app-view-container {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  height: calc(100vh - 70px - 60px); /* Subtract header and navbar heights */
  overflow: hidden;
}

.message-pane {
  width: 100%;
  max-width: 500px;
  padding-bottom: 100px; /* Space for the bottom navbar */
  overflow-y: auto;
  transition: all 0.3s ease;
}

.chat-pane {
  flex-grow: 1;
}

/* --- Follower List Styles --- */
#followers-list-container {
  padding: var(--spacing-md) 0;
  width: 100%; /* Changed from 100vw to 100% to fill parent */
  border-bottom: 1px solid var(--border-color);
  background-color: #fff;
}

.followers-list-header {
  padding: 0 var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.followers-list-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.horizontal-scroll-container {
  display: flex;
  overflow-x: auto;
  padding: 0 var(--spacing-lg);
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.horizontal-scroll-container::-webkit-scrollbar {
  display: none;
}

.follower-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin-right: var(--spacing-md);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.follower-item:hover {
  opacity: 0.8;
}

.follower-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border-color);
}

.follower-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.follower-name {
  margin-top: var(--spacing-sm);
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70px;
}

/* --- Message List Styles --- */
.message-list-container {
  padding: var(--spacing-lg);
  overflow-y: auto;
}

#message-list {
  /* No specific styles here, items are styled below */
}

.message-item {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

.message-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.message-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-heavy);
  border-color: var(--primary-color);
}

.message-item:hover::before {
  opacity: 0.05;
}

.message-item:active {
  transform: translateY(0);
}

.message-item.selected {
  background: var(--secondary-color);
  border-color: var(--primary-color);
}

.message-avatar {
  position: relative;
}

.message-avatar img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--border-color);
  transition: all 0.2s ease;
}

.message-avatar .online-indicator {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: #10B981;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: var(--shadow-light);
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-xs);
}

.message-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.message-time {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.message-preview {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--spacing-xs);
}

.message-type-icon {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 12px;
  color: var(--text-muted);
}

/* Unread Message Styles */
.message-item.unread {
  border-color: var(--primary-color);
}

.message-item.unread .message-name {
  font-weight: 700;
  color: var(--primary-color);
}

.message-item.unread .message-preview {
  color: var(--text-primary);
  font-weight: 500;
}

.unread-indicator {
  position: absolute;
  top: var(--spacing-lg);
  right: var(--spacing-lg);
  width: 12px;
  height: 12px;
  margin-right: 35px;
  background: var(--primary-color);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(0, 200, 81, 0.2);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 200, 81, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(0, 200, 81, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 200, 81, 0); }
}

/* New Message Animation */
.message-item.new {
  animation: slideInFromTop 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--spacing-2xl) var(--spacing-lg);
  display: none;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--spacing-xl);
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 32px;
}

.empty-state h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Skeleton Loader */
.skeleton-wrapper {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}

.skeleton-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

.skeleton-content {
  flex: 1;
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  margin-bottom: var(--spacing-sm);
}

.skeleton-line.title { width: 40%; height: 16px; }
.skeleton-line.subtitle { width: 70%; }
.skeleton-line.time { width: 25%; height: 10px; }

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

#navbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  background-color: white;
  box-shadow: 0 0 10px #ddd;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  transition: all 0.3s ease-in-out;
}

/* Desktop: Move to top-right */
@media (min-width: 900px) {
  #navbar {
    top: -4px;
    bottom: auto;
    left: auto;
    right: 0px;
    transform: none;
    max-width: 400px;
    background-color: transparent;
    box-shadow: none;
  }
}

@media (min-width: 900px) {
  #navbar a span:not(.notification-badge):not(.icon-with-badge) {
    display: none;
  }
}

#navbar ul {
  display: flex;
  max-width: 900px;
  justify-content: center;
  padding: 10px 0;
  list-style: none;
  margin: 0 auto;
  width: 100%;
}

#navbar li {
  flex: 1;
  text-align: center;
}

#navbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #28a745;
  font-size: 12px;
  padding: 8px;
  transition: color 0.2s;
}

#navbar a.active {
  color: #28a745;
  font-weight: 500;
}

#navbar i.active {
  color: #28a745;
  font-weight: 500;
}

#navbar a i {
  font-size: 14px;
  margin-bottom: 5px;
  background: #fff;
  border: 1px solid #fff;
  box-shadow: 0 0 10px #ddd;
  padding: 10px;
  height: 35px;
  width: 35px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
}

.icon-badge-wrapper {
  position: relative;
  display: inline-block;
}

.icon-with-badge {
  position: relative;
  display: inline-block;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -10px;
  background-color: red;
  color: white;
  font-size: 10px;
  width: 18px;
  height: 18px;
  line-height: 18px;
  border-radius: 50%;
  text-align: center;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Responsive Design */
@media (min-width: 768px) {
  .desktop-only {
    display: block;
  }
  
  .message-pane {
    max-width: 400px;
    padding: var(--spacing-lg);
    border-right: 1px solid var(--border-color);
  }

  .chat-pane {
    height: 100%;
    position: relative;
    overflow: hidden;
  }

  .desktop-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-medium);
    transition: all 0.3s ease;
  }

  #navbar {
    display: none;
  }

  .header {
    max-width: 1400px;
    margin: 0 auto;
  }
}

@media (max-width: 767px) {
  .desktop-only {
    display: none;
  }

  .message-pane {
    max-width: 100%;
    margin: 0 auto;
    padding: var(--spacing-lg) 0;
    padding-bottom: 100px;
  }

  .message-list-container {
    padding: var(--spacing-lg);
  }

  .header {
    padding: var(--spacing-md) var(--spacing-lg);
  }

  .header-title {
    font-size: 20px;
  }

  .message-item {
    padding: var(--spacing-md);
    gap: var(--spacing-md);
  }

  .message-avatar img {
    width: 48px;
    height: 48px;
  }
}

/* Loading States */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* Error State */
.error-message {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #DC2626;
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  text-align: center;
  margin: var(--spacing-lg);
}
