/* ==============================================
   KI-Guide Styles — Wolfgangs Prompting-Tipps
   Uses existing CSS variables from styles.css
   Dark mode compatible via CSS custom properties
   ============================================== */

/* Theme-adaptive color tokens */
:root {
  --tip-red: #e74c3c;
  --tip-red-bg: rgba(231, 76, 60, 0.08);
  --tip-green: #2ecc71;
  --tip-green-bg: rgba(46, 204, 113, 0.08);
  --tip-orange-border: rgba(230, 126, 34, 0.2);
  --tip-hover-bg: rgba(230, 126, 34, 0.08);
  --tip-dismiss-hover: rgba(0, 0, 0, 0.06);
}

/* Dark mode overrides */
.variant-4 {
  --tip-red: #ff6b6b;
  --tip-red-bg: rgba(255, 107, 107, 0.12);
  --tip-green: #51cf66;
  --tip-green-bg: rgba(81, 207, 102, 0.12);
  --tip-orange-border: rgba(230, 126, 34, 0.25);
  --tip-hover-bg: rgba(230, 126, 34, 0.1);
  --tip-dismiss-hover: rgba(255, 255, 255, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not(.variant-1):not(.variant-2):not(.variant-3):not(.variant-5) {
    --tip-red: #ff6b6b;
    --tip-red-bg: rgba(255, 107, 107, 0.12);
    --tip-green: #51cf66;
    --tip-green-bg: rgba(81, 207, 102, 0.12);
    --tip-orange-border: rgba(230, 126, 34, 0.25);
    --tip-hover-bg: rgba(230, 126, 34, 0.1);
    --tip-dismiss-hover: rgba(255, 255, 255, 0.08);
  }
}

/* --- Suggestion Card Inline Tip --- */
.suggestion-tip {
  margin-top: 12px;
  border-radius: var(--radius-md);
  background: var(--color-orange-light);
  border: 1px solid var(--tip-orange-border);
  overflow: hidden;
  transition: all 0.2s ease;
}

.suggestion-tip-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 0.85rem;
  text-align: left;
  transition: background 0.15s ease;
}

.suggestion-tip-toggle:hover {
  background: var(--tip-hover-bg);
}

.tip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  background: var(--color-orange);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.tip-title {
  flex: 1;
  font-weight: 500;
}

.tip-chevron {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.suggestion-tip-toggle[aria-expanded="true"] .tip-chevron {
  transform: rotate(180deg);
}

.suggestion-tip-detail {
  padding: 0 12px 12px;
  animation: tipSlideDown 0.2s ease;
}

.suggestion-tip-detail[hidden] {
  display: none;
}

@keyframes tipSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tip-description {
  font-size: 0.83rem;
  color: var(--text-secondary);
  margin: 0 0 8px;
  line-height: 1.5;
}

.tip-example {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tip-bad,
.tip-good {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.tip-bad {
  background: var(--tip-red-bg);
  border-left: 3px solid var(--tip-red);
  color: var(--text-secondary);
}

.tip-good {
  background: var(--tip-green-bg);
  border-left: 3px solid var(--tip-green);
  color: var(--text-primary);
}

.tip-bad::before {
  content: 'Vorher: ';
  font-weight: 600;
  color: var(--tip-red);
}

.tip-good::before {
  content: 'Nachher: ';
  font-weight: 600;
  color: var(--tip-green);
}

/* --- Post-Analysis Tip Banner --- */
.analysis-tip-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-left: 4px solid var(--color-orange);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  animation: bannerSlideIn 0.4s ease;
}

.analysis-tip-banner.hidden {
  display: none;
}

@keyframes bannerSlideIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tip-banner-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--color-orange);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.tip-banner-text {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.tip-banner-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 1.2rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.tip-banner-dismiss:hover {
  background: var(--tip-dismiss-hover);
  color: var(--text-primary);
}

/* --- Help Drawer: KI-Guide Tab --- */
.ki-guide-search {
  position: relative;
  margin-bottom: 16px;
}

.ki-guide-search input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ki-guide-search input:focus {
  outline: none;
  border-color: var(--color-orange);
  box-shadow: 0 0 0 3px var(--color-orange-light);
}

.ki-guide-search input::placeholder {
  color: var(--text-tertiary);
}

.ki-guide-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.ki-guide-results-info {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

/* Tier Accordions */
.ki-guide-tier {
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.ki-guide-tier:hover {
  border-color: var(--color-orange);
}

.ki-guide-tier-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary, var(--bg-primary));
  border: none;
  width: 100%;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s ease;
}

.ki-guide-tier-header:hover {
  background: var(--color-orange-light);
}

.ki-guide-tier-header[aria-expanded="true"] {
  border-bottom: 1px solid var(--border-color);
}

.ki-guide-tier-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ki-guide-tier-range {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-weight: 400;
}

.ki-guide-tier-chevron {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
  color: var(--text-tertiary);
}

.ki-guide-tier-header[aria-expanded="true"] .ki-guide-tier-chevron {
  transform: rotate(180deg);
}

.ki-guide-tier-content {
  padding: 8px;
}

.ki-guide-tier-content[hidden] {
  display: none;
}

/* Individual Tip Cards */
.ki-guide-tip-card {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
  cursor: default;
}

.ki-guide-tip-card:hover {
  background: var(--color-orange-light);
}

.ki-guide-tip-card.seen {
  opacity: 0.7;
}

.ki-guide-tip-number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  background: var(--color-orange);
  color: #fff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.ki-guide-tip-card.seen .ki-guide-tip-number {
  background: var(--text-tertiary);
}

.ki-guide-tip-body {
  flex: 1;
  min-width: 0;
}

.ki-guide-tip-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.ki-guide-tip-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.ki-guide-tip-example {
  margin-top: 8px;
  display: none;
}

.ki-guide-tip-card.expanded .ki-guide-tip-example {
  display: block;
  animation: tipSlideDown 0.2s ease;
}

.ki-guide-seen-check {
  color: var(--tip-green);
  font-size: 0.8rem;
  margin-left: 4px;
}

/* No results state */
.ki-guide-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-tertiary);
  font-size: 0.9rem;
}

/* --- Responsive: Mobile (375px+) --- */
@media (max-width: 640px) {
  .analysis-tip-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    position: relative;
    padding-right: 36px;
  }

  .tip-banner-dismiss {
    position: absolute;
    top: 8px;
    right: 8px;
  }

  .suggestion-tip-toggle {
    padding: 10px 12px;
  }

  .tip-example {
    gap: 8px;
  }

  .tip-bad,
  .tip-good {
    font-size: 0.78rem;
    padding: 6px 8px;
  }

  .ki-guide-tip-card {
    padding: 8px 10px;
  }

  .ki-guide-tier-header {
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .ki-guide-search input {
    font-size: 16px; /* Prevents iOS zoom on focus */
  }
}

/* Extra small screens */
@media (max-width: 375px) {
  .tip-badge {
    min-width: 24px;
    height: 20px;
    font-size: 0.7rem;
  }

  .ki-guide-tip-number {
    min-width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }

  .tip-banner-badge {
    font-size: 0.72rem;
    padding: 3px 8px;
  }
}
