/* Basic styles for the game */

body {
    font-family: sans-serif;
    background-color: #f0f0f0;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
}

h1, h2, h3, h4 {
    color: #222;
    margin-top: 0.25em;
    margin-bottom: 0.5em;
}

a, a:visited {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

p {
    margin-bottom: 1em;
}

/* Roster Specific Styles */
#offense-list, #defense-list, #special-teams-list {
    margin-bottom: 30px;
}

.ninja-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    background-color: #fff;
    border: 1px solid #eee;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    cursor: grab;
}

.ninja-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.ninja-card > span, .ninja-assignment {
    padding: 0 10px;
    white-space: nowrap;
}

.ninja-jersey {
    font-weight: bold;
    width: 40px;
}

.ninja-name {
    flex: 2; /* Allows name to take more space */
    min-width: 150px;
}

.ninja-gender, .ninja-age, .ninja-salary {
    flex: 0 0 auto;
    width: 80px;
}
.ninja-salary {
    width: 100px;
}

.ninja-assignment {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
    margin-left: auto; /* Pushes assignment to the right */
}

.ninja-assignment select {
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    font-size: 0.9em;
}

.ninja-assignment button, .release-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
    margin-left: 5px;
}

.ninja-assignment .save-assignment-btn {
    background-color: #28a745;
    color: white;
}

.ninja-assignment .save-assignment-btn:hover {
    background-color: #218838;
}

.release-btn {
    background-color: #dc3545;
    color: white;
}

.release-btn:hover {
    background-color: #c82333;
}

/* Agency-action button slot (Renegotiate, Start Trade, etc.) on holdout/trade-request
   cards. Rendered AFTER .ninja-assignment in DOM order; flex-basis: 100% forces
   flex-wrap to push it onto its own row below the standard player info row.
   text-align: center centers the button within that row. The slot honors the
   `.ninja-card > span` padding/nowrap rules automatically (direct child span),
   plus a top margin for row separation. Multiple action slots on one card stack
   naturally since each takes its own full-width row. */
.agency-action-slot {
    flex: 0 0 100%;
    text-align: center;
    margin-top: 8px;
}

/* Shared button base for agency-action links. Differentiated by color only:
   .ninja-renegotiate-btn → orange (holdout: must act before the player walks)
   .ninja-trade-btn       → purple (trade request: player wants out)
   .ninja-deny-trade-btn  → red    (trade request: flat-out refuse)
   .ninja-fifth-year-btn  → green  (Round 1 rookie 5YO decision available this offseason)
   .ninja-ir-btn          → slate  (injured reserve: place an OUT player / activate one)
   Two buttons sharing a slot are separated by 8px (the agency-action-slot itself
   provides horizontal centering, so the buttons sit next to each other in the middle). */
.ninja-renegotiate-btn,
.ninja-trade-btn,
.ninja-deny-trade-btn,
.ninja-fifth-year-btn,
.ninja-ir-btn {
    display: inline-block;
    padding: 5px 10px;
    color: #fff !important;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85em;
    font-weight: 600;
    line-height: 1.2;
    transition: background-color 0.15s ease;
}

.ninja-trade-btn + .ninja-deny-trade-btn,
.ninja-deny-trade-btn + .ninja-trade-btn {
    margin-left: 8px;
}

.ninja-renegotiate-btn {
    background-color: #fd7e14;
}
.ninja-renegotiate-btn:hover {
    background-color: #e8690b;
}

.ninja-trade-btn {
    background-color: #7c3aed;
}
.ninja-trade-btn:hover {
    background-color: #6d28d9;
}

.ninja-deny-trade-btn {
    background-color: #dc3545;
}
.ninja-deny-trade-btn:hover {
    background-color: #b02a37;
}

.ninja-fifth-year-btn {
    background-color: #28a745;
}
.ninja-fifth-year-btn:hover {
    background-color: #1e8035;
}

.ninja-ir-btn {
    background-color: #475569;
}
.ninja-ir-btn:hover {
    background-color: #334155;
}
/* "On IR — N game weeks left" label in the same action row, for a stint not yet served. */
.ninja-ir-status {
    font-size: 0.85em;
    font-weight: 600;
    color: #334155;
}

.notification {
    padding: 10px 20px;
    margin-bottom: 15px;
    border-radius: 5px;
    font-weight: bold;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.notification.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.notification.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* --- New Columnar Roster Styles --- */
.position-group {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 20px;
}

.position-group h3 {
    margin-top: 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.depth-chart-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.grid-header {
    font-weight: bold;
    color: #555;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
    margin-bottom: 10px;
    text-align: center;
}

.depth-zone {
    background-color: #f0f2f5;
    border-radius: 4px;
    padding: 10px;
    min-height: 50px; /* Ensures drop zone is present even when empty */
    transition: background-color 0.2s ease, padding 0.2s ease;
}

.depth-zone.drag-over {
    background-color: #d4edda; /* Highlight drop zone */
    padding-bottom: 70px; /* Add space for one more player card */
}

.depth-zone .player-cards-container {
    display: flex;
    flex-direction: column;
}

.ninja-card.drag-over-above {
    border-top: 2px solid #007bff;
}

.ninja-card.drag-over-below {
    border-bottom: 2px solid #007bff;
}

/* O-Line subgroup styles */
.oline-subgroup {
    background-color: #e8eaed;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 8px;
    min-height: 40px;
    transition: background-color 0.2s ease, padding 0.2s ease;
}

.oline-subgroup h4 {
    margin: 0 0 5px 0;
    font-size: 0.85em;
    color: #666;
}

.oline-subgroup.drag-over {
    background-color: #d4edda;
    padding-bottom: 70px; /* Add space for one more player card */
}

/* === Roster View Toggle === */
.roster-view-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
}

.view-toggle-btn {
    padding: 8px 20px;
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    color: #555;
    cursor: pointer;
    font-size: 0.95em;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.view-toggle-btn:first-child {
    border-radius: 4px 0 0 4px;
}

.view-toggle-btn:last-child {
    border-radius: 0 4px 4px 0;
}

.view-toggle-btn + .view-toggle-btn {
    border-left: none;
}

.view-toggle-btn.active {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}

/* === Coaches View === */
/* 380px columns: wide enough that a filled card's "Pupil: [Camp picks — name] [set pupil]"
   and "Teaching: …" rows each sit on one line (the roster's Sensei tab). min() keeps a
   phone-width screen at one full-width column instead of scrolling sideways. */
.coaches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.coach-slot {
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
}

.coach-slot-header {
    background-color: #f0f2f5;
    padding: 8px 12px;
    font-weight: bold;
    font-size: 0.85em;
    color: #555;
    border-bottom: 1px solid #eee;
}

.coach-slot-body {
    padding: 15px 12px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coach-empty {
    color: #aaa;
    font-style: italic;
    font-size: 0.9em;
}

/* A filled coach slot: hired sensei's name over their contract terms, centered in the body. */
.coach-filled {
    text-align: center;
}

.coach-contract {
    margin-top: 4px;
    font-size: 0.8em;
    color: #444;
}

/* The pass-down block under a filled slot (technique + pupil pickers — the same forms the
   /sensei staff panel shows), set off from the contract terms by a dotted rule. */
.coach-mentor {
    margin-top: 6px;
    padding-top: 4px;
    border-top: 1px dotted #ddd;
}

.coach-slot.coordinator .coach-slot-header {
    background-color: #e2e6ea;
    font-size: 0.9em;
}

/* === Player List Table === */
.player-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.player-list-table thead th {
    background-color: #f0f2f5;
    border-bottom: 2px solid #ddd;
    padding: 8px 10px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.player-list-table thead th:hover {
    background-color: #e2e6ea;
}

.player-list-table thead th.sort-asc::after {
    content: ' \25B2';
    font-size: 0.7em;
}

.player-list-table thead th.sort-desc::after {
    content: ' \25BC';
    font-size: 0.7em;
}

.player-list-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    text-align: center;
}

.player-list-table tbody tr:hover {
    background-color: #f8f9fa;
}
/* ── Touch: tap-to-move selection highlight (roster.js two-tap flow) ── */
.ninja-card.tap-selected {
    outline: 3px solid #e6a817;
    outline-offset: 2px;
    box-shadow: 0 0 0 6px rgba(230, 168, 23, 0.25);
}

/* ── Medical-evaluation confidence (medical-research.js confidenceForHalfWidth) ──
   A filed report shows ONE number per stat, coloured by how far to trust it:
   green high (within 5), yellow medium (within 10), red low (within 20), grey none
   (a reading the stat has since moved more than 20 from). Pills for table cells and
   captions; dot fills for the stat radars (npc-details + the /medical report modal). */
.conf-pill {
    display: inline-block;
    min-width: 2.2em;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
}
.conf-pill.conf-high   { background: #c8e6c9; color: #1b5e20; }
.conf-pill.conf-medium { background: #fff59d; color: #5d4800; }
.conf-pill.conf-low    { background: #ffcdd2; color: #b71c1c; }
.conf-pill.conf-none   { background: #e0e0e0; color: #555; }
.conf-dot { stroke: #fff; stroke-width: 1.5; }
.conf-dot.conf-high   { fill: #2e7d32; }
.conf-dot.conf-medium { fill: #f9a825; }
.conf-dot.conf-low    { fill: #c62828; }
.conf-dot.conf-none   { fill: #9e9e9e; }
