/**
 * Principia Metaphysica - Tooltip Styles
 * =======================================
 *
 * Styles for hoverable constant tooltips showing formula,
 * derivation, uncertainty, and experimental agreement.
 *
 * Copyright (c) 2025 Andrew Keith Watts. All rights reserved.
 */

/* Value elements that trigger tooltips */
.pm-value {
    color: #8b7fff;
    cursor: help;
    border-bottom: 1px dotted #8b7fff;
    transition: all 0.2s ease;
}

.pm-value:hover {
    color: #a99cff;
    border-bottom-color: #a99cff;
    background-color: rgba(139, 127, 255, 0.08);
}

/* Tooltip popup */
.pm-tooltip-popup {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #0f3460;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.1);
    max-width: 500px;
    min-width: 300px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #e0e0e0;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
    pointer-events: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pm-tooltip-content {
    padding: 16px;
}

/* Value header */
.pm-tooltip-value {
    font-size: 18px;
    font-weight: bold;
    color: #64ffda;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(100, 255, 218, 0.2);
}

/* Description */
.pm-tooltip-desc {
    color: #b0b0b0;
    margin-bottom: 8px;
    font-style: italic;
}

/* Formula */
.pm-tooltip-formula {
    background: rgba(139, 127, 255, 0.1);
    border-left: 3px solid #8b7fff;
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #b3aaff;
}

.pm-tooltip-formula em {
    color: #8b7fff;
    font-style: normal;
    font-weight: bold;
    margin-right: 8px;
}

/* Derivation */
.pm-tooltip-derivation {
    background: rgba(156, 39, 176, 0.1);
    border-left: 3px solid #9c27b0;
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 4px;
    color: #ce93d8;
}

.pm-tooltip-derivation em {
    color: #ba68c8;
    font-style: normal;
    font-weight: bold;
    margin-right: 8px;
}

/* Uncertainty */
.pm-tooltip-uncertainty {
    background: rgba(255, 152, 0, 0.1);
    border-left: 3px solid #ff9800;
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 4px;
    color: #ffb74d;
}

.pm-tooltip-uncertainty em {
    color: #ffa726;
    font-style: normal;
    font-weight: bold;
    margin-right: 8px;
}

/* Experimental value */
.pm-tooltip-experiment {
    background: rgba(76, 175, 80, 0.1);
    border-left: 3px solid #4caf50;
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 4px;
    color: #81c784;
}

.pm-tooltip-experiment em {
    color: #66bb6a;
    font-style: normal;
    font-weight: bold;
    margin-right: 8px;
}

/* Agreement (color-coded by sigma) */
.pm-tooltip-agreement {
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 4px;
    font-weight: bold;
}

.pm-tooltip-agreement em {
    font-style: normal;
    margin-right: 8px;
}

/* Testability info */
.pm-tooltip-testable {
    background: rgba(255, 193, 7, 0.1);
    border-left: 3px solid #ffc107;
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 4px;
    color: #ffd54f;
}

.pm-tooltip-testable em {
    color: #ffca28;
    font-style: normal;
    font-weight: bold;
    margin-right: 8px;
}

/* Source traceability */
.pm-tooltip-source {
    background: rgba(158, 158, 158, 0.1);
    border-left: 3px solid #9e9e9e;
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 4px;
    color: #bdbdbd;
    font-size: 12px;
}

.pm-tooltip-source em {
    color: #e0e0e0;
    font-style: normal;
    font-weight: bold;
    margin-right: 8px;
}

.pm-tooltip-source code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #64ffda;
}

/* References */
.pm-tooltip-refs {
    background: rgba(103, 58, 183, 0.1);
    border-left: 3px solid #673ab7;
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 4px;
    color: #b39ddb;
    font-size: 12px;
}

.pm-tooltip-refs em {
    color: #9575cd;
    font-style: normal;
    font-weight: bold;
    margin-right: 8px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .pm-tooltip-popup {
        max-width: 90vw;
        min-width: 250px;
        font-size: 12px;
        /* Fix positioning on mobile - center in viewport */
        position: fixed !important;
        left: 5vw !important;
        right: 5vw !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 90vw !important;
        z-index: 100000 !important;
        pointer-events: auto; /* Allow interaction on mobile */
    }

    .pm-tooltip-value {
        font-size: 16px;
    }

    /* Touch-friendly PM values */
    .pm-value {
        padding: 4px 2px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* Touch device specific (no hover capability) */
@media (hover: none) and (pointer: coarse) {
    .pm-tooltip-popup {
        /* Ensure tooltip is centered and visible on touch */
        position: fixed !important;
        left: 5% !important;
        right: 5% !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 90% !important;
        max-width: 90vw !important;
        z-index: 100000 !important;
        pointer-events: auto;
    }

    .pm-value {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(139, 127, 255, 0.3);
    }
}

/* Print styles - hide tooltips when printing */
@media print {
    .pm-tooltip-popup {
        display: none !important;
    }

    .pm-value {
        color: inherit;
        border-bottom: none;
        cursor: text;
    }
}
