/* ================================================================
   # AI KASSENPRÜFER — Contextual AI Sidebar
   Cluely-style: Schlanke Sidebar mit Echtzeit-Analysen.
   ================================================================ */

.ai-auditor-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  height: 100vh;
  background: var(--surface, #ffffff);
  border-left: 1px solid var(--border, #e2e8f0);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-auditor-open {
  transform: translateX(0);
}

.ai-auditor-closing {
  transform: translateX(100%);
}

/* Header */
.ai-auditor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.ai-auditor-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
}

.ai-auditor-pulse {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  animation: aiPulse 2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
}

@keyframes aiPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
  }
}

.ai-auditor-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.ai-auditor-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Status Card */
.ai-auditor-status {
  margin: 16px;
  padding: 16px;
  background: var(--surface-2, #f8fafc);
  border-radius: 12px;
  border-left: 4px solid;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-auditor-status-icon {
  font-size: 24px;
}

.ai-auditor-status-text {
  flex: 1;
}

.ai-auditor-status-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text, #1e293b);
}

.ai-auditor-status-subtitle {
  font-size: 12px;
  color: var(--text-secondary, #64748b);
  margin-top: 2px;
}

/* Item List */
.ai-auditor-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px;
}

.ai-auditor-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.ai-auditor-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.ai-auditor-item {
  display: flex;
  gap: 12px;
  padding: 14px;
  margin-bottom: 8px;
  background: var(--surface-2, #f8fafc);
  border-radius: 10px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.ai-auditor-item:hover {
  border-color: var(--brand, #3b82f6);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

/* Prioritäts-Kategorien */
.ai-auditor-item-error {
  border-left: 3px solid #ef4444;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}
.ai-auditor-item-error .ai-auditor-item-icon { color: #dc2626; }

.ai-auditor-item-warning {
  border-left: 3px solid #f59e0b;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}
.ai-auditor-item-warning .ai-auditor-item-icon { color: #b45309; }

.ai-auditor-item-tip {
  border-left: 3px solid #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}
.ai-auditor-item-tip .ai-auditor-item-icon { color: #1d4ed8; }

.ai-auditor-item-action {
  border-left: 3px solid #22c55e;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}
.ai-auditor-item-action .ai-auditor-item-icon { color: #15803d; }

/* Prioritäts-Badge */
.ai-auditor-priority {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
}
.ai-auditor-priority.critical { background: #ef4444; color: white; }
.ai-auditor-priority.warning { background: #f59e0b; color: white; }
.ai-auditor-priority.info { background: #3b82f6; color: white; }

.ai-auditor-item-icon {
  font-size: 20px;
  width: 28px;
  flex-shrink: 0;
}

.ai-auditor-item-content {
  flex: 1;
  min-width: 0;
}

.ai-auditor-item-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}

.ai-auditor-item-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.ai-auditor-item-action {
  margin-top: 8px;
  padding: 6px 12px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-auditor-item-action:hover {
  background: var(--brand-dark, #2563eb);
  transform: translateY(-1px);
}

/* Footer */
.ai-auditor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 11px;
  color: var(--text-secondary);
}

.ai-auditor-shortcut {
  font-family: monospace;
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.ai-auditor-refresh {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}

.ai-auditor-refresh:hover {
  color: var(--brand);
}

/* Scrollbar */
.ai-auditor-list::-webkit-scrollbar {
  width: 6px;
}

.ai-auditor-list::-webkit-scrollbar-track {
  background: transparent;
}

.ai-auditor-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

[data-theme="dark"] .ai-auditor-panel {
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .ai-auditor-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #312e81 100%);
}

[data-theme="dark"] .ai-auditor-status,
[data-theme="dark"] .ai-auditor-item,
[data-theme="dark"] .ai-auditor-footer {
  background: var(--surface-alt, #0f172a);
  border-color: var(--border, rgba(255,255,255,0.08));
}

[data-theme="dark"] .ai-auditor-item:hover {
  border-color: var(--blue, #60a5fa);
  box-shadow: 0 2px 12px rgba(96, 165, 250, 0.12);
}

[data-theme="dark"] .ai-auditor-item-error {
  background: var(--red-bg, rgba(248,113,113,0.1));
  border-left-color: var(--red, #f87171);
}

[data-theme="dark"] .ai-auditor-item-error .ai-auditor-item-icon {
  color: var(--red, #f87171);
}

[data-theme="dark"] .ai-auditor-item-warning {
  background: var(--amber-bg, rgba(251,146,60,0.1));
  border-left-color: var(--amber, #fb923c);
}

[data-theme="dark"] .ai-auditor-item-warning .ai-auditor-item-icon {
  color: var(--amber, #fb923c);
}

[data-theme="dark"] .ai-auditor-item-tip {
  background: var(--blue-bg, rgba(96,165,250,0.1));
  border-left-color: var(--blue, #60a5fa);
}

[data-theme="dark"] .ai-auditor-item-tip .ai-auditor-item-icon {
  color: var(--blue, #60a5fa);
}

[data-theme="dark"] .ai-auditor-item.ai-auditor-item-action {
  background: var(--green-bg, rgba(74,222,128,0.1));
  border-left-color: var(--green, #4ade80);
}

[data-theme="dark"] .ai-auditor-item.ai-auditor-item-action .ai-auditor-item-icon {
  color: var(--green, #4ade80);
}

/* Calm production styling: kein dekorativer Gradient, klare Status-Signale. */
.ai-auditor-header {
  background: var(--surface, #ffffff);
  color: var(--text, #0f172a);
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.ai-auditor-close {
  background: var(--surface-soft, #f8fafc);
  color: var(--text-secondary, #64748b);
  border: 1px solid var(--border, #e2e8f0);
}

.ai-auditor-close:hover {
  background: var(--surface-2, #f1f5f9);
  color: var(--text, #0f172a);
}

[data-theme="dark"] .ai-auditor-panel {
  background: #111827;
  border-left-color: rgba(148, 163, 184, 0.16);
}

[data-theme="dark"] .ai-auditor-header {
  background: #111827;
  color: #f8fafc;
  border-bottom-color: rgba(148, 163, 184, 0.16);
}

[data-theme="dark"] .ai-auditor-close {
  background: #1f2937;
  color: #a8b3c4;
  border-color: rgba(148, 163, 184, 0.16);
}

[data-theme="dark"] .ai-auditor-close:hover {
  background: #2b374a;
  color: #f8fafc;
}

/* Mobile */
@media (max-width: 480px) {
  .ai-auditor-panel {
    width: 100%;
  }
}
