/* static/css/style.css */
@import "./admin.css";

:root {
  --bg-main: #0b0f19;
  --bg-surface: #151d30;
  --bg-surface-hover: #1e2942;
  --border-color: #243049;
  --border-subtle: #1c273c;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-color: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-success: #10b981;
  --accent-danger: #dc2626;
  --accent-danger-hover: #ef4444;
  --accent-cyan: #38bdf8;
  --accent-warning: #eab308;
  --msg-sent: #1e3a8a;
  --msg-received: #1e293b;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

.hidden { display: none !important; }

/* Formulare & Buttons */
input, select, textarea, button {
  font-family: inherit;
  font-size: 0.95rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  padding: 10px 14px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-color); }
.btn { 
  cursor: pointer; 
  border: none; 
  font-weight: 600; 
  transition: background 0.15s, opacity 0.15s; 
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #ffffff !important;
}
.btn.primary { background: var(--accent-color); color: #fff !important; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.secondary { background: #334155; color: #fff !important; border: 1px solid var(--border-color); }
.btn.secondary:hover { background: #475569; }
.btn.danger { background: var(--accent-danger); color: #fff !important; }
.btn.danger:hover { background: var(--accent-danger-hover); }
.btn.small { padding: 6px 14px; font-size: 0.82rem; }

.btn-text { 
  background: none; 
  border: none; 
  cursor: pointer; 
  font-size: 0.85rem; 
  padding: 6px 12px; 
  border-radius: 6px;
  text-decoration: none; 
  color: var(--text-primary);
  font-weight: 600;
}
.btn-text.danger { 
  background: rgba(220, 38, 38, 0.25);
  color: #fca5a5 !important; 
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.btn-text.danger:hover { 
  background: var(--accent-danger); 
  color: #ffffff !important; 
}

.btn-block-action {
  background: #991b1b !important;
  color: #ffffff !important;
  border: 1px solid #ef4444 !important;
  font-weight: 700;
}
.btn-block-action:hover {
  background: #dc2626 !important;
}

.btn-trail-action {
  background: #1e293b !important;
  color: var(--accent-cyan) !important;
  border: 1px solid #334155 !important;
  font-weight: 600;
}
.btn-trail-action:hover {
  background: #334155 !important;
  color: #ffffff !important;
}

#btn-open-killswitch {
  background: #b91c1c !important;
  color: #ffffff !important;
  border: 1px solid #ef4444 !important;
  font-weight: 700;
}
#btn-open-killswitch:hover {
  background: #dc2626 !important;
}

.btn-icon { background: none; border: none; font-size: 1.25rem; cursor: pointer; padding: 6px; transition: opacity 0.15s; }
.btn-icon:hover { opacity: 0.8; }
.btn-icon.danger:hover { color: var(--accent-danger); }

/* AUTH & LOCK SCREENS */
.screen-overlay {
  position: fixed; inset: 0; background: var(--bg-main);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.auth-card {
  background: var(--bg-surface); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 2rem 2.5rem; width: 100%; max-width: 440px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5); text-align: center;
}
.auth-card .logo { font-size: 2rem; font-weight: 800; margin-bottom: 1rem; }
.auth-card .logo span { color: var(--accent-color); }
.form-group { margin-bottom: 1rem; }
.form-group input { width: 100%; }
.auth-card .btn { width: 100%; margin-top: 0.5rem; padding: 12px; }
.switch-auth { margin-top: 1.2rem; font-size: 0.85rem; color: var(--text-secondary); }
.switch-auth a { color: var(--accent-color); text-decoration: none; }
.info-text { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1.2rem; }
.lock-card { border: 2px solid var(--accent-color); max-width: 380px; }

/* CHAT MAIN LAYOUT */
.main-layout { display: flex; height: 100vh; width: 100vw; }

.sidebar {
  width: 320px;
  min-width: 200px;
  max-width: 650px;
  resize: horizontal;
  overflow-x: hidden;
  background: var(--bg-surface);
  border-right: 2px solid var(--border-color);
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  padding: 1rem; border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
}
.user-badge { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.status-indicator.online { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-success); }
.header-actions { display: flex; align-items: center; gap: 4px; }

.sidebar-tabs { display: flex; border-bottom: 1px solid var(--border-color); background: var(--bg-main); overflow-x: auto; }
.sidebar-tab-btn {
  flex: 1; border: none; padding: 10px; font-weight: 600; font-size: 0.82rem;
  color: var(--text-secondary); background: none; cursor: pointer; white-space: nowrap;
}
.sidebar-tab-btn.active { color: #fff; border-bottom: 2px solid var(--accent-color); background: var(--bg-surface); }
.sidebar-tools { display: flex; gap: 6px; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-color); flex-wrap: wrap; }
.sidebar-tools .btn { flex: 1; min-width: 60px; padding: 6px 8px; font-size: 0.8rem; }
.contacts-list { flex: 1; overflow-y: auto; padding: 0.5rem; }
.contact-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 8px; cursor: pointer; margin-bottom: 4px;
}
.contact-item:hover, .contact-item.active { background: var(--bg-surface-hover); }

/* BADGES */
.badge, .contact-badge {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  display: inline-block;
  letter-spacing: 0.4px;
}
.badge-verified { background: #064e3b; color: #34d399; }
.badge-pending { background: #78350f; color: #fbbf24; }
.badge-group { background: #3730a3; color: #a5b4fc; }
.badge-note { background: #0e7490; color: #67e8f9; }
.badge-calendar { background: #581c87; color: #d8b4fe; }
.badge-pinned { background: #854d0e; color: #fef08a; }
.badge-inactive { background: #450a0a; color: #fca5a5; }
.badge-critical { background: #58151c; color: #fca5a5; border: 1px solid #991b1b; }
.badge-warning { background: #451a03; color: #fde047; border: 1px solid #854d0e; }
.badge-info { background: #0c2d48; color: #7dd3fc; border: 1px solid #0284c7; }

.item-info-wrap { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.item-title { font-weight: 600; font-size: 0.88rem; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.item-meta { font-size: 0.75rem; color: var(--text-secondary); }

/* CHAT BEREICH */
.chat-area { flex: 1; display: flex; flex-direction: column; background: var(--bg-main); min-width: 0; }
.chat-header {
  height: 64px; padding: 0 1.5rem; border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface); display: flex; align-items: center; justify-content: space-between;
}
.chat-title-info h3 { font-size: 1.1rem; }
.sub-status { font-size: 0.8rem; color: var(--text-secondary); }
.messages-container {
  flex: 1; overflow-y: auto; padding: 1.5rem;
  display: flex; flex-direction: column; gap: 12px;
}
.welcome-box { text-align: center; color: var(--text-secondary); margin: auto; max-width: 400px; }

/* SPRECHBLASEN & MEDIEN */
.msg-bubble {
  max-width: 70%; padding: 10px 14px; border-radius: 12px;
  position: relative; line-height: 1.4; word-break: break-word;
}
.msg-bubble.sent { align-self: flex-end; background: var(--msg-sent); border-bottom-right-radius: 2px; }
.msg-bubble.received { align-self: flex-start; background: var(--msg-received); border-bottom-left-radius: 2px; }
.media-preview { max-width: 100%; border-radius: 8px; margin-top: 4px; }
.chat-audio-player { max-width: 260px; height: 36px; margin-top: 4px; }
.chat-video-note {
  width: 220px; height: 220px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--accent-color); margin-top: 4px; background: #000;
}
.forward-tag { font-size: 0.72rem; color: #93c5fd; font-style: italic; margin-bottom: 4px; display: block; }
.msg-actions { display: inline-flex; margin-left: 8px; vertical-align: middle; }
.btn-forward-msg { background: none; border: none; cursor: pointer; font-size: 0.8rem; opacity: 0.6; }
.btn-forward-msg:hover { opacity: 1; }

/* EINGABELEISTE & AUFNAHME */
.chat-input-bar {
  padding: 0.75rem 1.5rem; background: var(--bg-surface);
  border-top: 1px solid var(--border-color); display: flex; align-items: center; gap: 8px;
}
.chat-input-bar input[type="text"] { flex: 1; }
.file-label { cursor: pointer; }
.send-btn { padding: 10px 20px; }
.recording-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 1.5rem;
  background: #1e1b2e; border-top: 2px solid #ef4444;
}
.recording-pulse { animation: recpulse 1s infinite; font-size: 1rem; }
@keyframes recpulse { 0% { opacity: 1; } 50% { opacity: 0.3; } 100% { opacity: 1; } }
.recording-time { font-family: var(--font-mono); font-size: 1.1rem; color: #f87171; font-weight: 700; flex: 1; }

/* EMOJI PICKER POPUP */
.emoji-container-anchor { position: relative; }
.emoji-picker-popup {
  position: absolute; bottom: 50px; left: 0; width: 320px; max-height: 280px;
  background: var(--bg-surface); border: 1px solid var(--border-color);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.6); z-index: 150;
  display: flex; flex-direction: column; overflow: hidden;
}
.emoji-nav { display: flex; overflow-x: auto; background: var(--bg-main); border-bottom: 1px solid var(--border-color); }
.emoji-cat-btn {
  padding: 6px 10px; border: none; background: none; color: var(--text-secondary);
  font-size: 0.75rem; cursor: pointer; white-space: nowrap;
}
.emoji-cat-btn.active { color: #fff; background: var(--accent-color); }
.emoji-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 8px; overflow-y: auto; max-height: 220px; }
.emoji-item { font-size: 1.3rem; background: none; border: none; cursor: pointer; padding: 4px; border-radius: 4px; }
.emoji-item:hover { background: var(--bg-surface-hover); }

/* STANDARD MODALS */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85);
  display: flex; align-items: center; justify-content: center; z-index: 200;
  padding: 1rem;
}
.modal-card {
  background: var(--bg-surface); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 2rem; max-width: 480px; width: 90%; text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.7);
}
.fingerprint-box {
  background: #000; color: #38bdf8; font-family: var(--font-mono);
  padding: 12px; border-radius: 6px; margin: 1.2rem 0; font-size: 0.9rem; word-break: break-all;
}
.modal-buttons { display: flex; gap: 10px; justify-content: center; margin-top: 1.2rem; }
.modal-buttons-wrap { flex-wrap: wrap; gap: 10px; }
.members-checklist { max-height: 55vh; overflow-y: auto; margin: 1rem 0; text-align: left; }
.checklist-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px; cursor: pointer; }
.checklist-item:hover { background: var(--bg-surface-hover); }

/* VIDEO LIVE PREVIEW */
.video-modal-card { max-width: 360px; }
.video-preview-wrapper {
  width: 240px; height: 240px; margin: 1.2rem auto; border-radius: 50%;
  overflow: hidden; border: 3px solid var(--accent-color); background: #000;
}
#video-live-preview { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 768px) {
  .sidebar { width: 100%; min-width: 100%; max-width: 100%; resize: none; position: absolute; inset: 0; z-index: 50; }
  .chat-area { width: 100%; }
}