body {
  margin: 0;
  display: flex;
  font-family: monospace;
  background-color: #121212;
  color: #fff;
}

.panel {
  width: 60%;
  padding: 2rem;
  box-sizing: border-box;
}

.logs {
  width: 40%;
  height: 100vh;
  background-color: #000;
  color: #0f0;
  padding: 1rem;
  overflow-y: scroll;
  font-size: 0.85rem;
  border-left: 2px solid #333;
  position: relative;
}

#logs-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.log-line { line-height: 1.4; }
.log-line.log-error { color: #ff6b6b; }
.log-line.log-warning { color: #ffd93d; }
.log-line.log-info { color: #0f0; }
.log-line.log-debug { color: #888; }

.logs-paused-indicator {
  position: sticky;
  top: 0;
  background: rgba(50, 50, 0, 0.9);
  color: #ffd93d;
  text-align: center;
  padding: 0.25rem;
  font-size: 0.75rem;
  cursor: pointer;
  z-index: 10;
  display: none;
}

select, button, input {
  margin: 0.4rem 0.5rem 0.4rem 0;
  padding: 0.4rem;
  background: #333;
  color: #fff;
  border: 1px solid #555;
}

.section {
  margin-bottom: 2rem;
}

pre {
  white-space: pre-wrap;
  background: #1e1e1e;
  padding: 1rem;
  border: 1px solid #333;
}

h1, h3 {
  color: #61dafb;
}

#notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #222;
  color: #fff;
  padding: 1rem;
  border: 1px solid #555;
  border-radius: 8px;
  opacity: 0.95;
  display: none;
  z-index: 3000;
  font-size: 0.9rem;
  transition: opacity 0.3s ease;
}

.server-card {
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.server-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.server-name {
  font-size: 1.2rem;
  font-weight: bold;
  color: #61dafb;
}

.server-actions {
  display: flex;
  gap: 0.5rem;
}

.feature-tag {
  display: inline-block;
  background: #444;
  padding: 0.2rem 0.5rem;
  margin: 0.2rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.add-server-form {
  background: #1e1e1e;
  border: 1px solid #333;
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 8px;
}

.form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: center;
}

.form-group {
  flex: 1;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #ccc;
}

.checkbox-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dm-users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.dm-user-card {
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 1rem;
  transition: all 0.3s ease;
}

.dm-user-card:hover {
  border-color: #666;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.dm-user-card h4 {
  margin: 0 0 0.5rem 0;
  color: #4CAF50;
}

.dm-user-card p {
  margin: 0.25rem 0;
  font-size: 0.9rem;
}

.dm-user-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Blocked Users Styles */
.blocked-users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.blocked-user-card {
  background: #3d2a2a;
  border: 1px solid #664444;
  border-radius: 8px;
  padding: 1rem;
  transition: all 0.3s ease;
}

.blocked-user-card:hover {
  border-color: #886666;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.blocked-user-card h4 {
  margin: 0 0 0.5rem 0;
  color: #ff9800;
}

.blocked-user-card p {
  margin: 0.25rem 0;
  font-size: 0.9rem;
}

.blocked-user-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Conversation View Styles */
.message-reactions {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.reaction-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 0.2rem 0.5rem;
  font-size: 0.85rem;
  transition: background 0.2s ease;
}

.reaction-item:hover {
  background: rgba(255,255,255,0.12);
}

.reaction-emoji {
  font-size: 1rem;
}

.reaction-by {
  color: #aaa;
  font-size: 0.75rem;
}

.reaction-by.bot-reaction {
  color: #61dafb;
}

.reaction-by.user-reaction {
  color: #ffa726;
}

.attachment {
  margin: 0.25rem 0;
}

.delete-message-btn {
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.delete-message-btn:hover {
  opacity: 1;
}

.dm-user-actions button {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

.conversation-view {
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 1rem;
}

.conversations-list {
  max-height: 600px;
  overflow-y: auto;
  margin-top: 1rem;
}

.conversation-message {
  background: #333;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.conversation-message.user-message {
  border-left: 4px solid #4CAF50;
}

.conversation-message.bot-message {
  border-left: 4px solid #2196F3;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.sender {
  font-weight: bold;
}

.timestamp {
  color: #888;
  font-size: 0.8rem;
}

.message-content {
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.message-attachments {
  background: #444;
  border-radius: 4px;
  padding: 0.5rem;
  font-size: 0.9rem;
}

.attachment {
  margin: 0.25rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.attachment a {
  color: #4CAF50;
  text-decoration: none;
}

.attachment a:hover {
  text-decoration: underline;
}

/* Tab styling */
.tab-container {
  margin-bottom: 1rem;
}

.tab-buttons {
  display: grid;
  grid-template-rows: repeat(2, auto);
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  border-bottom: 2px solid #333;
  margin-bottom: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: #555 #222;
  row-gap: 0.05rem;
  column-gap: 0.1rem;
  padding-bottom: 0.1rem;
}

.tab-buttons::-webkit-scrollbar {
  height: 8px;
}

.tab-buttons::-webkit-scrollbar-track {
  background: #222;
}

.tab-buttons::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}

.tab-buttons::-webkit-scrollbar-thumb:hover {
  background: #666;
}

.tab-button {
  background: #222;
  color: #ccc;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.tab-button:hover {
  background: #333;
  color: #fff;
}

.tab-button.active {
  background: #444;
  color: #fff;
  border-bottom-color: #4CAF50;
}

/* Prompt source toggle buttons */
.prompt-source-btn {
  background: #333;
  color: #aaa;
}
.prompt-source-btn.active {
  background: #4CAF50;
  color: #fff;
}
.prompt-source-btn:hover:not(.active) {
  background: #444;
  color: #ddd;
}

/* Prompt History Section */
#prompt-history-section.collapsed #prompt-history-body {
  display: none;
}
#prompt-history-toggle {
  user-select: none;
  transition: color 0.2s;
}
#prompt-history-toggle:hover {
  color: #4CAF50;
}
#prompt-metadata span {
  white-space: nowrap;
}
#prompt-metadata .prompt-meta-label {
  color: #666;
}
#prompt-metadata .prompt-meta-value {
  color: #ccc;
}
#prompt-display pre {
  margin: 0;
}
.prompt-subsection-header {
  cursor: pointer;
  user-select: none;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  background: #2a2a2a;
  margin: 0.5rem 0 0.25rem 0;
  font-size: 0.82rem;
  color: #aaa;
  transition: background 0.15s;
}
.prompt-subsection-header:hover {
  background: #333;
  color: #ddd;
}
.prompt-subsection-body.collapsed {
  display: none;
}
#prompt-truncate-toggle {
  accent-color: #4CAF50;
}

/* Mood Activities Editor */
.act-mood-row {
  margin-bottom: 0.5rem;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  overflow: hidden;
}
.act-mood-header {
  cursor: pointer;
  user-select: none;
  padding: 0.5rem 0.75rem;
  background: #2a2a2a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.act-mood-header:hover { background: #333; }
.act-mood-header .act-mood-name { font-weight: bold; min-width: 120px; }
.act-mood-header .act-mood-stats { color: #888; font-size: 0.8rem; }
.act-mood-content { display: none; padding: 0.75rem; background: #1e1e1e; }
.act-entry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #333;
}
.act-entry:last-child { border-bottom: none; }
.act-entry-icon { font-size: 1.1rem; min-width: 24px; text-align: center; }
.act-entry input[type="text"] { flex: 1; }
.act-entry input[type="number"] { width: 55px; }
.act-entry select { width: 130px; }
.act-toolbar {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #444;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Tab loading spinner */
.tab-loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: #888;
  font-size: 1rem;
  gap: 0.75rem;
}
.tab-loading-overlay .spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #444;
  border-top-color: #4CAF50;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Chat Interface Styles */
.chat-message {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 8px;
  animation: fadeIn 0.3s ease-in;
}

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

.chat-message.user-message {
  background: #2a3a4a;
  border-left: 4px solid #4CAF50;
  margin-left: 2rem;
}

.chat-message.assistant-message {
  background: #3a2a3a;
  border-left: 4px solid #61dafb;
  margin-right: 2rem;
}

.chat-message.error-message {
  background: #4a2a2a;
  border-left: 4px solid #f44336;
}

.chat-message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.chat-message-sender {
  font-weight: bold;
  color: #61dafb;
}

.chat-message.user-message .chat-message-sender {
  color: #4CAF50;
}

.chat-message-time {
  color: #888;
  font-size: 0.8rem;
}

.chat-message-content {
  color: #ddd;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chat-typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem;
}

.chat-typing-indicator span {
  width: 8px;
  height: 8px;
  background: #61dafb;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.chat-typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.7; }
  30% { transform: translateY(-10px); opacity: 1; }
}

#chat-messages::-webkit-scrollbar {
  width: 8px;
}

#chat-messages::-webkit-scrollbar-track {
  background: #1e1e1e;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
  background: #666;
}

/* Evil Mode Styles */
body.evil-mode h1, body.evil-mode h3 {
  color: #ff4444;
}

body.evil-mode .tab-button.active {
  border-bottom-color: #ff4444;
}

body.evil-mode #evil-mode-toggle {
  background: #ff4444;
  border-color: #ff4444;
  color: #000;
}

body.evil-mode .server-name {
  color: #ff4444;
}

body.evil-mode .chat-message-sender {
  color: #ff4444;
}

body.evil-mode .chat-message.assistant-message {
  border-left-color: #ff4444;
}

body.evil-mode #notification {
  border-color: #ff4444;
}

/* Override any blue status text in evil mode */
body.evil-mode [style*="color: #007bff"],
body.evil-mode [style*="color: rgb(0, 123, 255)"] {
  color: #ff4444 !important;
}

/* Bipolar Mode Styles */
#bipolar-section {
  transition: all 0.3s ease;
}

#bipolar-section h3 {
  margin-top: 0;
}

#bipolar-mode-toggle.bipolar-active {
  background: #9932CC !important;
  border-color: #9932CC !important;
}

/* Responsive breakpoints */
@media (max-width: 1200px) {
  .panel { width: 55%; padding: 1.5rem; }
  .logs { width: 45%; }
}

@media (max-width: 1024px) {
  body { flex-direction: column; }
  .panel { width: 100%; padding: 1.5rem; }
  .logs {
    width: 100%;
    height: 300px;
    border-left: none;
    border-top: 2px solid #333;
  }
}

@media (max-width: 768px) {
  .panel { padding: 1rem; }
  .tab-buttons {
    grid-template-rows: none;
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
  .tab-button { font-size: 0.85rem; padding: 0.4rem 0.6rem; }
}

@media (max-width: 480px) {
  .panel { padding: 0.5rem; }
  .tab-buttons { grid-template-columns: 1fr 1fr; }
  .tab-button { font-size: 0.8rem; padding: 0.35rem 0.5rem; }
  h1 { font-size: 1.2rem; }
}

/* Profile Picture Tab Styles */
.pfp-preview-container {
  display: flex;
  gap: 2rem;
  margin: 1.5rem 0;
  align-items: flex-start;
  flex-wrap: wrap;
}
.pfp-preview-box {
  text-align: center;
}
.pfp-preview-box img {
  max-width: 400px;
  max-height: 400px;
  border: 2px solid #444;
  border-radius: 8px;
  background: #1e1e1e;
}
.pfp-preview-box .label {
  display: block;
  margin-bottom: 0.5rem;
  color: #aaa;
  font-size: 0.9rem;
}
.pfp-crop-container {
  max-width: 100%;
  max-height: 550px;
  background: #111;
  border: 2px solid #555;
  border-radius: 8px;
  overflow: hidden;
  margin: 1rem 0;
}
.pfp-crop-container img {
  display: block;
  max-width: 100%;
}
.crop-mode-toggle {
  display: flex;
  gap: 1.5rem;
  margin: 1rem 0;
  align-items: center;
}
.crop-mode-toggle label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  color: #ccc;
}
.crop-mode-toggle input[type="radio"] {
  accent-color: #4CAF50;
}
.pfp-description-editor {
  width: 100%;
  min-height: 120px;
  background: #1e1e1e;
  color: #ddd;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 0.75rem;
  font-family: monospace;
  font-size: 0.9rem;
  resize: vertical;
}
.pfp-description-editor:focus {
  border-color: #61dafb;
  outline: none;
}
/* Album / Gallery grid */
.album-section {
  margin: 1.5rem 0;
  padding: 1rem;
  background: #1a1a2e;
  border: 1px solid #444;
  border-radius: 8px;
}
.album-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.album-header h4 { margin: 0; }
.album-toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 0.75rem 0;
}
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  max-height: 480px;
  overflow-y: auto;
  padding: 0.25rem;
}
.album-card {
  position: relative;
  border: 2px solid #444;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #111;
}
.album-card:hover { border-color: #61dafb; }
.album-card.selected { border-color: #4CAF50; box-shadow: 0 0 8px rgba(76,175,80,0.4); }
.album-card.checked { border-color: #ff9800; }
.album-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.album-card .album-check {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  accent-color: #ff9800;
}
.album-card .album-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.7);
  padding: 2px 4px;
  font-size: 0.7rem;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.album-card .color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid #888;
  vertical-align: middle;
  margin-right: 3px;
}
.album-detail {
  margin-top: 1rem;
  padding: 1rem;
  background: #222;
  border: 1px solid #555;
  border-radius: 8px;
}
.album-detail-previews {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: flex-start;
  margin: 1rem 0;
}
.album-detail-previews .pfp-preview-box img {
  max-width: 300px;
  max-height: 300px;
}
.album-disk-usage {
  font-size: 0.8rem;
  color: #888;
  margin-left: auto;
}

/* Disabled mood controls (Evil Miku per-server mood lockout) */
.server-mood-controls select:disabled,
.server-mood-controls button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  background: #2a2a2a;
  border-color: #444;
}
.evil-mode-exempt-notice {
  color: #888;
  font-size: 0.85rem;
  font-style: italic;
  margin-top: 0.5rem;
  line-height: 1.4;
}
