/* ==========================================================================
   File drop zones — shared by the public tools and the admin media library.
   Loaded by layouts/public.blade.php and layouts/admin.blade.php; the markup
   is built at runtime by assets/js/filedrop.js from a plain <input type=file>,
   so a field without JS stays a working native picker.
   Depends on the --pbi-* tokens defined in app.css / admin.css.
   ========================================================================== */

.filedrop {
    position: relative;
    display: block;
    border: 2px dashed #cfd0e6;
    border-radius: var(--pbi-radius, 1rem);
    background: #fbfbff;
    padding: 1.5rem 1rem;
    min-height: 8.5rem;
    text-align: center;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.filedrop:hover {
    border-color: var(--pbi-primary, #7c3aed);
    background: var(--pbi-primary-soft, #f2edfe);
}

/* The real input sits on top, invisible but full size: it keeps the native
   click-to-browse, keyboard focus, form validation and drop target for free. */
/* Several parts below set `display`, which would otherwise beat the UA rule for
   [hidden] — the JS toggles `.hidden`, so it has to win here. */
.filedrop [hidden] {
    display: none;
}

.filedrop-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.filedrop-input:disabled {
    cursor: not-allowed;
}

.filedrop-body {
    position: relative;
    z-index: 1;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    min-height: 5.5rem;
}

.filedrop-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
}

.filedrop-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: .15rem;
    border-radius: 50%;
    color: var(--pbi-primary, #7c3aed);
    background: var(--pbi-primary-soft, #f2edfe);
    transition: transform .15s ease;
}

.filedrop-title {
    font-weight: 600;
    color: var(--pbi-ink, #191b28);
}

.filedrop-browse {
    color: var(--pbi-primary-hover, #6d28d9);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.filedrop-hint {
    font-size: .8125rem;
    color: var(--pbi-muted, #62688a);
}

/* ─── Focus (keyboard) ─────────────────────────────────────────────────── */

.filedrop.is-focused {
    border-color: var(--pbi-primary, #7c3aed);
    box-shadow: 0 0 0 .25rem rgba(124, 58, 237, .2);
}

/* ─── Dragging a file over the zone ────────────────────────────────────── */

.filedrop.is-dragover {
    border-color: var(--pbi-primary, #7c3aed);
    border-style: solid;
    background: var(--pbi-primary-soft, #f2edfe);
    box-shadow: var(--pbi-glow, 0 8px 24px -8px rgba(124, 58, 237, .45));
}

.filedrop.is-dragover .filedrop-icon {
    transform: translateY(-3px) scale(1.06);
}

/* ─── Selected files ───────────────────────────────────────────────────── */

.filedrop.has-files {
    border-style: solid;
    border-color: #d6d7ea;
    background: #fff;
    text-align: left;
}

.filedrop-list {
    list-style: none;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.filedrop-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .6rem;
    border: 1px solid var(--pbi-border, #e7e8f4);
    border-radius: var(--pbi-radius-sm, .625rem);
    background: var(--pbi-bg, #f7f7fc);
    font-size: .875rem;
    text-align: left;
}

.filedrop-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--pbi-ink, #191b28);
}

.filedrop-item-size {
    margin-left: auto;
    flex-shrink: 0;
    font-size: .78125rem;
    color: var(--pbi-muted, #62688a);
}

.filedrop-more {
    font-size: .78125rem;
    color: var(--pbi-muted, #62688a);
}

.filedrop-swap {
    font-size: .8125rem;
    color: var(--pbi-muted, #62688a);
}

/* Sits above the invisible input so it can be clicked on its own. */
.filedrop-clear {
    position: absolute;
    top: .5rem;
    right: .5rem;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 1px solid var(--pbi-border, #e7e8f4);
    border-radius: 50%;
    background: #fff;
    color: var(--pbi-muted, #62688a);
    line-height: 1;
    cursor: pointer;
}

.filedrop-clear:hover {
    border-color: #f0c9c9;
    background: #fdf0f0;
    color: #c02929;
}

.filedrop-error {
    margin-top: .5rem;
    font-size: .8125rem;
    color: #c02929;
}

@media (max-width: 575.98px) {
    .filedrop {
        padding: 1.15rem .75rem;
        min-height: 7.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {

    .filedrop,
    .filedrop-icon {
        transition: none;
    }

    .filedrop.is-dragover .filedrop-icon {
        transform: none;
    }
}