/**
 * Range Viewer - Styles (read-only mode)
 */

/* Viewer Container */
.viewer-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 100px);
}

/* Header */
.viewer-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--pk-container-border);
}

.viewer-header h1 {
    flex: 1;
    font-size: 1.25rem;
    color: var(--pk-text-primary);
    margin: 0;
    text-align: center;
}

/* Main Layout */
.viewer-main {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    flex: 1;
}

@media (max-width: 900px) {
    .viewer-main {
        grid-template-columns: 1fr;
    }

    .viewer-panel {
        order: -1;
    }
}

/* Grid Section */
.viewer-grid-section {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Grid Header (column labels) */
.grid-header {
    display: grid;
    grid-template-columns: 30px repeat(13, 1fr);
    gap: 2px;
    width: 100%;
    max-width: 600px;
    margin-bottom: 2px;
}

.grid-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--pk-text-muted);
    height: 24px;
}

/* Grid Container */
.grid-container {
    display: grid;
    grid-template-columns: 30px repeat(13, 1fr);
    gap: 2px;
    width: 100%;
    max-width: 600px;
}

.row-label {
    height: auto;
}

/* Grid Cells (read-only) */
.grid-cell {
    aspect-ratio: 1;
    background: var(--pk-background);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: opacity 0.2s ease;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.cell-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--pk-cell-label, #F2EDE4);
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.dark-labels .cell-label {
    --pk-cell-label: #14110F;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.45);
}

/* Cell Bars (strategy visualization) */
.cell-bars {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    display: flex;
    flex-direction: row;
}

.cell-bar {
    height: 100%;
    transition: width 0.2s ease;
}

/* Grid Legend — wraps `.pk-action-chip-stack` chips (action-chips.css)
   side by side, capped at the grid width so a many-action range spills
   to a second row instead of overflowing. */
.grid-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem auto 0;
    justify-content: center;
    width: 100%;
    max-width: 600px;
}

/* Panel */
.viewer-panel {
    padding: 1rem;
    height: fit-content;
    position: sticky;
    top: 60px;
}

.panel-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--pk-container-border);
}

.panel-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.panel-section h3 {
    font-size: 0.9rem;
    color: var(--pk-text-secondary);
    margin: 0 0 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Info tags — position / format / depth / custom tags rendered as
   pill chips. Replaces the old "label : value" grid which spent two
   columns on data that fits in one tag. The typed-tag classes share
   one accent colour from the active theme; custom tags keep their
   per-tag colour from the DB row via the inline `style` attribute. */
.info-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}

.info-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--pk-text-primary);
    background: transparent;
    border: 1px solid var(--pk-container-border);
    white-space: nowrap;
}

/* Typed tags (position / format / depth) share the theme accent on
   the outline so they read as "system" data, while custom tags keep
   their per-row background coming from the inline style attribute. */
.info-tag-position,
.info-tag-format,
.info-tag-depth {
    border-color: var(--pk-accent);
}

.info-description {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    color: var(--pk-text-secondary);
    line-height: 1.45;
}

/* Action Distribution — chip-shaped per-action rows. The visual
   primitive (.pk-action-chip / .pk-action-chip-block) lives in
   static/css/action-chips.css so the Range Drawer, future tools and
   this viewer all share one styling source. */
.action-distribution {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
