/**
 * Modern Tooltip Styles (Tippy.js)
 * ClickUp-Inspired Tooltips & Popovers
 * Version 2.0 - December 2025
 */

/* ========================================
   MODERN THEME (Default)
   ======================================== */

.tippy-box[data-theme~='modern'] {
  background-color: var(--color-gray-900);
  color: white;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  box-shadow: var(--shadow-lg);
  line-height: var(--leading-normal);
}

.tippy-box[data-theme~='modern'][data-placement^='top'] > .tippy-arrow::before {
  border-top-color: var(--color-gray-900);
}

.tippy-box[data-theme~='modern'][data-placement^='bottom'] > .tippy-arrow::before {
  border-bottom-color: var(--color-gray-900);
}

.tippy-box[data-theme~='modern'][data-placement^='left'] > .tippy-arrow::before {
  border-left-color: var(--color-gray-900);
}

.tippy-box[data-theme~='modern'][data-placement^='right'] > .tippy-arrow::before {
  border-right-color: var(--color-gray-900);
}

/* Dark Mode Adjustments */
.dark .tippy-box[data-theme~='modern'] {
  background-color: var(--dark-bg-tertiary);
  color: var(--dark-text-primary);
  border: 1px solid var(--dark-border);
}

.dark .tippy-box[data-theme~='modern'][data-placement^='top'] > .tippy-arrow::before {
  border-top-color: var(--dark-bg-tertiary);
}

.dark .tippy-box[data-theme~='modern'][data-placement^='bottom'] > .tippy-arrow::before {
  border-bottom-color: var(--dark-bg-tertiary);
}

.dark .tippy-box[data-theme~='modern'][data-placement^='left'] > .tippy-arrow::before {
  border-left-color: var(--dark-bg-tertiary);
}

.dark .tippy-box[data-theme~='modern'][data-placement^='right'] > .tippy-arrow::before {
  border-right-color: var(--dark-bg-tertiary);
}

/* ========================================
   LIGHT THEME
   ======================================== */

.tippy-box[data-theme~='light'] {
  background-color: white;
  color: var(--color-gray-900);
  border: 1px solid var(--color-gray-200);
  box-shadow: var(--shadow-xl);
}

.tippy-box[data-theme~='light'][data-placement^='top'] > .tippy-arrow::before {
  border-top-color: white;
}

.tippy-box[data-theme~='light'][data-placement^='bottom'] > .tippy-arrow::before {
  border-bottom-color: white;
}

.tippy-box[data-theme~='light'][data-placement^='left'] > .tippy-arrow::before {
  border-left-color: white;
}

.tippy-box[data-theme~='light'][data-placement^='right'] > .tippy-arrow::before {
  border-right-color: white;
}

/* ========================================
   SEMANTIC THEMES
   ======================================== */

/* Primary Theme */
.tippy-box[data-theme~='primary'] {
  background-color: var(--color-primary);
  color: white;
}

.tippy-box[data-theme~='primary'][data-placement^='top'] > .tippy-arrow::before {
  border-top-color: var(--color-primary);
}

.tippy-box[data-theme~='primary'][data-placement^='bottom'] > .tippy-arrow::before {
  border-bottom-color: var(--color-primary);
}

.tippy-box[data-theme~='primary'][data-placement^='left'] > .tippy-arrow::before {
  border-left-color: var(--color-primary);
}

.tippy-box[data-theme~='primary'][data-placement^='right'] > .tippy-arrow::before {
  border-right-color: var(--color-primary);
}

/* Success Theme */
.tippy-box[data-theme~='success'] {
  background-color: var(--color-success);
  color: white;
}

.tippy-box[data-theme~='success'][data-placement^='top'] > .tippy-arrow::before {
  border-top-color: var(--color-success);
}

.tippy-box[data-theme~='success'][data-placement^='bottom'] > .tippy-arrow::before {
  border-bottom-color: var(--color-success);
}

.tippy-box[data-theme~='success'][data-placement^='left'] > .tippy-arrow::before {
  border-left-color: var(--color-success);
}

.tippy-box[data-theme~='success'][data-placement^='right'] > .tippy-arrow::before {
  border-right-color: var(--color-success);
}

/* Warning Theme */
.tippy-box[data-theme~='warning'] {
  background-color: var(--color-warning);
  color: white;
}

.tippy-box[data-theme~='warning'][data-placement^='top'] > .tippy-arrow::before {
  border-top-color: var(--color-warning);
}

.tippy-box[data-theme~='warning'][data-placement^='bottom'] > .tippy-arrow::before {
  border-bottom-color: var(--color-warning);
}

.tippy-box[data-theme~='warning'][data-placement^='left'] > .tippy-arrow::before {
  border-left-color: var(--color-warning);
}

.tippy-box[data-theme~='warning'][data-placement^='right'] > .tippy-arrow::before {
  border-right-color: var(--color-warning);
}

/* Danger Theme */
.tippy-box[data-theme~='danger'] {
  background-color: var(--color-danger);
  color: white;
}

.tippy-box[data-theme~='danger'][data-placement^='top'] > .tippy-arrow::before {
  border-top-color: var(--color-danger);
}

.tippy-box[data-theme~='danger'][data-placement^='bottom'] > .tippy-arrow::before {
  border-bottom-color: var(--color-danger);
}

.tippy-box[data-theme~='danger'][data-placement^='left'] > .tippy-arrow::before {
  border-left-color: var(--color-danger);
}

.tippy-box[data-theme~='danger'][data-placement^='right'] > .tippy-arrow::before {
  border-right-color: var(--color-danger);
}

/* Info Theme */
.tippy-box[data-theme~='info'] {
  background-color: var(--color-info);
  color: white;
}

.tippy-box[data-theme~='info'][data-placement^='top'] > .tippy-arrow::before {
  border-top-color: var(--color-info);
}

.tippy-box[data-theme~='info'][data-placement^='bottom'] > .tippy-arrow::before {
  border-bottom-color: var(--color-info);
}

.tippy-box[data-theme~='info'][data-placement^='left'] > .tippy-arrow::before {
  border-left-color: var(--color-info);
}

.tippy-box[data-theme~='info'][data-placement^='right'] > .tippy-arrow::before {
  border-right-color: var(--color-info);
}

/* ========================================
   TOOLTIP CONTENT ENHANCEMENTS
   ======================================== */

/* Tooltip with Icon */
.tooltip-content {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.tooltip-icon {
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.tooltip-text {
  flex: 1;
}

/* Tooltip with Title & Description */
.tooltip-title {
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-1);
  font-size: var(--text-sm);
}

.tooltip-description {
  font-size: var(--text-xs);
  opacity: 0.9;
  line-height: var(--leading-relaxed);
}

/* Keyboard Shortcut in Tooltip */
.tooltip-shortcut {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: var(--space-2);
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: var(--font-semibold);
}

/* ========================================
   POPOVER STYLES
   ======================================== */

.tippy-box[data-popover] {
  max-width: 400px;
  padding: var(--space-4);
}

.popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.popover-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  margin: 0;
}

.popover-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  background: transparent;
  border: none;
  color: inherit;
  padding: 0;
}

.popover-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.popover-body {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.popover-footer {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ========================================
   ANIMATIONS
   ======================================== */

/* Shift Away Animation (Default) */
.tippy-box[data-animation='shift-away'][data-state='hidden'] {
  opacity: 0;
}

.tippy-box[data-animation='shift-away'][data-state='hidden'][data-placement^='top'] {
  transform: translateY(10px);
}

.tippy-box[data-animation='shift-away'][data-state='hidden'][data-placement^='bottom'] {
  transform: translateY(-10px);
}

.tippy-box[data-animation='shift-away'][data-state='hidden'][data-placement^='left'] {
  transform: translateX(10px);
}

.tippy-box[data-animation='shift-away'][data-state='hidden'][data-placement^='right'] {
  transform: translateX(-10px);
}

/* Scale Animation */
.tippy-box[data-animation='scale'] {
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1), opacity 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.tippy-box[data-animation='scale'][data-state='hidden'] {
  opacity: 0;
  transform: scale(0.8);
}

/* Perspective Animation */
.tippy-box[data-animation='perspective'] {
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1), opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.tippy-box[data-animation='perspective'][data-state='hidden'] {
  opacity: 0;
  transform: perspective(700px) rotateX(60deg);
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  .tippy-box {
    transition: none !important;
  }
  
  .tippy-box[data-animation='shift-away'][data-state='hidden'],
  .tippy-box[data-animation='scale'][data-state='hidden'],
  .tippy-box[data-animation='perspective'][data-state='hidden'] {
    transform: none !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .tippy-box {
    border: 2px solid currentColor;
  }
}

/* ========================================
   RESPONSIVE BEHAVIOR
   ======================================== */

@media (max-width: 768px) {
  .tippy-box {
    max-width: 90vw !important;
  }
  
  .tippy-box[data-popover] {
    max-width: 90vw !important;
  }
}
