/**
 * Copyright (c) 2026 DNA Genics, S.L. All rights reserved.
 *
 * Styling for the shared "Panel Sample Map" component (server-rendered, capped map of the
 * reference/comparison ancient individuals used by a report, shown on that report's anonymous
 * product marketing page). Tooltip content reuses the shared .unified-map-tooltip classes from
 * wwwroot/css/shared/map-pins-unified.css; this file only styles the section shell, map canvas,
 * and marker cluster bubbles specific to this component.
 */

.psm-section {
    margin: 48px 0;
}

.psm-header {
    text-align: center;
    margin-bottom: 20px;
}

.psm-title {
    font-weight: 700;
    margin-bottom: 8px;
}

.psm-subtitle {
    max-width: 720px;
    margin: 0 auto;
    opacity: 0.85;
    font-size: 0.95rem;
}

.psm-map-shell {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.psm-map {
    width: 100%;
    height: 420px;
}

.psm-transparency-note {
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.7;
    margin-top: 12px;
}

.psm-transparency-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 10px;
    border-radius: 999px;
    background-color: rgba(196, 149, 106, 0.18);
    color: #a9724a;
    margin-right: 8px;
    vertical-align: middle;
}

/* Marker cluster bubble, styled to match the Shared Roots matches map design language. */
.psm-map-cluster-core {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 2px;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    background-color: #c4956a;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
    .psm-map {
        height: 320px;
    }
}

/* ------------------------------------------------------------------ */
/* "Browse all" AJAX-paginated reference-panel table                   */
/* ------------------------------------------------------------------ */

.psm-table-shell {
    margin-top: 24px;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background-color: rgba(0, 0, 0, 0.015);
    padding: 20px;
}

.psm-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.psm-table-heading {
    font-weight: 700;
    font-size: 1.05rem;
    margin: 0;
}

.psm-table-search-wrap {
    /* flex-basis intentionally uses `auto` (content-based), not a raw px value:
       `.psm-table-toolbar` is `flex-wrap: wrap`, and this same rule also applies
       when the toolbar switches to `flex-direction: column` below 768px. A fixed
       px flex-basis is read against the *main axis*, so on any layout where the
       main axis is vertical (column) or where wrapping changes the effective
       axis, a width-sized basis like `260px` gets applied as a height instead,
       stretching this wrap far taller than its <input> child. `auto` always
       resolves from the element's own content box on whichever axis is active,
       so it cannot be misread as a height. min-width/max-width still bound the
       search box's width on desktop via flex-grow/shrink. */
    position: relative;
    min-width: 240px;
    flex: 1 1 auto;
    max-width: 360px;
}

.psm-table-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    opacity: 0.5;
    pointer-events: none;
}

.psm-table-search {
    width: 100%;
    padding: 8px 12px 8px 34px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
    background-color: #fff;
}

.psm-table-search:focus {
    outline: none;
    border-color: #c4956a;
    box-shadow: 0 0 0 3px rgba(196, 149, 106, 0.2);
}

.psm-table-scroll {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.psm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    background-color: #fff;
}

.psm-table thead th {
    text-align: left;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.6;
    padding: 10px 12px;
    background-color: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    white-space: nowrap;
}

.psm-table-cell {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    vertical-align: middle;
}

.psm-table-cell-id {
    font-variant-numeric: tabular-nums;
    opacity: 0.75;
    white-space: nowrap;
}

.psm-table-cell-name {
    font-weight: 600;
    min-width: 220px;
}

.psm-table-name-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.psm-table-portrait {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(196, 149, 106, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    background-color: rgba(0, 0, 0, 0.08);
}

.psm-table-name-text {
    font-weight: 600;
    min-width: 0;
}

.psm-table-portrait-notice {
    margin: 10px 0 0;
    font-size: 0.75rem;
    opacity: 0.7;
    text-align: center;
}

.psm-table-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.psm-table-row:hover,
.psm-table-row:focus {
    background-color: rgba(196, 149, 106, 0.1);
    outline: none;
}

.psm-table-loading,
.psm-table-empty {
    text-align: center;
    padding: 24px 12px;
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.7;
    background-color: #fff;
}

.psm-table-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 14px;
}

.psm-table-page-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background-color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease;
}

.psm-table-page-btn:hover:not(:disabled) {
    background-color: rgba(196, 149, 106, 0.12);
}

.psm-table-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.psm-table-page-btn .dna-icon {
    width: 12px;
    height: 12px;
}

.psm-table-page-status {
    font-size: 0.85rem;
    opacity: 0.75;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .psm-table-col-optional {
        display: none;
    }

    .psm-table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .psm-table-search-wrap {
        /* The base rule now uses `flex: 1 1 auto` precisely so it cannot be
           misread as a height when .psm-table-toolbar switches to
           flex-direction: column here (see the comment on the base rule).
           This override just pins the wrap to a non-flexible, full-width box
           in the stacked mobile layout for clarity; align-items: stretch on
           the column toolbar above would already produce the same width. */
        flex: none;
        min-width: 0;
        max-width: none;
        width: 100%;
    }
}

/* Dark-theme product pages (Ancient Composition, Shared Roots, regional Ancient*). */
.psm-theme-dark {
    --psm-dark-text: rgba(236, 240, 245, 0.92);
    --psm-dark-text-muted: rgba(236, 240, 245, 0.68);
    --psm-dark-text-heading: rgba(236, 240, 245, 0.78);
    color: var(--psm-dark-text);
}

.psm-theme-dark .psm-table-shell {
    border-color: rgba(255, 255, 255, 0.08);
    background-color: rgba(255, 255, 255, 0.03);
}

.psm-theme-dark .psm-title,
.psm-theme-dark .psm-subtitle,
.psm-theme-dark .psm-table-heading,
.psm-theme-dark .psm-table-page-status,
.psm-theme-dark .psm-transparency-note {
    color: var(--psm-dark-text);
}

.psm-theme-dark .psm-subtitle,
.psm-theme-dark .psm-transparency-note {
    color: var(--psm-dark-text-muted);
}

.psm-theme-dark .psm-table-search {
    border-color: rgba(255, 255, 255, 0.18);
    background-color: rgba(0, 0, 0, 0.35);
    color: var(--psm-dark-text);
}

.psm-theme-dark .psm-table-search::placeholder {
    color: var(--psm-dark-text-muted);
    opacity: 1;
}

.psm-theme-dark .psm-table-scroll {
    border-color: rgba(255, 255, 255, 0.08);
}

.psm-theme-dark .psm-table,
.psm-theme-dark .psm-table-loading,
.psm-theme-dark .psm-table-empty {
    background-color: rgba(0, 0, 0, 0.25);
}

/* Overrides site.css global "table { color: #000 !important; }" on dark pages. */
.psm-theme-dark table.psm-table,
.psm-theme-dark .psm-table,
.psm-theme-dark .psm-table thead th,
.psm-theme-dark .psm-table tbody td,
.psm-theme-dark .psm-table-name-text,
.psm-theme-dark .psm-table-loading,
.psm-theme-dark .psm-table-empty {
    color: var(--psm-dark-text) !important;
    opacity: 1;
}

.psm-theme-dark .psm-table thead th {
    background-color: rgba(255, 255, 255, 0.04);
    border-bottom-color: rgba(255, 255, 255, 0.1);
    color: var(--psm-dark-text-heading) !important;
}

.psm-theme-dark .psm-table-cell {
    border-bottom-color: rgba(255, 255, 255, 0.08);
    opacity: 1;
}

.psm-theme-dark .psm-table-cell-id {
    color: var(--psm-dark-text-muted) !important;
}

.psm-theme-dark .psm-table-portrait {
    border-color: rgba(196, 149, 106, 0.55);
}

.psm-theme-dark .psm-table-row:hover,
.psm-theme-dark .psm-table-row:focus {
    background-color: rgba(196, 149, 106, 0.18);
}

.psm-theme-dark .psm-table-page-btn {
    border-color: rgba(255, 255, 255, 0.18);
    background-color: rgba(0, 0, 0, 0.35);
    color: inherit;
}

.psm-theme-dark .psm-table-page-btn:hover:not(:disabled) {
    background-color: rgba(196, 149, 106, 0.2);
}

.psm-theme-dark .psm-transparency-badge {
    background-color: rgba(196, 149, 106, 0.22);
    color: #e0b58a;
}
