@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  --bg: #090a0f;
  --card-bg: rgba(20, 22, 28, 0.75);
  --sidebar-bg: rgba(12, 14, 18, 0.9);
  --primary: #475569; /* Slate 600 - elegant solid */
  --primary-hover: #334155; /* Slate 700 */
  --accent: #64748b; /* Slate 500 */
  --border: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(255, 255, 255, 0.2);
  --text: #f1f5f9; /* Slate 100 */
  --text-muted: #64748b; /* Slate 500 */
  --bubble-self: #334155; /* Solid elegant slate grey */
  --bubble-other: #1e293b; /* Solid dark grey */
  --shadow-glow: 0 4px 24px 0 rgba(0, 0, 0, 0.4);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font-interface: 'Inter', sans-serif;
  --font-title: 'Outfit', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

html, body {
  height: 100dvh;
}

body {
  font-family: var(--font-interface);
  background-color: var(--bg);
  color: var(--text);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Background Animated Glows */
body::before, body::after {
  display: none;
}

/* App Containers */
.app-container {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-glow);
  overflow: hidden;
}

/* Auth View Styles */
.auth-view {
  width: 100%;
  max-width: 440px;
  margin: auto;
  padding: 2.5rem;
  background: var(--card-bg);
  border-radius: 16px;
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-glow);
  animation: fadeIn 0.4s ease-out;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header h1 {
  font-family: var(--font-title);
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.auth-header p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.input-group {
  margin-bottom: 1.25rem;
}

.input-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-control {
  width: 100%;
  padding: 0.875rem 1rem;
  background: rgba(10, 15, 30, 0.6);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
  transition: var(--transition);
}

.input-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.btn {
  width: 100%;
  padding: 0.875rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.auth-toggle {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-toggle a {
  color: var(--text-muted);
  text-decoration: underline;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.auth-toggle a:hover {
  color: var(--text);
}

/* Chat Layout Styles */
.chat-view {
  display: flex;
  width: 100%;
  height: 100%;
}

.sidebar {
  width: 320px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  z-index: 10;
}

.sidebar-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.9375rem;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
  text-align: center;
}

.username-display {
  font-weight: 500;
  font-size: 0.9375rem;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-icon:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.section-title {
  padding: 1.25rem 1.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  margin: 0.125rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.list-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.list-item.active {
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--accent);
}

.delete-channel-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  opacity: 0;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.list-item:hover .delete-channel-btn {
  opacity: 1;
}

.delete-channel-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.leave-channel-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  opacity: 0;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.list-item:hover .leave-channel-btn {
  opacity: 1;
}

.leave-channel-btn:hover {
  color: #f97316;
  background: rgba(249, 115, 22, 0.15);
}

.list-item-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  overflow: hidden;
}

.list-item-name {
  font-size: 0.9375rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Chat Pane */
.chat-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: rgba(13, 17, 26, 0.4);
}

.chat-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 13, 20, 0.3);
}

.room-info h2 {
  font-family: var(--font-title);
  font-size: 1.125rem;
  font-weight: 600;
}

.room-info p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.message-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 70%;
  animation: messageSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.message-wrapper.self {
  align-self: flex-end;
}

.message-wrapper.other {
  align-self: flex-start;
}

.message-sender {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  margin-left: 0.5rem;
}

.message-wrapper.self .message-sender {
  display: none; /* Sender is self, hiding */
}

.message-bubble {
  padding: 0.875rem 1.125rem;
  border-radius: 16px;
  font-size: 0.9375rem;
  line-height: 1.5;
  word-break: break-word;
}

.message-wrapper.self .message-bubble {
  background: var(--bubble-self);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message-wrapper.other .message-bubble {
  background: var(--bubble-other);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.message-time {
  font-size: 0.6875rem;
  color: var(--text-muted);
  align-self: flex-end;
  margin-top: 0.25rem;
  margin-right: 0.5rem;
}

.message-wrapper.self .message-time {
  margin-right: 0.25rem;
}

.message-bubble-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.message-wrapper.self .message-bubble-row {
  flex-direction: row-reverse;
}

.delete-message-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  opacity: 0;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.delete-message-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

/* Chat Input Area */
.chat-input-area {
  padding: 1.25rem;
  background: rgba(10, 13, 20, 0.4);
  border-top: 1px solid var(--border);
}

#message-form {
  width: 100%;
}

.input-console {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(10, 15, 30, 0.7);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
  position: relative;
  width: 100%;
}

.input-console:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.chat-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
  padding: 0.5rem;
}

/* Typography Drawer Styles */
.font-selector-popover {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 280px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-glow);
  padding: 1rem;
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 20;
  backdrop-filter: blur(20px);
  animation: popoverFade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.font-selector-popover.show {
  display: flex;
}

.popover-header {
  font-family: var(--font-title);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.font-list-items {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.font-option {
  padding: 0.625rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.font-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.font-option.selected {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 500;
}

.btn-upload-font {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-upload-font:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent);
  color: var(--text);
}

.hidden-file-input {
  display: none;
}

.selected-font-badge {
  display: inline-block;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

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

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

/* Scrollbars styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Utility Helpers */
.hidden {
  display: none !important;
}

/* Modal Component */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: var(--transition);
}

.modal-content {
  background: #0d111a;
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90%;
  max-width: 440px;
  max-height: 90dvh;
  padding: 2rem;
  box-shadow: var(--shadow-glow);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.modal-header h3 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 600;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
}

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

.modal-body {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-family: var(--font-title);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: #ef4444;
  color: #fff;
  border: none;
  cursor: pointer;
  font-family: var(--font-title);
  font-weight: 600;
  border-radius: 8px;
  transition: var(--transition);
}

.btn-danger:hover {
  background: #dc2626;
}

/* Toast System */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 380px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: var(--shadow-glow);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  font-size: 0.875rem;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), fadeOut 0.5s ease-in forwards;
  animation-delay: 0s, 4.5s;
}

.toast.success {
  border-left: 4px solid #10b981;
}

.toast.error {
  border-left: 4px solid #ef4444;
}

.toast.info {
  border-left: 4px solid #3b82f6;
}

.toast-message {
  flex: 1;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.mobile-menu-btn {
  display: none !important;
}

.sidebar-overlay {
  display: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .app-container {
    border: none;
  }
  
  .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    z-index: 100;
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .sidebar-overlay {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 90;
    transition: var(--transition);
  }
  
  .sidebar-overlay.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
  }
  
  .mobile-menu-btn {
    display: flex !important;
    margin-right: 0.5rem;
  }
  
  .message-wrapper {
    max-width: 85%;
  }
}

@media (max-width: 480px) {
  .modal-content {
    padding: 1.25rem;
    gap: 1rem;
  }
  .chat-input-area {
    padding: 0.75rem;
  }
  .input-console {
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
  }
  .selected-font-badge {
    max-width: 80px;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }
  .font-selector-popover {
    width: calc(100vw - 1.5rem);
    right: -10px;
  }
}

/* Admin Typography Manager Styles */
.admin-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  gap: 0.5rem;
}

.admin-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.75rem 1.25rem;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.admin-tab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}

.admin-tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

.admin-modal-content {
  max-width: 680px !important;
}

.admin-upload-section {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-upload-section h4, .admin-list-section h4 {
  font-family: var(--font-title);
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.admin-upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.admin-upload-form .input-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 200px;
}

.admin-upload-form button {
  height: 42px;
  padding: 0 1.25rem;
  width: auto;
}

.admin-fonts-table-wrapper {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(10, 15, 30, 0.4);
}

.admin-fonts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.admin-fonts-table th, .admin-fonts-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.admin-fonts-table th {
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
  color: var(--text-muted);
}

.admin-fonts-table tr:last-child td {
  border-bottom: none;
}

.admin-font-row-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  border: none;
  font-family: var(--font-title);
  transition: var(--transition);
}

.btn-small-edit {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-small-edit:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  color: var(--text);
}

.btn-small-delete {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.btn-small-delete:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
}

.inline-edit-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.inline-edit-input {
  flex: 1;
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  background: rgba(10, 15, 30, 0.8);
  border: 1px solid var(--primary);
  border-radius: 6px;
  color: var(--text);
  outline: none;
}

/* Discover/Join items listing inside modals */
.available-items-list {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(10, 15, 30, 0.4);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.discover-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  transition: var(--transition);
}

.discover-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.discover-item-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-discover-action {
  background: var(--primary);
  border: none;
  color: white;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-title);
  transition: var(--transition);
}

.btn-discover-action:hover {
  background: var(--primary-hover);
}

/* Alpha / Development Warning Elements */
.badge-alpha {
  font-family: var(--font-title);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--primary);
  color: #ffffff;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  vertical-align: middle;
  display: inline-block;
}

.alpha-disclaimer-card {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  padding: 0.875rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: #fca5a5;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.alpha-disclaimer-card svg {
  flex-shrink: 0;
  color: #fca5a5;
  margin-top: 0.1rem;
}

.sidebar-alpha-warning {
  background: rgba(249, 115, 22, 0.06);
  border-bottom: 1px solid rgba(249, 115, 22, 0.15);
  padding: 0.625rem 1rem;
  font-size: 0.75rem;
  line-height: 1.35;
  color: #ffedd5;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-alpha-warning svg {
  flex-shrink: 0;
  color: #fb923c;
}


/* Notification Badges and Muting indicators */
.unread-badge {
  background: linear-gradient(135deg, #6366f1, #4f46e5); /* Premium Indigo gradient */
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
  animation: badgePop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.unread-badge.mention {
  background: linear-gradient(135deg, #ef4444, #dc2626); /* Vibrant Red gradient */
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

@keyframes badgePop {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.mute-icon {
  color: var(--text-muted);
  opacity: 0.5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.list-item-badge-container {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Unread List Item Styling */
.list-item.unread .list-item-name {
  font-weight: 600;
  color: #ffffff;
}

.list-item.unread .avatar {
  border: 1px solid rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 6px rgba(99, 102, 241, 0.2);
}

/* Chat Header Action items */
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#room-mute-btn {
  color: var(--text-muted);
  transition: var(--transition);
}

#room-mute-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

#room-mute-btn.muted {
  color: #fb923c; /* Alert/Warning orange */
}

#room-leave-btn {
  color: var(--text-muted);
  transition: var(--transition);
}

#room-leave-btn:hover {
  color: #f97316;
  background: rgba(249, 115, 22, 0.15);
}

/* User Profile Modal Custom Size */
#profile-modal .modal-content {
  max-width: 520px;
}

@media (max-width: 576px) {
  #profile-modal .modal-content {
    padding: 1.25rem;
    gap: 1rem;
  }
  .profile-tab-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
}

/* Profile Dialog Tab Navigation Styles */
.profile-tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  gap: 0.25rem;
  scrollbar-width: none; /* Hide scrollbar on Firefox */
}

.profile-tabs::-webkit-scrollbar {
  display: none; /* Hide scrollbar on Chrome/Safari/Edge */
}

.profile-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  white-space: nowrap; /* Prevent tab labels from wrapping on narrow viewports */
}

.profile-tab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}

.profile-tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

/* User Profile Font Preferences Selection Styles */
.profile-fonts-list {
  max-height: 250px;
  overflow-y: auto;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem;
  background: rgba(10, 15, 30, 0.4);
}

.profile-font-row {
  display: flex;
  align-items: center;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
  border-radius: 6px;
}

.profile-font-row:last-child {
  border-bottom: none;
}

.profile-font-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.profile-font-row label {
  cursor: pointer;
  flex: 1;
  font-size: 0.9375rem;
  user-select: none;
  padding-left: 0.75rem;
  color: var(--text);
  transition: var(--transition);
}

.profile-font-row:hover label {
  color: #fff;
}

.profile-font-row input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
  transition: var(--transition);
}


/* Premium Logo and Brand styling */
.auth-logo {
  display: block;
  width: 90px;
  height: 90px;
  margin: 0 auto 1.5rem auto;
  border-radius: 22px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.auth-logo:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1.5rem 1.25rem 1.25rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.1);
}

.sidebar-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06);
  transition: transform 0.2s ease;
}

.sidebar-brand:hover .sidebar-logo {
  transform: rotate(-5deg) scale(1.08);
}

.sidebar-brand-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.2rem;
  color: #fff;
  letter-spacing: -0.02em;
}

/* Welcome Dashboard / Empty State */
.welcome-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 500px;
  margin: auto;
  padding: 2rem;
  animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.welcome-logo {
  width: 140px;
  height: 140px;
  border-radius: 36px;
  margin-bottom: 2rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.welcome-logo:hover {
  transform: translateY(-8px) scale(1.04);
}

.welcome-container h2 {
  font-family: var(--font-title);
  font-size: 2.25rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.welcome-container p {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 2.5rem;
}

.welcome-instructions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  text-align: left;
}

.instruction-step {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: var(--transition);
}

.instruction-step:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-focus);
  transform: translateX(4px);
}

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
}

.instruction-step span:not(.step-num) {
  font-size: 0.9375rem;
  color: var(--text);
  font-weight: 500;
}

/* Fonts Directory styles */
.fonts-directory-modal-content {
  max-width: 680px !important;
}

.font-details-modal-content {
  max-width: 550px !important;
}

.fonts-directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  max-height: 400px;
  overflow-y: auto;
  padding: 0.25rem;
}

.font-directory-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.font-directory-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.font-card-display-name {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.font-card-preview {
  font-size: 0.875rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.5rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  margin-top: 0.25rem;
}

.font-preview-banner {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1.25rem;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.font-preview-banner span {
  word-break: break-word;
}

.font-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.info-label {
  color: var(--text-muted);
  font-weight: 500;
}

.font-detail-section {
  margin-top: 1.25rem;
}

.font-detail-section h4 {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.font-details-text-block {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  background: rgba(10, 15, 30, 0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.font-details-text-block ul {
  padding-left: 1.25rem;
  margin: 0;
  list-style-type: disc;
}

.font-details-text-block li {
  margin-bottom: 0.35rem;
}

.font-details-text-block li:last-child {
  margin-bottom: 0;
}

.font-details-text-block a {
  color: #60a5fa; /* Sleek light blue link color */
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.font-details-text-block a:hover {
  text-decoration: underline;
  color: #93c5fd;
}

.font-textarea {
  font-family: inherit;
  resize: vertical;
  min-height: 70px;
}

/* Isolate messages, inputs, usernames, and channel names from localization font-family inheritance */
.chat-input,
.message-bubble,
.list-item-name,
#active-room-name,
#profile-display-name,
#profile-avatar-text,
.message-sender,
#username-display,
.username-display,
#new-room-name,
.discover-item-name,
.inline-edit-input,
.input-control {
  font-family: 'Inter', sans-serif;
}

#active-room-name.welcome-title {
  font-family: var(--font-title), sans-serif;
}

.avatar,
#profile-avatar-preview {
  font-family: 'Outfit', sans-serif;
}

/* Optimize text rendering and enable ligatures/contextual alternates for conlang fonts */
.chat-input,
.message-bubble,
.list-item-name,
#active-room-name,
#profile-display-name,
#new-room-name,
#profile-avatar-preview,
.font-option,
.font-directory-card,
.avatar,
.inline-edit-input,
#font-badge {
  font-variant-ligatures: common-ligatures discretionary-ligatures historical-ligatures contextual !important;
  font-feature-settings: "liga" on, "clig" on, "calt" on !important;
  text-rendering: optimizeLegibility !important;
}

/* Date separator in chat logs */
.chat-date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.725rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  width: 100%;
  pointer-events: none;
  user-select: none;
  margin: 0.5rem 0;
}

.chat-date-separator::before,
.chat-date-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 0 1.25rem;
}

/* Enable ligatures globally for Toki Pona to ensure sitelen pona logographs render correctly in the UI */
body.lang-tok,
body.lang-tok * {
  font-variant-ligatures: common-ligatures discretionary-ligatures historical-ligatures contextual !important;
  font-feature-settings: "liga" on, "clig" on, "calt" on !important;
  text-rendering: optimizeLegibility !important;
  text-transform: none !important;
}
