/**
 * @file
 * CSS for the Melchior cross-page highlighting functionality.
 */

/* Highlight styles */
.melchior-highlighted {
  background-color: rgba(255, 0, 121, 0.15);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 0, 121, 0.2);
  padding: 0 2px;
  margin: 0 -2px;
  color: inherit;
  transition: background-color 0.3s ease;
}

/* Hover effects for highlights */
.melchior-highlighted:hover {
  background-color: rgba(255, 0, 121, 0.25);
}

/* Different match types can have subtle variations */
.melchior-highlighted[data-match-type="exact"] {
  background-color: rgba(255, 0, 121, 0.2);
}

.melchior-highlighted[data-match-type="markdown"] {
  background-color: rgba(255, 0, 121, 0.18);
}

.melchior-highlighted[data-match-type="fuzzy"] {
  background-color: rgba(255, 0, 121, 0.15);
  border-bottom: 1px dashed rgba(255, 0, 121, 0.3);
}

.melchior-highlighted[data-match-type="heading"] {
  background-color: rgba(255, 0, 121, 0.13);
}

.melchior-highlighted[data-match-type="keyword"] {
  background-color: rgba(255, 0, 121, 0.1);
  border-bottom: 1px dotted rgba(255, 0, 121, 0.25);
}

/* Notification banner */
.melchior-highlight-notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: auto;
  max-width: 80%;
  min-width: 300px;
  padding: 0;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: opacity 0.5s ease, transform 0.5s ease;
  font-size: 0.9rem;
}

.melchior-highlight-notification__content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}

.melchior-highlight-notification__message {
  margin-right: 16px;
  flex: 1;
}

.melchior-highlight-notification__close {
  background: none;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  padding: 0;
  height: 24px;
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  border-radius: 50%;
}

.melchior-highlight-notification__close:hover {
  opacity: 1;
  background-color: rgba(0, 0, 0, 0.05);
}

.melchior-highlight-notification__close:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Notification types */
.melchior-highlight-notification--success {
  background-color: #f0f9eb;
  border: 1px solid #e1f3d8;
  color: #67c23a;
}

.melchior-highlight-notification--warning {
  background-color: #fdf6ec;
  border: 1px solid #faecd8;
  color: #e6a23c;
}

.melchior-highlight-notification--error {
  background-color: #fef0f0;
  border: 1px solid #fde2e2;
  color: #f56c6c;
}

/* Notification hiding animation */
.melchior-highlight-notification--hiding {
  opacity: 0;
  transform: translateX(-50%) translateY(-20px);
}

/* Accessibility focus styles */
.melchior-highlighted:focus,
.melchior-highlighted:focus-visible {
  outline: 2px solid #2196F3;
  outline-offset: 2px;
}

/* Animation for the scroll target highlight */
@keyframes pulse-highlight {
  0% {
    box-shadow: 0 0 0 2px rgba(255, 0, 121, 0.4);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(255, 0, 121, 0.25);
  }
  100% {
    box-shadow: 0 0 0 2px rgba(255, 0, 121, 0.4);
  }
}

/* Visual indicator for the element being scrolled to */
.melchior-highlight-scroll-target {
  animation: pulse-highlight 1.5s ease-in-out;
  animation-iteration-count: 2;
  position: relative;
  z-index: 10;
}

/* Ensure highlighting works in various content contexts */
.content .melchior-highlighted,
article .melchior-highlighted,
.node .melchior-highlighted,
.field .melchior-highlighted {
  display: inline;
}

/* Ensure highlighted elements don't break layouts */
h1 .melchior-highlighted,
h2 .melchior-highlighted,
h3 .melchior-highlighted,
h4 .melchior-highlighted,
h5 .melchior-highlighted,
h6 .melchior-highlighted {
  display: inline;
  padding-top: 0;
  padding-bottom: 0;
}

/* Media queries for responsive notifications */
@media (max-width: 768px) {
  .melchior-highlight-notification {
    width: 90%;
    min-width: unset;
    max-width: 90%;
  }
}

/* Print styles - make highlights visible but not too intrusive */
@media print {
  .melchior-highlighted {
    background-color: transparent !important;
    box-shadow: none !important;
    border-bottom: 1px dotted #888 !important;
  }
  
  .melchior-highlight-notification {
    display: none !important;
  }
}