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

:root {
  --bg-primary: hsl(240, 15%, 3.5%);         /* #070709 - Matte deep black background */
  --bg-secondary: hsl(240, 8%, 7%);          /* #111113 - Charcoal sidebar background */
  --bg-tertiary: hsl(240, 6%, 12%);          /* #1e1e22 - Received message bubble background */
  --bg-glass: rgba(7, 7, 9, 0.85);           /* Glassy main background */
  --border-color: hsla(240, 5%, 84%, 0.06);  /* Subtle borders */
  --border-focus: hsl(20, 100%, 50%);        /* Vibrant Orange focus border */
  
  --accent-purple: hsl(20, 100%, 50%);       /* Vibrant Orange theme accent */
  --accent-purple-glow: rgba(255, 85, 0, 0.15);
  --accent-pink: hsl(15, 95%, 45%);          /* Darker Coral Orange secondary */
  --accent-pink-glow: rgba(230, 80, 0, 0.15);
  --accent-gold: hsl(45, 93%, 47%);          /* Pinned gold */
  
  --text-main: hsl(240, 10%, 96%);           /* Zinc-100 main text */
  --text-muted: hsl(240, 5%, 65%);           /* Zinc-400 muted text */
  --text-dark: hsl(240, 4%, 46%);            /* Zinc-500 timestamp/subtext */
  
  --font-display: 'Outfit', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  
  --gradient-primary: linear-gradient(135deg, hsl(20, 100%, 50%), hsl(12, 95%, 45%)); /* Orange sent bubble gradient */
  --gradient-dark: linear-gradient(180deg, var(--bg-secondary), var(--bg-primary));
  --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.01), rgba(255,255,255,0.005));
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  line-height: 1.5;
}

html {
  height: 100%;
}

/* App Layout */
.app-container {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-primary);
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dark);
}

/* Sidebar */
.sidebar {
  width: 320px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.logo svg {
  width: 24px;
  height: 24px;
  fill: var(--accent-purple);
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-tertiary);
  border-color: var(--border-color);
  transform: translateY(-1px);
}

.btn-new-chat {
  background: var(--accent-purple);
  color: #fff;
  border: none;
  padding: 10px 16px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-new-chat:hover {
  background: hsl(250, 60%, 60%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-purple-glow);
}

.btn-new-chat:active {
  transform: translateY(1px);
}

/* Sidebar Search */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  fill: var(--text-muted);
}

.search-input {
  width: 100%;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 12px 10px 38px;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

/* Tags List */
.tags-list-container {
  flex-grow: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tags-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tags-section-title {
  font-family: var(--font-display);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding-left: 8px;
  margin-bottom: 4px;
}

.tag-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  border: 1px solid transparent;
  color: var(--text-muted);
}

.tag-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.tag-item.active {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}

.tag-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.tag-hash {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 1.1rem;
}

.tag-item.active .tag-hash {
  color: var(--accent-purple);
}

.tag-name {
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.tag-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.3;
  transition: opacity 0.2s;
}

.tag-item:hover .tag-actions,
.tag-item.active .tag-actions {
  opacity: 1;
}

.tag-action-btn {
  background: transparent;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

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

.tag-action-btn.pinned {
  color: var(--accent-gold) !important;
}

.tag-action-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Main Chat Space */
.chat-space {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--bg-primary);
  position: relative;
}

.chat-header {
  height: 70px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

.chat-title-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.menu-toggle:hover {
  background-color: var(--bg-tertiary);
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.chat-room-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-room-title span {
  color: var(--text-muted);
  font-weight: 400;
}

.chat-room-status {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.room-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.room-search-box svg {
  position: absolute;
  left: 12px;
  width: 14px;
  height: 14px;
  fill: var(--text-muted);
}

.room-search-input {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px 8px 34px;
  border-radius: 8px;
  font-size: 0.85rem;
  width: 180px;
  transition: all 0.25s;
}

.room-search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  width: 260px;
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

/* Chat Messages */
.chat-messages-container {
  flex-grow: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(rgba(255, 85, 0, 0.02) 1px, transparent 0),
    radial-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 0);
  background-size: 32px 32px;
  background-position: 0 0, 16px 16px;
}

/* Scroll Anchor / Loading state */
.scroll-load-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
  width: 100%;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.spinner {
  border: 2px solid rgba(255,255,255,0.05);
  border-top: 2px solid var(--accent-purple);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Message Node */
.message-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 70%;
  position: relative;
  margin-top: 10px;
  animation: messageFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.message-wrapper.grouped {
  margin-top: 3px;
}

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

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

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

.message-bubble {
  padding: 10px 14px 6px 14px;
  border-radius: 18px;
  position: relative;
  display: inline-block;
  max-width: 100%;
  word-break: break-word;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  line-height: 1.45;
}

.message-text {
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
  display: inline;
}

.message-meta-inline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  float: right;
  margin-top: 6px;
  margin-left: 10px;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.45);
  user-select: none;
  vertical-align: bottom;
  position: relative;
  top: 2px;
}

.sender-name-inline {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-purple);
  margin-bottom: 3px;
}

.ticks-svg {
  width: 13px;
  height: 13px;
  fill: rgba(255, 255, 255, 0.7);
  display: inline-block;
}

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

.message-wrapper.sent.grouped .message-bubble {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.message-wrapper.received .message-bubble {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
  border-color: rgba(255, 255, 255, 0.01);
}

.message-wrapper.received.grouped .message-bubble {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

/* Copy Action */
.message-copy-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  color: var(--text-muted);
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
  z-index: 5;
}

.message-wrapper.sent .message-copy-btn {
  left: -38px;
}

.message-wrapper.received .message-copy-btn {
  right: -38px;
}

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

.message-copy-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-secondary);
  border-color: var(--border-focus);
}

.message-copy-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Copy Tooltip */
.copy-tooltip {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--bg-secondary);
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  border: 1px solid var(--border-color);
  pointer-events: none;
  animation: fadeIn 0.15s ease-out;
}

.message-text {
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-text a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

.message-wrapper.received .message-text a {
  color: hsl(200, 100%, 70%);
}

.message-time {
  font-size: 0.7rem;
  align-self: flex-end;
  opacity: 0.6;
}

/* Chat Input Area */
.chat-input-wrapper {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
}

.chat-input-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: transparent;
  border: none;
  padding: 0;
  width: 100%;
}

.chat-input-pill {
  flex-grow: 1;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 8px 16px;
  transition: all 0.2s;
  min-width: 0;
}

.chat-input-pill:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

.chat-textarea {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.95rem;
  resize: none;
  max-height: 150px;
  height: 24px;
  outline: none;
  line-height: 1.5;
  padding: 2px 0;
}

.input-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s;
  margin-bottom: 2px;
}

.input-action-btn:hover {
  color: var(--text-main);
}

.input-action-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.btn-send-circle {
  background: var(--accent-purple);
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--accent-purple-glow);
}

.btn-send-circle:hover {
  transform: scale(1.05);
  background: hsl(20, 100%, 55%);
  box-shadow: 0 4px 12px var(--accent-purple-glow);
}

.btn-send-circle:disabled {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-dark);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-send-circle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transform: translateX(1px);
}

/* Modals & Dialogs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

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

.modal-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-close-modal:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
}

.btn-close-modal svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-input {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: all 0.2s;
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-cancel {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
}

.btn-submit {
  background: var(--accent-purple);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px var(--accent-purple-glow);
}

.btn-submit:hover {
  background: hsl(250, 60%, 60%);
  box-shadow: 0 6px 16px var(--accent-purple-glow);
}

/* Empty State / Welcome Screen */
.welcome-screen {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  text-align: center;
}

.welcome-logo-container {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px var(--accent-purple-glow);
  position: relative;
}

.welcome-logo-container::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 24px;
  background: var(--accent-purple);
  opacity: 0.25;
  filter: blur(8px);
  z-index: -1;
}

.welcome-logo-container svg {
  width: 40px;
  height: 40px;
  fill: #fff;
}

.welcome-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.welcome-subtitle {
  color: var(--text-muted);
  max-width: 380px;
  margin-bottom: 24px;
}

/* Login Page UI */
.login-container {
  width: 100%;
  height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

/* Dynamic glowing backgrounds for login page */
.login-bg-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-purple-glow) 0%, rgba(0,0,0,0) 70%);
  top: -200px;
  right: -200px;
  z-index: 1;
  pointer-events: none;
}

.login-bg-glow-2 {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-pink-glow) 0%, rgba(0,0,0,0) 70%);
  bottom: -150px;
  left: -150px;
  z-index: 1;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background-color: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 36px;
  box-shadow: var(--shadow-lg);
  z-index: 10;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.login-card-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.login-logo {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px var(--accent-purple-glow);
}

.login-logo svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

.login-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  margin-top: 8px;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.error-message {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: hsl(0, 85%, 65%);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  text-align: center;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Device Limit Replacements List */
.device-replace-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.device-replace-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.device-item-choice {
  border: 1px solid var(--border-color);
  background-color: var(--bg-tertiary);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.device-item-choice:hover {
  border-color: var(--text-dark);
}

.device-item-choice.selected {
  border-color: var(--accent-purple);
  background-color: rgba(124, 58, 237, 0.05);
  box-shadow: 0 0 0 1px var(--accent-purple);
}

.device-item-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.device-item-active {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Overlay Sidebar on Mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

/* Responsive Rules */
@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }
  
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100dvh;
    transform: translateX(-100%);
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .sidebar-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
  
  .room-search-input {
    width: 100px;
  }
  
  .room-search-input:focus {
    width: 130px;
  }

  .chat-title-container {
    min-width: 0;
    flex-shrink: 1;
  }

  .chat-room-title {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .message-wrapper {
    max-width: 85%;
  }
  
  .chat-header {
    padding: 0 12px;
    gap: 8px;
  }
  
  .chat-messages-container {
    padding: 16px 12px;
  }
  
  .chat-input-wrapper {
    padding: 12px;
  }
}

@media (max-width: 360px) {
  .room-search-box {
    display: none; /* Hide search bar completely on extremely small screens to save space */
  }
}

/* Orange Theme Custom Layout Elements */
.sidebar-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 2px 0;
  margin-top: 4px;
  scrollbar-width: none; /* Hide scrollbar for tabs */
}
.sidebar-tabs::-webkit-scrollbar {
  display: none;
}
.sidebar-tabs .tab-item {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.sidebar-tabs .tab-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}
.sidebar-tabs .tab-item.active {
  color: #fff;
  background: var(--accent-purple);
  font-weight: 600;
}

.room-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

.room-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.room-status-wrapper {
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #22c55e; /* Green online dot */
  display: inline-block;
}

.header-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

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

.header-action-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
