/**
 * Copyright (c) 2026 DNA Genics, S.L. All rights reserved.
 *
 * AI Portrait Disclosure - Shared Styles.
 * Styling for the clickable AI marker, container chip, and shared modal auto-attached to
 * every AI-generated ancient-sample portrait by wwwroot/js/shared/ai-portrait-disclosure.js.
 * See ".cursorrules" section "AI Analysis Legal Disclaimer (MANDATORY)" (subsection
 * "AI-Generated Images and Portraits") and "docs/legal/ai-content-disclaimers.md".
 *
 * The marker/chip are appended as new children of an existing element (never wrapping the
 * <img>), so they must never affect the host's layout, flow, or sizing: both are always
 * `position: absolute`, out of normal flow. No entrance animation is used, per the
 * "Section and Element Fade-In (Forbidden)" rule; the modal uses transform motion only.
 */

/* ========================================
   Corner marker (portraits ~72px or larger)
   ======================================== */

.dnai-marker {
    position: absolute;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: rgba(20, 18, 14, 0.72);
    color: #f4e3b8;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.dnai-marker:hover,
.dnai-marker:focus-visible {
    background: rgba(20, 18, 14, 0.92);
    border-color: #f4e3b8;
    transform: scale(1.12);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
    outline: none;
}

.dnai-marker:focus-visible {
    outline: 2px solid #f4e3b8;
    outline-offset: 2px;
}

/* Larger portraits (hero-sized) get a slightly bigger, more legible marker. */
.dnai-marker--lg {
    width: 26px;
    height: 26px;
    font-size: 10px;
}

/* ========================================
   Container chip (small thumbnails: tooltips, timelines, table cells)
   ======================================== */

.dnai-chip {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(20, 18, 14, 0.72);
    color: #f4e3b8;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.dnai-chip:hover,
.dnai-chip:focus-visible {
    background: rgba(20, 18, 14, 0.92);
    border-color: #f4e3b8;
    outline: none;
}

.dnai-chip:focus-visible {
    outline: 2px solid #f4e3b8;
    outline-offset: 2px;
}

.dnai-chip__dot {
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Inline text-only variant for narrow popup roots (Leaflet tooltips/popups) where an
   absolutely positioned pill would overflow the popup bounds. Rendered in normal flow as
   the popup's own last line, not absolutely positioned. */
.dnai-chip--inline {
    position: static;
    display: block;
    margin-top: 0.3rem;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    color: inherit;
    opacity: 0.75;
    font-size: 0.65rem;
    font-weight: 500;
    white-space: normal;
    text-decoration: underline dotted;
}

/* ========================================
   Shared modal (self-contained, no Bootstrap dependency)
   ======================================== */

.dnai-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20000;
    background: rgba(10, 9, 7, 0.6);
    display: none;
}

.dnai-modal-backdrop.dnai-modal-open {
    display: block;
}

.dnai-modal {
    position: fixed;
    inset: 0;
    z-index: 20001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.dnai-modal.dnai-modal-open {
    display: flex;
}

.dnai-modal-panel {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: 85vh;
    overflow-y: auto;
    background: #1a1712;
    color: #f2ede1;
    border: 1px solid rgba(244, 227, 184, 0.25);
    border-radius: 12px;
    padding: 1.5rem 1.5rem 1.25rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(8px) scale(0.98);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.dnai-modal-open .dnai-modal-panel {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.dnai-modal-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 700;
    color: #f4e3b8;
}

.dnai-modal-title-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(244, 227, 184, 0.15);
    color: #f4e3b8;
    font-size: 9px;
    font-weight: 700;
}

.dnai-modal-body {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #d9d2c2;
}

.dnai-modal-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #f2ede1;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.dnai-modal-close:hover,
.dnai-modal-close:focus-visible {
    background: rgba(255, 255, 255, 0.18);
    outline: none;
}

/* Never let the marker/chip/modal be styled into invisibility outside this stylesheet's own
   print rule below (see ".cursorrules" "AI-Generated Images and Portraits"). */
.dnai-marker,
.dnai-chip,
.dnai-modal,
.dnai-modal-backdrop {
    visibility: visible;
}

/* Keep the marker/chip/modal out of printed reports and PDF/html2canvas exports; the inline
   text disclosure (sample drawer, sample profile) is retained in print via its own styles. */
@@media print {
    .dnai-marker,
    .dnai-chip,
    .dnai-modal,
    .dnai-modal-backdrop {
        display: none !important;
    }
}
