/* ==========================================================================
   Personal Timeline – Modern Design System & Styles
   ========================================================================== */

:root {
  /* Color Palette - Dark Mode (Default) */
  --bg-main: #090d16;
  --bg-surface: #111827;
  --bg-surface-elevated: #1e293b;
  --bg-surface-glass: rgba(17, 24, 39, 0.75);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --accent-emerald: #10b981;
  --danger: #ef4444;
  --danger-hover: #dc2626;

  --timeline-line: rgba(99, 102, 241, 0.25);
  --timeline-node-bg: #111827;
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --glass-blur: blur(16px);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

[data-theme="light"] {
  --bg-main: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8fafc;
  --bg-surface-glass: rgba(255, 255, 255, 0.85);
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: rgba(79, 70, 229, 0.1);
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --timeline-line: rgba(79, 70, 229, 0.2);
  --timeline-node-bg: #ffffff;
}

/* Base Reset & Typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Ambient Glow Background Effect */
.ambient-glow {
  position: fixed;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(6, 182, 212, 0.08) 40%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

/* Utilities */
.hidden {
  display: none !important;
}

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: transparent;
  color: var(--text-main);
  text-decoration: none;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  border-color: var(--border-subtle);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  color: var(--text-muted);
}

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

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-circle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  padding: 0;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.lang-text {
  font-weight: 700;
  font-size: 0.85rem;
}

/* ==========================================================================
   Header Component
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  background: var(--bg-surface-glass);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 20px;
}

.header-container {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-main) 60%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.header-stats {
  display: flex;
  gap: 8px;
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
}

.stat-number {
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  color: var(--text-muted);
}

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

/* ==========================================================================
   Main Layout Container
   ========================================================================== */
.main-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 80px;
  position: relative;
  z-index: 10;
}

/* ==========================================================================
   Composer Card (Eingabe)
   ========================================================================== */
.composer-card {
  background: var(--bg-surface-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  margin-bottom: 24px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.composer-card:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 12px 30px -4px rgba(99, 102, 241, 0.25);
}

.composer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.user-greeting {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.greeting-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

.composer-datetime {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.composer-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.composer-textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 1.05rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 80px;
}

.composer-textarea::placeholder {
  color: var(--text-dim);
}

.composer-hint {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Audio Recording Active Banner */
.recording-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  animation: fadeIn 0.2s ease-in;
}

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.recording-pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse-ring 1.2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 1; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.1); opacity: 0.9; box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.9); opacity: 1; }
}

.recording-label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--danger);
}

.recording-timer {
  font-family: monospace;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.recording-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* GPS Badge Draft */
.gps-badge-draft {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-full);
  color: var(--accent-cyan);
  font-size: 0.82rem;
  font-weight: 600;
  width: fit-content;
}

.gps-badge-content {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-remove-chip {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.7;
}

.btn-remove-chip:hover {
  opacity: 1;
}

/* Media Draft List */
.media-draft-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px dashed var(--border-subtle);
  padding-top: 12px;
}

.media-draft-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.media-count-indicator {
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.media-draft-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.media-draft-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
}

.media-draft-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  display: block;
}

.media-draft-audio {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.media-draft-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.btn-media-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: background var(--transition-fast);
}

.btn-media-remove:hover {
  background: var(--danger);
}

/* Composer Toolbar Footer */
.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.08);
  border-top: 1px solid var(--border-subtle);
}

.toolbar-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tool-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.tool-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-submit {
  padding: 10px 22px;
  font-size: 0.95rem;
}

.submit-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Filter & Search Bar
   ========================================================================== */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 36px 10px 38px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-glass);
  backdrop-filter: var(--glass-blur);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

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

.btn-clear-search {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
}

.filter-pills {
  display: flex;
  gap: 6px;
}

.filter-pill {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-glass);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-pill:hover {
  color: var(--text-main);
  border-color: var(--primary);
}

.filter-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* ==========================================================================
   Timeline Feed & Cards
   ========================================================================== */
.timeline-container {
  position: relative;
  padding-left: 28px;
}

.timeline-line {
  position: absolute;
  left: 11px;
  top: 10px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--timeline-line) 20%, var(--timeline-line) 90%, transparent 100%);
}

.timeline-feed {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Timeline Card */
.timeline-card {
  position: relative;
  background: var(--bg-surface-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  padding: 18px 22px;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.timeline-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.35);
}

/* Timeline Node Dot */
.timeline-card::before {
  content: "";
  position: absolute;
  left: -24px;
  top: 24px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid var(--timeline-node-bg);
  box-shadow: 0 0 10px var(--primary);
}

/* Card Header */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-meta-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-datetime-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-time-badge {
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  background: var(--bg-surface-elevated);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.card-relative-time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card-gps-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: all var(--transition-fast);
  margin-top: 4px;
  width: fit-content;
}

.card-gps-badge:hover {
  background: rgba(6, 182, 212, 0.2);
  transform: translateY(-1px);
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-card-action {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-card-action:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.btn-card-action.js-edit-entry:hover {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
}

/* "Last edited" Hinweis am Ende einer Karte */
.card-last-edited {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-subtle);
  font-size: 0.75rem;
  font-style: italic;
  color: var(--text-dim);
}

/* Card Content */
.card-content {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 14px;
}

.card-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Inline-Bilder via [img]URL[/img]: links, ein Drittel breit, Text fließt rechts */
.post-image-float {
  float: left;
  width: 33.333%;
  max-width: 33.333%;
  margin: 2px 16px 10px 0;
  display: block;
}

.post-image-float img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}

.image-save-btn {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 3px 6px;
  font-size: 0.68rem;
  font-family: inherit;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.image-save-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
}

.card-content::after {
  content: "";
  display: block;
  clear: both;
}

@media (max-width: 560px) {
  .post-image-float {
    float: none;
    width: 100%;
    max-width: 100%;
    margin: 8px 0;
  }
}

/* Card Media Gallery */
.card-media-gallery {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Image Grid Layouts */
.media-image-grid {
  display: grid;
  gap: 8px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.media-image-grid.count-1 {
  grid-template-columns: 1fr;
  max-height: 480px;
}

.media-image-grid.count-2 {
  grid-template-columns: 1fr 1fr;
  max-height: 340px;
}

.media-image-grid.count-3 {
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 170px 170px;
  max-height: 350px;
}

.media-image-grid.count-3 .grid-item:first-child {
  grid-row: span 2;
}

.media-image-grid.count-4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 170px 170px;
}

.media-image-grid.count-many {
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 130px;
}

.grid-item {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 140px;
  cursor: pointer;
  overflow: hidden;
  background: var(--bg-surface-elevated);
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-normal);
}

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

/* Audio Player Container */
.audio-card-wrapper {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audio-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-pink);
}

.custom-audio-player {
  width: 100%;
  height: 38px;
  outline: none;
}

/* File Download Cards */
.file-download-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  width: fit-content;
}

.file-download-chip:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}

/* Empty & Loading States */
.loading-state,
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

.empty-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--primary);
}

.empty-icon {
  width: 32px;
  height: 32px;
}

.empty-state h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 340px;
}

/* ==========================================================================
   Modals (Lightbox, Export, Confirm)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease-out;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  width: 100%;
  max-width: 540px;
  overflow: hidden;
  animation: scaleUp 0.2s ease-out;
}

.modal-box-sm {
  max-width: 400px;
}

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

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title-wrap h2,
.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-icon {
  color: var(--primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-main);
}

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

.modal-intro {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.export-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.radio-card:hover {
  border-color: var(--primary);
}

.radio-card input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--primary);
}

.radio-card-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.radio-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
}

.radio-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.date-range-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.date-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.date-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.date-input {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
}

.export-future-proof-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--accent-emerald);
  font-size: 0.8rem;
  font-weight: 600;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  background: rgba(0, 0, 0, 0.05);
  border-top: 1px solid var(--border-subtle);
}

/* Lightbox */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(12px);
}

.lightbox-content {
  position: relative;
  z-index: 10;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  max-height: 100%;
}

.lightbox-img {
  max-width: 88vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.lightbox-caption {
  margin-top: 10px;
  font-size: 0.85rem;
  color: #e2e8f0;
}

.lightbox-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 20;
}

.lightbox-prev {
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
}

.lightbox-next {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideInUp 0.25s ease-out;
}

.toast.success {
  border-color: var(--accent-emerald);
}

.toast.error {
  border-color: var(--danger);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 640px) {
  /* Sicherheitsnetz gegen horizontales Scrollen */
  html {
    overflow-x: hidden;
  }

  /* --- App-Header: Marke (Zeile 1), Aktionen umbrechend (Zeile 2) --- */
  .app-header {
    padding: 10px 12px;
  }

  .header-container {
    flex-wrap: wrap;
    gap: 10px;
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .brand-text {
    min-width: 0;
  }

  .brand-title,
  .brand-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-stats {
    display: none;
  }

  .header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    width: 100%;
  }

  .header-actions .btn {
    padding: 8px;
  }

  /* Textlabels in den Header-Buttons ausblenden (nur Icons) */
  .header-actions .btn-icon-text > span {
    display: none;
  }

  .main-container {
    padding: 16px 12px 60px;
  }

  /* --- Composer: Prompt oben, Bedienelemente darunter --- */
  .composer-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 16px 10px;
  }

  .user-greeting {
    width: 100%;
  }

  .composer-header-right {
    width: 100%;
    justify-content: space-between;
  }

  /* --- Composer-Fußzeile: Tools umbrechend, Eintragen volle Breite --- */
  .composer-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 16px;
  }

  .toolbar-tools {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px;
  }

  .tool-btn {
    padding: 8px;
  }

  .tool-btn .tool-label {
    display: none;
  }

  .composer-submit-wrap {
    width: 100%;
  }

  .btn-submit {
    width: 100%;
    justify-content: center;
  }

  /* --- Suche & Filter --- */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    max-width: 100%;
  }

  .search-input-wrapper {
    min-width: 0;
    width: 100%;
  }

  /* Filter-Pills in mehrere Zeilen umbrechen (statt einer breiten Reihe) */
  .filter-pills {
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
  }

  .filter-pill {
    flex: 0 1 auto;
    white-space: nowrap;
  }

  /* Lange, nicht trennbare Zeichenketten (z.B. [img]https://...[/img]) umbrechen */
  .composer-hint,
  .card-content {
    overflow-wrap: anywhere;
  }

  /* --- Timeline --- */
  .timeline-container {
    padding-left: 16px;
  }

  .timeline-line {
    left: 6px;
  }

  .timeline-card {
    padding: 14px 16px;
  }

  .timeline-card::before {
    left: -14px;
    top: 18px;
    width: 12px;
    height: 12px;
  }

  /* --- Gast-Banner --- */
  .guest-banner-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    gap: 12px;
  }

  .guest-banner-content {
    min-width: 0;
  }

  /* --- Modals --- */
  .modal-overlay {
    padding: 12px;
  }

  .modal-box,
  .modal-box-sm {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    padding: 20px 16px;
  }

  .date-range-fields {
    grid-template-columns: 1fr;
  }

  /* --- Karten-Details --- */
  .card-share-bar {
    flex-wrap: wrap;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .card-datetime-group {
    flex-wrap: wrap;
    gap: 4px;
  }

  img,
  video,
  iframe {
    max-width: 100%;
  }
}

/* ==========================================================================
   Extension: Auth, Guest Banner, YouTube, Visibility, Share & Settings
   ========================================================================== */

/* Header Auth & Sync */
.auth-header-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-admin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.2));
  border: 1px solid rgba(99, 102, 241, 0.4);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

.admin-badge-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sync-icon.spinning {
  animation: spin 0.8s linear infinite;
}

/* Guest Lock Banner */
.guest-banner-card {
  background: var(--bg-surface-glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--card-shadow);
  flex-wrap: wrap;
}

.guest-banner-content {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 260px;
}

.guest-banner-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.guest-banner-text h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.guest-banner-text p {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Composer Visibility Selector */
.composer-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.visibility-selector-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}

.visibility-label {
  color: var(--text-muted);
  font-weight: 600;
}

.visibility-select {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.visibility-select:focus {
  border-color: var(--primary);
}

/* YouTube Input in Composer */
.youtube-draft-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-md);
  animation: fadeIn 0.2s ease-in;
}

.youtube-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-yt {
  width: 22px;
  height: 22px;
  color: #ef4444;
  flex-shrink: 0;
}

.youtube-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
}

.youtube-input::placeholder {
  color: var(--text-dim);
}

.youtube-preview-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-emerald);
}

/* Visibility Badges on Cards */
.card-visibility-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-left: 6px;
}

.card-visibility-badge.badge-private {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.card-visibility-badge.badge-members {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.card-visibility-badge.badge-public {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* YouTube Video Embed Player */
.video-embed-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  margin-top: 14px;
  background: #000;
}

.video-embed-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Social Share Bar on Public Cards */
.card-share-bar {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.share-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 5px;
}

.share-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.share-btn:hover {
  color: var(--text-main);
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
}

.share-btn.btn-share-copy:hover { color: var(--accent-cyan); }
.share-btn.btn-share-x:hover { color: #ffffff; background: #000; }
.share-btn.btn-share-fb:hover { color: #1877f2; }
.share-btn.btn-share-linkedin:hover { color: #0a66c2; }
.share-btn.btn-share-wa:hover { color: #25d366; }

/* Form Controls in Modals */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.form-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input:focus {
  border-color: var(--primary);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.55;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.form-group-checkbox {
  margin: 6px 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-main);
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.settings-sync-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  margin-top: 6px;
}

.settings-sync-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

