/**
 * Chord Tooltip Styles
 * Desktop: Hover tooltips
 * Mobile: Click with backdrop
 */

/* Chord trigger */
.chord-tooltip-trigger {
    display: inline-block;
    color: #2563eb;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
}

.chord-tooltip-trigger:hover {
    background: #dbeafe;
    color: #1e40af;
}

.chord-tooltip-trigger:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.chord-tooltip-trigger:focus:not(:focus-visible) {
    outline: none;
}

/* Tooltip container */
.chord-tooltip {
    position: absolute;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.chord-tooltip.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Desktop tooltip */
@media (min-width: 768px) {
    .chord-tooltip {
        transform: translateY(8px);
    }
    
    .chord-tooltip.active {
        transform: translateY(0);
    }
    
    .chord-tooltip-content {
        background: white;
        border-radius: 12px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 
                    0 0 0 1px rgba(0, 0, 0, 0.05);
        padding: 12px;
        min-width: 200px;
        max-width: 300px;
    }
    
    .chord-tooltip-arrow {
        position: absolute;
        bottom: -6px;
        left: 50%;
        transform: translateX(-50%);
        width: 12px;
        height: 12px;
        background: white;
        border-right: 1px solid rgba(0, 0, 0, 0.05);
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        transform: translateX(-50%) rotate(45deg);
    }
}

/* Mobile tooltip */
@media (max-width: 767px) {
    .chord-tooltip {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) scale(0.9);
        max-width: 90vw;
    }
    
    .chord-tooltip.active {
        transform: translate(-50%, -50%) scale(1);
    }
    
    .chord-tooltip-content {
        background: white;
        border-radius: 16px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        padding: 20px;
        max-width: 90vw;
    }
    
    .chord-tooltip-arrow {
        display: none;
    }
}

/* Backdrop for mobile */
.chord-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.chord-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Tooltip header */
.chord-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.chord-tooltip-title {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.chord-tooltip-close {
    background: #f3f4f6;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 20px;
    line-height: 1;
    transition: all 0.2s ease;
}

.chord-tooltip-close:hover {
    background: #e5e7eb;
    color: #1f2937;
}

@media (max-width: 767px) {
    .chord-tooltip-close {
        display: flex;
    }
}

/* Tooltip image */
.chord-tooltip-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.chord-tooltip-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.chord-tooltip-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.chord-tooltip-error {
    text-align: center;
    padding: 20px;
    color: #dc2626;
    font-size: 14px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .chord-tooltip-trigger {
        border: 2px solid currentColor;
    }
    
    .chord-tooltip-content {
        border: 2px solid #000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .chord-tooltip-trigger,
    .chord-tooltip,
    .chord-backdrop,
    .chord-tooltip-close {
        transition: none;
    }
    
    .chord-tooltip-spinner {
        animation: none;
        border-top-color: transparent;
    }
}

/* Print styles */
@media print {
    .chord-tooltip {
        display: none !important;
    }
    
    .chord-tooltip-trigger {
        color: inherit;
        background: none;
    }
}