/* ==========================================================================
   Football photos with markup (CR req_iJLIEG7Gsir1): the photo panel of the
   football board (an overlay) and of a saved football game (an inline section),
   the timeline's photo buttons, and the shared photos on the recap.

   Colours: the site tokens only (public/css/core/variables.css: --bg-primary,
   --text-primary, --border-color, --color-primary), with their own values as
   fallbacks. The drawing surface and its toolbar are the drawing module's
   (public/css/draw/dtc-draw.css). Laid out from 360px up; nothing is fixed-width.
   ========================================================================== */

.fbp {
    --fbp-bg: var(--bg-primary, #ffffff);
    --fbp-panel: var(--bg-secondary, #f8fafc);
    --fbp-text: var(--text-primary, #1e293b);
    --fbp-dim: var(--text-secondary, #64748b);
    --fbp-border: var(--border-color, #e2e8f0);
    --fbp-accent: var(--color-primary, #2ba8ff);
    --fbp-accent-hover: var(--color-primary-hover, #1a97f0);
    color: var(--fbp-text);
    font-size: 0.9375rem;
    line-height: 1.45;
}

.fbp[hidden],
.fbp [hidden] {
    display: none !important;
}

.fbp *,
.fbp *::before,
.fbp *::after {
    box-sizing: border-box;
}

/* ---- The board: a full-screen overlay, under the Pro prompt (9950) ---- */
.fbp-overlay {
    position: fixed;
    inset: 0;
    z-index: 9800;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
}

.fbp-overlay .fbp-modal {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 960px;
    height: 100%;
    background: var(--fbp-bg);
    overflow: hidden;
}

.fbp-overlay .fbp-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---- The saved game: a section of the page ---- */
.fbp-inline .fbp-modal {
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

.fbp-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--fbp-accent);
    background: var(--fbp-panel);
    flex-shrink: 0;
}

.fbp-inline .fbp-head {
    padding-left: 0;
    padding-right: 0;
    background: none;
}

.fbp-title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.fbp-allowance {
    flex: 0 1 auto;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--fbp-dim);
    text-align: right;
}

.fbp-close {
    flex: 0 0 auto;
    min-width: 44px;
    min-height: 44px;
    border: 0;
    background: none;
    color: var(--fbp-text);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.fbp-body {
    padding: 0.875rem 1rem 1.25rem;
}

.fbp-inline .fbp-body {
    padding-left: 0;
    padding-right: 0;
}

.fbp-lead,
.fbp-empty,
.fbp-pending {
    margin: 0 0 0.75rem;
    color: var(--fbp-dim);
}

.fbp-pending {
    font-weight: 600;
    color: var(--fbp-text);
}

/* ---- Buttons ---- */
.fbp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 0.875rem;
}

.fbp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.5rem 0.95rem;
    border: 1px solid var(--fbp-border);
    border-radius: 10px;
    background: var(--fbp-panel);
    color: var(--fbp-text);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.fbp-btn:focus-visible,
.fbp-close:focus-visible,
.fbp-thumb:focus-visible,
.fbp-ev-add:focus-visible,
.fbp-ev-thumb:focus-visible {
    outline: 2px solid var(--fbp-accent);
    outline-offset: 2px;
}

.fbp-btn-primary {
    border-color: var(--fbp-accent);
    background: var(--fbp-accent);
    color: #ffffff;
}

.fbp-btn-primary:hover {
    background: var(--fbp-accent-hover);
}

.fbp-btn-quiet {
    background: none;
}

/* The file inputs sit inside their labels, out of sight but reachable by keyboard. */
.fbp-file {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.fbp-btn:focus-within {
    outline: 2px solid var(--fbp-accent);
    outline-offset: 2px;
}

/* ---- The photos of the game ---- */
.fbp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.fbp-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.fbp-thumb {
    display: block;
    width: 100%;
    padding: 0;
    border: 1px solid var(--fbp-border);
    border-radius: 10px;
    background: var(--fbp-panel);
    overflow: hidden;
    cursor: pointer;
}

.fbp-thumb img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.fbp-cap {
    font-size: 0.75rem;
    color: var(--fbp-dim);
    overflow-wrap: anywhere;
}

/* ---- The editor ---- */
.fbp-stage {
    width: 100%;
    max-width: 900px;
    margin: 0 auto 0.75rem;
}

.fbp-plain {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
}

.fbp-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    align-items: center;
    margin: 0 0 0.875rem;
}

.fbp-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1 1 220px;
    min-width: 0;
    font-size: 0.8125rem;
    font-weight: 600;
}

.fbp-select {
    width: 100%;
    min-height: 44px;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--fbp-border);
    border-radius: 10px;
    background: var(--fbp-bg);
    color: var(--fbp-text);
    font: inherit;
    font-size: 16px;
}

.fbp-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 220px;
    min-height: 44px;
    font-weight: 600;
}

.fbp-check input {
    width: 20px;
    height: 20px;
    accent-color: var(--fbp-accent);
}

.fbp-check small {
    font-weight: 400;
    color: var(--fbp-dim);
}

/* ---- Lines: the notice, the warning, the status, the limit, the offer, the gate ---- */
.fbp-notice,
.fbp-team-note,
.fbp-warning,
.fbp-status,
.fbp-limit,
.fbp-offer,
.fbp-gate {
    margin: 0 0 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--fbp-border);
    border-left: 4px solid var(--fbp-accent);
    border-radius: 8px;
    background: var(--fbp-panel);
}

.fbp-warning,
.fbp-limit {
    border-left-color: #b45309;
}

.fbp-status.is-error {
    border-left-color: #b91c1c;
}

.fbp-limit-text,
.fbp-offer-text,
.fbp-gate p {
    margin: 0 0 0.5rem;
}

.fbp-limit-text {
    margin: 0;
    font-weight: 600;
}

/* The pay pop-up (the Team Pass's sheet) opens over the photo panel. */
.fbp-pay.tm-pass-modal {
    z-index: 9960;
}

/* ---- The board's timeline: a camera button and the photos on each play or score ---- */
.event-item .fbp-ev {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
    flex-shrink: 0;
}

.fbp-ev-add,
.fbp-ev-thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    background: none;
    color: var(--text-secondary, #64748b);
    overflow: hidden;
    cursor: pointer;
}

.fbp-ev-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---- The recap page and the saved game: shared photos ---- */
.fbp-shared {
    margin: 1.5rem 0 0;
}

.fbp-shared-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.875rem;
    margin: 0.75rem 0 0;
    padding: 0;
    list-style: none;
}

.fbp-shared-item {
    margin: 0;
    min-width: 0;
}

.fbp-shared-frame {
    display: block;
    width: 100%;
    line-height: 0;
}

.fbp-shared-frame img {
    display: block;
    width: 100%;
    height: auto;
}

.fbp-recap-line {
    margin-top: 0.5rem;
}

/* ---- The team owner's photo list on the team's scorer tools page ---- */
.fbp-team-line {
    margin: 0.4rem 0 0.5rem;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.fbp-team-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.fbp-team-actions form {
    margin: 0;
}

@media (max-width: 480px) {
    .fbp-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fbp-actions .fbp-btn {
        flex: 1 1 140px;
    }
}
