/* PigPro Trading Card — Beckett's-worthy player detail card. */

.pigpro-card-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
}
.pigpro-card-backdrop.is-open { display: flex; }

.pigpro-card-shell {
    position: relative;
    width: min(560px, 95vw);
    max-width: 95vw;
    animation: pp-pop 0.22s cubic-bezier(0.2, 0.8, 0.4, 1);
}
@keyframes pp-pop {
    from { opacity: 0; transform: scale(0.95) translateY(-12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.pigpro-card-close {
    position: absolute;
    top: -12px;
    right: -12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #1e293b;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.pigpro-card-close:hover { background: #ef4444; }

.pigpro-card-loading {
    background: #1e293b;
    color: #fff;
    padding: 3rem;
    text-align: center;
    border-radius: 16px;
    font-size: 16px;
}

/* The card itself */
.pp-card {
    position: relative;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border-radius: 18px;
    overflow: hidden;
    color: #f1f5f9;
    box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 4px 16px rgba(0,0,0,0.3);
    padding: 0;
}

/* Foil border effect — gradient keyed to tier */
.pp-foil-frame {
    position: absolute;
    inset: 0;
    border-radius: 18px;
    padding: 3px;
    background: var(--pp-foil, linear-gradient(135deg, #475569, #64748b));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
    animation: pp-foil-shimmer 6s linear infinite;
    background-size: 200% 200%;
}
@keyframes pp-foil-shimmer {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 200%; }
}

/* Hero section */
.pp-hero {
    display: grid;
    grid-template-columns: 88px 1fr 112px;
    gap: 1rem;
    padding: 1.25rem 1.5rem 1rem;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
}

.pp-headshot {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--pp-border-color, #475569);
    flex: 0 0 88px;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pp-headshot-img { width: 100%; height: 100%; object-fit: cover; }
.pp-headshot-fallback {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 28px;
    letter-spacing: 1px;
}

.pp-identity { min-width: 0; }
.pp-position-strip {
    display: inline-block;
    color: #fff;
    font-weight: 800;
    font-size: 10px;
    letter-spacing: 1.5px;
    padding: 2px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.pp-name {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 4px;
    letter-spacing: -0.5px;
    line-height: 1.1;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pp-meta {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    font-weight: 500;
}
.pp-team { color: #fbbf24; font-weight: 700; }

.pp-score-panel {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.pp-score-ring {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fef3c7, #f59e0b 60%, #b45309);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3), inset 0 -4px 8px rgba(0,0,0,0.2);
    position: relative;
}
.pp-score-value {
    font-size: 20px;
    font-weight: 900;
    color: #1e293b;
    letter-spacing: -1px;
    line-height: 1;
}
.pp-score-label {
    font-size: 8px;
    font-weight: 800;
    color: #78350f;
    letter-spacing: 1.5px;
    margin-top: 1px;
}
.pp-tier-strip {
    padding: 2px 10px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.2px;
    border-radius: 3px;
    color: #fff;
    text-transform: uppercase;
}
.pp-rec-pill {
    padding: 2px 8px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 10px;
    color: #fff;
}
.pp-delta {
    font-size: 10px;
    font-weight: 700;
    margin-top: 2px;
}
.pp-delta small { font-weight: 500; opacity: 0.7; }

/* Stats strip */
.pp-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: rgba(15, 23, 42, 0.9);
    padding: 0;
    border-top: 1px solid rgba(245, 158, 11, 0.2);
    border-bottom: 1px solid rgba(245, 158, 11, 0.2);
}
.pp-stat {
    padding: 0.75rem;
    text-align: center;
    background: rgba(30, 41, 59, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.pp-stat-label {
    font-size: 9px;
    font-weight: 800;
    color: #64748b;
    letter-spacing: 1.5px;
}
.pp-stat-value {
    font-size: 22px;
    font-weight: 900;
    color: #fff;
    letter-spacing: -1px;
}
.pp-stat-unit {
    font-size: 9px;
    color: #475569;
    font-weight: 600;
}
.pp-stat-ceiling .pp-stat-value { color: #10b981; }
.pp-stat-floor   .pp-stat-value { color: #94a3b8; }

/* Sections */
.pp-section { padding: 1rem 1.5rem; }
.pp-section-title {
    font-size: 10px;
    font-weight: 800;
    color: #64748b;
    letter-spacing: 1.5px;
    margin: 0 0 0.6rem;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Component bars */
.pp-comp-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pp-comp-row {
    display: grid;
    grid-template-columns: 140px 1fr 80px;
    gap: 10px;
    align-items: center;
    font-size: 12px;
}
.pp-comp-label { color: #cbd5e1; }
.pp-comp-label strong { font-weight: 600; color: #e2e8f0; }
.pp-comp-weight {
    display: block;
    font-size: 9px;
    color: #64748b;
    letter-spacing: 0.5px;
}
.pp-comp-bar {
    height: 10px;
    background: rgba(30, 41, 59, 0.8);
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(100, 116, 139, 0.2);
}
.pp-comp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--pp-pos-color, #3b82f6), #fbbf24);
    border-radius: 5px;
    transition: width 0.4s cubic-bezier(0.2, 0.8, 0.4, 1);
}
.pp-comp-value {
    text-align: right;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.pp-comp-value small { font-weight: 500; color: #94a3b8; font-size: 10px; }

/* Card-level banner: ROOKIE / DEF / etc. — sits between header and stats */
.pp-card-banner {
    padding: 0.6rem 1.5rem;
    font-size: 0.78rem;
    line-height: 1.35;
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.08);
    border-top: 1px solid rgba(245, 158, 11, 0.25);
    border-bottom: 1px solid rgba(245, 158, 11, 0.25);
    letter-spacing: 0.2px;
}
.pp-card-banner strong { font-weight: 800; letter-spacing: 0.5px; margin-right: 0.25rem; }
.pp-banner-def {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.25);
}

/* Rookie proxy indicator — component derived from draft capital, not NFL play */
.pp-comp-proxy {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: help;
}
.pp-comp-row.is-proxy .pp-comp-fill { opacity: 0.55; }

/* Context rows */
.pp-context-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
}
.pp-context-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 10px;
    background: rgba(30, 41, 59, 0.4);
    border-radius: 6px;
}
.pp-context-label {
    font-weight: 600;
    color: #94a3b8;
    font-size: 11px;
    letter-spacing: 0.5px;
}
.pp-context-value { color: #f1f5f9; }
.pp-context-value small { color: #64748b; font-weight: 400; }

/* News */
.pp-news-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pp-news-item {
    padding: 6px 10px;
    background: rgba(30, 41, 59, 0.4);
    border-radius: 6px;
    font-size: 12px;
    display: grid;
    grid-template-columns: 80px 40px 1fr 80px;
    gap: 8px;
    align-items: baseline;
}
.pp-news-item[data-direction="positive"] { border-left: 3px solid #10b981; }
.pp-news-item[data-direction="negative"] { border-left: 3px solid #ef4444; }
.pp-news-item[data-direction="neutral"]  { border-left: 3px solid #6b7280; }
.pp-news-direction {
    text-transform: uppercase;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #94a3b8;
}
.pp-news-mag {
    font-weight: 700;
    color: #fbbf24;
    font-variant-numeric: tabular-nums;
}
.pp-news-reason { color: #e2e8f0; }
.pp-news-date { color: #64748b; font-size: 10px; text-align: right; }

/* Sparkline */
.pp-sparkline { display: block; margin-top: 4px; }
.pp-sparkline-axis {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #64748b;
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}
.pp-sparkline-empty {
    font-size: 11px;
    color: #64748b;
    padding: 8px;
    text-align: center;
    font-style: italic;
}

/* Footer */
.pp-card-actions {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid rgba(100, 116, 139, 0.2);
    text-align: center;
}
.pp-full-profile-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #f5c451;
    font-weight: 600;
    font-size: 0.8125rem;
    text-decoration: none;
}
.pp-full-profile-link:hover { text-decoration: underline; }

.pp-footer {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    font-size: 10px;
    color: #64748b;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(100, 116, 139, 0.2);
}

.pp-error {
    background: #1e293b;
    color: #fff;
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
}
.pp-error h3 { margin: 0 0 0.5rem; color: #f87171; }
.pp-error code { background: rgba(0,0,0,0.4); padding: 2px 8px; border-radius: 4px; font-size: 11px; color: #fbbf24; }

/* Soft "no card yet" empty state — a real player we can't grade yet. */
.pp-nocard {
    background: #1e293b;
    color: #e2e8f0;
    padding: 2.25rem 2rem;
    border-radius: 16px;
    text-align: center;
}
.pp-nocard-icon {
    width: 56px; height: 56px;
    margin: 0 auto 1rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.12);
    color: #94a3b8;
    font-size: 1.4rem;
}
.pp-nocard h3 { margin: 0 0 0.4rem; color: #f8fafc; font-size: 1.15rem; letter-spacing: .01em; }
.pp-nocard-name { margin: 0 0 0.85rem; color: #22c55e; font-weight: 700; font-size: 1rem; }
.pp-nocard-msg { margin: 0 auto; max-width: 34ch; color: #94a3b8; font-size: .85rem; line-height: 1.55; }

/* A small badge that can be embedded inline in tables to indicate PigPro score */
.pp-inline-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.5px;
    cursor: pointer;
    min-width: 40px;
    text-align: center;
}
.pp-inline-badge[data-tier="1"] { background: linear-gradient(135deg, #f59e0b, #d97706); }
.pp-inline-badge[data-tier="2"] { background: linear-gradient(135deg, #10b981, #059669); }
.pp-inline-badge[data-tier="3"] { background: linear-gradient(135deg, #eab308, #ca8a04); }
.pp-inline-badge[data-tier="4"] { background: #6b7280; }
.pp-inline-badge:hover { filter: brightness(1.1); transform: scale(1.05); transition: 0.15s; }

/* Mobile */
@media (max-width: 520px) {
    .pp-hero {
        grid-template-columns: 64px 1fr;
        gap: 0.75rem;
    }
    .pp-headshot { width: 64px; height: 64px; flex: 0 0 64px; }
    .pp-score-panel {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: center;
        padding-top: 0.5rem;
    }
    .pp-score-ring { width: 60px; height: 60px; }
    .pp-score-value { font-size: 16px; }
    .pp-comp-row { grid-template-columns: 100px 1fr 60px; font-size: 11px; }
}

/* === Trading card v2 additions === */

.pp-hero-chips {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.pp-hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 2px 0.5rem;
    border: 1px solid #6b7280;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255,255,255,0.04);
    line-height: 1.4;
    white-space: nowrap;
}

[data-theme="light"] .pp-hero-chip {
    background: rgba(10,22,40,0.04);
}

/* Situation detail section */
.pp-sit-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pp-sit-row {
    display: grid;
    grid-template-columns: 130px 1fr 36px;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8125rem;
}

.pp-sit-label {
    color: var(--pp-text-secondary, #A0AEC0);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pp-sit-bar {
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.06);
    overflow: hidden;
}

[data-theme="light"] .pp-sit-bar {
    background: rgba(10,22,40,0.06);
}

.pp-sit-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444 0%, #f59e0b 40%, #10b981 70%);
    border-radius: 3px;
}

.pp-sit-val {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    text-align: right;
    font-size: 0.875rem;
}

.pp-sit-signals {
    list-style: none;
    padding: 0.5rem 0 0;
    margin: 0.5rem 0 0;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 0.8125rem;
    color: var(--pp-text-muted, #94a3b8);
}

.pp-signal {
    padding: 2px 0;
}

/* ──────────────────────────────────────────────────────────────
   Coach card additions — reuses pp-card / pp-hero / pp-foil-frame
   from the player card. Only the extras below are coach-specific.
   ────────────────────────────────────────────────────────────── */

/* Component bars under the hero — stacked bars inside the existing .pp-stats grid */
.pp-stat-bar {
    width: 90%;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}
.pp-stat-fill {
    height: 100%;
    background: linear-gradient(90deg, #d4a847, #fbbf24);
}
.pp-stat-sub {
    font-size: 9px;
    color: #64748b;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

/* Top fantasy assets list (reused on coach card to show roster) */
.pp-roster {
    list-style: none;
    margin: 0;
    padding: 0;
}
.pp-roster-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.875rem;
}
.pp-roster-row:last-child { border-bottom: 0; }
.pp-roster-pos {
    display: inline-block;
    min-width: 28px;
    padding: 2px 4px;
    border-radius: 3px;
    color: #fff;
    font-weight: 800;
    font-size: 10px;
    text-align: center;
    letter-spacing: 0.5px;
}
.pp-roster-name {
    flex: 1;
    color: #e5e7eb;
    text-decoration: none;
    font-weight: 600;
}
.pp-roster-name:hover { color: #fbbf24; text-decoration: underline; }
.pp-roster-score {
    color: #fbbf24;
    font-weight: 800;
    font-family: ui-monospace, "SF Mono", monospace;
}

/* AI narrative block */
.pp-narrative-overall {
    color: #cbd5e1;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 0.75rem;
}
.pp-pos-impact-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pp-pos-impact {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 6px 8px;
    background: rgba(15, 23, 42, 0.4);
    border-left: 2px solid rgba(245, 158, 11, 0.5);
    border-radius: 0 4px 4px 0;
}
.pp-pos-badge {
    display: inline-block;
    min-width: 30px;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    font-weight: 800;
    font-size: 10px;
    text-align: center;
    letter-spacing: 0.5px;
}
.pp-pos-text {
    flex: 1;
    color: #cbd5e1;
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Coach component grid — 4 columns instead of 3 (for 4 components). Scoped
   to .pp-stats.pp-stats-coach so player cards keep their existing 3-col layout. */
.pp-stats.pp-stats-coach { grid-template-columns: repeat(4, 1fr); }
