/* Transfer — gemeinsames UI für App und Share-Seiten */

:root {
    --bg: #f3f4f7;
    --card: #ffffff;
    --text: #191c21;
    --muted: #69707b;
    --line: #e3e6eb;
    --accent: #2257d6;
    --accent-press: #1a46b0;
    --accent-soft: #e8eefc;
    --danger: #c43c3c;
    --ok: #1e8e4e;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 20, 28, .05), 0 8px 24px rgba(16, 20, 28, .06);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14161a;
        --card: #1d2026;
        --text: #e8eaee;
        --muted: #9aa1ac;
        --line: #2c3038;
        --accent: #4f7df0;
        --accent-press: #3a66d6;
        --accent-soft: #232c42;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 16px;
}

.page {
    max-width: 880px;
    margin: 0 auto;
    padding: 20px 16px calc(48px + env(safe-area-inset-bottom));
}

.page--narrow { max-width: 460px; padding-top: 9vh; }

h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.02em; }
h2 { font-size: 18px; margin: 0 0 4px; letter-spacing: -.01em; }

.muted { color: var(--muted); }
.error { color: var(--danger); margin: 10px 0 0; font-size: 14px; }

/* ---------- Marke ---------- */

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 650;
    letter-spacing: -.01em;
}

.brand--big { font-size: 22px; margin-bottom: 4px; }

.brand-mark {
    width: 22px; height: 22px;
    border-radius: 7px;
    background: linear-gradient(150deg, var(--accent), var(--accent-press));
    position: relative;
    flex: none;
}

.brand-mark::after {
    content: "";
    position: absolute;
    inset: 0;
    background: center / 12px no-repeat
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M8 12V4m0 0L4.8 7.2M8 4l3.2 3.2" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}

.brand--big .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
.brand--big .brand-mark::after { background-size: 16px; }

/* ---------- Karten ---------- */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin: 0 0 18px;
}

.card--center { text-align: center; }

.login-card { padding: 34px 28px; }
.login-card form { margin-top: 18px; }

/* ---------- Formulare & Buttons ---------- */

input[type="text"], input[type="password"] {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    margin: 0 0 12px;
}

input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 560;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    background: transparent;
    white-space: nowrap;
    transition: background .12s ease, border-color .12s ease, transform .05s ease;
}

.btn:active { transform: scale(.985); }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-press); }

.btn--secondary { background: var(--accent-soft); color: var(--accent); }
.btn--secondary:hover { border-color: var(--accent); }

.btn--ghost { border-color: var(--line); }
.btn--ghost:hover { border-color: var(--muted); }

.btn--danger { color: var(--danger); border-color: var(--line); }
.btn--danger:hover { border-color: var(--danger); }

.btn--small { padding: 7px 12px; font-size: 14px; }
.btn--block { width: 100%; }

.btn[disabled] { opacity: .55; pointer-events: none; }

.row-form { display: flex; gap: 10px; margin-top: 12px; }
.row-form input { flex: 1; margin: 0; }

/* ---------- Topbar ---------- */

.topbar { border-bottom: 1px solid var(--line); background: var(--card); }
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    padding-bottom: 12px;
}

/* ---------- Uploader ---------- */

.uploader-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.uploader-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.linkbox { display: flex; gap: 8px; margin: 14px 0 16px; flex-wrap: wrap; }
.linkbox input {
    flex: 1 1 220px;
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

.dropzone { display: block; cursor: pointer; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.dropzone-inner {
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    padding: 34px 18px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: border-color .15s ease, background .15s ease;
}

.dropzone-inner svg { width: 34px; height: 34px; color: var(--accent); margin-bottom: 4px; }

.dropzone:hover .dropzone-inner,
.dropzone.is-drag .dropzone-inner {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.queue { list-style: none; margin: 16px 0 0; padding: 0; }

.queue-item {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.queue-thumb {
    width: 44px; height: 44px;
    border-radius: 8px;
    background: var(--bg) center/cover no-repeat;
    border: 1px solid var(--line);
    overflow: hidden;
    position: relative;
}

.queue-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-state { font-size: 13px; color: var(--muted); }
.queue-state.is-error { color: var(--danger); }
.queue-state.is-done { color: var(--ok); }

.progress {
    height: 5px;
    border-radius: 99px;
    background: var(--line);
    overflow: hidden;
    margin-top: 6px;
}

.progress-fill {
    height: 100%;
    width: 0;
    border-radius: 99px;
    background: var(--accent);
    transition: width .25s ease;
}

.queue-summary { margin: 14px 0 0; font-size: 14px; }

.uploader-existing { margin-top: 8px; }
.uploader-existing .existing-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid var(--line);
    font-size: 14px;
}
.uploader-existing .existing-row:first-child { border-top: 0; }
.uploader-existing h3 { font-size: 14px; color: var(--muted); font-weight: 560; margin: 18px 0 6px; }

/* ---------- Übertragungs-Liste ---------- */

.shares-list { margin-top: 8px; }

.share-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    padding: 13px 0;
    border-top: 1px solid var(--line);
}

.share-row:first-child { border-top: 0; }

.share-row .info { flex: 1 1 240px; min-width: 0; }
.share-row .title { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-row .meta { font-size: 13px; color: var(--muted); }
.share-row .actions { display: flex; gap: 7px; flex-wrap: wrap; }

/* ---------- Share-Seite ---------- */

.share-head { margin: 14px 0 20px; }
.share-head .brand { margin-bottom: 14px; font-size: 15px; }
.share-head p { margin: 4px 0 0; }

.hint {
    background: var(--accent-soft);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    margin: 0 0 16px;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
}

.file-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.file-thumb {
    aspect-ratio: 16 / 10;
    background: var(--bg);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }

a.thumb-link { cursor: zoom-in; text-decoration: none; overflow: hidden; }
a.thumb-link:hover img, a.thumb-link:focus-visible img { transform: scale(1.04); }
a.thumb-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.file-thumb--image::before, .file-thumb--video::before, .file-thumb--other::before {
    content: "";
    width: 38px; height: 38px;
    opacity: .4;
    background: center / contain no-repeat;
}

.file-thumb--image::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="3" y="5" width="18" height="14" rx="2" fill="none" stroke="%23888" stroke-width="1.6"/><circle cx="9" cy="10" r="1.6" fill="%23888"/><path d="m5 17 4.5-4.5 3 3L16 12l3 3" fill="none" stroke="%23888" stroke-width="1.6" stroke-linejoin="round"/></svg>');
}

.file-thumb--video::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="3" y="5" width="18" height="14" rx="2" fill="none" stroke="%23888" stroke-width="1.6"/><path d="m10 9.5 5 2.5-5 2.5z" fill="%23888"/></svg>');
}

.file-thumb--other::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 3h7l4 4v14H7z" fill="none" stroke="%23888" stroke-width="1.6" stroke-linejoin="round"/><path d="M14 3v4h4" fill="none" stroke="%23888" stroke-width="1.6" stroke-linejoin="round"/></svg>');
}

.file-thumb:has(img)::before { display: none; }

/* Kleiner Typ-Chip unten links — Kennzeichnung, bewusst keine Play-Affordanz */
.badge-play {
    position: absolute;
    left: 8px;
    bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(12, 14, 18, .62);
    color: #fff;
    font-size: 12px;
    font-weight: 560;
    line-height: 1;
    padding: 4px 10px 4px 8px;
    border-radius: 99px;
    backdrop-filter: blur(2px);
    pointer-events: none;
}

.badge-play::before {
    content: "";
    width: 9px; height: 9px;
    background: center / contain no-repeat
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="m5.5 3.5 7 4.5-7 4.5z" fill="white"/></svg>');
}

.file-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.file-name { font-size: 14px; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 13px; }

.file-actions { display: flex; gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.file-actions .btn { flex: 1; font-size: 14px; padding: 9px 10px; }

.btn--media.is-ready { animation: nudge 1.2s ease infinite; }

@keyframes nudge {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 87, 214, .35); }
    50% { box-shadow: 0 0 0 6px rgba(34, 87, 214, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .btn--media.is-ready { animation: none; }
}

.share-foot { margin-top: 26px; font-size: 13px; text-align: center; }

/* ---------- Lightbox ---------- */

.lb {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb[hidden] { display: none; }

body.lb-open { overflow: hidden; }

.lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 11, 15, .93);
}

.lb-stage {
    position: relative;
    z-index: 1;
    margin: 0;
    max-width: 94vw;
    max-height: 82vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-img {
    max-width: 94vw;
    max-height: 82vh;
    display: block;
    border-radius: 10px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
    transition: opacity .15s ease;
}

.lb-stage.is-loading .lb-img { opacity: .2; }

.lb-spinner {
    display: none;
    position: absolute;
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, .25);
    border-top-color: #fff;
    animation: lbspin .8s linear infinite;
}

.lb-stage.is-loading .lb-spinner { display: block; }

@keyframes lbspin { to { transform: rotate(360deg); } }

.lb-bar {
    position: fixed;
    z-index: 2;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(18px + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 92vw;
    background: rgba(22, 25, 31, .88);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 99px;
    padding: 8px 9px 8px 17px;
}

.lb-caption {
    color: #e8eaee;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-dl {
    flex: none;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 560;
    padding: 7px 13px;
    border-radius: 99px;
}

.lb-dl:hover { background: rgba(255, 255, 255, .24); }

.lb-close, .lb-nav {
    position: fixed;
    z-index: 2;
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(22, 25, 31, .75);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 3px;
}

.lb-close:hover, .lb-nav:hover { background: rgba(50, 56, 66, .9); }

.lb-close {
    top: calc(14px + env(safe-area-inset-top));
    right: 14px;
}

.lb-prev { left: 10px; top: 50%; margin-top: -21px; }
.lb-next { right: 10px; top: 50%; margin-top: -21px; }

@media (max-width: 540px) {
    .lb-img, .lb-stage { max-height: 74vh; }
    .lb-prev { left: 6px; }
    .lb-next { right: 6px; }
}

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

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(22px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    background: var(--text);
    color: var(--card);
    padding: 10px 18px;
    border-radius: 99px;
    font-size: 14px;
    box-shadow: var(--shadow);
    z-index: 50;
    max-width: calc(100vw - 40px);
}

/* ---------- Klein ---------- */

@media (max-width: 540px) {
    .row-form { flex-direction: column; }
    .file-grid { grid-template-columns: 1fr 1fr; }
    .file-actions { flex-direction: column; }
    h1 { font-size: 22px; }
    .card { padding: 17px; }
}

@media (max-width: 380px) {
    .file-grid { grid-template-columns: 1fr; }
}
