/* 
   =====================================================
   VERBESSERTE MARKIERUNGS-PALETTE
   Bibel-Vergleich Pro v5.0
   =====================================================
*/

/* ==================== MARKIERUNGS-PALETTE ADVANCED ==================== */
.highlight-palette-advanced {
  position: absolute;
  background: var(--bg-primary, #0c1222);
  border: 1px solid var(--border, rgba(161, 180, 207, 0.12));
  border-radius: 12px;
  padding: 0;
  min-width: 360px;
  max-width: 400px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 30px rgba(79, 142, 255, 0.2);
  z-index: 10000;
  animation: paletteSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes paletteSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Header */
.palette-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary, #151d2e);
  border-bottom: 1px solid var(--border, rgba(161, 180, 207, 0.12));
  border-radius: 12px 12px 0 0;
}

.palette-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary, #f8fafc);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.palette-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary, #1e2a42);
  border: 1px solid var(--border, rgba(161, 180, 207, 0.12));
  border-radius: 8px;
  color: var(--text-secondary, #a1b4cf);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.palette-close:hover {
  background: var(--accent-danger, #ff6b6b);
  color: white;
  border-color: var(--accent-danger, #ff6b6b);
  transform: rotate(90deg);
}

/* Farbliste */
.palette-color-list {
  padding: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
}

.palette-color-list::-webkit-scrollbar {
  width: 8px;
}

.palette-color-list::-webkit-scrollbar-track {
  background: var(--bg-secondary, #151d2e);
}

.palette-color-list::-webkit-scrollbar-thumb {
  background: var(--bg-hover, #283551);
  border-radius: 4px;
}

/* Farbreihe */
.palette-color-row {
  display: grid;
  grid-template-columns: 44px 1fr 40px 36px;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  background: var(--bg-secondary, #151d2e);
  border: 1px solid var(--border, rgba(161, 180, 207, 0.12));
  border-radius: 10px;
  margin-bottom: 0.5rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.palette-color-row:hover {
  background: var(--bg-hover, #283551);
  border-color: var(--accent, #4f8eff);
  transform: translateX(2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Farbkreis */
.palette-color-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid var(--bg-primary, #0c1222);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3), inset 0 2px 4px rgba(255,255,255,0.1);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  flex-shrink: 0;
}

.palette-color-circle::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 1.2rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.2s;
}

.palette-color-circle:hover {
  transform: scale(1.15) rotate(5deg);
  border-color: var(--accent, #4f8eff);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 20px rgba(79, 142, 255, 0.3);
}

.palette-color-circle:hover::after {
  opacity: 1;
}

.palette-color-circle:active {
  transform: scale(1.05);
}

/* Label Container */
.palette-label-container {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 0;
}

.palette-label-name,
.palette-label-desc {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-tertiary, #1e2a42);
  border: 1px solid var(--border, rgba(161, 180, 207, 0.12));
  border-radius: 6px;
  color: var(--text-primary, #f8fafc);
  font-size: 0.9rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.palette-label-name {
  font-weight: 600;
}

.palette-label-desc {
  font-size: 0.8rem;
  color: var(--text-secondary, #a1b4cf);
}

.palette-label-name:focus,
.palette-label-desc:focus {
  outline: none;
  border-color: var(--accent, #4f8eff);
  background: var(--bg-hover, #283551);
  box-shadow: 0 0 0 3px rgba(79, 142, 255, 0.15);
}

.palette-label-name::placeholder,
.palette-label-desc::placeholder {
  color: var(--text-muted, #6b7d99);
  opacity: 0.6;
}

/* Farbwähler */
.palette-color-picker {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border, rgba(161, 180, 207, 0.12));
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.palette-color-picker:hover {
  border-color: var(--accent, #4f8eff);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.palette-color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.palette-color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}

/* Löschen-Button */
.palette-delete-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary, #1e2a42);
  border: 1px solid var(--border, rgba(161, 180, 207, 0.12));
  border-radius: 8px;
  color: var(--text-muted, #6b7d99);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.7;
}

.palette-delete-btn:hover {
  background: var(--accent-danger, #ff6b6b);
  border-color: var(--accent-danger, #ff6b6b);
  color: white;
  opacity: 1;
  transform: scale(1.1) rotate(-10deg);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

/* Neue Farbe Button */
.palette-add-btn {
  width: 100%;
  padding: 0.875rem 1rem;
  margin: 0.75rem 0.75rem 0.5rem;
  background: var(--bg-secondary, #151d2e);
  border: 2px dashed var(--accent, #4f8eff);
  border-radius: 10px;
  color: var(--accent, #4f8eff);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.palette-add-btn:hover {
  background: rgba(79, 142, 255, 0.15);
  border-style: solid;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 142, 255, 0.3);
}

.palette-add-btn:active {
  transform: translateY(0);
}

/* Entfernen Button */
.palette-remove-btn {
  width: 100%;
  padding: 0.875rem 1rem;
  margin: 0.5rem 0.75rem 0.75rem;
  background: var(--bg-secondary, #151d2e);
  border: 1px solid var(--border, rgba(161, 180, 207, 0.12));
  border-radius: 10px;
  color: var(--text-secondary, #a1b4cf);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.palette-remove-btn:hover {
  background: var(--accent-danger, #ff6b6b);
  border-color: var(--accent-danger, #ff6b6b);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.palette-remove-btn:active {
  transform: translateY(0);
}

/* ==================== HIGHLIGHT LABEL AM VERS ==================== */
.highlight-label {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: middle;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  animation: labelFadeIn 0.3s ease;
}

@keyframes labelFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==================== VERSE ROW MIT HIGHLIGHT ==================== */
.verse-row[data-highlight] {
  background: var(--highlight-color);
  border-left: 4px solid var(--highlight-color);
  padding-left: calc(0.5rem - 4px);
  transition: all 0.3s ease;
}

.verse-row[data-highlight]:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateX(2px);
}

/* ==================== RESPONSIVE: MOBILE ==================== */
@media (max-width: 768px) {
  .highlight-palette-advanced {
    position: fixed !important;
    bottom: 1rem !important;
    left: 1rem !important;
    right: 1rem !important;
    top: auto !important;
    min-width: auto;
    max-width: none;
    max-height: 70vh;
    border-radius: 16px;
  }

  .palette-color-list {
    max-height: calc(70vh - 180px);
  }

  .palette-color-row {
    grid-template-columns: 40px 1fr 36px;
    gap: 0.625rem;
    padding: 0.625rem;
  }

  .palette-color-circle {
    width: 40px;
    height: 40px;
  }

  .palette-color-picker {
    grid-column: 1 / -1;
    width: 100%;
    height: 36px;
    margin-top: 0.375rem;
  }

  .palette-delete-btn {
    width: 34px;
    height: 34px;
  }

  .palette-label-name,
  .palette-label-desc {
    padding: 0.5rem 0.625rem;
    font-size: 0.85rem;
  }

  .palette-add-btn,
  .palette-remove-btn {
    padding: 1rem;
    font-size: 0.95rem;
  }
}

/* ==================== RESPONSIVE: KLEINE HANDYS ==================== */
@media (max-width: 480px) {
  .palette-header {
    padding: 0.875rem 1rem;
  }

  .palette-title {
    font-size: 0.95rem;
  }

  .palette-color-row {
    grid-template-columns: 36px 1fr 32px;
    padding: 0.5rem;
  }

  .palette-color-circle {
    width: 36px;
    height: 36px;
  }

  .palette-delete-btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }
}

/* ==================== DARK/LIGHT THEME SUPPORT ==================== */
[data-theme="light"] .highlight-palette-advanced {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 12px 40px rgba(0,0,0,0.12), 0 0 30px rgba(37, 99, 235, 0.15);
}

[data-theme="light"] .palette-header {
  background: #f8fafc;
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .palette-color-row {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .palette-color-row:hover {
  background: #e8eef4;
  border-color: #2563eb;
}

[data-theme="light"] .palette-label-name,
[data-theme="light"] .palette-label-desc {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

[data-theme="light"] .palette-label-desc {
  color: #475569;
}

[data-theme="light"] .palette-label-name:focus,
[data-theme="light"] .palette-label-desc:focus {
  border-color: #2563eb;
  background: #f8fafc;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

[data-theme="light"] .palette-add-btn {
  background: #f8fafc;
  border-color: #2563eb;
  color: #2563eb;
}

[data-theme="light"] .palette-add-btn:hover {
  background: rgba(37, 99, 235, 0.1);
}

[data-theme="light"] .palette-remove-btn {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.08);
  color: #475569;
}

/* ==================== ACCESSIBILITY ==================== */
@media (prefers-reduced-motion: reduce) {
  .highlight-palette-advanced,
  .palette-color-circle,
  .palette-add-btn,
  .palette-remove-btn,
  .highlight-label,
  .verse-row[data-highlight] {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus-sichtbar für Tastaturnavigation */
.palette-color-circle:focus-visible,
.palette-label-name:focus-visible,
.palette-label-desc:focus-visible,
.palette-color-picker:focus-visible,
.palette-delete-btn:focus-visible,
.palette-add-btn:focus-visible,
.palette-remove-btn:focus-visible,
.palette-close:focus-visible {
  outline: 3px solid var(--accent, #4f8eff);
  outline-offset: 2px;
}
