/* Grounding and Citations Styles */

/* Verified with Google Search Badge */
.grounding-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(34, 197, 94, 0.1);
    color: var(--color-success);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

/* Link icon that appears after grounded text (Gemini Style) */
.citation-link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 4px;
    color: #ffffff !important;
    background-color: rgba(95, 99, 104, 0.8);
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.citation-link-icon:hover,
.citation-link-icon.active {
    background-color: #5f6368;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .citation-link-icon:hover,
[data-theme="dark"] .citation-link-icon.active {
    background-color: #888b8d;
    /* Lighter gray for visibility in dark mode */
}

[data-theme="light"] .citation-link-icon {
    background-color: rgba(95, 99, 104, 0.7);
    border-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .citation-link-icon:hover,
[data-theme="light"] .citation-link-icon.active {
    background-color: #3c4043;
}

.citation-link-icon svg {
    width: 14px;
    height: 14px;
}

/* Grounded text highlight */
.grounded-text {
    border-radius: 4px;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.grounded-text.active {
    background-color: rgba(128, 128, 128, 0.15);
    box-shadow: 0 0 0 1px rgba(128, 128, 128, 0.1);
}

[data-theme="light"] .grounded-text.active {
    background-color: rgba(0, 0, 0, 0.05);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.03);
}

/* Hover preview tooltip */
.citation-hover-preview {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #1f1f1f;
    border: 1px solid #3f3f3f;
    border-radius: 8px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: 240px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
    pointer-events: none;
}

[data-theme="light"] .citation-hover-preview {
    background: #ffffff;
    border-color: #e0e0e0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.citation-hover-preview::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #1f1f1f transparent transparent transparent;
}

[data-theme="light"] .citation-hover-preview::after {
    border-color: #ffffff transparent transparent transparent;
}

.citation-link-icon:hover .citation-hover-preview {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.citation-preview-favicon {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    object-fit: contain;
    flex-shrink: 0;
}

.citation-preview-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.citation-preview-title {
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme="light"] .citation-preview-title {
    color: #1f1f1f;
}

.citation-preview-domain {
    font-size: 11px;
    color: #a0a0a0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme="light"] .citation-preview-domain {
    color: #666666;
}

/* Fallback for legacy citation markers if still present in some scripts */
.citation-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    color: white;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 700;
    cursor: pointer;
    vertical-align: super;
}