/* MARKTPREIS-OVERLAY PANEL */

.marktpreis-panel {
  margin-top: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(30, 30, 30, 0.92);
  color: #e8e8e8;
  font-size: 13px;
  font-family: inherit;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  width: min(420px, calc(100vw - 24px));
  max-width: 420px;
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 50000;
  backdrop-filter: blur(2px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Minimierter Zustand: Panel fährt nach links, nur 36px Tab sichtbar */
.marktpreis-panel.is-minimized {
  transform: translateX(calc(-100% + 36px));
  left: 0 !important;
  cursor: pointer;
}

/* Restore-Pfeil im Tab-Bereich */
.marktpreis-panel.is-minimized::after {
  content: '\25B6';
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: #60a5fa;
  font-size: 13px;
  pointer-events: none;
}

#marktpreis-james-btn {
  display: none;
}

/* Panel darf in der rechten Preview nicht abgeschnitten werden */
#preview-tab.preview-area {
  overflow-y: auto !important;
}

.marktpreis-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: move;
  user-select: none;
}

.marktpreis-panel.is-dragging {
  cursor: move;
}

.marktpreis-minimize-btn {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #9ca3af;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.marktpreis-minimize-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #f0f0f0;
}

/* Im minimierten Zustand Button verstecken (Tab-Bereich zeigt nur Pfeil) */
.marktpreis-panel.is-minimized .marktpreis-minimize-btn {
  display: none;
}

.marktpreis-title {
  font-weight: 600;
  font-size: 13px;
  color: #f0f0f0;
  flex: 1;
}

.marktpreis-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.marktpreis-badge.fresh {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.marktpreis-badge.stale_age {
  background: rgba(251, 146, 60, 0.2);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.3);
}

.marktpreis-badge.stale_changed {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.marktpreis-badge.no_data,
.marktpreis-badge.loading {
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.marktpreis-badge.analyzing {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.4);
  animation: marktpreis-badge-pulse 1.6s ease-in-out infinite;
}

@keyframes marktpreis-badge-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* Analysieren-Zustand */
.marktpreis-analyzing-box {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
}

.marktpreis-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(96, 165, 250, 0.15);
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: marktpreis-spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.marktpreis-analyzing-text {
  color: #93c5fd;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.marktpreis-analyzing-sub {
  color: #4b5563;
  font-size: 11px;
  text-align: center;
  line-height: 1.4;
}

.marktpreis-panel-body {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
}

.marktpreis-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
}

.marktpreis-row.full-width {
  grid-column: 1 / -1;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 4px;
  padding-top: 6px;
}

.marktpreis-label {
  color: #9ca3af;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.marktpreis-value {
  font-weight: 600;
  font-size: 13px;
  color: #f0f0f0;
}

.marktpreis-value.highlight {
  color: #fbbf24;
}

.marktpreis-meta-text {
  color: #6b7280;
  font-size: 11px;
}

.marktpreis-quellen-row {
  margin-top: 2px;
}

.marktpreis-quellen-links {
  font-size: 11px;
  color: #9ca3af;
  text-align: right;
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0;
}

.marktpreis-quelle-link {
  color: #60a5fa;
  text-decoration: none;
  white-space: nowrap;
}

.marktpreis-quelle-link:hover {
  text-decoration: underline;
  color: #93c5fd;
}

.marktpreis-quellen-sep {
  color: #4b5563;
}

.marktpreis-schaetzung-hinweis {
  color: #f59e0b;
  font-style: italic;
}

/* James-Kurzempfehlung */
.marktpreis-notiz-row {
  margin-top: 6px;
}

.marktpreis-notiz-box {
  width: 100%;
  background: rgba(96, 165, 250, 0.07);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-left: 3px solid #60a5fa;
  border-radius: 5px;
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.marktpreis-notiz-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #60a5fa;
}

.marktpreis-notiz-text {
  font-size: 11.5px;
  color: #cbd5e1;
  line-height: 1.5;
}

.marktpreis-empty {
  padding: 12px;
  color: #6b7280;
  font-style: italic;
  text-align: center;
  grid-column: 1 / -1;
}

.marktpreis-panel-footer {
  padding: 6px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: flex-end;
}

.marktpreis-refresh-btn {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s;
}

.marktpreis-refresh-btn:hover {
  background: rgba(96, 165, 250, 0.25);
}

.marktpreis-refresh-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* James-Volltext-Analyse */
.marktpreis-james-text {
  grid-column: 1 / -1;
  color: #cbd5e1;
  font-size: 12.5px;
  line-height: 1.65;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* KRITISCH: Panel NIEMALS drucken */
@media print {
  #marktpreis-overlay {
    display: none !important;
  }
}
