/* Belting & Service Xfer: brand colours from beltingservice.de, set in a calm, Apple-like style. */

/* Served from the app itself rather than Google Fonts, so that no page sends visitors' IP addresses
   to a third party. Variable font with weight and optical-size axes, Latin subset (covers äöüß);
   from @fontsource-variable/dm-sans 5.3.0, SIL Open Font License (see fonts/DM-Sans-LICENSE.txt). */
@font-face {
    font-family: "DM Sans";
    font-style: normal;
    font-weight: 100 1000;
    font-display: swap;
    src: url("../fonts/dm-sans-latin-opsz-normal.woff2") format("woff2");
}

:root {
    --brand: #00519e;
    --brand-hover: #00447f;
    --brand-tint: #e9f1fa;
    --brand-tint-hover: #dbe8f6;

    --text: #1d2329;
    --text-secondary: #636e72;
    --text-tertiary: #8b949a;
    --background: #f6f5f3;
    --surface: #ffffff;
    --surface-muted: #f1f0ee;
    --line: rgba(29, 35, 41, 0.1);
    --line-strong: #c9cdd1;

    --success: #1f8a4c;
    --success-tint: #e6f4ec;
    --warning: #9a5b00;
    --warning-tint: #fdf1dc;

    --radius-large: 22px;
    --radius: 14px;
    --radius-small: 10px;
    --shadow: 0 1px 2px rgba(29, 35, 41, 0.04), 0 10px 30px rgba(29, 35, 41, 0.06);
    --shadow-hover: 0 2px 4px rgba(29, 35, 41, 0.05), 0 16px 40px rgba(29, 35, 41, 0.1);
    --focus: 0 0 0 4px rgba(0, 81, 158, 0.18);
    --card-padding: 32px;

    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "DM Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "DM Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--background);
    color: var(--text);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.47;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--text);
}

p { margin: 0; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

[hidden] { display: none !important; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-small); }

.wrap {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

.muted { color: var(--text-secondary); }

.icon {
    width: 1.15em;
    height: 1.15em;
    flex: none;
    vertical-align: -0.2em;
}

/* Header ------------------------------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.82);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 64px;
}

.brand { display: flex; align-items: center; }
.brand img {
    height: 34px;
    width: auto;
    /* The logo has a white background; let it melt into the header. */
    mix-blend-mode: multiply;
}

.app-nav {
    display: flex;
    gap: 4px;
    margin-right: auto;
}

.app-nav a {
    padding: 6px 14px;
    border-radius: 980px;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
}

.app-nav a:hover { color: var(--text); background: var(--surface-muted); text-decoration: none; }
.app-nav a[aria-current="page"] { color: var(--brand); background: var(--brand-tint); }

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.avatar {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
}

.user-menu form { margin: 0; }

.header-action { margin-left: auto; }

/* Layout ------------------------------------------------------------------------------------- */

main.wrap {
    flex: 1;
    padding-top: 56px;
    padding-bottom: 72px;
}

.hero { margin-bottom: 36px; }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }

.eyebrow {
    margin-bottom: 8px;
    color: var(--brand);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0;
}

.hero h1 {
    font-size: 48px;
    line-height: 1.08;
    letter-spacing: -0.035em;
}

.lead {
    margin-top: 12px;
    max-width: 640px;
    color: var(--text-secondary);
    font-size: 21px;
    line-height: 1.38;
    letter-spacing: -0.015em;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-top: 14px;
    color: var(--text-secondary);
    font-size: 15px;
}

.meta span { display: inline-flex; align-items: center; gap: 6px; }

.card {
    background: var(--surface);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow);
    padding: var(--card-padding);
}

.card + .card { margin-top: 20px; }

.card-center {
    text-align: center;
    padding: 56px 32px;
}

.card-center .lead,
.card-center p { margin-left: auto; margin-right: auto; }

.card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    margin-top: 28px;
}

.site-footer {
    padding: 28px 0 36px;
    border-top: 1px solid var(--line);
    color: var(--text-tertiary);
    font-size: 13px;
}

.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: space-between; }
.site-footer nav { display: flex; gap: 20px; }
.site-footer a { color: var(--text-secondary); }

/* Buttons and fields ------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border: 0;
    border-radius: 980px;
    font: inherit;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.01em;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease, opacity 0.2s ease;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn:focus-visible { border-radius: 980px; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }

.btn-secondary { background: var(--brand-tint); color: var(--brand); }
.btn-secondary:hover:not(:disabled) { background: var(--brand-tint-hover); }

.btn-plain { background: transparent; color: var(--brand); padding-left: 12px; padding-right: 12px; }
.btn-plain:hover { background: var(--surface-muted); }

.btn-small { padding: 7px 14px; font-size: 14px; }
.btn-block { width: 100%; }

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
}

.icon-button:hover { background: var(--surface-muted); color: var(--text); }

.field { display: grid; gap: 8px; margin-bottom: 24px; }
.field label { font-size: 14px; font-weight: 500; color: var(--text-secondary); }

.input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input::placeholder { color: var(--text-tertiary); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 980px;
    background: var(--surface-muted);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-success { background: var(--success-tint); color: var(--success); }
.badge-warning { background: var(--warning-tint); color: var(--warning); }

/* Upload page -------------------------------------------------------------------------------- */

.dropzone {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 56px 24px;
    border: 2px dashed var(--line-strong);
    border-radius: var(--radius-large);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.dropzone:hover,
.dropzone.dragover { border-color: var(--brand); background: var(--brand-tint); }
.dropzone:focus-visible { border-radius: var(--radius-large); }

.dropzone-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-bottom: 10px;
    border-radius: 50%;
    background: var(--brand-tint);
    color: var(--brand);
    font-size: 28px;
    transition: transform 0.2s ease;
}

.dropzone.dragover .dropzone-icon { transform: translateY(-4px); background: #fff; }

.dropzone-title { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.dropzone-hint { color: var(--text-secondary); font-size: 15px; }
.dropzone-hint .link { color: var(--brand); font-weight: 500; }

/* Once files are chosen the drop zone shrinks to one line, so the list and the button stay in view. */
.card:has(.file-list:not([hidden])) .dropzone {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 12px;
    padding: 16px 20px;
}

.card:has(.file-list:not([hidden])) .dropzone-icon { width: 40px; height: 40px; margin: 0; font-size: 20px; }
.card:has(.file-list:not([hidden])) .dropzone-title { font-size: 17px; }

/* The upload button stays at the bottom of the window while a long file list scrolls past. */
#select-step .card-footer {
    position: sticky;
    bottom: 0;
    margin: 12px calc(-1 * var(--card-padding)) calc(-1 * var(--card-padding));
    padding: 16px var(--card-padding);
    border-radius: 0 0 var(--radius-large) var(--radius-large);
    background: var(--surface);
}

.file-list {
    list-style: none;
    margin: 24px 0 0;
    padding: 0;
    border-top: 1px solid var(--line);
}

.file-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    animation: appear 0.25s ease;
}

.file-thumb {
    width: 56px;
    height: 42px;
    flex: none;
    border-radius: 8px;
    background: var(--surface-muted);
    object-fit: cover;
    overflow: hidden;
}

.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.file-size { color: var(--text-tertiary); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.progress-head h2 { font-size: 28px; }
.progress-percent { color: var(--brand); font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

.progress {
    height: 8px;
    border-radius: 980px;
    background: var(--surface-muted);
    overflow: hidden;
}

.progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--brand);
    transition: width 0.3s ease;
}

.progress-text { margin-top: 14px; color: var(--text-secondary); font-size: 15px; font-variant-numeric: tabular-nums; }

.status-icon {
    display: inline-grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin-bottom: 20px;
    border-radius: 50%;
    background: var(--success-tint);
    color: var(--success);
    font-size: 34px;
}

.status-icon-neutral { background: var(--surface-muted); color: var(--text-secondary); }

.card-center h2, .card-center h1 { font-size: 32px; }
.card-center .muted { margin-top: 8px; max-width: 480px; }
.request-id { font-size: 13px; }

.link-field {
    display: flex;
    gap: 10px;
    max-width: 560px;
    margin: 28px auto 0;
}

.link-field .input { font-size: 15px; background: var(--surface-muted); border-color: transparent; }

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.secondary-links { margin-top: 28px; font-size: 15px; color: var(--text-tertiary); }

/* File grid (download page) ------------------------------------------------------------------ */

.notice {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    padding: 14px 18px;
    border-radius: var(--radius);
    background: var(--brand-tint);
    color: var(--brand);
    font-size: 15px;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
}

.file-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.file-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }

.file-card-thumb {
    aspect-ratio: 4 / 3;
    background: var(--surface-muted);
    display: grid;
    place-items: center;
    position: relative;
    overflow: hidden;
}

.file-card-thumb img { width: 100%; height: 100%; object-fit: contain; }

.file-card-body { display: flex; flex-direction: column; gap: 4px; flex: 1; padding: 16px 18px 18px; }

.file-card-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 15px;
    font-weight: 500;
    word-break: break-word;
}

.file-card-size { margin-bottom: 14px; color: var(--text-tertiary); font-size: 14px; }
.file-card .btn { margin-top: auto; }

/* File-type tiles ---------------------------------------------------------------------------- */

/* Stands in for the thumbnail of everything but photos (see FileTypes.cs). The container gives the
   tile its size; the icon takes the middle two thirds and scales with it, label included. */
.file-tile {
    --tile: #5f6b73;
    position: relative;
    display: block;
    background: var(--surface-muted);
    background: color-mix(in srgb, var(--tile) 9%, var(--surface));
}

.file-card-thumb > .file-tile,
.thumb-stack .file-tile { position: absolute; inset: 0; }

.file-tile svg {
    position: absolute;
    top: 17%;
    left: 0;
    width: 100%;
    height: 66%;
    overflow: visible;
    filter: drop-shadow(0 1px 1.5px rgba(29, 35, 41, 0.12));
}
.ft-page { fill: #fff; stroke: var(--tile); stroke-width: 2.5; stroke-linejoin: round; }
.ft-fold { fill: none; stroke: var(--tile); stroke-width: 2.5; stroke-linejoin: round; }
.ft-lines { fill: none; stroke: var(--tile); stroke-width: 3; stroke-linecap: round; opacity: 0.3; }
.ft-badge { fill: var(--tile); }
.ft-label { fill: #fff; font-family: var(--font); font-size: 13px; font-weight: 700; letter-spacing: 0.02em; }

.file-tile[data-kind="pdf"] { --tile: #d4372c; }
.file-tile[data-kind="spreadsheet"] { --tile: #1e7b45; }
.file-tile[data-kind="document"] { --tile: #00519e; }
.file-tile[data-kind="presentation"] { --tile: #c8611c; }
.file-tile[data-kind="drawing"] { --tile: #6a4bb5; }
.file-tile[data-kind="image"] { --tile: #0e7c86; }
.file-tile[data-kind="video"] { --tile: #b5306b; }
.file-tile[data-kind="audio"] { --tile: #8a5a00; }
.file-tile[data-kind="archive"] { --tile: #7a6248; }
.file-tile[data-kind="email"] { --tile: #2f6fb3; }

/* My uploads --------------------------------------------------------------------------------- */

.upload-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.upload-list .card + .card { margin-top: 0; }

.upload-row {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px 22px;
}

.thumb-stack { position: relative; width: 84px; height: 63px; flex: none; }

.thumb-stack > * {
    position: absolute;
    overflow: hidden;
    width: 72px;
    height: 54px;
    border-radius: 9px;
    border: 2px solid var(--surface);
    background: var(--surface-muted);
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(29, 35, 41, 0.12);
}

.thumb-stack > :nth-child(1) { left: 0; top: 0; z-index: 3; }
.thumb-stack > :nth-child(2) { left: 6px; top: 5px; z-index: 2; transform: rotate(4deg); }
.thumb-stack > :nth-child(3) { left: 12px; top: 9px; z-index: 1; transform: rotate(8deg); }

.upload-info { flex: 1; min-width: 0; }
.upload-info h3 { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-info .meta { margin-top: 4px; font-size: 14px; }

.row-actions { display: flex; gap: 6px; align-items: center; }

/* Toast -------------------------------------------------------------------------------------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 20;
    max-width: calc(100% - 32px);
    padding: 12px 20px;
    border-radius: var(--radius);
    background: rgba(29, 35, 41, 0.92);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    color: #fff;
    font-size: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes appear {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Short windows, e.g. laptops with display scaling ----------------------------------------- */

@media (max-height: 820px) {
    :root { --card-padding: 24px; }
    main.wrap { padding-top: 28px; padding-bottom: 40px; }
    .hero { margin-bottom: 20px; }
    .hero h1 { font-size: 38px; }
    .lead { margin-top: 8px; font-size: 18px; }
    .field { margin-bottom: 16px; }
    .dropzone { padding: 28px 24px; }
    .dropzone-icon { width: 48px; height: 48px; margin-bottom: 4px; font-size: 22px; }
}

/* Small screens ------------------------------------------------------------------------------ */

@media (max-width: 720px) {
    body { font-size: 16px; }
    .wrap { padding: 0 16px; }
    main.wrap { padding-top: 32px; padding-bottom: 48px; }
    .header-inner { gap: 12px; }
    .brand img { height: 28px; }
    .user-name { display: none; }
    .app-nav a { padding: 6px 10px; font-size: 14px; }
    .hero h1 { font-size: 34px; }
    .lead { font-size: 18px; }
    :root { --card-padding: 22px; }
    .card { border-radius: 18px; }
    .card-center { padding: 40px 20px; }
    .dropzone { padding: 40px 16px; }
    .link-field { flex-direction: column; }
    .upload-row { flex-wrap: wrap; gap: 14px; padding: 16px; }
    .upload-info { flex-basis: calc(100% - 104px); }
    .row-actions { width: 100%; }
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
}

@media (max-width: 600px) {
    /* The app navigation moves to its own row, like a segmented control. */
    .header-inner:has(.app-nav) { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; row-gap: 10px; }
    .app-nav {
        order: 3;
        width: 100%;
        margin: 0;
        padding: 3px;
        border-radius: 980px;
        background: var(--surface-muted);
    }
    .app-nav a { flex: 1; text-align: center; white-space: nowrap; }
    .app-nav a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(29, 35, 41, 0.12); }
    .user-menu { margin-left: auto; }
}

@media (max-width: 480px) {
    .header-inner { height: 56px; }
    .brand img { height: 24px; }
    .user-menu .avatar { display: none; }
    .card-footer { flex-direction: column-reverse; align-items: stretch; gap: 10px; text-align: center; }
    #select-step .card-footer { border-radius: 0 0 18px 18px; }

    /* File cards become compact rows so the download button keeps its label. */
    .file-grid { grid-template-columns: 1fr; gap: 12px; }
    .file-card { flex-direction: row; align-items: center; border-radius: 18px; }
    .file-card:hover { transform: none; }
    .file-card-thumb { width: 96px; height: 72px; flex: none; aspect-ratio: auto; margin-left: 12px; border-radius: 12px; overflow: hidden; }
    .file-card-body { padding: 12px 14px; gap: 2px; }
    .file-card-size { margin-bottom: 8px; }
    .file-card .btn { align-self: flex-start; width: auto; padding: 7px 14px; font-size: 14px; }
}
