/* ================================================
   Smart Auto Linker — Tooltip Styles
   ================================================ */

.sal-link {
    color: var(--sal-link-color, #2563eb);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.sal-link:hover {
    color: var(--sal-link-hover, #1d4ed8);
    text-decoration-style: solid;
}

/* Tooltip Card */
.sal-tooltip-card {
    position: fixed;
    z-index: 9999;
    width: 300px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.07);
    overflow: hidden;
    opacity: 0;
    transform: translateY(6px) scale(0.97);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.sal-tooltip-card.sal-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.sal-tooltip-card.sal-above {
    transform-origin: bottom center;
}

.sal-tooltip-card.sal-below {
    transform-origin: top center;
}

/* Arrow */
.sal-tooltip-card::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
}

.sal-tooltip-card.sal-below::before {
    top: -7px;
    border-bottom: 7px solid #ffffff;
    filter: drop-shadow(0 -2px 2px rgba(0,0,0,0.06));
}

.sal-tooltip-card.sal-above::before {
    bottom: -7px;
    border-top: 7px solid #ffffff;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.06));
}

/* Thumbnail */
.sal-tooltip-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.sal-tooltip-thumb-placeholder {
    width: 100%;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

/* Content Area */
.sal-tooltip-body {
    padding: 14px 16px 16px;
}

.sal-tooltip-category {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #6366f1;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sal-tooltip-category::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
}

.sal-tooltip-title {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    line-height: 1.4;
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sal-tooltip-excerpt {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sal-tooltip-cta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    background: #eff6ff;
    padding: 5px 10px;
    border-radius: 20px;
    transition: background 0.2s, color 0.2s;
}

.sal-tooltip-cta:hover {
    background: #2563eb;
    color: #ffffff;
}

.sal-tooltip-cta svg {
    width: 11px;
    height: 11px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Loading skeleton */
.sal-tooltip-loading {
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sal-skel {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: sal-shimmer 1.2s infinite;
    border-radius: 4px;
}

.sal-skel-line { height: 10px; }
.sal-skel-title { height: 14px; width: 80%; }
.sal-skel-text  { height: 10px; }
.sal-skel-text:last-child { width: 60%; }

@keyframes sal-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .sal-tooltip-card {
        background: #1f2937;
        border-color: rgba(255,255,255,0.08);
        box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    }
    .sal-tooltip-card.sal-below::before { border-bottom-color: #1f2937; }
    .sal-tooltip-card.sal-above::before { border-top-color: #1f2937; }
    .sal-tooltip-title   { color: #f9fafb; }
    .sal-tooltip-excerpt { color: #9ca3af; }
    .sal-skel { background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%); background-size: 200% 100%; }
    .sal-tooltip-cta { background: rgba(37,99,235,0.2); }
    .sal-tooltip-cta:hover { background: #2563eb; color: #fff; }
}

/* Mobile: disable tooltip on touch */
@media (hover: none) {
    .sal-tooltip-card { display: none !important; }
}
