/* Auto-Linking Styles */

/* Base auto-link styling */
.auto-link {
    color: #3b82f6; /* Blue-500 */
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease-in-out;
    position: relative;
    font-weight: 500;
}

.auto-link:hover {
    color: #1d4ed8; /* Blue-700 */
    border-bottom-color: #3b82f6;
    text-decoration: none;
}

/* Different styles for different link types */
.auto-link-glossary {
    color: #7c3aed; /* Violet-600 */
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(139, 92, 246, 0.1));
    padding: 0 2px;
    border-radius: 2px;
}

.auto-link-glossary:hover {
    color: #5b21b6; /* Violet-800 */
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(139, 92, 246, 0.15));
}

.auto-link-atlas-company {
    color: #dc2626; /* Red-600 */
    background: rgba(239, 68, 68, 0.1);
    padding: 0 2px;
    border-radius: 2px;
}

.auto-link-atlas-company:hover {
    color: #991b1b; /* Red-800 */
    background: rgba(239, 68, 68, 0.15);
}

.auto-link-atlas-model {
    color: #059669; /* Emerald-600 */
    background: rgba(16, 185, 129, 0.1);
    padding: 0 2px;
    border-radius: 2px;
}

.auto-link-atlas-model:hover {
    color: #047857; /* Emerald-800 */
    background: rgba(16, 185, 129, 0.15);
}

.auto-link-atlas-tool {
    color: #d97706; /* Amber-600 */
    background: rgba(245, 158, 11, 0.1);
    padding: 0 2px;
    border-radius: 2px;
}

.auto-link-atlas-tool:hover {
    color: #92400e; /* Amber-800 */
    background: rgba(245, 158, 11, 0.15);
}

.auto-link-atlas-location {
    color: #0891b2; /* Cyan-600 */
    background: rgba(8, 145, 178, 0.1);
    padding: 0 2px;
    border-radius: 2px;
}

.auto-link-atlas-location:hover {
    color: #0e7490; /* Cyan-800 */
    background: rgba(8, 145, 178, 0.15);
}

.auto-link-blog-post {
    color: #7c2d12; /* Orange-900 */
    background: rgba(234, 88, 12, 0.1);
    padding: 0 2px;
    border-radius: 2px;
}

.auto-link-blog-post:hover {
    color: #9a3412; /* Orange-800 */
    background: rgba(234, 88, 12, 0.15);
}

.auto-link-external {
    color: #4b5563; /* Gray-600 */
    background: rgba(107, 114, 128, 0.1);
    padding: 0 2px;
    border-radius: 2px;
}

.auto-link-external:hover {
    color: #374151; /* Gray-700 */
    background: rgba(107, 114, 128, 0.15);
}

/* External link icon */
.auto-link-external::after {
    content: "↗";
    font-size: 0.75em;
    margin-left: 2px;
    opacity: 0.7;
}

/* Tooltip styling for links with descriptions */
.auto-link.has-tooltip {
    cursor: help;
}

.auto-link.has-tooltip:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937; /* Gray-800 */
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 400;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    pointer-events: none;
    animation: tooltip-fade-in 0.2s ease-out;
    max-width: 300px;
    white-space: normal;
}

.auto-link.has-tooltip:hover::before {
    content: "";
    position: absolute;
    bottom: 95%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1f2937; /* Gray-800 */
    z-index: 1001;
    pointer-events: none;
    animation: tooltip-fade-in 0.2s ease-out;
}

@keyframes tooltip-fade-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .auto-link {
        padding: 0 1px;
        font-size: 0.95em;
    }
    
    .auto-link.has-tooltip:hover::after {
        max-width: 250px;
        font-size: 0.8rem;
        padding: 6px 10px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .auto-link-glossary {
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(167, 139, 250, 0.2));
    }
    
    .auto-link-atlas-company {
        background: rgba(248, 113, 113, 0.2);
    }
    
    .auto-link-atlas-model {
        background: rgba(52, 211, 153, 0.2);
    }
    
    .auto-link-atlas-tool {
        background: rgba(251, 191, 36, 0.2);
    }
    
    .auto-link-atlas-location {
        background: rgba(34, 211, 238, 0.2);
    }
    
    .auto-link-blog-post {
        background: rgba(251, 146, 60, 0.2);
    }
    
    .auto-link-external {
        background: rgba(156, 163, 175, 0.2);
    }
}

/* Print styles - remove backgrounds and fancy styling */
@media print {
    .auto-link,
    .auto-link-glossary,
    .auto-link-atlas-company,
    .auto-link-atlas-model,
    .auto-link-atlas-tool,
    .auto-link-atlas-location,
    .auto-link-blog-post,
    .auto-link-external {
        background: none !important;
        color: #000 !important;
        text-decoration: underline !important;
        padding: 0 !important;
    }
    
    .auto-link-external::after {
        display: none;
    }
}