/* ==========================================================================
   Inline Drawer — compact player detail row within the table
   ========================================================================== */

.idw {
    background: transparent;
    position: relative;
}

/* Skater: Bio | Scoring | EDGE | Physical | Situational | Adv-Bars | Adv-Indiv | Adv-Context | Contract */
.idw-grid {
    display: grid;
    grid-template-columns: 130px 1fr 1fr auto auto 1fr auto auto auto;
    width: 100%;
    min-width: 860px;
    background: #ffffff;
    border-right: 2px solid #e0e0e0;
    box-shadow: 4px 0 12px rgba(0,0,0,0.04);
}
/* Goalie: Bio | Record | Stats | EDGE | Save% | Contract */
.idw-grid-goalie {
    display: grid;
    grid-template-columns: 130px auto auto 1fr 1fr auto;
    width: 100%;
    min-width: 860px;
    background: #ffffff;
    border-right: 2px solid #e0e0e0;
    box-shadow: 4px 0 12px rgba(0,0,0,0.04);
}

/* --------------------------------------------------------------------------
   Col 1: Identity / Bio
   -------------------------------------------------------------------------- */

.idw-id {
    padding: 28px 8px 8px 8px;
    border-right: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

.idw-name-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.idw-headshot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.idw-name {
    font-size: var(--text-micro);
    font-weight: var(--weight-black);
    text-transform: uppercase;
    line-height: 1.1;
}

.idw-meta {
    font-size: var(--text-micro);
    color: #888;
    line-height: 1.3;
}

.idw-btns {
    display: flex;
    gap: 3px;
    margin-top: 2px;
}

.idw-fullpage {
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 2px;
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    font-weight: var(--weight-bold);
    text-transform: uppercase;
    cursor: pointer;
}
.idw-fullpage:hover { background: #333; }

/* Close button — top-left corner */
.idw-close {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 1;
    width: 16px;
    height: 16px;
    background: #e8e9eb;
    border: 1px solid #ccc;
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.idw-close .icon {
    width: 9px;
    height: 9px;
    background: #777;
}
.idw-close:hover { background: #d8d9db; }
.idw-close:hover .icon { background: #333; }

/* --------------------------------------------------------------------------
   Sections (Scoring, EDGE, Physical, Situational, Goalie EDGE, Save %)
   -------------------------------------------------------------------------- */

.idw-section {
    padding: 6px 10px 6px 8px;
    border-right: 1px solid #f0f0f0;
}
.idw-section:last-child { border-right: none; }

.idw-stitle {
    font-size: var(--text-micro);
    font-weight: var(--weight-black);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--theme-accent-secondary);
}

/* Section header row — title + column headers on one line */
.idw-section-hdr {
    display: grid;
    gap: 3px;
    align-items: baseline;
    margin-bottom: 3px;
}
.idw-col-hdr {
    font-size: var(--text-micro);
    font-weight: var(--weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #bbb;
    text-align: center;
}

/* Scoring header: label | bar | value | fraction */
.idw-scoring-hdrs {
    grid-template-columns: 44px 1fr 32px 48px;
}

/* EDGE header: label | bar | value | pctl | fraction */
.idw-edge-hdrs {
    grid-template-columns: 44px 1fr 32px 36px 48px;
}

/* Goalie header: label | bar | value | pctl | rank pill */
.idw-goalie-hdrs {
    grid-template-columns: 56px 1fr 40px 44px 38px;
}

/* Advanced rows: label | bar | val */
.idw-adv-row {
    display: grid;
    grid-template-columns: 44px 1fr 38px;
    gap: 3px;
    align-items: center;
    margin-bottom: 2px;
}

/* Situation toggle buttons */
.idw-sit-toggle {
    display: flex;
    gap: 2px;
    margin-left: auto;
}
.idw-sit-btn {
    font-size: 9px;
    font-family: inherit;
    font-weight: var(--weight-bold);
    padding: 1px 5px;
    border: 1px solid #ddd;
    background: transparent;
    cursor: pointer;
    border-radius: 3px;
    color: #888;
    line-height: 1.4;
    transition: background 0.1s, color 0.1s;
}
.idw-sit-btn.active {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
}

/* --------------------------------------------------------------------------
   Shared bar elements
   -------------------------------------------------------------------------- */

.idw-elabel {
    font-size: var(--text-micro);
    font-weight: var(--weight-black);
    text-transform: uppercase;
    letter-spacing: 0.2px;
    color: #555;
}

.idw-etrack {
    height: 4px;
    background: #F0F0F0;
    border-radius: 2px;
    position: relative;
    min-width: 16px;
}

.idw-efill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}
.idw-efill.pctl-q1 { background: #A84848; }
.idw-efill.pctl-q2 { background: #C08040; }
.idw-efill.pctl-q3 { background: #2E6E90; }
.idw-efill.pctl-q4 { background: #2E5E3E; }

/* League average tick */
.idw-avg {
    position: absolute;
    left: 50%;
    top: -2px;
    bottom: -2px;
    width: 1.5px;
    background: #000;
    z-index: 2;
    pointer-events: none;
    margin-left: -0.75px;
}

.idw-eval {
    font-size: var(--text-micro);
    font-weight: var(--weight-black);
    text-align: right;
}

.idw-epctl {
    font-size: var(--text-micro);
    font-weight: var(--weight-bold);
    text-align: center;
}
.idw-epctl.pctl-q1 { color: #A84848; }
.idw-epctl.pctl-q2 { color: #C08040; }
.idw-epctl.pctl-q3 { color: #2E6E90; }
.idw-epctl.pctl-q4 { color: #2E5E3E; }

/* --------------------------------------------------------------------------
   Fraction pills (1/82, 38/82)
   -------------------------------------------------------------------------- */

.idw-frac {
    font-size: var(--text-micro);
    font-weight: var(--weight-black);
    text-align: center;
    padding: 1px 3px;
    border-radius: 2px;
    border: 1px solid #ddd;
    background: #fafafa;
    color: #555;
    white-space: nowrap;
}
.idw-frac-total {
    font-weight: var(--weight-bold);
    color: #999;
    font-size: 8px;
}
.idw-frac-top5 {
    border-color: #2E5E3E;
    background: #2E5E3E;
    color: #fff;
}
.idw-frac-top5 .idw-frac-total { color: rgba(255,255,255,0.7); }
.idw-frac-top10 {
    border-color: var(--theme-accent-secondary);
    color: var(--theme-accent-secondary);
    background: #f0f4ff;
}
.idw-frac-top10 .idw-frac-total { color: rgba(59,110,165,0.5); }

/* --------------------------------------------------------------------------
   Scoring rows: label | bar | value | fraction
   -------------------------------------------------------------------------- */

.idw-scoring-row {
    display: grid;
    grid-template-columns: 44px 1fr 32px 48px;
    gap: 3px;
    align-items: center;
    margin-bottom: 2px;
}

/* --------------------------------------------------------------------------
   EDGE rows: label | bar | value | pctl | fraction
   -------------------------------------------------------------------------- */

.idw-edge-row {
    display: grid;
    grid-template-columns: 44px 1fr 32px 36px 48px;
    gap: 3px;
    align-items: center;
    margin-bottom: 2px;
}

/* --------------------------------------------------------------------------
   Goalie rows: label | bar | value | pctl
   -------------------------------------------------------------------------- */

.idw-goalie-row {
    display: grid;
    grid-template-columns: 56px 1fr 40px 44px 38px;
    gap: 4px;
    align-items: center;
    margin-bottom: 2px;
}

/* --------------------------------------------------------------------------
   Key/value pairs (Physical, Situational, Record, Advanced)
   -------------------------------------------------------------------------- */

.idw-kv-title {
    margin-bottom: 3px;
}

.idw-kv {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 2px 0;
}

.idw-kv-label {
    font-size: var(--text-micro);
    font-weight: var(--weight-bold);
    color: #888;
    text-transform: uppercase;
}

.idw-kv-val {
    font-size: var(--text-xs);
    font-weight: var(--weight-black);
}

.idw-kv-val-wide {
    font-size: var(--text-xs);
    font-weight: var(--weight-black);
    padding-left: 4px;
}

/* --------------------------------------------------------------------------
   Contract card
   -------------------------------------------------------------------------- */

.idw-contract {
    padding: 6px 12px;
    background: #fafafa;
    border-left: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 85px;
}

.idw-cap {
    font-size: var(--text-sm);
    font-weight: var(--weight-black);
    line-height: 1.2;
}

.idw-cap-detail {
    font-size: var(--text-micro);
    color: #555;
    line-height: 1.5;
}
.idw-cap-detail strong {
    font-weight: var(--weight-black);
}

.idw-status-pill {
    display: inline-block;
    font-size: var(--text-micro);
    font-weight: var(--weight-black);
    padding: 1px 5px;
    border-radius: 2px;
    background: #1a1a1a;
    color: #fff;
    text-transform: uppercase;
    vertical-align: middle;
}

/* --------------------------------------------------------------------------
   Tooltips (cursor-following, driven by JS)
   -------------------------------------------------------------------------- */

.idw-tooltip {
    position: fixed;
    z-index: 50;
    background: #fff;
    color: #333;
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    font-weight: var(--weight-bold);
    white-space: nowrap;
    padding: 3px 8px;
    border: 0.5px solid #000;
    border-radius: 3px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
}
.idw-tooltip.visible {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

/* Full single-column stack on mobile */
@media (max-width: 767px) {
    .idw-grid,
    .idw-grid-goalie {
        grid-template-columns: 1fr;
    }
    .idw-id { border-right: none; border-bottom: 1px solid #f0f0f0; }
    .idw-section { border-right: none; border-bottom: 1px solid #f0f0f0; }
    .idw-section:last-child { border-bottom: none; }
    .idw-contract { border-left: none; border-top: 1px solid #f0f0f0; }
}
