/* ==================================================================
   drilldown-shared.css
   Structural styles shared across all four drill-down pages.
   Entity-specific item card styles live in each page's .razor.css.
   ================================================================== */

/* ── Page wrapper ── */
.drilldown-page {
    max-width: 1500px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 2rem;
    font-family: Arial, sans-serif;
}

.drilldown-page h2 {
    margin: 0 0 1.25rem;
    font-size: 1.75rem;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dd-back-link {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--primary-color, #115f66);
    text-decoration: none;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--primary-color, #115f66);
    border-radius: 6px;
    transition: all 0.15s;
}
.dd-back-link:hover {
    background: var(--primary-color, #115f66);
    color: white;
}

/* ── Filter Card ── */
.filter-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.filter-header {
    background: var(--gradient-primary, linear-gradient(135deg,#115f66,#1a8a94));
    color: white;
    padding: 0.85rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.clear-all-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.35);
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
}

.clear-all-btn:hover {
    background: rgba(255,255,255,0.32);
    border-color: rgba(255,255,255,0.55);
}

.filter-body {
    padding: 1.25rem;
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    min-width: 165px;
}

.filter-group label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.filter-input-wrap select {
    flex: 1;
    min-width: 0;          /* allow shrinking below intrinsic content width */
    padding: 0.5rem 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: auto;
}

.filter-input-wrap select:focus {
    outline: none;
    border-color: var(--primary-color, #115f66);
}

.clear-btn {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.1rem 0.4rem;
    border-radius: 50%;
    line-height: 1;
    transition: all 0.2s;
    flex-shrink: 0;
    position: relative;    /* ensure it stacks above the native <select> control */
    z-index: 1;
}

.clear-btn:hover {
    background: #fee;
    color: #c0392b;
}

/* ── Split Pane ── */
.split-pane {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.pane-left,
.pane-right {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pane-header {
    background: var(--gradient-primary, linear-gradient(135deg,#115f66,#1a8a94));
    color: white;
    padding: 0.7rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.pane-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.pane-content {
    padding: 1rem 1.25rem;
    max-height: 540px;
    overflow-y: auto;
    flex: 1;
}

.pane-content::-webkit-scrollbar { width: 8px; }
.pane-content::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; }
.pane-content::-webkit-scrollbar-thumb { background: #bbb; border-radius: 4px; }
.pane-content::-webkit-scrollbar-thumb:hover { background: #888; }

/* ── Pagination (lives inside .pane-header) ── */
.pagination-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.85);
    flex-shrink: 0;
}

.pagination-btn {
    padding: 0.2rem 0.6rem;
    border: 1px solid rgba(255,255,255,0.45);
    border-radius: 5px;
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.5;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.7);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

/* ── People Table (authors / inventors / team members) ── */
.people-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
}

.people-table thead {
}

.people-table th {
    background: var(--primary-color, #115f66);
    color: white;
    padding: 0.55rem 0.7rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.77rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.people-table th:first-child {
    border-radius: 6px 0 0 0;
    width: 36px;
    text-align: center;
}

.people-table th:last-child { border-radius: 0 6px 0 0; }

.people-table td {
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid #eee;
    color: #444;
}

.people-table td:first-child {
    text-align: center;
    font-weight: 600;
    color: #888;
}

.people-table tr:hover td { background: #f5f7fa; }
.people-table tr.clickable { cursor: pointer; }
.people-table tr.clickable:hover td { background: #eef6f7; color: var(--primary-color, #115f66); }

.linked-badge {
    display: inline-block;
    background: var(--gradient-secondary, #27ae60);
    color: white;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.pi-badge {
    display: inline-block;
    background: #d35400;
    color: white;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-left: 0.35rem;
    vertical-align: middle;
}

/* Profile link styled as a small teal button; sits beside the name in researcher rows. */
/* @onclick:stopPropagation on the element prevents the row's filter-click from firing. */
a.profile-btn {
    display: inline-block;
    background: var(--primary-color, #115f66);
    color: white;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-left: 0.35rem;
    vertical-align: middle;
    text-decoration: none;
    transition: background 0.15s ease;
}

a.profile-btn:hover {
    background: #0d4f55;
    color: white;
}

.dept-cell {
    font-size: 0.79rem;
    color: #777;
    max-width: 155px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Chart Card ── */
.chart-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.chart-header {
    background: var(--gradient-primary, linear-gradient(135deg,#115f66,#1a8a94));
    color: white;
    padding: 0.75rem 1.25rem;
}

.chart-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.chart-body {
    padding: 1.25rem;
    position: relative;     /* fallback positioning context: keeps displaced legends
                               inside the card even if .apexcharts-canvas loses its own
                               position:relative during a chart remount */
}

/* Reinforce ApexCharts' own .apexcharts-canvas { position: relative } rule.
   If anything overrides it during a Blazor remount cycle the legend would resolve
   to a higher ancestor and appear at the page top-left corner.  The !important
   ensures our sheet always wins. */
.chart-body .apexcharts-canvas {
    position: relative !important;
}

/* ── Select2 widget sizing ── */
/* Select2 injects .select2-container after render so Blazor scoped CSS can't
   reach it. Constrain it here via the shared (global) stylesheet. */
.filter-input-wrap .select2-container {
    width: 100% !important;
    flex: 1;
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    color: #aaa;
    padding: 2.5rem 1rem;
    font-style: italic;
    font-size: 0.95rem;
}

/* ── Status / category badges used in item cards ── */
.dd-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

.dd-badge-teal    { background: var(--primary-color, #115f66); color: white; }
.dd-badge-green   { background: #27ae60; color: white; }
.dd-badge-orange  { background: #e67e22; color: white; }
.dd-badge-gray    { background: #95a5a6; color: white; }
.dd-badge-red     { background: #c0392b; color: white; }
.dd-badge-blue    { background: #2980b9; color: white; }
.dd-badge-purple  { background: #8e44ad; color: white; }

/* ── Responsive ── */
@media (max-width: 960px) {
    .split-pane { grid-template-columns: 1fr; }
    .filter-body { flex-direction: column; }
    .filter-group { min-width: unset; }
}

/* ── Dark mode ── */
@media (prefers-color-scheme: dark) {
    .drilldown-page h2 { color: #dde; }

    .filter-card,
    .pane-left,
    .pane-right,
    .chart-card {
        background: #1e1e1e;
        border-color: #333;
    }

    .filter-group label { color: #aaa; }

    .filter-input-wrap select {
        background: #2a2a2a;
        color: #ddd;
        border-color: #444;
    }

    .people-table td {
        color: #ccc;
        border-bottom-color: #333;
    }

    .people-table tr:hover td { background: #2a2a2a; }
    .dept-cell { color: #999; }

    .pane-content::-webkit-scrollbar-track { background: #2a2a2a; }
    .pane-content::-webkit-scrollbar-thumb { background: #555; }
    .pane-content::-webkit-scrollbar-thumb:hover { background: #777; }
}
