/* ═══════════════════════════════════════════
   TFA-AVA – Component Styles
   ═══════════════════════════════════════════ */

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  min-height: 48px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: all var(--tr-fast);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--c-primary);
  color: white;
}
.btn-primary:hover { background: var(--c-primary-hover); }

.btn-secondary {
  background: var(--c-bg-elevated);
  color: var(--c-text);
  border: 1px solid var(--c-border);
}

.btn-success {
  background: var(--c-success);
  color: white;
}

.btn-danger {
  background: var(--c-error);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--c-text-secondary);
}
.btn-ghost:hover { color: var(--c-text); background: var(--c-primary-soft); }

.btn-sm { min-height: 36px; padding: 8px 14px; font-size: var(--fs-sm); }
.btn-lg { min-height: 56px; padding: 16px 28px; font-size: var(--fs-lg); }
.btn-block { width: 100%; }
.btn-icon { width: 48px; padding: 0; border-radius: var(--r-full); }

/* ─── Cards ─── */
.card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-md);
  transition: all var(--tr-fast);
}

.card-interactive {
  cursor: pointer;
}
.card-interactive:active {
  transform: scale(0.98);
  background: var(--c-bg);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-sm);
}

/* ─── Department Kacheln ─── */
.dept-tile {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md);
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all var(--tr-fast);
  min-height: 72px;
}

.dept-tile:active { transform: scale(0.98); }

.dept-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.dept-info { flex: 1; min-width: 0; }
.dept-name { font-weight: var(--fw-semibold); font-size: var(--fs-base); }
.dept-count {
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
}

/* ─── Task Cards ─── */
.task-card {
  display: flex;
  gap: var(--sp-md);
  padding: var(--sp-md);
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all var(--tr-fast);
}

.task-card:active { transform: scale(0.98); }

.task-card-body { flex: 1; min-width: 0; }
.task-card-title {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-base);
  margin-bottom: var(--sp-xs);
}
.task-card-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
}

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-primary { background: var(--c-primary-soft); color: var(--c-primary); }
.badge-success { background: var(--c-success-soft); color: var(--c-success); }
.badge-warning { background: var(--c-accent-soft); color: var(--c-accent); }
.badge-error { background: var(--c-error-soft); color: var(--c-error); }

.badge-priority-niedrig { background: var(--c-primary-soft); color: var(--c-primary); }
.badge-priority-normal { background: var(--c-success-soft); color: var(--c-success); }
.badge-priority-hoch { background: var(--c-accent-soft); color: var(--c-accent); }
.badge-priority-dringend { background: var(--c-error-soft); color: var(--c-error); }

.badge-count {
  min-width: 24px;
  height: 24px;
  border-radius: var(--r-full);
  background: var(--c-primary);
  color: white;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

/* ─── Filter Chips ─── */
.chip-group {
  display: flex;
  gap: var(--sp-sm);
  overflow-x: auto;
  padding-bottom: var(--sp-sm);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chip-group::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--c-border);
  background: transparent;
  color: var(--c-text-secondary);
  transition: all var(--tr-fast);
}

.chip.active {
  background: var(--c-primary);
  color: white;
  border-color: var(--c-primary);
}

/* ─── Inputs ─── */
.input-group { margin-bottom: var(--sp-md); }

.input-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--c-text-secondary);
  margin-bottom: var(--sp-xs);
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 12px var(--sp-md);
  background: var(--c-bg-input);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text);
  font-size: 16px;
  transition: border-color var(--tr-fast);
}

.input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-soft);
}

.input-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394A3B8'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.input { min-height: 100px; resize: vertical; }

/* ─── Header ─── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 var(--sp-md);
  background: var(--c-bg-elevated);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 90;
}

.app-header-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

/* ─── Avatar ─── */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  color: white;
  flex-shrink: 0;
}

.avatar-sm { width: 32px; height: 32px; font-size: var(--fs-sm); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--fs-xl); }
.avatar-xl { width: 72px; height: 72px; font-size: var(--fs-2xl); }

/* ─── PIN Pad ─── */
.pin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  animation: fadeIn var(--tr-normal) forwards;
}

.pin-container {
  background: var(--c-bg-elevated);
  border-radius: var(--r-xl);
  padding: var(--sp-xl);
  width: min(320px, 90vw);
  text-align: center;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: var(--sp-md);
  margin: var(--sp-lg) 0;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: var(--r-full);
  border: 2px solid var(--c-border);
  transition: all var(--tr-fast);
}

.pin-dot.filled {
  background: var(--c-primary);
  border-color: var(--c-primary);
}

.pin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-sm);
}

.pin-key {
  width: 72px;
  height: 72px;
  border-radius: var(--r-full);
  border: none;
  background: var(--c-bg);
  color: var(--c-text);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-medium);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  transition: all var(--tr-fast);
  -webkit-tap-highlight-color: transparent;
}

.pin-key:active {
  background: var(--c-primary);
  color: white;
  transform: scale(0.95);
}

.pin-key-empty { visibility: hidden; }

/* ─── Voice FAB ─── */
.voice-fab {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + var(--sp-md));
  right: var(--sp-md);
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: var(--r-full);
  background: var(--c-primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-fab);
  z-index: 200;
  transition: all var(--tr-fast);
  -webkit-tap-highlight-color: transparent;
}

.voice-fab:active { transform: scale(0.92); }

.voice-fab.recording {
  background: var(--c-error);
  animation: pulse 1.2s ease-in-out infinite;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.voice-fab svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

@media (min-width: 768px) {
  .voice-fab {
    bottom: var(--sp-lg);
    right: var(--sp-lg);
  }
}

/* ─── Voice Overlay ─── */
.voice-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 400;
  animation: fadeIn var(--tr-normal) forwards;
}

.voice-status {
  font-size: var(--fs-lg);
  color: var(--c-text-secondary);
  margin-top: var(--sp-lg);
}

.voice-result {
  max-width: 90%;
  margin-top: var(--sp-xl);
  padding: var(--sp-md);
  background: var(--c-bg-card);
  border-radius: var(--r-lg);
  font-size: var(--fs-base);
  color: var(--c-text);
}

/* ─── Toast ─── */
#toast-container {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + var(--sp-lg));
  left: var(--sp-md);
  right: var(--sp-md);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  pointer-events: none;
}

.toast {
  padding: 14px var(--sp-md);
  border-radius: var(--r-md);
  color: white;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-lg);
  animation: slideUp var(--tr-slow) forwards;
  pointer-events: auto;
}

.toast-success { background: var(--c-success); }
.toast-error { background: var(--c-error); }
.toast-info { background: var(--c-primary); }
.toast-warning { background: var(--c-warning); }

/* ─── Modal ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 600;
  animation: fadeIn var(--tr-normal) forwards;
}

.modal {
  background: var(--c-bg-elevated);
  border-radius: var(--r-xl);
  padding: var(--sp-lg);
  max-width: min(440px, 92vw);
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  width: 100%;
}

.modal-title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  margin-bottom: var(--sp-md);
}

.modal-actions {
  display: flex;
  gap: var(--sp-sm);
  justify-content: flex-end;
  margin-top: var(--sp-lg);
}

/* ─── Empty State ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-2xl) var(--sp-md);
  text-align: center;
  color: var(--c-text-muted);
}

.empty-state-icon { font-size: 48px; margin-bottom: var(--sp-md); }
.empty-state-text { font-size: var(--fs-base); }

/* ─── Loading ─── */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: var(--r-full);
  animation: spin 0.8s linear infinite;
}

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

.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60dvh;
  flex-direction: column;
  gap: var(--sp-md);
}

.loading-text {
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
}
