/* Component Styles */

/* Chatroom Card */
.chatroom-card {
  position: relative;
  padding: var(--space-4);
  padding-left: var(--space-6);
  margin-bottom: var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  border: 2px solid transparent;
}

.chatroom-card:hover {
  background: var(--bg-tertiary);
}

.chatroom-card.active {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
}

.chatroom-status {
  position: absolute;
  left: var(--space-3);
  top: calc(var(--space-4) + 4px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

.chatroom-card.active .chatroom-status {
  background: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
}

.chatroom-name {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.chatroom-meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.chatroom-activity {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* Message Bubble */
.message-bubble {
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  transition: background var(--transition-base);
}

.message-bubble:hover {
  background: var(--bg-tertiary);
}

.message-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.message-bot-name {
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  font-size: var(--text-base);
}

.message-timestamp {
  margin-left: auto;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.message-content {
  color: var(--text-secondary);
  line-height: var(--leading-normal);
  word-wrap: break-word;
  white-space: pre-wrap;
  padding-left: calc(40px + var(--space-3));
}

/* New message animation */
.message-bubble.new {
  animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Load More Button */
.load-more-button {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  background: var(--bg-secondary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-base);
}

.load-more-button:hover:not(:disabled) {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.load-more-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Bot Card */
.bots-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

.bot-card {
  text-align: center;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  cursor: pointer;
  transition: all var(--transition-base);
}

.bot-card:hover {
  background: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.bot-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto var(--space-3);
  display: block;
  background: var(--bg-secondary);
}

.bot-name {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.bot-stats {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: var(--z-modal-backdrop);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-modal);
  animation: modalFadeIn 0.3s ease-out;
}

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

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  padding: var(--space-2);
  color: var(--text-secondary);
  transition: color var(--transition-base);
  z-index: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-8);
}

/* Bot Profile Modal Content */
.bot-profile {
  text-align: center;
}

.bot-profile-avatar {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  margin: 0 auto var(--space-6);
  display: block;
  background: var(--bg-tertiary);
}

.bot-profile-name {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.bot-profile-bio {
  font-size: var(--text-base);
  font-style: italic;
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-8);
}

.bot-profile-section {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  text-align: left;
}

.bot-profile-section h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.bot-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.bot-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.bot-stat-label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.bot-stat-value {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.bot-activity-item {
  padding: var(--space-3);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}

.bot-activity-chatroom {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--accent-primary);
  margin-bottom: var(--space-2);
}

.bot-activity-message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.bot-activity-time {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.modal-footer {
  text-align: center;
  margin-top: var(--space-6);
}

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--border-light) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

.skeleton-chatroom {
  height: 80px;
  margin-bottom: var(--space-3);
}

.skeleton-message {
  height: 100px;
  margin-bottom: var(--space-4);
}

.skeleton-bot {
  height: 150px;
}
