/**
 * JerryTrades v4 — Depth Chart Panel Styles
 *
 * Slide-in right panel pattern (same as Trade Finder panel).
 * Panel sits at z-index 1100 with a semi-transparent backdrop.
 *
 * Color design:
 *   QB starters  #a78bfa  |  RB starters  #34d399
 *   WR starters  #60a5fa  |  TE starters  #fb923c
 *   Secondary dim  #94a3b8  (backups, inactive chips, metadata)
 *   Secondary mid  #cbd5e1  (col headers, subtitles)
 *   Bye week       #d4a853  (amber — bye column only)
 */

/* ── Panel shell ─────────────────────────────────────────────────────────── */

.dc-panel {
    position: fixed;
    inset: 0;
    z-index: 1100;
    pointer-events: none;   /* inactive until open */
    visibility: hidden;
}

.dc-panel.dc-panel--open {
    pointer-events: all;
    visibility: visible;
}

/* ── Backdrop ─────────────────────────────────────────────────────────────── */

.dc-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.dc-panel--open .dc-backdrop {
    opacity: 1;
}

/* ── Slide-in content pane ────────────────────────────────────────────────── */

.dc-content {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 820px;
    max-width: 100vw;
    background: #0f172a;
    border-left: 1px solid #1f2937;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
}

.dc-panel--open .dc-content {
    transform: translateX(0);
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.dc-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0.75rem 1rem 0.6rem;
    border-bottom: 1px solid #1f2937;
    flex-shrink: 0;
    gap: 0.75rem;
}

.dc-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.dc-title {
    font-size: 1rem;
    font-weight: 800;
    color: #f1f5f9;
    margin: 0;
    letter-spacing: -0.01em;
}

.dc-subtitle {
    font-size: 0.68rem;
    color: #94a3b8;  /* secondary dim */
    letter-spacing: 0.02em;
}

.dc-header-right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

/* ── View toggle (Grid / Card) ───────────────────────────────────────────── */

.dc-view-toggle {
    display: flex;
    border: 1px solid #1f2937;
    border-radius: 4px;
    overflow: hidden;
}

.dc-view-btn {
    padding: 0.3rem 0.6rem;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.72rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}

.dc-view-btn:hover {
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
}

.dc-view-btn.active {
    background: rgba(255,255,255,0.1);
    color: #f1f5f9;
    font-weight: 700;
}

/* ── Drafted toggle ──────────────────────────────────────────────────────── */

.dc-drafted-toggle {
    padding: 0.3rem 0.65rem;
    background: transparent;
    border: 1px solid #1f2937;
    border-radius: 4px;
    color: #94a3b8;
    font-size: 0.72rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}

.dc-drafted-toggle:hover {
    border-color: #374151;
    color: #cbd5e1;
}

.dc-drafted-toggle.active {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    color: #6ee7b7;
    font-weight: 700;
}

/* ── Close button ────────────────────────────────────────────────────────── */

.dc-close-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #64748b;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}

.dc-close-btn:hover {
    background: rgba(255,255,255,0.07);
    border-color: #374151;
    color: #e2e8f0;
}

/* ── Filter chips row ────────────────────────────────────────────────────── */

.dc-filters {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.45rem 1rem;
    border-bottom: 1px solid #1f2937;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.dc-chip {
    padding: 0.18rem 0.42rem;
    border-radius: 3px;
    border: 1px solid #1f2937;
    background: transparent;
    color: #475569;
    font-size: 0.64rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.12s;
    line-height: 1.4;
}

.dc-chip:hover {
    border-color: #374151;
    color: #94a3b8;
}

.dc-chip-divider {
    width: 1px;
    height: 16px;
    background: #1f2937;
    margin: 0 0.1rem;
}

/* ── Search row ──────────────────────────────────────────────────────────── */

.dc-search-row {
    padding: 0.45rem 1rem;
    border-bottom: 1px solid #1f2937;
    flex-shrink: 0;
}

.dc-search {
    width: 100%;
    box-sizing: border-box;
    padding: 0.35rem 0.65rem;
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 4px;
    color: #e2e8f0;
    font-size: 0.78rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.dc-search::placeholder {
    color: #475569;
}

.dc-search:focus {
    border-color: #374151;
}

/* ── Body ──────────────────────────────────────────────────────────────── */

.dc-body {
    flex: 1;
    overflow: auto;
    position: relative;
}

/* ── Loading spinner ─────────────────────────────────────────────────────── */

.dc-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
    color: #64748b;
    font-size: 0.78rem;
}

.dc-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid #1f2937;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: dc-spin 0.8s linear infinite;
}

@keyframes dc-spin {
    to { transform: rotate(360deg); }
}

/* ── Error state ─────────────────────────────────────────────────────────── */

.dc-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 3rem;
    text-align: center;
}

.dc-error-icon {
    font-size: 1.5rem;
    color: #ef4444;
}

.dc-error-msg {
    color: #f1f5f9;
    font-weight: 700;
    font-size: 0.85rem;
}

.dc-error-detail {
    color: #64748b;
    font-size: 0.72rem;
    max-width: 320px;
}

.dc-retry-btn {
    margin-top: 0.5rem;
    padding: 0.4rem 1rem;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 4px;
    color: #60a5fa;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.dc-retry-btn:hover {
    background: rgba(59, 130, 246, 0.25);
}

/* ── Empty state ─────────────────────────────────────────────────────────── */

.dc-empty {
    padding: 2.5rem;
    text-align: center;
    color: #475569;
    font-size: 0.8rem;
}

/* ── Grid view ───────────────────────────────────────────────────────────── */

.dc-grid-wrap {
    overflow-x: auto;
    overflow-y: auto;
    height: 100%;
}

.dc-grid-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.72rem;
    width: max-content;
    min-width: 100%;
}

/* Sticky header rows */
.dc-grid-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.dc-header-groups th,
.dc-header-ranks th {
    background: #111827;
    padding: 0.28rem 0.5rem;
    font-size: 0.63rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    white-space: nowrap;
    border-bottom: 1px solid #1f2937;
    text-align: left;
}

/* Rank sub-header row */
.dc-header-ranks th {
    font-size: 0.6rem;
    font-weight: 700;
    color: #475569;
    padding-top: 0.2rem;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid #1f2937;
}

/* Scarcity row */
.dc-scarcity-row td {
    background: #0a1020;
    border-bottom: 1px solid #1f2937;
    padding: 0.15rem 0.4rem;
    text-align: center;
    font-size: 0.6rem;
    font-weight: 700;
}

.dc-scarcity-cell {
    min-width: 52px;
}

/* Fixed team column */
.dc-col-fixed {
    min-width: 48px;
    position: sticky;
    left: 0;
    background: #111827 !important;
    z-index: 3;
}

.dc-col-bye {
    min-width: 36px;
    text-align: center;
}

.dc-col-rank {
    min-width: 90px;
    text-align: left;
}

.dc-col-group {
    text-align: center;
    font-weight: 900;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
}

/* Table body cells */
.dc-cell {
    padding: 0.22rem 0.5rem;
    border-bottom: 1px solid #0d1525;
    vertical-align: middle;
    white-space: nowrap;
}

.dc-cell--team {
    font-weight: 900;
    font-size: 0.7rem;
    color: #e2e8f0;
    letter-spacing: 0.05em;
    position: sticky;
    left: 0;
    background: inherit;
    z-index: 1;
    border-right: 1px solid #1f2937;
}

.dc-cell--bye {
    text-align: center;
    font-size: 0.68rem;
    font-weight: 700;
    border-right: 1px solid #1f2937;
}

.dc-cell--empty {
    font-size: 0.65rem;
    opacity: 0.4;
}

/* ── Drafted badge ───────────────────────────────────────────────────────── */

.dc-drafted-badge {
    display: inline-block;
    font-size: 0.5rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    color: #64748b;
    background: rgba(100, 116, 139, 0.15);
    border: 1px solid rgba(100, 116, 139, 0.25);
    border-radius: 2px;
    padding: 0.05rem 0.25rem;
    margin-left: 0.3rem;
    vertical-align: middle;
}

/* ── Search highlight ────────────────────────────────────────────────────── */

.dc-highlight {
    background: rgba(250, 204, 21, 0.25);
    color: #fde68a;
    border-radius: 2px;
    padding: 0 1px;
}

/* ── Card view ───────────────────────────────────────────────────────────── */

.dc-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.65rem;
    padding: 0.75rem 1rem;
}

.dc-card {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.15s;
}

.dc-card:hover {
    border-color: #374151;
}

.dc-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #1f2937;
    background: #0f172a;
}

.dc-card-team {
    font-weight: 900;
    font-size: 0.8rem;
    color: #e2e8f0;
    letter-spacing: 0.05em;
}

.dc-card-bye {
    font-size: 0.65rem;
    font-weight: 700;
}

.dc-card-body {
    padding: 0.4rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.dc-card-section {
    border-radius: 3px;
    padding: 0.3rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.dc-card-player {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
}

.dc-card-rank-num {
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    min-width: 28px;
    opacity: 0.8;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.dc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 1rem;
    border-top: 1px solid #1f2937;
    flex-shrink: 0;
}

.dc-footer-right {
    font-size: 0.62rem;
    color: #475569;
}

/* Refresh button in footer — looks like a text link, not a heavy button */
.dc-refresh-btn {
    background: transparent;
    border: none;
    font-size: 0.62rem;
    color: #475569;
    cursor: pointer;
    font-family: inherit;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
}

.dc-refresh-btn:hover {
    color: #94a3b8;
    background: rgba(255,255,255,0.05);
}

/* ── Card view toolbar (Expand All / Collapse All) ───────────────────────── */

.dc-card-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 1rem 0.3rem;
    flex-shrink: 0;
}

.dc-toolbar-btn {
    padding: 0.2rem 0.55rem;
    background: transparent;
    border: 1px solid #1f2937;
    border-radius: 3px;
    color: #64748b;
    font-size: 0.65rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.dc-toolbar-btn:hover {
    border-color: #374151;
    color: #94a3b8;
    background: rgba(255,255,255,0.04);
}

/* Collapsed card — header only visible */
.dc-card--collapsed .dc-card-header {
    border-bottom: none;
}

/* ── Responsive — narrow panels / mobile ─────────────────────────────────── */

@media (max-width: 860px) {
    .dc-content {
        width: 100vw;
    }
}

@media (max-width: 600px) {
    .dc-card-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dc-header {
        flex-wrap: wrap;
    }

    .dc-view-btn .dc-view-label {
        display: none;
    }
}
