/* =============================================================================
   Cell Type Map Visualization Styles
   PIASOmarkerDB - Interactive Cell Type UMAP Visualization
   ============================================================================= */

/* -----------------------------------------------------------------------------
   View Toggle
   ----------------------------------------------------------------------------- */
.view-toggle-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.view-toggle {
    display: inline-flex;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.view-toggle-btn {
    padding: 8px 18px;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #495057;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.view-toggle-btn:not(:last-child) {
    border-right: 1px solid #dee2e6;
}

.view-toggle-btn.active {
    background: #0d6efd;
    color: white;
}

.view-toggle-btn:not(.active):hover {
    background: #f8f9fa;
}

.view-toggle-btn svg {
    width: 16px;
    height: 16px;
}

/* -----------------------------------------------------------------------------
   Filter Controls
   ----------------------------------------------------------------------------- */
.map-filters-container {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 1rem;
}

.map-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.map-filter-group {
    flex: 1;
    min-width: 150px;
}

.map-filter-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 4px;
    display: block;
}

.map-filter-group select,
.map-filter-group input {
    font-size: 0.875rem;
}

.map-search-group {
    flex: 2;
    min-width: 200px;
}

.clear-filters-btn {
    white-space: nowrap;
}

/* -----------------------------------------------------------------------------
   Map Container
   ----------------------------------------------------------------------------- */
.map-view-container {
    display: none;
}

.map-view-container.active {
    display: block;
}

.table-view-container {
    display: none;
}

.table-view-container.active {
    display: block;
}

.cell-type-map-wrapper {
    position: relative;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    overflow: hidden;
    background: #fafafa;
}

.cell-type-map-container {
    position: relative;
    width: 100%;
    height: 550px;
    overflow: hidden;  /* Clip legends to container bounds */
}

.cell-type-map-container svg {
    width: 100%;
    height: 100%;
    cursor: grab;
}

.cell-type-map-container svg:active {
    cursor: grabbing;
}

/* -----------------------------------------------------------------------------
   Map Controls Panel
   ----------------------------------------------------------------------------- */
.map-controls-panel {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.97);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
    z-index: 100;
    min-width: 160px;
    max-width: 180px;
}

.map-controls-panel h6 {
    margin-bottom: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.map-controls-panel .form-check {
    margin-bottom: 5px;
}

.map-controls-panel .form-check-label {
    font-size: 0.82rem;
    color: #495057;
}

.map-controls-panel .form-check-input {
    margin-top: 0.2rem;
}

.map-controls-panel hr {
    margin: 12px 0;
    border-color: #e9ecef;
}

.map-controls-section {
    margin-bottom: 12px;
}

.map-controls-section:last-child {
    margin-bottom: 0;
}

/* Export buttons */
.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}

.export-btn {
    font-size: 0.78rem;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: 6px;
}

.export-btn svg {
    width: 14px;
    height: 14px;
}

/* -----------------------------------------------------------------------------
   Zoom Controls (RIGHT TOP)
   ----------------------------------------------------------------------------- */
.zoom-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 100;
}

.zoom-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 500;
    color: #495057;
    transition: all 0.15s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.zoom-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.zoom-btn:active {
    transform: scale(0.95);
}

/* -----------------------------------------------------------------------------
   Legend - Color (LEFT BOTTOM)
   ----------------------------------------------------------------------------- */
.map-legend-color {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 100;
    max-width: 160px;
}

/* Old class for backward compatibility */
.map-legend {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 100;
    max-width: 160px;
}

.legend-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.legend-gradient {
    height: 10px;
    width: 120px;
    border-radius: 2px;
    margin-bottom: 3px;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: #6c757d;
    font-family: 'Fira Code', monospace;
}

.legend-min, .legend-max {
    font-family: 'Fira Code', monospace;
    font-size: 0.65rem;
}

/* Categorical legend */
.legend-categorical {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    color: #495057;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.legend-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
}

/* -----------------------------------------------------------------------------
   Legend - Size (RIGHT BOTTOM)
   ----------------------------------------------------------------------------- */
.map-legend-size {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 100;
    max-width: 200px;           /* Safari fix: constrain width */
    width: auto;                /* Let content determine actual width */
}

.size-legend-items {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.size-legend-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
}

.size-legend-item svg {
    display: block;
    width: 24px;                /* Safari fix: explicit width */
    height: 24px;               /* Safari fix: explicit height */
    min-width: 24px;            /* Safari fix: prevent shrinking */
    max-width: 24px;            /* Safari fix: prevent expanding */
}

.size-legend-item .size-value {
    font-size: 0.6rem;
    color: #6c757d;
    font-family: 'Fira Code', monospace;
    text-align: center;
}

/* -----------------------------------------------------------------------------
   Tooltip
   ----------------------------------------------------------------------------- */
.ct-tooltip {
    position: fixed;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    pointer-events: none;
    z-index: 1000;
    max-width: 300px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.ct-tooltip.visible {
    opacity: 1;
    pointer-events: auto;
}

.ct-tooltip .tooltip-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    margin-bottom: 10px;
}

.ct-tooltip .pmdbc-id {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.72rem;
    color: #6c757d;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
}

.ct-tooltip .cell-type-name {
    font-weight: 600;
    font-size: 1rem;
    color: #212529;
    display: block;
    margin-top: 5px;
    line-height: 1.3;
}

.ct-tooltip .tooltip-body {
    font-size: 0.85rem;
}

.ct-tooltip .tooltip-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    gap: 10px;
}

.ct-tooltip .tooltip-row .label {
    color: #6c757d;
    flex-shrink: 0;
}

.ct-tooltip .tooltip-row .value {
    color: #212529;
    text-align: right;
    word-break: break-word;
}

.ct-tooltip .tooltip-row .value.specificity {
    font-weight: 600;
    color: #0d6efd;
}

.ct-tooltip .tooltip-actions {
    border-top: 1px solid #eee;
    padding-top: 10px;
    margin-top: 10px;
    text-align: center;
}

.ct-tooltip .tooltip-actions a {
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    color: #0d6efd;
}

.ct-tooltip .tooltip-actions a:hover {
    text-decoration: underline;
}

.ct-tooltip .tooltip-footer {
    border-top: 1px solid #eee;
    padding-top: 8px;
    margin-top: 10px;
    text-align: center;
}

/* Matched genes in tooltip (for analyze page) */
.ct-tooltip .matched-genes {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #eee;
}

.ct-tooltip .matched-genes-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 5px;
}

.ct-tooltip .matched-gene-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 3px;
}

.ct-tooltip .matched-gene-item .gene-name {
    font-weight: 500;
}

.ct-tooltip .matched-gene-item .gene-score {
    color: #0d6efd;
}

/* -----------------------------------------------------------------------------
   Dot Styles
   ----------------------------------------------------------------------------- */
.cell-type-dot {
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.cell-type-dot:hover {
    stroke: #ffffff;
    stroke-width: 2px;
    filter: drop-shadow(0 0 3px rgba(0,0,0,0.5));
}

.cell-type-dot.highlighted {
    stroke: #ff6b6b;
    stroke-width: 3px;
}

.cell-type-dot.matched {
    opacity: 1;
}

.cell-type-dot.unmatched {
    opacity: 0.3;
    fill: #D8D0E8 !important;
}

.cell-type-dot.filtered-out {
    fill: #D8D0E8 !important;
    opacity: 0.3 !important;
    pointer-events: none;
}

/* -----------------------------------------------------------------------------
   Stats Bar
   ----------------------------------------------------------------------------- */
.map-stats-bar {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 10px 15px;
    font-size: 0.85rem;
    color: #6c757d;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.map-stats-bar .stats-left {
    display: flex;
    gap: 20px;
}

.map-stats-bar .stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.map-stats-bar .stat-value {
    font-weight: 600;
    color: #212529;
}

/* -----------------------------------------------------------------------------
   Analyze Page Map Section
   ----------------------------------------------------------------------------- */
.analyze-map-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #dee2e6;
}

.analyze-map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.analyze-map-header h4 {
    margin: 0;
    font-size: 1.2rem;
    color: #212529;
}

.view-map-btn {
    font-size: 0.9rem;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Smaller map for analyze page */
.analyze-map-container .cell-type-map-container {
    height: 450px;
}

.analyze-map-container .map-controls-panel {
    padding: 12px;
    min-width: 140px;
}

.analyze-map-container .map-controls-panel h6 {
    font-size: 0.75rem;
}

/* -----------------------------------------------------------------------------
   Home Page Top Cell Types
   ----------------------------------------------------------------------------- */
.top-cell-types-section {
    margin-bottom: 2.5rem;
}

.top-cell-types-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.top-cell-types-header h3 {
    margin: 0;
}

.top-cell-type-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 15px;
    height: 100%;
    transition: all 0.2s ease;
    cursor: pointer;
}

.top-cell-type-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    border-color: #0d6efd;
}

.top-cell-type-card .cell-type-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #212529;
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.top-cell-type-card .cell-type-meta {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 8px;
}

.top-cell-type-card .cell-type-meta span {
    display: inline-block;
}

.top-cell-type-card .cell-type-meta span:not(:last-child)::after {
    content: " • ";
    margin: 0 3px;
}

.top-cell-type-card .specificity-score {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.top-cell-type-card .view-link {
    display: block;
    margin-top: 10px;
    font-size: 0.8rem;
    color: #0d6efd;
    text-decoration: none;
}

.top-cell-type-card .view-link:hover {
    text-decoration: underline;
}

/* -----------------------------------------------------------------------------
   Loading States
   ----------------------------------------------------------------------------- */
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #6c757d;
}

.map-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    margin-bottom: 10px;
}

.map-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #dc3545;
    max-width: 300px;
}

/* -----------------------------------------------------------------------------
   Responsive Design
   ----------------------------------------------------------------------------- */
@media (max-width: 992px) {
    .map-controls-panel {
        position: relative;
        top: auto;
        left: auto;
        max-width: 100%;
        margin-bottom: 1rem;
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
    }
    
    .map-controls-panel h6 {
        width: 100%;
    }
    
    .map-controls-section {
        flex: 1;
        min-width: 120px;
    }
    
    .export-buttons {
        flex-direction: row;
    }
    
    .cell-type-map-container {
        height: 400px;
    }
    
    .map-legend {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        margin-top: 1rem;
    }
}

@media (max-width: 768px) {
    .map-filters-row {
        flex-direction: column;
    }
    
    .map-filter-group,
    .map-search-group {
        width: 100%;
    }
    
    .view-toggle-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .view-toggle {
        width: 100%;
    }
    
    .view-toggle-btn {
        flex: 1;
        justify-content: center;
    }
    
    .cell-type-map-container {
        height: 350px;
    }
    
    .map-stats-bar {
        flex-direction: column;
        gap: 8px;
    }
    
    .map-stats-bar .stats-left {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* -----------------------------------------------------------------------------
   Clickable Table Links
   ----------------------------------------------------------------------------- */
.cell-type-link,
.study-link {
    color: #0d6efd;
    text-decoration: none;
    cursor: pointer;
}

.cell-type-link:hover,
.study-link:hover {
    text-decoration: underline;
    color: #0a58ca;
}

/* Ensure the strong tag inside link doesn't affect hover */
.cell-type-link strong {
    font-weight: 600;
}

/* -----------------------------------------------------------------------------
   Cell Type Details Panel (Above Map - slides in)
   ----------------------------------------------------------------------------- */
.cell-type-details-panel {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-bottom: 0;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, padding 0.3s ease-out, margin 0.3s ease-out;
}

.cell-type-details-panel.visible {
    max-height: none;      /* Let cards control height */
    opacity: 1;
    padding: 16px;
    margin-bottom: 20px;   /* Space between panel and map */
    overflow: visible;     /* Don't clip content */
}

.details-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;  /* Don't shrink header */
}

.details-panel-header h6 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

.details-panel-header .selection-count {
    background: #0d6efd;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.details-panel-header .clear-all-btn {
    font-size: 0.8rem;
    padding: 4px 12px;
}

.details-panel-body {
    display: flex;
    gap: 15px;                    /* Equal gap between all cards */
    flex-wrap: nowrap;            /* Keep cards in one row */
    align-items: stretch;         /* Equal height cards */
    overflow-x: auto;             /* Horizontal scroll if needed */
    overflow-y: visible;          /* Don't scroll panel body vertically */
    padding-bottom: 5px;          /* Space for scrollbar */
}

/* Selection Cards - Equal distribution with independent scroll */
.selection-card {
    flex: 1 1 0;                  /* Equal flex basis for all cards */
    min-width: 250px;
    max-width: none;              /* Remove max-width limit */
    max-height: 350px;            /* Max card height before scroll */
    display: flex;                /* Flex column for internal layout */
    flex-direction: column;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 15px;
    position: relative;
    overflow: hidden;             /* Contain content within card */
}

.selection-card.current {
    border-color: #0d6efd;
    background: #f0f7ff;
}

.selection-card.previous {
    border-color: #6c757d;
    border-style: dashed;
}

.selection-card.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    max-height: 350px;            /* Match other cards max height */
    color: #adb5bd;
    font-style: italic;
}

.selection-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-shrink: 0;               /* Don't compress header */
}

.selection-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 4px;
}

.selection-card.current .selection-label {
    background: #0d6efd;
    color: white;
}

.selection-card.previous .selection-label {
    background: #6c757d;
    color: white;
}

.selection-card .clear-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 1rem;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.selection-card .clear-btn:hover {
    background: #e9ecef;
    color: #dc3545;
}

.selection-card-body {
    flex: 1;                      /* Take remaining space */
    overflow-y: auto;             /* Independent scroll per card */
    min-height: 0;                /* Required for flex scroll to work */
    margin-bottom: 12px;
    padding-right: 5px;           /* Space for scrollbar */
}

.selection-cell-type {
    font-size: 1.1rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 4px;
    line-height: 1.3;
}

.selection-cell-type a {
    color: #212529;
    text-decoration: none;
}

.selection-cell-type a:hover {
    color: #0d6efd;
    text-decoration: underline;
}

.selection-pmdbc {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.75rem;
    color: #6c757d;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 10px;
}

.selection-details {
    font-size: 0.85rem;
}

.selection-detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    gap: 10px;
}

.selection-detail-row .label {
    color: #6c757d;
    flex-shrink: 0;
}

.selection-detail-row .value {
    color: #212529;
    text-align: right;
    word-break: break-word;
}

.selection-detail-row .value a {
    color: #0d6efd;
    text-decoration: none;
}

.selection-detail-row .value a:hover {
    text-decoration: underline;
}

.selection-detail-row .value.specificity {
    font-weight: 600;
    color: #0d6efd;
}

/* Matched genes section (for Analyze page) */
.selection-matched-genes {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #dee2e6;
}

.matched-genes-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 5px;
}

.matched-gene-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.matched-gene-tag {
    background: #e7f1ff;
    color: #0d6efd;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Top markers section in selection cards */
.selection-markers {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #dee2e6;
}

.markers-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.marker-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.marker-tag {
    background: #f0f7ff;
    color: #0d6efd;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.marker-tag small {
    color: #6c757d;
    font-weight: 400;
}

/* Match statistics section (Analyze page) */
.selection-match-stats {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.match-stats-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.match-stats-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 3px;
}

.match-stats-row .label {
    color: #6c757d;
}

.match-stats-row .value {
    font-weight: 600;
    color: #212529;
}

/* Selection card actions */
.selection-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid #dee2e6;
    flex-shrink: 0;               /* Don't compress actions */
    margin-top: auto;             /* Push to bottom of card */
}

.selection-card-actions .btn {
    font-size: 0.8rem;
    padding: 6px 12px;
}

/* -----------------------------------------------------------------------------
   Map Selection Highlight Rings
   ----------------------------------------------------------------------------- */
.cell-type-dot.selected-current {
    stroke: #ffffff;
    stroke-width: 3px;
    filter: drop-shadow(0 0 4px rgba(13, 110, 253, 0.8)) drop-shadow(0 0 2px rgba(0,0,0,0.5));
}

.cell-type-dot.selected-previous {
    stroke: #ffffff;
    stroke-width: 2px;
    stroke-dasharray: 4 2;
    filter: drop-shadow(0 0 3px rgba(108, 117, 125, 0.6)) drop-shadow(0 0 2px rgba(0,0,0,0.4));
}

/* -----------------------------------------------------------------------------
   Find in Table Row Highlight Animation
   ----------------------------------------------------------------------------- */
.table-row-highlight {
    animation: highlightFade 2s ease-out forwards;
}

@keyframes highlightFade {
    0% {
        background-color: #fff3cd !important;
    }
    50% {
        background-color: #fff3cd !important;
    }
    100% {
        background-color: transparent !important;
    }
}

/* Alternative class for non-animation fallback */
.table-row-flash {
    background-color: #fff3cd !important;
    transition: background-color 2s ease-out;
}

.table-row-flash.fade-out {
    background-color: transparent !important;
}

/* -----------------------------------------------------------------------------
   Responsive Details Panel
   ----------------------------------------------------------------------------- */
@media (max-width: 992px) {
    .details-panel-body {
        flex-wrap: wrap;
    }
    
    .selection-card {
        flex: 1 1 calc(50% - 10px);  /* Two cards per row on medium screens */
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .details-panel-body {
        flex-direction: column;
        flex-wrap: nowrap;
    }
    
    .selection-card {
        flex: none;
        width: 100%;
        min-width: auto;
    }
    
    .selection-card-actions {
        flex-direction: column;
    }
    
    .selection-card-actions .btn {
        width: 100%;
    }
}

/* -----------------------------------------------------------------------------
   Cluster/Group Labels on Map
   ----------------------------------------------------------------------------- */
.cluster-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    pointer-events: none;
    user-select: none;
}

.map-labels-group {
    pointer-events: none;
}

/* Legend note for cluster/group modes */
.legend-note {
    padding: 4px 0;
}
