/* =========================================================================
   LucyChat - UI Components (components.css)
   Chatblasen, Attachments, Dashboard, Modale, Formulare, Dropdowns, Toasts
   ========================================================================= */

/* Auth Tabs & Buttons */
.auth-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.auth-tabs::-webkit-scrollbar {
  display: none;
}

.auth-tabs .tab-btn {
  flex: 1;
  padding: 8px 6px;
  font-weight: 600;
  font-size: 0.82rem;
  white-space: nowrap;
  text-align: center;
  justify-content: center;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tab-btn {
  padding: 8px 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 0.15s;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tab-btn.active {
  color: var(--accent);
  border-bottom: 3px solid var(--accent);
  background: transparent;
}

.btn-send {
  background-color: var(--accent);
  color: #ffffff;
  border: none;
  padding: 0 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  height: 42px;
  transition: background 0.15s ease, transform 0.08s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.95rem;
}

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

.password-eye-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.btn-toggle-eye {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #8696a0);
  opacity: 0.7;
  transition: opacity 0.2s, color 0.2s;
}

.btn-toggle-eye:hover {
  opacity: 1;
  color: var(--text-main, #e9edef);
}

.quick-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.15s ease;
}

.quick-btn:hover {
  background: var(--border);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.rule-item {
  transition: color 0.15s ease;
}

.rule-item.valid {
  color: var(--online-green);
  font-weight: 600;
}

/* Chat Items in Sidebar */
.chat-item,
.user-item {
  padding: 0 16px;
  height: 72px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: background 0.12s ease;
  position: relative;
}

.chat-item:hover,
.user-item:hover {
  background-color: var(--bg-secondary);
}

.chat-item.active {
  background-color: var(--bg-secondary);
}

.avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.avatar-img-circle {
  width: 49px;
  height: 49px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.avatar-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: absolute;
  bottom: 1px;
  right: 1px;
  border: 2px solid var(--bg-sidebar);
  background-color: var(--offline-red);
}

.avatar-dot.online {
  background-color: var(--online-green);
}

.item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.item-name {
  font-weight: 500;
  font-size: 16px;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
  line-height: 21px;
}

.chat-tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
  margin-left: 6px;
}

[data-theme="dark"] .chat-tag {
  background: rgba(255, 255, 255, 0.08);
}

.item-sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3px;
}

.item-sub {
  font-size: 13.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  line-height: 18px;
}

.unread-badge {
  background-color: var(--offline-red, #ef4444);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
  height: 20px;
  min-width: 20px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  box-shadow: 0 1px 3px rgba(234, 67, 53, 0.4);
}

.btn-remove-contact {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
  margin-left: auto;
  flex-shrink: 0;
}

.user-item:hover .btn-remove-contact {
  opacity: 0.75;
}

.btn-remove-contact:hover {
  opacity: 1 !important;
  background: rgba(239, 68, 68, 0.12);
  color: var(--offline-red);
  transform: scale(1.1);
}

.btn-item-more {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.15s ease;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}

.btn-item-more:hover {
  opacity: 1;
  background: var(--bg-hover);
  color: var(--text-main);
}

.btn-favorite-star {
  background: none;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 4px;
  transition: transform 0.15s ease, opacity 0.15s ease;
  opacity: 0.75;
}

.btn-favorite-star:hover {
  opacity: 1;
  transform: scale(1.2);
}

.btn-favorite-star.active {
  opacity: 1;
  filter: drop-shadow(0 0 2px rgba(234, 179, 8, 0.5));
}

.quick-add-contact-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 16px;
  margin: 18px auto 20px auto;
  max-width: calc(100% - 48px);
  width: fit-content;
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 20px;
  font-size: 0.80rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  text-align: center;
}

.quick-add-contact-btn:hover {
  background: var(--bg-card);
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* Chatblasen (WhatsApp Style mit Tails) */
.message-row {
  display: flex;
  width: 100%;
  margin-bottom: 2px;
}

.message-row.outgoing {
  justify-content: flex-end;
}

.message-row.incoming {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 65%;
  min-width: 85px;
  padding: 6px 9px 6px 11px;
  line-height: 1.42;
  font-size: 14.2px;
  position: relative;
  word-break: break-word;
  transition: opacity 0.2s ease;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
}

.message-bubble.incoming {
  background-color: var(--bubble-in-bg);
  color: var(--bubble-in-text);
  border-radius: 0px 8px 8px 8px;
  margin-right: auto;
  margin-left: 8px;
  border: none;
}

.message-bubble.incoming::before {
  content: "";
  position: absolute;
  top: 0;
  left: -8px;
  width: 0;
  height: 0;
  border-top: 10px solid var(--bubble-in-bg);
  border-left: 8px solid transparent;
}

.message-bubble.outgoing {
  background-color: var(--bubble-out-bg);
  color: var(--bubble-out-text);
  border-radius: 8px 0px 8px 8px;
  margin-left: auto;
  margin-right: 8px;
  border: none;
}

.message-bubble.outgoing::before {
  content: "";
  position: absolute;
  top: 0;
  right: -8px;
  width: 0;
  height: 0;
  border-top: 10px solid var(--bubble-out-bg);
  border-right: 8px solid transparent;
}

.message-author {
  font-size: 12.8px;
  font-weight: 600;
  color: #1f9c87;
  margin-bottom: 2px;
}

[data-theme="dark"] .message-author {
  color: #53bdeb;
}

.msg-body {
  display: inline;
}

.message-meta {
  font-size: 11px;
  color: #667781;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  float: right;
  margin-left: 8px;
  margin-top: 4px;
  user-select: none;
  vertical-align: bottom;
  white-space: nowrap;
  line-height: 1;
  height: 15px;
}

[data-theme="dark"] .message-meta {
  color: #8696a0;
}

.msg-time {
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.msg-actions {
  display: none;
  align-items: center;
  gap: 3px;
  margin-left: 4px;
}

.message-bubble:hover .msg-actions {
  display: inline-flex;
}

.msg-btn-icon {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: inherit;
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0 1px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s ease, transform 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.msg-btn-icon:hover {
  opacity: 1;
  transform: scale(1.25);
}

.msg-btn-icon.copied {
  opacity: 1;
  color: var(--online-green);
}

/* Checkmarks (SVG Stroke) */
.receipt-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 11px;
  line-height: 1;
  flex-shrink: 0;
  vertical-align: middle;
}

.receipt-icon.sent svg path,
.receipt-icon.delivered svg path {
  stroke: #8696a0;
}

.receipt-icon.read svg path {
  stroke: #53bdeb !important;
}

/* Reaktionen */
.message-bubble.has-reactions {
  margin-bottom: 12px !important;
}

.msg-reactions-badge {
  position: absolute;
  bottom: -9px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
  user-select: none;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.message-bubble.outgoing .msg-reactions-badge {
  right: 10px;
}

.message-bubble.incoming .msg-reactions-badge {
  left: 10px;
}

.msg-reactions-badge:hover {
  transform: scale(1.1);
  background: var(--bg-secondary);
}

.msg-reactions-badge.has-own {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.reaction-item-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-left: 2px;
}

.reaction-floating-bar {
  position: fixed;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 4px 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  z-index: 3500;
  animation: reactionPopIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

@keyframes reactionPopIn {
  from { opacity: 0; transform: translateY(6px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.reaction-quick-btn {
  background: transparent;
  border: none;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 50%;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.reaction-quick-btn:hover {
  transform: scale(1.25);
  background: rgba(134, 150, 160, 0.18);
}

.reaction-quick-btn.active {
  background: var(--accent-soft);
  outline: 1.5px solid var(--accent);
}

.reaction-btn-more {
  font-size: 0.95rem !important;
  color: var(--text-muted);
}

/* Floating Sprung-Buttons & Trenner */
.jump-unread-container {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70 !important;
  pointer-events: auto;
}

.btn-jump-unread {
  background: #ffffff;
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 6px 16px;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

[data-theme="dark"] .btn-jump-unread {
  background: #202c33;
  color: #53bdeb;
  border-color: #222d34;
}

.btn-jump-unread:hover {
  background: var(--bg-card);
  transform: scale(1.04);
}

.btn-scroll-bottom {
  position: absolute;
  bottom: 75px;
  right: 24px;
  width: 42px;
  height: 42px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0;
  border-radius: 50%;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60 !important;
  transition: all 0.15s ease;
}

.btn-scroll-bottom:hover {
  background: var(--border);
  transform: scale(1.08);
}

.scroll-unread-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.unread-divider,
.date-divider {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 12px 0;
  width: 100%;
  clear: both;
  pointer-events: none;
}

.unread-divider span,
.date-divider span {
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 9999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.unread-divider span {
  color: var(--accent);
  border-color: rgba(0, 168, 132, 0.35);
  background: rgba(0, 168, 132, 0.08);
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
}

[data-theme="dark"] .unread-divider span,
[data-theme="dark"] .date-divider span {
  background-color: #182229;
  color: #8696a0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.highlight-pulse {
  animation: highlight-pulse-anim 2s ease;
}

@keyframes highlight-pulse-anim {
  0%, 100% { box-shadow: 0 0 0 rgba(0, 168, 132, 0); }
  30%, 70% { box-shadow: 0 0 12px var(--accent); }
}

.typing-status-text {
  font-size: 0.78rem;
  color: var(--accent);
  font-style: italic;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.typing-dots span {
  animation: blink-dot 1.4s infinite both;
  display: inline-block;
  font-size: 0.7rem;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink-dot {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.15); }
}

/* Markdown Styles */
.md-code-block {
  background: rgba(0, 0, 0, 0.1);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 0.88rem;
  overflow-x: auto;
  margin: 6px 0;
  white-space: pre-wrap;
}

[data-theme="dark"] .md-code-block {
  background: rgba(0, 0, 0, 0.35);
}

.md-inline-code {
  background: rgba(0, 0, 0, 0.08);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 0.88rem;
}

[data-theme="dark"] .md-inline-code {
  background: rgba(255, 255, 255, 0.12);
}

.md-quote {
  border-left: 3px solid var(--accent);
  padding-left: 8px;
  margin: 4px 0;
  opacity: 0.85;
  font-style: italic;
}

.md-list {
  margin: 4px 0 4px 18px;
  padding: 0;
}

.md-link {
  color: var(--accent);
  text-decoration: underline;
  word-break: break-all;
}

.md-h {
  margin: 6px 0 2px 0;
  font-weight: 700;
}

/* Such-Hervorhebungen */
.search-highlight {
  background-color: #facc15;
  color: #000000;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
  scroll-margin: 120px 0;
  transition: background-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.search-highlight.search-highlight-active {
  background-color: #ff6b00 !important;
  color: #ffffff !important;
  box-shadow: 0 0 0 2px #ff9800, 0 0 10px rgba(255, 107, 0, 0.75);
  border-radius: 3px;
  font-weight: 700;
  animation: searchMatchPulse 1.4s infinite ease-in-out;
}

@keyframes searchMatchPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

.chat-search-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 8px;
  gap: 4px;
  transition: all 0.2s ease;
  min-width: 0;
}

.chat-search-wrapper:focus-within {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.btn-search-nav {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background-color 0.15s, color 0.15s;
}

.btn-search-nav:hover:not(:disabled) {
  background: var(--bg-hover, rgba(255, 255, 255, 0.1));
  color: var(--text-main);
}

.btn-search-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-search-clear:hover {
  color: var(--offline-red, #ef4444) !important;
}

/* Attachments */
.attachment-popup-menu {
  position: absolute;
  bottom: 70px;
  left: 12px;
  background: #233138;
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 50;
  width: 220px;
  animation: popupSlideUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
}

[data-theme="light"] .attachment-popup-menu {
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
}

@keyframes popupSlideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.attachment-popup-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  width: 100%;
  text-align: left;
}

[data-theme="dark"] .attachment-popup-item {
  color: #e9edef;
}

.attachment-popup-item:hover {
  background: rgba(134, 150, 160, 0.18);
}

.attachment-preview-box {
  margin-top: 6px;
  max-width: 280px;
  max-height: 220px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.08);
}

.attachment-img {
  width: 100%;
  height: 100%;
  max-height: 220px;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.attachment-img:hover {
  transform: scale(1.03);
}

.attachment-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.attachment-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.attachment-icon {
  font-size: 1.5rem;
}

.attachment-details {
  min-width: 0;
}

.attachment-filename {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.btn-download-att {
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
}

.btn-download-att:hover {
  background: var(--accent-hover);
}

.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* Chat Karten */
.contact-card-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  min-width: 240px;
  margin: 4px 0;
}

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

.contact-card-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.contact-card-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
}

.contact-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  word-break: break-all;
}

.contact-card-actions {
  display: flex;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.call-log-bubble {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
  min-width: 220px;
}

[data-theme="dark"] .call-log-bubble {
  background: rgba(255, 255, 255, 0.05);
}

.call-log-bubble.call-log-missed .call-log-icon {
  color: #ef4444;
}

.call-log-icon {
  font-size: 1.4rem;
}

.call-log-title {
  font-weight: 600;
  font-size: 0.88rem;
}

.call-log-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.call-log-btn {
  margin-left: auto;
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 600;
}

.call-link-bubble {
  background: rgba(0, 168, 132, 0.08);
  border: 1px solid rgba(0, 168, 132, 0.25);
  border-radius: 12px;
  padding: 12px;
  min-width: 250px;
  max-width: 320px;
}

[data-theme="dark"] .call-link-bubble {
  background: rgba(0, 168, 132, 0.12);
  border-color: rgba(0, 168, 132, 0.35);
}

.msg-protected-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
  margin: 4px auto;
  max-width: 90%;
  text-align: center;
}

[data-theme="dark"] .msg-protected-placeholder {
  background: rgba(255, 255, 255, 0.04);
}

/* Sprachaufnahme Live-Anzeige in der Pille */
.recording-container {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 2px 0;
  animation: fadeIn 0.2s ease;
}

.recording-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--offline-red);
  animation: pulse-record 1s infinite alternate;
  flex-shrink: 0;
}

@keyframes pulse-record {
  from { transform: scale(0.85); opacity: 0.7; }
  to { transform: scale(1.25); opacity: 1; }
}

.recording-timer {
  font-size: 15px;
  font-weight: 600;
  color: var(--offline-red);
  font-variant-numeric: tabular-nums;
}

.recording-label {
  font-size: 14px;
  color: var(--text-muted);
  flex: 1;
}

.btn-cancel-recording {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-cancel-recording:hover {
  background: rgba(234, 67, 53, 0.12);
  color: var(--offline-red);
  transform: scale(1.15);
}

/* Empty-State Dashboard */
.empty-state-dashboard {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-primary);
  padding: 30px 20px;
  overflow-y: auto;
  text-align: center;
  user-select: none;
  width: 100%;
  height: 100%;
}

.dash-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 480px;
  width: 100%;
  animation: fadeInDashboard 0.22s ease-out;
}

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

.dash-profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 22px;
}

.dash-avatar-wrapper {
  position: relative;
  cursor: pointer;
  margin-bottom: 10px;
  transition: transform 0.18s ease;
}

.dash-avatar-wrapper:hover {
  transform: scale(1.04);
}

.dash-avatar-img {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  display: block;
}

.dash-avatar-edit-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.80rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.dash-user-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.dash-user-name {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.dash-edit-name-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.05rem;
  padding: 2px 4px;
  opacity: 0.75;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.dash-edit-name-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

.dash-user-email {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.dash-user-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 12px;
  margin-top: 8px;
  font-weight: 500;
}

.dash-feature-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 26px 24px;
  width: 100%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dash-illu-icon-circle {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.dash-feature-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 8px 0;
}

.dash-feature-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 18px 0;
  max-width: 360px;
}

.dash-feature-btn {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 24px;
  padding: 9px 24px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 168, 132, 0.35);
  transition: background 0.15s ease, transform 0.15s ease;
}

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

.dash-quick-actions-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.dash-action-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  width: 80px;
  transition: transform 0.15s ease;
}

.dash-action-btn:hover {
  transform: translateY(-2px);
}

.dash-action-icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: background 0.15s ease, color 0.15s ease;
}

.dash-action-btn:hover .dash-action-icon-circle {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.dash-action-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.25;
  text-align: center;
  font-weight: 500;
}

/* Modale & Formulare */
.modal-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: 2000 !important;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 520px;
  max-width: 92%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  margin-bottom: 4px;
  color: var(--text-muted);
}

.form-input,
.form-select {
  width: 100%;
  padding: 10px 13px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: var(--text-main);
  border-radius: 8px;
  outline: none;
  font-size: 0.92rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text-main);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-primary-action {
  flex: 1;
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.15s;
}

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

.btn-secondary-action {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s;
}

.btn-secondary-action:hover {
  background: var(--border);
}

.btn-close-modal {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.05rem;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

[data-theme="dark"] .btn-close-modal {
  background: rgba(255, 255, 255, 0.06);
}

.btn-close-modal:hover {
  background: var(--border);
  color: var(--text-main);
  transform: scale(1.08);
}

/* Neuer Chat / Gruppen Modal */
.new-chat-contact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
}

.new-chat-contact-item:hover {
  background-color: var(--accent-soft);
}

.btn-newchat-chat {
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: max-content;
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background 0.15s ease, transform 0.08s ease;
}

.btn-newchat-chat:hover {
  background: var(--accent-hover);
}

.group-member-list {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.group-member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-sidebar);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  border: 1px solid transparent;
  user-select: none;
}

.group-member-item:hover {
  background: var(--bg-card);
}

.group-member-item.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* Gruppenstatus Badges & Einladungsbanner */
.group-invite-banner {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 10px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 9;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.group-invite-banner-locked {
  background-color: var(--bg-secondary);
  color: var(--text-muted);
  padding: 14px;
  text-align: center;
  font-size: 0.88rem;
  border-top: 1px solid var(--border);
}

.member-badge-active {
  background: rgba(37, 211, 102, 0.15);
  color: var(--online-green);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.member-badge-invited {
  background: rgba(234, 179, 8, 0.15);
  color: #d97706;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.member-badge-owner {
  background: rgba(0, 168, 132, 0.15);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
}

.member-badge-admin {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
}

.group-info-stats-row {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}

.group-info-stat-pill {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
}

.group-info-tab-bar {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  padding-bottom: 6px;
}

.group-info-tab {
  background: transparent;
  border: none;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
}

.group-info-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Einstellungen & Theme-Presets */
.theme-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.theme-preset-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.15s;
}

.theme-preset-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.theme-preview-dots {
  display: flex;
  gap: 4px;
}

.theme-preview-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.profile-avatar-preview-box {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.profile-avatar-large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}

.share-channel-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-align: left;
  transition: all 0.15s ease-in-out;
  user-select: none;
}

.share-channel-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* 3-Punkte Kontext-Menü */
.contact-dropdown-menu {
  position: fixed;
  z-index: 3000 !important;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  min-width: 215px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: fadeInDropdown 0.12s ease-out;
}

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

.contact-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 500;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-main);
  text-align: left;
  transition: background 0.12s ease;
}

.contact-dropdown-item:hover {
  background: var(--bg-hover);
}

.contact-dropdown-item.danger {
  color: var(--offline-red);
}

/* Emoji Picker Panel */
.emoji-picker-panel {
  position: absolute;
  bottom: 65px;
  left: 16px;
  width: 360px;
  max-width: calc(100% - 32px);
  height: 350px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  z-index: 500;
  overflow: hidden;
  animation: emoji-popup 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes emoji-popup {
  0% { opacity: 0; transform: translateY(12px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.emoji-picker-header {
  padding: 8px 10px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

.emoji-search-input {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.84rem;
  outline: none;
}

.emoji-search-input:focus {
  border-color: var(--accent);
}

.emoji-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.15s;
}

.emoji-close-btn:hover {
  background: var(--border);
  color: var(--text-main);
}

.emoji-quick-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.emoji-quick-bar::-webkit-scrollbar {
  display: none;
}

.emoji-quick-chip {
  font-size: 1.15rem;
  padding: 2px 5px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  transition: transform 0.12s, background 0.12s;
}

.emoji-quick-chip:hover {
  background: var(--bg-card);
  transform: scale(1.22);
}

.emoji-tabs {
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
}

.emoji-tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 6px 0;
  font-size: 1.05rem;
  cursor: pointer;
  opacity: 0.6;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  text-align: center;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.emoji-tab-btn.active,
.emoji-tab-btn:hover {
  opacity: 1;
  border-bottom-color: var(--accent);
}

.emoji-grid-container {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  align-content: start;
}

.emoji-item-btn {
  background: none;
  border: none;
  font-size: 1.35rem;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  transition: transform 0.12s, background 0.12s;
}

.emoji-item-btn:hover {
  background: var(--bg-card);
  transform: scale(1.25);
}

/* Toasts */
.toast-container {
  position: fixed;
  top: 60px;
  right: 20px;
  z-index: 10000 !important;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}

.toast-card {
  pointer-events: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--accent);
  color: var(--text-main);
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  animation: slide-in 0.3s ease;
  width: 400px;
  max-width: 100%;
}

@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
