/**
 * MOL-GOD v3.1.0 — Confidence Badge styles
 * 4 tiers + 3 statuses + tooltip + accessibility
 */

.molgod-confidence-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1.2;
    border: 2px solid;
    cursor: help;
    position: relative;
    vertical-align: middle;
    margin-left: 6px;
    transition: all 0.2s ease;
}

.molgod-confidence-badge:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.15); }

.molgod-confidence-badge .badge-icon { font-size: 12px; line-height: 1; }
.molgod-confidence-badge .badge-text { line-height: 1; }

/* TIER COLORS */
.molgod-confidence-production    { background: #d4edda; color: #155724; border-color: #27ae60; }
.molgod-confidence-acceptable    { background: #fff3cd; color: #856404; border-color: #f39c12; }
.molgod-confidence-refinement    { background: #ffe5d0; color: #803d12; border-color: #e67e22; }
.molgod-confidence-not_for_use   { background: #f8d7da; color: #721c24; border-color: #e74c3c; }
.molgod-confidence-unknown       { background: #ecf0f1; color: #555;    border-color: #95a5a6; }
.molgod-confidence-verified      { background: #d4eaf7; color: #0c5460; border-color: #3498db; }
.molgod-confidence-cross_ref     { background: #e8d5f2; color: #4a235a; border-color: #9b59b6; }

/* SIZES */
.molgod-confidence-size-small  { padding: 2px 6px; font-size: 10px; }
.molgod-confidence-size-medium { padding: 3px 8px; font-size: 11px; }
.molgod-confidence-size-large  { padding: 6px 14px; font-size: 14px; border-width: 3px; }

/* CORNER POSITION (per accordion) */
.molgod-confidence-pos-corner {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
}

/* TOOLTIP */
.molgod-confidence-badge .badge-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    max-width: 90vw;
    padding: 12px 14px;
    background: #2c3e50;
    color: white;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 9999;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.molgod-confidence-badge:hover .badge-tooltip,
.molgod-confidence-badge:focus .badge-tooltip {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.molgod-confidence-badge .badge-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #2c3e50 transparent transparent transparent;
}

.badge-sources {
    margin: 8px 0 0 0;
    padding: 0 0 0 18px;
    list-style-type: none;
    font-size: 11px;
}
.badge-sources li {
    margin: 3px 0;
    padding-left: 4px;
    line-height: 1.4;
}
.badge-sources a {
    color: #74c0fc;
    text-decoration: underline;
}
.badge-sources a:hover { color: #a5d8ff; }
.badge-sources code {
    background: rgba(255,255,255,0.15);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 10px;
}

/* MASTER badge na produkcie */
.molgod-confidence-master {
    display: block;
    padding: 12px 18px;
    margin: 16px 0;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    border-width: 3px;
}

/* ECHA reference block */
.molgod-echa-block {
    margin: 16px 0;
    padding: 14px 16px;
    background: #f0f8ff;
    border-left: 5px solid #1e88e5;
    border-radius: 6px;
}
.molgod-echa-block h4 { margin: 0 0 10px 0; color: #0d47a1; font-size: 16px; }
.molgod-echa-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.molgod-echa-table td { padding: 6px 8px; border-bottom: 1px solid #e3f2fd; font-size: 13px; }
.molgod-echa-table td code { background: #fff; padding: 2px 6px; border-radius: 3px; font-family: monospace; }
.molgod-echa-source { margin: 8px 0 0 0; font-size: 12px; color: #555; }
.molgod-echa-unavailable { background: #fff3cd; border-left-color: #f39c12; }
.molgod-svhc-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e74c3c;
    color: white;
    font-weight: 700;
    border-radius: 4px;
    margin-top: 8px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .molgod-confidence-badge { border-width: 3px; }
    .molgod-confidence-badge .badge-tooltip { background: black; border: 2px solid white; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .molgod-confidence-badge,
    .molgod-confidence-badge .badge-tooltip { transition: none; }
}

/* Print */
@media print {
    .molgod-confidence-badge .badge-tooltip { display: none !important; }
    .molgod-confidence-badge {
        border: 1px solid #000 !important;
        background: white !important;
        color: black !important;
    }
}
