/* =========================================================================
   Image file picker
   Replaces the browser's bare "Choose File" control with a drop area that
   shows what you actually picked. Applied automatically to image inputs by
   js/filepicker.js; the native input stays in the DOM, so the form still
   submits normally if JavaScript never runs.
   ========================================================================= */

.fp {
    --fp-accent: #3d52a8;
    --fp-border: #d8ddee;
    --fp-bg: #f7f8fd;
    --fp-ink: #272b41;
    --fp-muted: #767d99;
}

.fp input[type="file"].fp-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.fp-drop {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    border: 1.5px dashed var(--fp-border);
    border-radius: 10px;
    background: var(--fp-bg);
    cursor: pointer;
    text-align: left;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.fp-drop:hover,
.fp-native:focus-visible + .fp-drop {
    border-color: var(--fp-accent);
    background: #eef1fb;
}

.fp-native:focus-visible + .fp-drop {
    box-shadow: 0 0 0 3px rgba(61, 82, 168, .25);
}

.fp.is-dragging .fp-drop {
    border-color: var(--fp-accent);
    border-style: solid;
    background: #e7ecfb;
}

.fp-icon {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(61, 82, 168, .1);
    color: var(--fp-accent);
    font-size: 1.35rem;
}

.fp-text { min-width: 0; }

.fp-title {
    display: block;
    font-weight: 620;
    font-size: .95rem;
    color: var(--fp-ink);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fp-hint {
    display: block;
    font-size: .8rem;
    color: var(--fp-muted);
    line-height: 1.35;
}

.fp-action {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: .82rem;
    font-weight: 600;
    color: var(--fp-accent);
    border: 1px solid rgba(61, 82, 168, .35);
    border-radius: 6px;
    padding: .35rem .8rem;
    background: #fff;
    white-space: nowrap;
}

.fp-drop:hover .fp-action { background: var(--fp-accent); color: #fff; border-color: var(--fp-accent); }

/* ---------- previews ---------- */
.fp-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}
.fp-previews:empty { display: none; }

.fp-thumb {
    position: relative;
    width: 104px;
    border-radius: 9px;
    overflow: hidden;
    border: 1px solid var(--fp-border);
    background: #fff;
    box-shadow: 0 2px 8px rgba(24, 33, 78, .07);
}

.fp-thumb img {
    display: block;
    width: 100%;
    height: 78px;
    object-fit: cover;
}

.fp-thumb .fp-name {
    display: block;
    font-size: .68rem;
    color: var(--fp-muted);
    padding: 5px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Non-image files get a glyph instead of a thumbnail */
.fp-thumb .fp-file {
    display: grid;
    place-items: center;
    height: 78px;
    background: #eef1fb;
    color: var(--fp-accent);
    font-size: 1.6rem;
}

.fp-clear {
    margin-top: 8px;
    font-size: .78rem;
    background: none;
    border: 0;
    padding: 0;
    color: #c9542a;
    cursor: pointer;
}
.fp-clear:hover { text-decoration: underline; }

/* Existing image shown next to the picker (edit screens) */
.fp-current {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: .82rem;
    color: var(--fp-muted);
}
.fp-current img {
    width: 74px;
    height: 56px;
    object-fit: cover;
    border-radius: 7px;
    border: 1px solid var(--fp-border);
}

/* ---------- dark admin surfaces ---------- */
@media (prefers-color-scheme: dark) {
    .fp:not([data-theme="light"]) {
        --fp-border: #333c58;
        --fp-bg: #1b2032;
        --fp-ink: #e7eaf6;
        --fp-muted: #98a0bd;
    }
    .fp:not([data-theme="light"]) .fp-action { background: #232840; }
    .fp:not([data-theme="light"]) .fp-thumb { background: #232840; }
}

@media (prefers-reduced-motion: reduce) {
    .fp-drop { transition: none; }
}
