/* =============================================================================
   Player Note Manager v4 — badges, context menu, report modal, editor
   Follows te-modal + roster-management visual patterns.
   ============================================================================= */

/* ── Note badge (full display) ─────────────────────────────────────────────── */

.player-note-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 10px;
    line-height: 1;
    margin-left: 3px;
    cursor: pointer;
    vertical-align: middle;
    transition: transform 0.15s;
    flex-shrink: 0;
}
.player-note-badge:hover { transform: scale(1.2); }

/* Action color rings */
.player-note-badge--untouchable { background: rgba(239,68,68,.18);  border: 1px solid #ef4444; }
.player-note-badge--trade_high  { background: rgba(34,197,94,.18);  border: 1px solid #22c55e; }
.player-note-badge--trade_low   { background: rgba(245,158,11,.18); border: 1px solid #f59e0b; }
.player-note-badge--dump        { background: rgba(148,163,184,.18);border: 1px solid #94a3b8; }
.player-note-badge--interested  { background: rgba(59,130,246,.18); border: 1px solid #3b82f6; }

/* ── Note pip (compact mode) ───────────────────────────────────────────────── */

.player-note-pip {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
    flex-shrink: 0;
}
.player-note-pip--untouchable { background: #ef4444; }
.player-note-pip--trade_high  { background: #22c55e; }
.player-note-pip--trade_low   { background: #f59e0b; }
.player-note-pip--dump        { background: #94a3b8; }
.player-note-pip--interested  { background: #3b82f6; }

/* ── Context menu ──────────────────────────────────────────────────────────── */

.pn-context-menu {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,.55);
    min-width: 200px;
    overflow: hidden;
    font-size: 13px;
    animation: pnCtxFadeIn 0.1s ease-out;
}
@keyframes pnCtxFadeIn {
    from { opacity: 0; transform: scale(.97); }
    to   { opacity: 1; transform: scale(1);   }
}

.pn-ctx-header {
    padding: 8px 12px 6px;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid #334155;
}

.pn-ctx-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 14px;
    background: transparent;
    border: none;
    color: #e2e8f0;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s;
}
.pn-ctx-item:hover     { background: #334155; }
.pn-ctx--danger        { color: #f87171; }
.pn-ctx--danger:hover  { background: rgba(248,113,113,.12); }

.pn-ctx-action-tag {
    font-style: normal;
    font-size: 11px;
    color: #94a3b8;
    margin-left: 4px;
}

/* ── Deadline banners ──────────────────────────────────────────────────────── */

.pn-deadline-banners {
    position: fixed;
    top: 56px;   /* below app header */
    left: 50%;
    transform: translateX(-50%);
    z-index: 8000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(520px, 94vw);
    pointer-events: none;
}

.pn-deadline-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #1e293b;
    border-left: 4px solid #3b82f6;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
    font-size: 13px;
    color: #e2e8f0;
    pointer-events: all;
    animation: pnBannerIn 0.25s ease-out;
}
@keyframes pnBannerIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0);    }
}
.pn-deadline-banner.pn-db-hiding {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .3s, transform .3s;
}

.pn-deadline-banner--untouchable { border-left-color: #ef4444; }
.pn-deadline-banner--trade_high  { border-left-color: #22c55e; }
.pn-deadline-banner--trade_low   { border-left-color: #f59e0b; }
.pn-deadline-banner--dump        { border-left-color: #94a3b8; }

.pn-db-icon  { font-size: 16px; flex-shrink: 0; }
.pn-db-text  { flex: 1; line-height: 1.4; }
.pn-db-text strong { color: #f1f5f9; }
.pn-db-text em     { font-style: normal; color: #94a3b8; }

.pn-db-view {
    padding: 4px 10px;
    background: #334155;
    border: none;
    border-radius: 5px;
    color: #e2e8f0;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.pn-db-view:hover { background: #475569; }

.pn-db-dismiss {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    flex-shrink: 0;
}
.pn-db-dismiss:hover { color: #94a3b8; }

/* ── Modal overlay ─────────────────────────────────────────────────────────── */

.pn-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.82);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: pnFadeIn 0.2s ease-out;
}
@keyframes pnFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.pn-modal-backdrop {
    position: absolute;
    inset: 0;
    cursor: pointer;
}

.pn-modal {
    position: relative;
    background: #1e293b;
    border-radius: 12px;
    width: min(900px, 96vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,.6);
    border: 1px solid #334155;
    animation: pnSlideUp 0.25s ease-out;
    overflow: hidden;
}
@keyframes pnSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── Modal header ──────────────────────────────────────────────────────────── */

.pn-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #334155;
    background: linear-gradient(135deg, #1e3a5f, #0f766e);
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}
.pn-modal-header-left { display: flex; align-items: center; gap: 10px; }
.pn-modal-icon        { font-size: 1.3rem; }
.pn-modal-title       { font-size: 1rem; font-weight: 700; color: #f1f5f9; }
.pn-modal-subtitle    { font-size: 0.75rem; color: #94a3b8; margin-top: 1px; }
.pn-modal-header-right{ display: flex; align-items: center; gap: 8px; }

.pn-add-btn {
    padding: 6px 14px;
    background: #3b82f6;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.pn-add-btn:hover { background: #2563eb; }

.pn-modal-close {
    width: 28px; height: 28px;
    background: rgba(255,255,255,.1);
    border: none;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 14px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.pn-modal-close:hover { background: rgba(255,255,255,.2); }

/* ── Modal body: list + editor grid ───────────────────────────────────────── */

.pn-modal-body {
    display: grid;
    grid-template-columns: 1fr;   /* expands to 1fr 340px when editor is open */
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ── List panel ────────────────────────────────────────────────────────────── */

.pn-list-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid #334155;
}

.pn-filter-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-bottom: 1px solid #334155;
    background: #0f172a;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.pn-filter-btn {
    padding: 4px 10px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 20px;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.pn-filter-btn:hover  { border-color: #64748b; color: #e2e8f0; }
.pn-filter-btn.active { background: #3b82f6; border-color: #3b82f6; color: #fff; }

.pn-sort-select {
    margin-left: auto;
    padding: 4px 8px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
}

.pn-note-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pn-list-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #64748b;
    font-size: 13px;
    padding: 2rem;
    gap: 6px;
}

/* ── Note card ─────────────────────────────────────────────────────────────── */

.pn-note-card {
    background: #0f172a;
    border: 1px solid #334155;
    border-left: 3px solid #334155;
    border-radius: 8px;
    padding: 10px 12px;
    transition: border-color 0.15s, background 0.15s;
}
.pn-note-card:hover { background: #1e293b; }

.pn-note-card--untouchable { border-left-color: #ef4444; }
.pn-note-card--trade_high  { border-left-color: #22c55e; }
.pn-note-card--trade_low   { border-left-color: #f59e0b; }
.pn-note-card--dump        { border-left-color: #94a3b8; }
.pn-note-card--interested  { border-left-color: #3b82f6; }
.pn-note-card--alerted     { background: #1a1a2e; }

/* Pulse highlight when scrolled-to from context menu */
@keyframes pnCardHighlight {
    0%,100% { background: #0f172a; }
    50%      { background: #1e3a5f; }
}
.pn-note-card--highlighted { animation: pnCardHighlight 0.6s ease-in-out 2; }

.pn-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.pn-card-action-icon { font-size: 16px; flex-shrink: 0; }
.pn-card-player      { flex: 1; min-width: 0; }
.pn-card-name        { display: block; font-weight: 600; color: #f1f5f9; font-size: 13px; }
.pn-card-pos         { font-size: 11px; color: #64748b; }

.pn-card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.pn-note-card:hover .pn-card-actions { opacity: 1; }

.pn-card-edit,
.pn-card-delete {
    background: transparent;
    border: none;
    padding: 3px 5px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.12s;
}
.pn-card-edit:hover   { background: #334155; }
.pn-card-delete:hover { background: rgba(248,113,113,.15); }

.pn-card-body {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.pn-card-action-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.pn-card-timeframe,
.pn-card-flags,
.pn-card-alert {
    font-size: 11px;
    color: #64748b;
}
.pn-card-alert { color: #fbbf24; }
.pn-card-notes {
    width: 100%;
    margin: 4px 0 0;
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.4;
    font-style: italic;
}

/* ── Editor panel ──────────────────────────────────────────────────────────── */

.pn-editor-panel {
    display: flex;
    flex-direction: column;
    background: #0f172a;
    overflow: hidden;
}
.pn-editor-panel--hidden  { display: none; }
.pn-editor-panel--visible { display: flex; }

.pn-editor-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #334155;
    background: #1e293b;
    flex-shrink: 0;
}

/* Back button: mobile only */
.pn-editor-back {
    display: none;
    background: transparent;
    border: none;
    color: #3b82f6;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 0;
    flex-shrink: 0;
}

.pn-editor-player-name {
    font-weight: 700;
    font-size: 14px;
    color: #f1f5f9;
}
.pn-editor-player-meta {
    font-size: 11px;
    color: #64748b;
    margin-top: 1px;
}

.pn-editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pn-editor-field { display: flex; flex-direction: column; gap: 6px; }

.pn-editor-label {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.pn-field-optional {
    font-weight: 400;
    text-transform: none;
    color: #475569;
    font-size: 11px;
    letter-spacing: 0;
    margin-left: 4px;
}

.pn-editor-input,
.pn-editor-select,
.pn-editor-textarea {
    width: 100%;
    padding: 8px 10px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 13px;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.pn-editor-input:focus,
.pn-editor-select:focus,
.pn-editor-textarea:focus {
    outline: none;
    border-color: #3b82f6;
}
.pn-editor-textarea { resize: vertical; min-height: 80px; font-family: inherit; line-height: 1.5; }
.pn-date-input { margin-top: 6px; }

/* Action radio group */
.pn-action-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pn-action-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.pn-action-option:hover   { border-color: #64748b; }
.pn-action-option.selected{ border-color: #3b82f6; background: rgba(59,130,246,.08); }
.pn-action-option input   { display: none; }
.pn-action-icon  { font-size: 15px; flex-shrink: 0; }
.pn-action-text  { font-size: 13px; color: #e2e8f0; }

/* Colored selected states per action */
.pn-action-option--untouchable.selected { border-color: #ef4444; background: rgba(239,68,68,.08); }
.pn-action-option--trade_high.selected  { border-color: #22c55e; background: rgba(34,197,94,.08); }
.pn-action-option--trade_low.selected   { border-color: #f59e0b; background: rgba(245,158,11,.08); }
.pn-action-option--dump.selected        { border-color: #94a3b8; background: rgba(148,163,184,.08); }

/* Action Tooltip */
.pn-action-tooltip {
    margin-left: auto;
    flex-shrink: 0;
    color: #475569;
    cursor: help;
    display: flex;
    align-items: center;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.pn-action-option:hover .pn-action-tooltip {
    opacity: 1;
    color: #94a3b8;
}

/* League flags */
.pn-flag-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.pn-flag-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #94a3b8;
    cursor: pointer;
}
.pn-flag-option input { accent-color: #3b82f6; }

/* Player search suggestions */
.pn-player-suggestions {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    overflow: hidden;
    max-height: 180px;
    overflow-y: auto;
}
.pn-player-suggestion {
    padding: 8px 12px;
    font-size: 13px;
    color: #e2e8f0;
    cursor: pointer;
    transition: background 0.1s;
}
.pn-player-suggestion:hover { background: #334155; }

/* Editor footer */
.pn-editor-footer {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid #334155;
    background: #1e293b;
    flex-shrink: 0;
}
.pn-editor-cancel {
    flex: 1;
    padding: 9px;
    background: #334155;
    border: none;
    border-radius: 7px;
    color: #e2e8f0;
    font-size: 13px;
    cursor: pointer;
}
.pn-editor-cancel:hover { background: #475569; }

.pn-editor-save {
    flex: 2;
    padding: 9px;
    background: #3b82f6;
    border: none;
    border-radius: 7px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.pn-editor-save:hover    { background: #2563eb; }
.pn-editor-save:disabled { background: #475569; cursor: not-allowed; }

/* ── Desktop: show list + editor side by side ──────────────────────────────── */
@media (min-width: 768px) {
    .pn-modal-body:has(.pn-editor-panel--visible) {
        grid-template-columns: 1fr 340px;
    }
}

/* ── Mobile: editor slides up as full overlay inside modal ─────────────────── */
@media (max-width: 767px) {
    .pn-editor-panel {
        position: absolute;
        inset: 0;
        z-index: 10;
        transform: translateY(100%);
        transition: transform 0.25s ease-out;
    }
    .pn-editor-panel--visible {
        transform: translateY(0);
    }
    .pn-editor-back { display: block; }
}

/* ── TF note-triggered card tag ─────────────────────────────────────────────── */

.tf-note-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(59,130,246,.15);
    border: 1px solid rgba(59,130,246,.35);
    color: #93c5fd;
    margin-left: 6px;
    vertical-align: middle;
}
.tf-note-tag--trade_high  { background: rgba(34,197,94,.12);  border-color: rgba(34,197,94,.35);  color: #86efac; }
.tf-note-tag--trade_low   { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.35); color: #fcd34d; }
.tf-note-tag--dump        { background: rgba(148,163,184,.12);border-color: rgba(148,163,184,.35);color: #cbd5e1; }
.tf-note-tag--interested  { background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.35); color: #93c5fd; }

/* ── Slot menu button (⋮) ──────────────────────────────────────────────────── */

/* Desktop: hidden until parent slot is hovered */
.slot-menu-btn {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 41, 59, 0.75);
    border: none;
    border-radius: 3px;
    color: #94a3b8;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    z-index: 3;
    /* Hidden by default on desktop — revealed by parent hover */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, background 0.12s, color 0.12s;
}

/* Reveal on slot hover (desktop) */
.roster-slot:hover .slot-menu-btn {
    opacity: 1;
    pointer-events: all;
}

.slot-menu-btn:hover {
    background: #334155;
    color: #e2e8f0;
}

/* Mobile variant: always visible, sits in 4th grid column */
.slot-menu-btn--mobile {
    position: static;          /* overrides absolute — lives in grid flow */
    opacity: 1;
    pointer-events: all;
    width: 24px;
    height: 32px;              /* full row height for easy tap */
    background: transparent;
    color: #9ca3af;
    font-size: 16px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
}

.slot-menu-btn--mobile:active {
    background: #f3f4f6;
    color: #374151;
}

/* Touch devices: always show even on non-mobile layout (avoids hover trap) */
@media (hover: none) {
    .slot-menu-btn {
        opacity: 1;
        pointer-events: all;
    }
}

/* ── Slot action popover menu ──────────────────────────────────────────────── */

.psm-menu {
    position: fixed;
    z-index: 9998;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,.55);
    min-width: 210px;
    overflow: hidden;
    font-size: 13px;
    animation: psmFadeIn 0.1s ease-out forwards;
}

@keyframes psmFadeIn {
    from { opacity: 0; transform: scale(.97); }
    to   { opacity: 1; transform: scale(1);   }
}

.psm-header {
    padding: 8px 12px 6px;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid #334155;
}

.psm-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 14px;
    background: transparent;
    border: none;
    color: #e2e8f0;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s;
}

.psm-item:hover   { background: #334155; }
.psm-item:focus   { background: #334155; outline: none; }

.psm-divider {
    height: 1px;
    background: #334155;
    margin: 3px 0;
}

.psm-note-tag {
    font-style: normal;
    font-size: 11px;
    color: #64748b;
    margin-left: 2px;
}

/* Reports cluster on Roster board — matches Trading board pattern */

/* ── Reports cluster (shared: Trading board + Roster board) ────────────────── */

.reports-cluster {
    position: relative;
    display: flex;
    align-items: center;
}

/* The label pill — always visible, shows "Reports" text + icon */
.reports-cluster-label {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,.7);
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 5px;
    cursor: default;
    white-space: nowrap;
    user-select: none;
    transition: background 0.15s;
}

/* The expand buttons — hidden until hover */
.reports-cluster-btn {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 5px;
    color: rgba(255,255,255,.8);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s;
    margin-left: 4px;
}

.reports-cluster-btn:hover {
    background: rgba(255,255,255,.16);
    color: #fff;
}

/* Expand on cluster hover */
.reports-cluster:hover .reports-cluster-label {
    background: rgba(255,255,255,.12);
}

.reports-cluster:hover .reports-cluster-btn {
    display: flex;
}

/* Player Notes button color accent inside cluster */
.report-playernotes { color: #93c5fd; }
.report-playernotes:hover { background: rgba(59,130,246,.2) !important; color: #bfdbfe !important; }

/* Responsive: hide btn-label text below 1100px (icon-only mode) */
@media (max-width: 1100px) {
    .reports-cluster-btn .btn-label { display: none; }
}