/* Messenger-Erweiterung – Design "Papier" (nutzt Variablen aus style.css) */

/* ---------- Formulare ---------- */
.auth-box { max-width: 420px; width: 100%; margin: 2rem auto; }
.stack-form { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.1rem; }
.stack-form input[type="text"], .stack-form input[type="password"], .stack-form textarea,
.chat-input input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--r-m);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  padding: 0.7rem 0.9rem;
  outline: none;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.stack-form textarea { resize: vertical; }
.stack-form input[type="file"] { font-size: 0.8rem; color: var(--text-muted); }
.stack-form input:focus, .stack-form textarea:focus, .chat-input input:focus {
  border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-soft);
}
.stack-form input:disabled { opacity: 0.5; cursor: not-allowed; }
.stack-form .btn-action, .chat-input .btn-action {
  border: none; cursor: pointer; padding: 0.7rem; font-size: 0.85rem; font-family: inherit;
  background: var(--accent-primary); color: var(--on-accent); font-weight: 600;
}
.stack-form .btn-action:hover, .chat-input .btn-action:hover { background: var(--accent-hover); }
.btn-secondary { cursor: pointer; font-family: inherit; }
.btn-action:disabled { opacity: 0.5; cursor: not-allowed; }
.hint { color: var(--text-muted); font-size: 0.72rem; }
.auth-switch { margin-top: 1rem; font-size: 0.8rem !important; }
.auth-switch a { color: var(--accent-primary); text-decoration: underline; }

.flash { padding: 0.7rem 1rem; border-radius: var(--r-m); font-size: 0.85rem; border: 1px solid; }
.flash-ok { background: rgba(95, 208, 142, 0.1); color: #7fe0a8; border-color: rgba(95, 208, 142, 0.35); }
.flash-error { background: rgba(224, 166, 74, 0.1); color: #f0c070; border-color: rgba(224, 166, 74, 0.4); }

/* ---------- Avatare & Badges ---------- */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; vertical-align: middle; display: inline-block; }
.avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-primary); color: var(--on-accent); font-weight: 700;
}
.avatar-wrap { position: relative; display: inline-flex; }
.online-dot {
  position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--status-online); border: 2px solid var(--side-bg, var(--bg-card));
}
.badge-verified { color: var(--accent-primary); font-size: 0.85em; margin-left: 0.25rem; }
.tag-admin {
  display: inline-block; margin-left: 0.35rem; padding: 0.1rem 0.4rem; border-radius: var(--r-s);
  font-family: var(--font-code); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.05em;
  color: var(--danger); background: rgba(239, 106, 91, 0.14); border: 1px solid rgba(239, 106, 91, 0.4);
  vertical-align: middle;
}
.clickable { cursor: pointer; }
.clickable:hover { opacity: 0.85; }

/* ---------- Profilseite ---------- */
.profile-head { display: flex; align-items: center; gap: 1.25rem; }
.profile-head h1 { font-family: var(--font-serif); display: flex; align-items: center; flex-wrap: wrap; }
.card-box { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--r-m); padding: 1.25rem; }

/* ---------- Chat-Layout (Webseite) ---------- */
.chat-layout { display: grid; grid-template-columns: 290px 1fr; gap: 1.75rem; align-items: start; }
.user-scroll { max-height: 48vh; overflow-y: auto; }
.dev-card { cursor: pointer; }
.dev-card.active { border-color: var(--accent-primary); background: var(--accent-soft); box-shadow: none; }
.dev-name { display: inline-flex; align-items: center; }

.chat-panel {
  display: flex; flex-direction: column; background: var(--bg-card);
  border: 1px solid var(--border-color); border-radius: var(--r-m);
  height: 70vh; min-height: 440px; overflow: hidden;
}
.chat-header {
  padding: 0.85rem 1.2rem; font-family: var(--font-serif); font-weight: 700; font-size: 1rem;
  border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 0.5rem;
}
.chat-messages { flex: 1; overflow-y: auto; padding: 1.1rem; display: flex; flex-direction: column; gap: 0.65rem; }

.msg-row { display: flex; align-items: flex-end; gap: 0.5rem; max-width: 76%; }
.msg-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-row.theirs { align-self: flex-start; }
.msg {
  padding: 0.55rem 0.85rem; border-radius: var(--r-l); font-size: 0.9rem; line-height: 1.5;
  overflow-wrap: anywhere; min-width: 0;
}
.mine .msg { background: var(--accent-primary); color: var(--on-accent); border-bottom-right-radius: 3px; }
.theirs .msg { background: var(--bg-input); border: 1px solid var(--border-color); border-bottom-left-radius: 3px; }
.msg-author { font-size: 0.74rem; font-weight: 700; color: var(--accent-primary); margin-bottom: 0.15rem; }
.msg-body { white-space: pre-wrap; }
.msg-time {
  display: flex; justify-content: flex-end; align-items: center; gap: 0.4rem; margin-top: 0.2rem;
  font-family: var(--font-code); font-size: 0.6rem; opacity: 0.65;
}
.msg-del { background: none; border: none; color: inherit; cursor: pointer; font-size: 0.65rem; opacity: 0.7; }
.msg-del:hover { opacity: 1; color: var(--danger); }
.mine .msg-del:hover { color: var(--on-accent); text-decoration: underline; }

.chat-input { display: flex; gap: 0.6rem; padding: 0.8rem; border-top: 1px solid var(--border-color); background: var(--bg-surface); }
.chat-input .btn-action { flex: 0 0 auto; padding: 0.6rem 1.1rem; }

/* ---------- Profil-Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500; background: rgba(0, 0, 0, 0.65);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  position: relative; width: 100%; max-width: 380px; background: var(--bg-card);
  border: 1px solid var(--edge); border-radius: var(--r-l); padding: 1.75rem;
  box-shadow: 6px 6px 0 var(--edge);
}
.modal-close { position: absolute; top: 0.75rem; right: 0.75rem; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; }
.modal-close:hover { color: var(--text-main); }
.modal-profile { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; text-align: center; }
.modal-profile h2 { font-family: var(--font-serif); font-size: 1.3rem; display: flex; align-items: center; flex-wrap: wrap; justify-content: center; }
.modal-bio { color: var(--text-muted); font-size: 0.875rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.status-line { font-size: 0.75rem; color: var(--text-muted); }
.modal-profile .btn-action { border: none; cursor: pointer; margin-top: 0.5rem; padding: 0.6rem 1.2rem; font-family: inherit; flex: 0 0 auto; }

@media (max-width: 850px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-panel { height: 70vh; }
  .msg-row { max-width: 92%; }
  .profile-head { flex-direction: column; text-align: center; }
}

/* ---------- Freundschaftsanfragen ---------- */
.rel-icon { color: var(--text-muted); font-size: 0.8rem; flex-shrink: 0; }
.rel-icon.ok { color: var(--status-online); }
.fr-actions { display: flex; gap: 0.35rem; }
.icon-btn {
  width: 28px; height: 28px; border-radius: var(--r-s); border: 1px solid var(--border-color);
  background: transparent; color: var(--text-muted); cursor: pointer;
}
.icon-btn.ok:hover { color: var(--status-online); border-color: var(--status-online); }
.icon-btn.no:hover { color: var(--danger); border-color: var(--danger); }
.modal-actions { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; margin-top: 0.5rem; }
.modal-actions .btn-action { margin-top: 0; }
.modal-actions .hint { text-align: center; }
.lock-hint { color: var(--status-maint); }
.stack-form .btn-secondary, .modal-profile .btn-secondary { border: 1px solid var(--border-color); background: transparent; color: var(--text-main); }
.stack-form .btn-secondary:hover, .modal-profile .btn-secondary:hover { background: var(--hover-tint); border-color: var(--edge); }

.setting-line { font-size: 0.875rem; margin-top: 0.5rem; }
.setting-state {
  font-family: var(--font-code); font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.5rem;
  border-radius: var(--r-s); margin-left: 0.3rem;
}
.setting-state.on { background: rgba(95, 208, 142, 0.14); color: #7fe0a8; }
.setting-state.off { background: rgba(224, 166, 74, 0.15); color: #f0c070; }

/* ---------- Admin-Panel ---------- */
.admin-search {
  background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--r-m); color: var(--text-main);
  font-family: var(--font-main); font-size: 0.9rem; padding: 0.7rem 0.9rem; outline: none; width: 100%;
}
.admin-search:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-soft); }
.admin-list { display: flex; flex-direction: column; gap: 0.75rem; }
.admin-user {
  background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--r-m); padding: 1rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.85rem;
}
.admin-user[hidden] { display: none; }
.admin-head { display: flex; align-items: center; gap: 0.75rem; min-width: 200px; }
.admin-name { font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; flex-wrap: wrap; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.admin-actions form { margin: 0; }
.inline-form { display: flex; gap: 0.35rem; }
.inline-form select {
  background: var(--bg-input); color: var(--text-main); border: 1px solid var(--border-color);
  border-radius: var(--r-s); font-family: var(--font-main); font-size: 0.75rem; padding: 0.4rem;
}
.btn-mini {
  background: transparent; color: var(--text-main); border: 1px solid var(--border-color); border-radius: var(--r-s);
  font-family: var(--font-main); font-size: 0.75rem; font-weight: 600; padding: 0.45rem 0.75rem; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-mini:hover { background: var(--hover-tint); border-color: var(--edge); }
.btn-danger { color: var(--danger); border-color: rgba(239, 106, 91, 0.45); }
.btn-danger:hover { background: rgba(239, 106, 91, 0.12); border-color: var(--danger); }
.mute-flag { color: var(--status-maint); }

/* ---------- Benutzer-Dropdown in der Navbar ---------- */
.user-menu { position: relative; }
.user-toggle { background: transparent; border: none; font-family: inherit; cursor: pointer; color: var(--text-main); }
.user-toggle .chev { font-size: 0.65rem; opacity: 0.7; transition: transform 0.15s; }
.user-toggle.open { background: var(--hover-tint); }
.user-toggle.open .chev { transform: rotate(180deg); }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 14px); min-width: 220px; z-index: 200;
  background: var(--bg-card); border: 1px solid var(--edge); border-radius: var(--r-m);
  padding: 0.35rem; box-shadow: 4px 4px 0 var(--edge);
}
.user-dropdown[hidden] { display: none; }
.user-dropdown a {
  display: flex; align-items: center; gap: 0.65rem; padding: 0.6rem 0.75rem; border-radius: var(--r-s);
  color: var(--text-main); text-decoration: none; font-size: 0.875rem; font-weight: 500;
}
.user-dropdown a i { width: 1rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; }
.user-dropdown a:hover { background: var(--accent-soft); }
.user-dropdown a.danger, .user-dropdown a.danger i { color: var(--danger); }
.user-dropdown a.danger:hover { background: rgba(239, 106, 91, 0.12); }
.dd-sep { height: 1px; background: var(--border-color); margin: 0.35rem 0.25rem; }
@media (max-width: 850px) {
  .user-dropdown { right: auto; left: 50%; transform: translateX(-50%); }
}

/* ---------- Bilder & Videos im Chat ---------- */
.msg-media {
  display: block; max-width: min(380px, 70vw); max-height: 320px; height: auto;
  border-radius: var(--r-m); object-fit: contain; background: rgba(0, 0, 0, 0.3); margin: 0.1rem 0 0.35rem;
}
a:has(> img.msg-media) { display: block; cursor: zoom-in; }
.msg-media[controls] { cursor: default; }

.attach-btn { width: 42px; flex: 0 0 auto; font-size: 0.95rem; }
.attach-btn:hover { color: var(--accent-primary); border-color: var(--accent-primary); }
.attach-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.attach-area { padding: 0.6rem 0.75rem 0; border-top: 1px solid var(--border-color); background: var(--bg-surface); }
.attach-chip {
  display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--text-main);
  background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--r-m); padding: 0.4rem 0.65rem;
}
.attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.attach-chip .hint { white-space: nowrap; }
.attach-chip .icon-btn { margin-left: auto; width: 24px; height: 24px; flex-shrink: 0; }
.upload-bar { height: 4px; background: var(--border-color); border-radius: 2px; overflow: hidden; margin-top: 0.5rem; }
.upload-bar[hidden], .attach-area[hidden] { display: none; }
.upload-fill { height: 100%; width: 0%; background: var(--accent-primary); transition: width 0.15s; }
.attach-area + .chat-input { border-top: none; }

/* ---------- Profil-Banner ---------- */
.profile-banner {
  height: 150px; border-radius: var(--r-m) var(--r-m) 0 0; border: 1px solid var(--border-color); border-bottom: none;
  background: var(--bg-card) center / cover no-repeat; margin-bottom: -2rem;
}
.profile-banner + .profile-head { border-top-left-radius: 0; border-top-right-radius: 0; }
.banner-preview {
  height: 110px; border-radius: var(--r-m); border: 1px solid var(--border-color); margin-top: 0.75rem;
  background: var(--bg-surface) center / cover no-repeat;
}