/**
 * Responsive Accessible Popovers CSS
 */

/* Tooltip-Definitionen verstecken */
.tooltip-definitions {
  display: none !important;
}

/* Tooltip Trigger (das "i" Icon) */
.tooltip-trigger {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  border: none;
  background: var(--teal-100);
}

/* Hover nur auf Desktop */
@media (hover: hover) {
  .tooltip-trigger:hover {
    background-color: rgba(0, 0, 0, 0.1);
  }
}

/* Focus Styles für Keyboard Navigation */
.tooltip-trigger:focus {
  outline: 2px solid #005fcc;
  outline-offset: 2px;
  border-radius: 3px;
}

/* Touch Feedback für Mobile */
.tooltip-trigger:active {
  background-color: rgba(0, 0, 0, 0.15);
}

/* Das Popover selbst */
.responsive-popover {
  position: absolute;
  background: white;
  border-radius: 8px;
  box-shadow: 10px 10px 1px 0px rgba(0,0,0,0.3)!important;
  padding: 1rem;
  max-width: 350px;
  z-index: 1000;
  padding: 1.5em 1.5em;
  line-height: 1.5;
  border: 3px solid #000;
  
  /* Animation */
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

/* Popover sichtbar */
.responsive-popover[aria-hidden="false"] {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Popover Inhalt */
.popover-content {
  /* Reset für saubere Darstellung */
}

.popover-content h3 {
  margin: 0 0 0.5rem 0;
  font-size: 16px;
  font-weight: 600;
}

.popover-content p {
  margin: 0 0 0.75rem 0;
}

.popover-content p:last-child {
  margin-bottom: 0;
}

.popover-content a {
  color: var(--teal-300);
  text-decoration: underline;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.popover-content a:hover {
  color: var(--teal-500);
}

.popover-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 0.5rem 0;
}

/* Schließen Button */
.popover-close {
  position: absolute;
  top: -12px;
  right: -12px;
  background-color: white;
  border: none;
  color: #000;
  font-size: 1.4em;
  font-weight:600;
  line-height: 1;
  cursor: pointer;
  z-index: 110;
  padding: 0.3em 0.5em;
  border-radius: 50%;
  transition: background-color 0.15s;
  outline: 3px solid #000;
}

.popover-close:hover {
  background: #000;
  color: white;
}

.popover-close:focus {
  outline: 2px solid var(--teal-700);
  outline-offset: 1px;
}

/* Popover Pfeil */
.popover-arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: white;
  border: 3px solid rgba(0, 0, 0, 1);
  transform: rotate(45deg);
  z-index: -1;
}

/* Pfeil Positionen je nach Placement */
.responsive-popover[data-placement^='top'] .popover-arrow {
  bottom: -8px;
  border-top: none;
  border-left: none;
}

.responsive-popover[data-placement^='bottom'] .popover-arrow {
  top: -8px;
  border-bottom: none;
  border-right: none;
}

.responsive-popover[data-placement^='left'] .popover-arrow {
  right: -8px;
  border-left: none;
  border-bottom: none;
}

.responsive-popover[data-placement^='right'] .popover-arrow {
  left: -8px;
  border-right: none;
  border-top: none;
}

/* Tablet Anpassungen */
@media (max-width: 768px) {
  .responsive-popover {
    max-width: 90vw;
    font-size: 16px; /* Verhindert iOS Zoom */
    padding: 1.25rem;
  }
  
  .tooltip-trigger {
    padding: 6px 8px;
    min-width: 32px;
    min-height: 32px;
  }
}

/* Mobile Anpassungen */
@media (max-width: 480px) {
  .responsive-popover {
    max-width: 95vw;
    max-height: 70vh;
    overflow-y: auto;
    font-size: 16px;
    padding: 1.5rem;
  }
  
  .tooltip-trigger {
    padding: 8px;
    min-width: 36px;
    min-height: 36px;
  }
  
  .popover-content h3 {
    font-size: 18px;
  }
  
  .popover-close {
    top: 12px;
    right: 12px;
    font-size: 20px;
  }
}