/* Mass Drive dashboard. Builds on style.css (glass, hero, page). */

:root {
    --line: rgba(255, 255, 255, 0.1);
    --line-2: rgba(255, 255, 255, 0.18);
    --muted: rgba(255, 255, 255, 0.55);
    --soft: rgba(255, 255, 255, 0.06);
    --danger: #ff8a8a;
    --ok: #8ff0b0;
}

.mi {
    font-family: "Material Symbols Rounded";
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    direction: ltr;
    display: inline-block;
    width: 1em;
    overflow: hidden;
    flex: none;
    font-feature-settings: "liga";
    -webkit-font-smoothing: antialiased;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.92em;
}

/* ---------- Buttons ---------- */

.ui-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.ui-btn:hover,
.ui-btn:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
    outline: none;
}

.ui-btn:active { transform: scale(0.97); }
.ui-btn:disabled { opacity: 0.5; cursor: default; }

.ui-btn--primary {
    background: #fff;
    border-color: #fff;
    color: #000;
}

.ui-btn--primary:hover,
.ui-btn--primary:focus-visible {
    background: rgba(255, 255, 255, 0.86);
}

.ui-btn--ghost {
    border-color: transparent;
    background: transparent;
}

.ui-btn--sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.ui-btn--wide { width: 100%; padding: 12px; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}

.icon-btn:hover,
.icon-btn:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    outline: none;
}

.icon-btn--danger:hover,
.icon-btn--danger:focus-visible { color: var(--danger); background: rgba(255, 110, 110, 0.12); }
.icon-btn.is-armed { color: #fff; background: rgba(255, 90, 90, 0.55); }

.ui-btn--danger { border-color: rgba(255, 138, 138, 0.35); color: var(--danger); }
.ui-btn--danger:hover { background: rgba(255, 110, 110, 0.12); }
.ui-btn--danger.is-armed { background: rgba(255, 90, 90, 0.55); border-color: transparent; color: #fff; }

/* ---------- Sign in ---------- */

.signin {
    width: min(100%, 420px) !important;
    padding: 34px 32px 26px !important;
    gap: 4px !important;
}

.form {
    width: 100%;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--muted);
}

.field__wrap { position: relative; display: block; }
.field__at {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.95rem;
}
.field__wrap input { padding-left: 32px !important; }

.field input,
.open-any input,
.search,
.select,
.rename-input {
    width: 100%;
    padding: 11px 15px;
    border: 1px solid var(--line-2);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font: inherit;
    font-size: 0.93rem;
    outline: none;
    transition: border-color 150ms ease, background 150ms ease;
}

.field input:focus,
.open-any input:focus,
.search:focus,
.select:focus,
.rename-input:focus {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.55);
}

#login-key {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    letter-spacing: 0.04em;
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
}

.check input { accent-color: #fff; width: 16px; height: 16px; }

.msg {
    margin: 0;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 90, 90, 0.12);
    border: 1px solid rgba(255, 90, 90, 0.3);
    color: #ffc9c9;
    font-size: 0.86rem;
}

.hint {
    margin: 18px 0 0;
    font-size: 0.84rem;
    color: rgba(255, 255, 255, 0.5);
}

.ulink {
    text-decoration: underline;
    text-underline-offset: 3px;
    color: rgba(255, 255, 255, 0.85);
}

/* ---------- Shell ---------- */

.shell {
    width: min(94vw, 1120px);
    margin: 0 auto;
    padding: 18px 0 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0 6px;
}

.top__brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.08rem;
    letter-spacing: -0.02em;
}

.top__brand img { border-radius: 8px; }

.top__right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.who {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--soft);
    border: 1px solid var(--line);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
}

.banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border-radius: 16px;
    border: 1px solid rgba(250, 204, 21, 0.35);
    background: rgba(250, 204, 21, 0.1);
    color: #fde68a;
    font-size: 0.9rem;
}

.banner span:nth-child(2) { flex: 1; }

/* ---------- Stats ---------- */

.stats {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 16px;
}

.stat {
    padding: 18px 20px;
    border-radius: 22px;
}

.stat__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat__head strong {
    font-size: 0.95rem;
    letter-spacing: 0;
    text-transform: none;
    color: #fff;
}

.stat__foot {
    margin-top: 10px;
    font-size: 0.82rem;
    color: var(--muted);
}

.usage__track {
    height: 8px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.usage__fill {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.65), #fff);
    transition: width 400ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.usage__fill.is-full { background: var(--danger); }

.stat--kinds {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
}

.kind-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--soft);
}

.kind-stat .mi { color: var(--k, #fff); font-size: 22px; }
.kind-stat strong { font-size: 1.15rem; font-weight: 600; }
.kind-stat span:last-child { font-size: 0.75rem; color: var(--muted); }

/* ---------- Drop zone ---------- */

.drop {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 30px 20px;
    border-radius: 22px;
    border-style: dashed !important;
    text-align: center;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.drop:hover,
.drop:focus-visible,
.drop.is-over {
    border-color: rgba(255, 255, 255, 0.55) !important;
    outline: none;
}

.drop.is-over { transform: scale(1.01); background: rgba(255, 255, 255, 0.1); }
.drop.is-disabled { opacity: 0.45; cursor: not-allowed; }

.drop__icon { font-size: 34px; opacity: 0.85; }
.drop__title { font-weight: 500; }
.drop__title u { text-underline-offset: 3px; }
.drop__meta { font-size: 0.82rem; color: var(--muted); }

/* ---------- Upload queue ---------- */

.queue {
    list-style: none;
    margin: -4px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.queue li {
    position: relative;
    overflow: hidden;
    padding: 9px 14px;
    border-radius: 12px;
    background: var(--soft);
    border: 1px solid var(--line);
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.queue li::before {
    content: "";
    position: absolute;
    inset: 0;
    width: var(--p, 0%);
    background: rgba(255, 255, 255, 0.08);
    transition: width 200ms ease;
    pointer-events: none;
}

.q__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q__state { flex: 0 0 auto; color: var(--muted); }
.queue li.is-error .q__state { color: var(--danger); }
.queue li.is-done .q__state { color: var(--ok); }

/* ---------- Library ---------- */

.library {
    padding: 18px;
    border-radius: 24px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.search-wrap {
    position: relative;
    flex: 1 1 220px;
}

.search-wrap .mi {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.45);
    pointer-events: none;
}

.search { padding-left: 40px; }

.select {
    width: auto;
    flex: 0 0 auto;
    padding-right: 10px;
    cursor: pointer;
}

.select option { background: #111; }

.seg {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--line-2);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.4);
}

.seg__btn {
    display: grid;
    place-items: center;
    width: 38px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.seg__btn[aria-pressed="true"] { background: rgba(255, 255, 255, 0.14); color: #fff; }

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0 14px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 6px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease;
}

.chip .mi { font-size: 17px; color: var(--k, inherit); }
.chip small { color: var(--muted); font-size: 0.75rem; }
.chip:hover { border-color: var(--line-2); }
.chip[aria-pressed="true"] { background: #fff; border-color: #fff; color: #000; }
.chip[aria-pressed="true"] .mi,
.chip[aria-pressed="true"] small { color: rgba(0, 0, 0, 0.6); }

#list-msg { margin-bottom: 12px; }

/* Kind colours */
[data-kind="image"] { --k: #7dd3fc; }
[data-kind="video"] { --k: #f9a8d4; }
[data-kind="audio"] { --k: #c4b5fd; }
[data-kind="doc"] { --k: #fde68a; }
[data-kind="other"] { --k: #a7f3d0; }

/* ---------- Files: gallery ---------- */

.files--gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
    gap: 12px;
}

.fcard {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.035);
    overflow: hidden;
    transition: border-color 150ms ease, transform 150ms ease;
}

.fcard:hover { border-color: var(--line-2); transform: translateY(-2px); }

.thumb {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    background:
        repeating-conic-gradient(rgba(255, 255, 255, 0.04) 0 25%, transparent 0 50%) 0 0 / 16px 16px,
        rgba(0, 0, 0, 0.35);
    overflow: hidden;
    color: var(--k, #fff);
}

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

.thumb .mi { font-size: 40px; opacity: 0.85; }

.thumb__ext {
    position: absolute;
    left: 8px;
    top: 8px;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.65);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
}

.fcard__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px 4px;
    min-width: 0;
}

.fname {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.88rem;
    font-weight: 500;
}

.fname:hover { text-decoration: underline; text-underline-offset: 3px; }

.fmeta {
    font-size: 0.75rem;
    color: var(--muted);
}

.actions {
    display: flex;
    gap: 2px;
    padding: 4px 6px 8px;
}

.actions .icon-btn { width: 32px; height: 32px; }
.actions .mi { font-size: 19px; }
.actions .spacer { flex: 1; }

.rename {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
}

/* One box holding the name and its extension, so the whole width is for typing. */
.rename__field {
    display: flex;
    align-items: center;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
    cursor: text;
}

.rename__field:focus-within { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.16); }

.rename__field .rename-input {
    flex: 1;
    min-width: 0;
    padding: 9px 4px 9px 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 0.92rem;
    font-weight: 500;
}

.rename__field .rename-input:focus { background: transparent; }
.rename-input::selection { background: #fff; color: #000; }

/* A card being renamed takes two columns, so long names fit. */
.files--gallery .fcard.is-renaming { grid-column: span 2; }
.fcard.is-renaming .thumb { aspect-ratio: 8 / 3; }
.rename__ext { padding: 0 12px 0 2px; color: var(--muted); font-size: 0.88rem; white-space: nowrap; }

.rename__bar { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.rename__bar .ui-btn .mi { font-size: 17px; }
.rename__hint { margin-right: auto; color: var(--muted); font-size: 0.72rem; }
.fcard .rename__hint { display: none; }

/* ---------- Files: list ---------- */

.files--list { display: flex; flex-direction: column; }

.row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 6px;
    border-radius: 14px;
    transition: background 150ms ease;
}

.row:hover { background: rgba(255, 255, 255, 0.04); }
.row + .row { border-top: 1px solid rgba(255, 255, 255, 0.05); }

.row .thumb {
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    aspect-ratio: auto;
    border-radius: 12px;
}

.row .thumb .mi { font-size: 24px; }
.row .thumb__ext { display: none; }

.row__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.row .actions { padding: 0; }
.row .rename { padding: 0; flex: 1; flex-direction: row; align-items: center; }
.row .rename__field { flex: 1; }

/* ---------- Empty ---------- */

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 36px 10px;
    color: var(--muted);
    text-align: center;
}

.empty[hidden] { display: none !important; }
.empty .mi { font-size: 40px; opacity: 0.6; }
.empty p { margin: 0; font-size: 0.92rem; }

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    z-index: 50;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    background: #fff;
    color: #000;
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: toast-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toast--error { background: #ffb4b4; }

@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- Multi-select ---------- */

.pick {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: opacity 150ms ease, background 150ms ease;
}

.pick .mi { font-size: 21px; }
.pick:hover, .pick:focus-visible { color: #fff; outline: none; }
.pick[aria-checked="true"] { color: #fff; }

/* On cards the box sits over the picture, and shows on hover or once something is ticked. */
.fcard .pick {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    opacity: 0;
}

.fcard:hover .pick,
.fcard .pick:focus-visible,
.is-selecting .fcard .pick { opacity: 1; }

.fcard.is-selected { border-color: rgba(255, 255, 255, 0.7); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7); }
.fcard.is-selected .thumb { opacity: 0.85; }
.row .pick { flex: 0 0 30px; }
.row.is-selected { background: rgba(255, 255, 255, 0.07); }

.selbar {
    position: sticky;
    bottom: 14px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 8px 8px 8px 16px;
    border: 1px solid var(--line-2);
    border-radius: 16px;
    background: rgba(20, 20, 20, 0.88);
    backdrop-filter: blur(14px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.selbar[hidden] { display: none; }
.selbar__count { font-size: 0.88rem; font-weight: 600; margin-right: 4px; white-space: nowrap; }
.selbar .spacer { flex: 1; }
.selbar .ui-btn .mi { font-size: 18px; }

/* ---------- All drives (admins) ---------- */

.view { display: flex; flex-direction: column; gap: 16px; }
.view[hidden] { display: none !important; }

#drives-btn[aria-pressed="true"] { background: rgba(255, 255, 255, 0.14); color: #fff; }

.stats--drives { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.big { font-size: 1.9rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }

.open-any {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}

.open-any .field__wrap { flex: 0 1 320px; }
.open-any input { padding-top: 8px; padding-bottom: 8px; font-size: 0.88rem; }
.open-any .ui-btn .mi { font-size: 18px; }

.loading { margin: 18px 6px; color: var(--muted); font-size: 0.9rem; }

.drives { display: flex; flex-direction: column; margin-top: 12px; }

.drive {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) minmax(140px, 220px) auto;
    align-items: center;
    gap: 14px;
    padding: 10px 6px;
    border-radius: 14px;
    transition: background 150ms ease;
}

.drive:hover { background: rgba(255, 255, 255, 0.04); }
.drive + .drive { border-top: 1px solid rgba(255, 255, 255, 0.05); }

.drive__avatar {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--soft);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.drive__info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.drive__name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.drive__link {
    padding: 0;
    border: 0;
    background: none;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.drive__link:hover { text-decoration: underline; text-underline-offset: 3px; }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.72rem;
    color: var(--muted);
}

.tag .mi { font-size: 14px; }
.tag--warn { border-color: rgba(250, 204, 21, 0.35); color: #fde68a; }

.drive__kinds { display: flex; flex-wrap: wrap; gap: 10px; font-size: 0.8rem; color: var(--muted); }
.dkind { display: inline-flex; align-items: center; gap: 3px; }
.dkind .mi { font-size: 16px; color: var(--k, inherit); }

.drive__nums { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 0.82rem; }
.drive__nums span { color: var(--muted); }
.drive[data-full] .drive__nums strong { color: var(--danger); }

.drive__actions { display: flex; align-items: center; gap: 4px; }
.drive__actions .ui-btn .mi { font-size: 18px; }

@media (max-width: 760px) {
    .stats.stats--drives { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .stats--drives .stat { padding: 14px; }
    .big { font-size: 1.4rem; }
    .drive { grid-template-columns: 42px minmax(0, 1fr) auto; }
    .drive__usage { grid-column: 2 / -1; grid-row: 2; }
}

@media (max-width: 760px) {
    .stats { grid-template-columns: 1fr; }
    .stat--kinds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hide-sm { display: none; }
    .files--gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 480px) {
    .toolbar .select { flex: 1 1 40%; }
}
