/* static/css/style.css */
:root {
  --bg-main: #0b0f19;
  --bg-surface: #151d30;
  --bg-surface-hover: #1e2942;
  --border-color: #243049;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --accent-color: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-success: #10b981;
  --accent-danger: #ef4444;
  --msg-sent: #1e3a8a;
  --msg-received: #1e293b;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { 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, 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 { border-color: var(--accent-color); }
.btn { cursor: pointer; border: none; font-weight: 600; transition: background 0.15s; }
.btn.primary { background: var(--accent-color); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.secondary { background: #334155; color: #fff; }
.btn.small { padding: 6px 12px; font-size: 0.85rem; }
.btn-icon { background: none; border: none; font-size: 1.25rem; cursor: pointer; padding: 6px; }
.btn-icon.danger:hover { color: var(--accent-danger); }

/* AUTH SCREEN */
.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: 2.5rem;
  width: 100%; max-width: 420px;
  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: 0.2rem; }
.auth-card .logo span { color: var(--accent-color); }
.auth-card .subtitle { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 2rem; }
.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; }
.qr-wrapper img { width: 180px; height: 180px; margin: 1rem auto; display: block; border-radius: 8px; }
.mono-code { font-family: monospace; background: #000; padding: 6px; border-radius: 4px; font-size: 0.8rem; word-break: break-all; }

/* CHAT MAIN LAYOUT */
.main-layout { display: flex; height: 100vh; width: 100vw; }
.sidebar {
  width: 320px;
  background: var(--bg-surface);
  border-right: 1px 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; }
.status-indicator.online { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-success); }
.sidebar-tools { display: flex; gap: 8px; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-color); }
.sidebar-tools .btn { flex: 1; }
.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); }
.contact-badge { font-size: 0.75rem; padding: 2px 6px; border-radius: 4px; }
.badge-verified { background: #064e3b; color: #34d399; }
.badge-pending { background: #78350f; color: #fbbf24; }

/* CHAT BEREICH */
.chat-area { flex: 1; display: flex; flex-direction: column; background: var(--bg-main); }
.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 */
.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; }
.msg-meta { display: flex; justify-content: flex-end; gap: 6px; font-size: 0.7rem; color: var(--text-secondary); margin-top: 4px; }
.media-preview { max-width: 100%; border-radius: 8px; margin-top: 4px; }
audio { max-width: 260px; height: 36px; margin-top: 4px; }

/* CHAT EINGABELEISTE */
.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: 10px;
}
.chat-input-bar input[type="text"] { flex: 1; }
.file-label { cursor: pointer; }
.send-btn { padding: 10px 20px; }
.recording-active { animation: pulse-red 1s infinite alternate; color: var(--accent-danger) !important; }
@keyframes pulse-red {
  from { transform: scale(1); }
  to { transform: scale(1.2); }
}

/* MODAL OVERLAY */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal-card {
  background: var(--bg-surface); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 2rem; max-width: 460px; width: 90%; text-align: center;
}
.fingerprint-box {
  background: #000; color: #38bdf8; font-family: monospace;
  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; }

/* RESPONSIVE (SMARTPHONE) */
@media (max-width: 768px) {
  .sidebar { width: 100%; position: absolute; inset: 0; z-index: 50; }
  .sidebar.mobile-hidden { display: none; }
  .chat-area { width: 100%; }
}