/* ============================================================
   PuroArchive – Komponenten (components.css)
   Nav Bar, Buttons, Cards, Forms, Toast, Action Sheet, etc.
   ============================================================ */

/* ==============================
   NAV BAR
   ============================== */

.nav-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: calc(44px + var(--safe-top));
  padding-top: var(--safe-top);
  padding-left: var(--space-5);
  padding-right: var(--space-5);
  background: rgba(240, 237, 230, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: flex-end;
  padding-bottom: var(--space-2);
  z-index: 100;
  gap: var(--space-3);
}

.nav-bar__title {
  flex: 1;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-tight);
  text-align: center;
}

.nav-bar__left {
  width: 44px;
  display: flex;
  align-items: center;
}

.nav-bar__right {
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* Zurück-Button */
.nav-btn-back {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-text);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  padding: var(--space-2) 0;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-btn-back svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
}

/* Icon-Button (Settings, Options) */
.nav-btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 20px;
}

/* ==============================
   BUTTONS
   ============================== */

/* Primär-Button – schwarz */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--color-text);
  color: var(--color-text-inverse);
  font-family: var(--font-primary);
  font-weight: var(--font-weight-black);
  font-size: var(--font-size-base);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  border-radius: var(--radius-full);
  padding: var(--space-4) var(--space-6);
  border: none;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
  -webkit-appearance: none;
}

.btn-primary:active {
  transform: scale(0.96);
  box-shadow: none;
}

/* Orange Variante */
.btn-primary--orange {
  background: var(--color-primary);
}

/* Große Home-CTA Buttons */
.btn-primary--lg {
  flex: 1;
  padding: var(--space-5) var(--space-6);
  font-size: var(--font-size-lg);
  min-height: 60px;
}

/* Sekundär-Button – transparent mit Rahmen */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-primary);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  border-radius: var(--radius-full);
  padding: var(--space-3) var(--space-5);
  border: 1.5px solid var(--color-border);
  cursor: pointer;
  transition: background var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
}

.btn-secondary:active {
  background: var(--color-surface-alt);
}

/* Destruktiver Button – roter Text */
.btn-destructive {
  color: var(--color-error);
  background: transparent;
  border: 1.5px solid rgba(196, 90, 74, 0.25);
}

/* Button Vollbreite */
.btn-full {
  width: 100%;
}

/* Bibliothek-Link */
.btn-library-link {
  background: none;
  border: none;
  font-family: var(--font-primary);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: var(--space-3) 0;
  text-align: center;
}

.btn-library-link:active {
  color: var(--color-text);
}

/* ==============================
   SHUTTER-BUTTON (Kamera)
   ============================== */

.shutter-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: white;
  border: 3px solid rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast);
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  -webkit-user-select: none;
  user-select: none;
}

.shutter-btn::after {
  content: '';
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: white;
  border: 2px solid rgba(0,0,0,0.1);
}

.shutter-btn:active {
  transform: scale(0.92);
}

/* ==============================
   MIKROFON-BUTTON
   ============================== */

.mic-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background var(--transition-fast);
}

.mic-btn svg {
  width: 28px;
  height: 28px;
}

.mic-btn.recording {
  background: var(--color-error);
}

/* ==============================
   LIBRARY KARTEN
   ============================== */

.library-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-3);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.library-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.library-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.library-card__category {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  opacity: 0.65;
  color: var(--color-text);
}

.library-card__title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-black);
  letter-spacing: var(--letter-spacing-tight);
  line-height: 1.1;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.library-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.library-card__date {
  font-size: var(--font-size-xs);
  color: var(--color-text);
  opacity: 0.5;
  font-weight: var(--font-weight-medium);
}

/* Vorschau-Bild (rechts oben) */
.library-card__image {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  object-fit: cover;
  opacity: 0.8;
}

/* ==============================
   SYNC-STATUS-INDIKATOR
   ============================== */

.sync-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sync-indicator--synced   { background: var(--color-success); }
.sync-indicator--pending  { background: var(--color-pending); }
.sync-indicator--error    { background: var(--color-error); }

/* ==============================
   TAGS / CHIPS
   ============================== */

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: rgba(13, 13, 13, 0.07);
  color: var(--color-text);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wide);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.tag-chip--removable {
  cursor: pointer;
  padding-right: var(--space-2);
}

.tag-chip__remove {
  font-size: 14px;
  opacity: 0.5;
  line-height: 1;
}

/* ==============================
   FORMULAR-ELEMENTE
   ============================== */

.form-section {
  margin-bottom: var(--space-6);
}

.form-label {
  display: block;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

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

.form-input--title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-black);
  letter-spacing: var(--letter-spacing-tight);
  padding: var(--space-4);
  min-height: 60px;
}

.form-input--textarea {
  resize: none;
  min-height: 100px;
  line-height: 1.5;
}

/* Category Select */
.form-select {
  width: 100%;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%230D0D0D' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: calc(var(--space-4) + 24px);
}

/* Tags-Eingabe */
.tags-input-wrapper {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  cursor: text;
  min-height: 52px;
  transition: border-color var(--transition-fast);
}

.tags-input-wrapper:focus-within {
  border-color: var(--color-text);
}

.tags-input-field {
  border: none;
  background: none;
  font-family: var(--font-primary);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  outline: none;
  flex: 1;
  min-width: 80px;
  padding: var(--space-1) 0;
}

.tags-input-field::placeholder {
  color: var(--color-text-muted);
}

/* ==============================
   BILD-VORSCHAU
   ============================== */

.image-preview {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
  background: var(--color-surface-alt);
}

.image-preview-container {
  position: relative;
  margin-bottom: var(--space-5);
}

.image-preview-container .btn-retry {
  position: absolute;
  bottom: var(--space-3);
  right: var(--space-3);
  background: rgba(13,13,13,0.75);
  color: white;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
}

/* ==============================
   TOAST NOTIFICATION
   ============================== */

.toast {
  position: fixed;
  top: calc(var(--safe-top) + 54px);
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--color-text);
  color: var(--color-text-inverse);
  font-family: var(--font-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  white-space: nowrap;
  z-index: 9999;
  pointer-events: none;
  transition: transform var(--transition-spring), opacity var(--transition-fast);
  opacity: 0;
  max-width: calc(100vw - 48px);
  text-align: center;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast--success { background: var(--color-success); }
.toast--error   { background: var(--color-error); }

/* ==============================
   ACTION SHEET
   ============================== */

.action-sheet-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.action-sheet-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.action-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  padding: var(--space-3) var(--space-5) calc(var(--space-6) + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform var(--transition-spring);
  z-index: 200;
}

.action-sheet.open {
  transform: translateY(0);
}

/* Drag-Indikator */
.action-sheet__handle {
  width: 40px;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-5);
}

.action-sheet__title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  text-align: center;
}

.action-sheet__item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  color: var(--color-text);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  text-align: left;
}

.action-sheet__item:last-child {
  border-bottom: none;
}

.action-sheet__item--destructive {
  color: var(--color-error);
}

/* ==============================
   SETTINGS – iOS-Stil Sektionen
   ============================== */

.settings-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-5);
}

.settings-section__title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 0 var(--space-4) var(--space-2);
  padding-top: var(--space-5);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row__label {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

.settings-row__value {
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Status-Dot */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--green { background: var(--color-success); }
.status-dot--red   { background: var(--color-error); }
.status-dot--amber { background: var(--color-pending); }

/* ==============================
   DETAIL-SCREEN
   ============================== */

.detail-image {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  background: var(--color-surface-alt);
  display: block;
}

.detail-category-badge {
  display: inline-flex;
  align-items: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-4);
  opacity: 0.85;
}

.detail-title {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-black);
  letter-spacing: var(--letter-spacing-tight);
  line-height: 1.05;
  margin-bottom: var(--space-5);
  color: var(--color-text);
}

.detail-description {
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}

.detail-meta {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.detail-notion-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  text-decoration: none;
}

/* ==============================
   ANALYZE SCREEN
   ============================== */

.analyze-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--space-8);
  padding: var(--space-8);
  text-align: center;
}

.analyze-status {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text);
}

.analyze-hint {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ==============================
   KAMERA-SCREEN
   ============================== */

.camera-screen {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: calc(var(--space-10) + var(--safe-bottom));
  align-items: center;
}

.camera-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(var(--safe-top) + var(--space-4)) var(--space-5) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
}

.camera-btn {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
}

.camera-preview {
  position: absolute;
  inset: 0;
  background: #000;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

.camera-preview img {
  flex: 1;
  width: 100%;
  object-fit: contain;
}

.camera-preview__actions {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-5) calc(var(--space-5) + var(--safe-bottom));
  background: rgba(0,0,0,0.8);
}

/* ==============================
   NOTION-LINK-BUTTON
   ============================== */

.btn-notion {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  text-decoration: none;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-3) var(--space-5);
  background: none;
}

/* ==============================
   KEIN NETZ / OFFLINE BANNER
   ============================== */

.offline-banner {
  position: fixed;
  top: calc(var(--safe-top) + 44px);
  left: var(--space-4);
  right: var(--space-4);
  background: var(--color-pending);
  color: var(--color-text);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  text-align: center;
  z-index: 500;
  transform: translateY(-80px);
  transition: transform var(--transition-spring);
}

.offline-banner.visible {
  transform: translateY(0);
}

/* ==============================
   LADE-OVERLAY (ganze App)
   ============================== */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  gap: var(--space-4);
  transition: opacity var(--transition-slow);
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-wordmark {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-black);
  letter-spacing: var(--letter-spacing-tight);
  text-transform: uppercase;
  color: var(--color-text);
}
