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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #1a1025;
  color: #eee;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1e1433;
}

::-webkit-scrollbar-thumb {
  background: #7c3aed;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a855f7;
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #7c3aed #1e1433;
}

#app {
  width: 100%;
  height: 100%;
}

.chat-container {
  background: #1e1433;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  background: #2d1f47;
  padding: 12px 20px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input {
  display: none;
}

.toggle-slider {
  width: 36px;
  height: 20px;
  background: #1e1433;
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #888;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: #7c3aed;
}

.toggle-switch input:checked + .toggle-slider::after {
  left: 18px;
  background: white;
}

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

.connection-status {
  font-size: 0.8rem;
}

.connection-status.connected {
  color: #4ade80;
}

.connection-status.disconnected {
  color: #f87171;
}

.status-filters {
  display: flex;
  gap: 4px;
}

.status-filter-btn {
  padding: 4px 10px;
  border: none;
  background: #1e1433;
  color: #888;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 4px;
}

.status-filter-btn:hover {
  color: #eee;
}

.status-filter-btn.active {
  color: white;
  background: #7c3aed;
}

.status-filter-btn.status-filter-info.active {
  background: #3b82f6;
}

.status-filter-btn.status-filter-warn.active {
  background: #f59e0b;
  color: #1a1a2e;
}

.status-filter-btn.status-filter-error.active {
  background: #ef4444;
}

.service-tabs {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
}

.service-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: #888;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
  min-width: 80px;
}

.service-tab:hover {
  color: #a855f7;
}

.service-tab.active {
  color: #a855f7;
  border-bottom-color: #a855f7;
}

.active-filters {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #3b2963;
  color: #c4b5fd;
  font-size: 0.8rem;
  font-family: monospace;
}

.filter-remove {
  background: none;
  border: none;
  color: #c4b5fd;
  font-size: 1rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.filter-remove:hover {
  color: #f87171;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  background: #2d1f47;
  padding: 12px 16px;
  width: 100%;
  animation: slideIn 0.3s ease;
  border-left: 4px solid #3b82f6;
}

.message-info {
  border-left-color: #3b82f6;
}

.message-warn {
  border-left-color: #f59e0b;
}

.message-error {
  border-left-color: #ef4444;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  min-width: 50px;
  text-align: center;
}

.status-info {
  background: #3b82f6;
  color: white;
}

.status-warn {
  background: #f59e0b;
  color: #1a1a2e;
}

.status-error {
  background: #ef4444;
  color: white;
}

.message-service {
  font-size: 0.75rem;
  color: #a855f7;
  font-weight: 600;
}

.message-ip {
  font-size: 0.75rem;
  color: #888;
  font-family: monospace;
}

.clickable {
  cursor: pointer;
  transition: color 0.2s;
}

.clickable:hover {
  color: #a855f7;
  text-decoration: underline;
}

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

.message-text {
  word-wrap: break-word;
}

.message-session {
  font-size: 0.7rem;
  color: #666;
  font-family: monospace;
}

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

.empty-state {
  text-align: center;
  color: #666;
  padding: 40px;
}

.chat-input-container {
  display: flex;
  padding: 20px;
  gap: 12px;
  background: #2d1f47;
}

.status-select {
  padding: 14px 12px;
  border: none;
  border-radius: 8px;
  background: #1e1433;
  color: #eee;
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.status-select:focus {
  box-shadow: 0 0 0 2px #a855f7;
}

.chat-input {
  flex: 1;
  padding: 14px 18px;
  border: none;
  border-radius: 8px;
  background: #1e1433;
  color: #eee;
  font-size: 1rem;
  outline: none;
  transition: box-shadow 0.2s;
}

.chat-input:focus {
  box-shadow: 0 0 0 2px #a855f7;
}

.chat-input::placeholder {
  color: #666;
}

.send-button {
  padding: 14px 28px;
  border: none;
  border-radius: 8px;
  background: #7c3aed;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.send-button:hover {
  background: #a855f7;
}

.send-button:active {
  transform: scale(0.98);
}

.send-button:disabled {
  background: #444;
  cursor: not-allowed;
}

/* Server name styles */
.message-ip.has-server-name {
  color: #4ade80;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Payload button in message header */
.message-header-spacer {
  flex: 1;
}

.payload-btn {
  background: none;
  border: none;
  color: #666;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
  letter-spacing: 2px;
  transition: color 0.2s;
}

.payload-btn:hover {
  color: #a855f7;
}

/* Payload popup overlay */
.payload-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* Payload popup modal */
.payload-popup {
  background: #2d1f47;
  border-radius: 8px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  border: 1px solid #3b2963;
}

.payload-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #3b2963;
  color: #a855f7;
  font-weight: 600;
}

.payload-close {
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.payload-close:hover {
  color: #f87171;
}

.payload-content {
  padding: 20px;
  overflow: auto;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.85rem;
  color: #c4b5fd;
  background: #1e1433;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Clear service button */
.clear-service-btn {
  padding: 4px 12px;
  border: none;
  background: #ef4444;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 4px;
}

.clear-service-btn:hover {
  background: #dc2626;
}

/* Confirmation dialog */
.confirm-popup {
  background: #2d1f47;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  border: 1px solid #3b2963;
}

.confirm-header {
  padding: 16px 20px;
  border-bottom: 1px solid #3b2963;
  color: #a855f7;
  font-weight: 600;
  font-size: 1rem;
}

.confirm-body {
  padding: 20px;
  color: #eee;
  line-height: 1.5;
}

.confirm-buttons {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid #3b2963;
  justify-content: flex-end;
}

.confirm-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.confirm-cancel {
  background: #1e1433;
  color: #888;
}

.confirm-cancel:hover {
  background: #2d1f47;
  color: #eee;
}

.confirm-yes {
  background: #ef4444;
  color: white;
}

.confirm-yes:hover {
  background: #dc2626;
}
