/* BOCK Secure File Transfer - Corporate Design */
:root {
    --bock-green: #95c11f;
    --steel-blue: #202d39;
    --dark-gray: #3d4349;
    --blue-gray: #4e6470;
    --silver-gray: #9b9c9c;
    --text-dark: rgba(0, 0, 0, 0.8);
    --bg-light: #ededed;
    --white: #ffffff;
    --kpi-red: #d33425;
    --kpi-yellow: #fcd037;
    --radius: 6px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Latin-Extended */
@font-face {
    font-family: "Titillium Web";
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    src: url("/static/fonts/TitilliumWeb-Regular-LatExt.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Latin */
@font-face {
    font-family: "Titillium Web";
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    src: url("/static/fonts/TitilliumWeb-Regular.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Latin-Extended */
@font-face {
    font-family: "Titillium Web";
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    src: url("/static/fonts/TitilliumWeb-Bold-LatExt.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Latin */
@font-face {
    font-family: "Titillium Web";
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    src: url("/static/fonts/TitilliumWeb-Bold.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Titillium Web", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--bg-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--steel-blue);
    color: var(--white);
    padding: 0 1.5rem;
    height: 64px;
    display: flex;
    align-items: center;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.header-logo img {
    display: block;
}

.header-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--bock-green);
}

/* Main */
.main {
    flex: 1;
    padding: 2rem 1.5rem;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

/* Footer */
.footer {
    background: var(--steel-blue);
    color: var(--silver-gray);
    padding: 1rem 1.5rem;
    font-size: 0.85rem;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    max-width: 900px;
    margin: 0 auto;
}

/* Card */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    border-left: 4px solid var(--bock-green);
}

.card h1 {
    font-size: 1.5rem;
    color: var(--steel-blue);
    margin-bottom: 0.5rem;
}

.card > p {
    color: var(--blue-gray);
    margin-bottom: 1.5rem;
}

/* Form */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 700;
    color: var(--steel-blue);
    margin-bottom: 0.35rem;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
/* Without this, the date fields on the statistics page fall back to the browser default and
   look like they belong to a different application than the button beside them. */
.form-group input[type="date"],
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--blue-gray);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-dark);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--bock-green);
    box-shadow: 0 0 0 2px rgba(149, 193, 31, 0.2);
}

.input-valid {
    border-color: var(--bock-green) !important;
    border-width: 2px !important;
}

.input-invalid {
    border-color: var(--kpi-red) !important;
    border-width: 2px !important;
}

.hint {
    font-size: 0.85rem;
    color: var(--blue-gray);
    margin-bottom: 0.5rem;
}

/* Password toggle */
.password-field {
    display: flex;
    gap: 0.5rem;
}

.password-field input {
    flex: 1;
}

.btn-icon {
    background: none;
    border: 1px solid var(--blue-gray);
    border-radius: var(--radius);
    padding: 0.6rem;
    cursor: pointer;
    font-size: 1rem;
}

/* Inline Error/Success Messages */
.msg-box {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: none;
}

.msg-box.error {
    background: rgba(211, 52, 37, 0.08);
    border: 1px solid var(--kpi-red);
    color: var(--kpi-red);
    display: block;
}

.msg-box.success {
    background: rgba(149, 193, 31, 0.08);
    border: 1px solid var(--bock-green);
    color: var(--steel-blue);
    display: block;
}

.msg-box.info {
    background: rgba(78, 100, 112, 0.08);
    border: 1px solid var(--blue-gray);
    color: var(--blue-gray);
    display: block;
}

/* Language Switcher */
.lang-switcher {
    margin-left: auto;
    display: flex;
    gap: 0.4rem;
}

.lang-flag {
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    border: 2px solid transparent;
    border-radius: 3px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.lang-flag img {
    display: block;
}

.lang-flag.active {
    border-color: var(--bock-green);
}

/* Recipient rows */
.recipient-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.recipient-row .rcpt-email {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--blue-gray);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
}

.recipient-row .rcpt-lang {
    width: 120px;
    padding: 0.6rem 0.4rem;
    border: 1px solid var(--blue-gray);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.85rem;
    background: var(--white);
}

/* Recipient email autocomplete */
.rcpt-email-wrap {
    flex: 1;
    position: relative;
}

.rcpt-email-wrap input {
    width: 100%;
}

.rcpt-suggest {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--blue-gray);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    z-index: 10;
    max-height: 160px;
    overflow-y: auto;
}

.rcpt-suggest-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
}

.rcpt-suggest-item:hover {
    background: rgba(149, 193, 31, 0.1);
}

.rcpt-suggest-item .suggest-lang {
    color: var(--silver-gray);
    font-size: 0.8rem;
    margin-left: auto;
    padding-right: 0.5rem;
}

.rcpt-suggest-item .suggest-delete {
    color: var(--kpi-red);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 0.3rem;
    margin-left: 0.5rem;
    opacity: 0.5;
}

.rcpt-suggest-item .suggest-delete:hover {
    opacity: 1;
}

/* Column headings above the recipient rows.
   The gap must match .recipient-row's, or the headings sit beside the wrong fields - they
   were 1rem against the rows' 0.5rem and had never quite lined up. */
.rcpt-head {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.rcpt-head label:first-child {
    flex: 1;
}

.rcpt-head label:nth-child(2) {
    width: 120px;
    font-size: 0.85rem;
    color: var(--blue-gray);
}

/* Reserves the width of the remove button so the two headings stay over their columns. */
.rcpt-head span {
    width: 1.9rem;
    flex: none;
}

.btn-remove-rcpt {
    background: none;
    border: none;
    color: var(--kpi-red);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 0.4rem;
    line-height: 1;
}

.btn-remove-rcpt:hover {
    color: #a02010;
}

/* Wizard Steps */
.steps {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.step {
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--bg-light);
    color: var(--silver-gray);
}

.step.active {
    background: var(--bock-green);
    color: var(--steel-blue);
}

.step.done {
    background: var(--steel-blue);
    color: var(--white);
}

.wizard-step h1 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--bock-green);
    color: var(--steel-blue);
}

.btn-primary:hover {
    background: #a8d42a;
}

.btn-danger {
    background: var(--kpi-red);
    color: var(--white);
}

/* Dropzone */
.dropzone {
    border: 2px dashed var(--blue-gray);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--bock-green);
    background: rgba(149, 193, 31, 0.05);
}

.dropzone p {
    color: var(--blue-gray);
    margin: 0;
}

.dropzone-hint {
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Transfer summary on the file step.
   The wizard has no back navigation, so this is the only way to re-read who the
   transfer is addressed to while choosing files. */
/* Label/value grid rather than fixed-width labels: "Von" and "Nachricht" differ in length,
   and so do their translations, so an explicit column width would either clip Hungarian or
   leave a gap in Chinese. auto lets the column take the longest label actually shown. */
.transfer-summary {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 0.85rem;
    background: var(--light-gray, #f4f4f4);
    border-left: 4px solid var(--bock-green, #95c11f);
    border-radius: var(--radius, 6px);
    padding: 0.75rem 1rem;
    margin: 0 0 1.25rem;
    font-size: 0.9rem;
    line-height: 1.45;
    /* Long addresses must wrap rather than widen the card. */
    overflow-wrap: anywhere;
}

.transfer-summary-label {
    color: var(--steel-blue, #4e6470);
    font-weight: 700;
    white-space: nowrap;
}

.transfer-summary-value {
    color: var(--dark-gray, #333);
    min-width: 0;
}

/* One recipient per line: a comma-separated list of long addresses wraps mid-address and
   becomes unreadable exactly when there are enough recipients to want checking. */
.transfer-summary-rcpt {
    display: block;
}

.transfer-summary-rcpt + .transfer-summary-rcpt {
    margin-top: 0.15rem;
}

/* pre-wrap keeps the sender's own line breaks. Capped height so a pasted wall of text cannot
   push the dropzone below the fold - the point of this block is orientation, not reading.

   The cap is expressed in em against this element's own line-height, deliberately: it was
   6.5rem against an inherited line-height of 1.305rem, which is 4.98 lines, so a five-line
   message got a scrollbar for the sake of a few pixels. 1.5 x 6 = 9em is six whole lines, and
   the extra 0.3em leaves a sliver of the seventh visible when there is more - which is the
   honest signal that the text is truncated, rather than a scrollbar over nothing. */
.transfer-summary-note {
    white-space: pre-wrap;
    line-height: 1.5;
    max-height: 9.3em;
    overflow-y: auto;
    font-style: italic;
}

/* Collapsed hint on how to split an oversized file. Closed by default: it is the answer to a
   question most senders never have, and open it would compete with the dropzone. */
.split-hint {
    background: var(--light-gray, #f4f4f4);
    border-radius: var(--radius, 6px);
    padding: 0.5rem 0.85rem;
    margin: 0 0 0.85rem;
    font-size: 0.85rem;
    color: var(--blue-gray, #6b7f8a);
}

.split-hint > summary {
    cursor: pointer;
    color: var(--steel-blue, #4e6470);
    font-weight: 600;
    /* The marker stays: it is what says "there is more here" before anything is clicked. */
    list-style-position: outside;
}

.split-hint > summary:hover {
    color: var(--bock-green, #95c11f);
}

.split-hint > p {
    margin: 0.5rem 0 0;
    line-height: 1.5;
}

/* File list */
.file-list {
    margin-top: 0.75rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-light);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    color: var(--blue-gray);
    white-space: nowrap;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--kpi-red);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 0.25rem;
}

/* Progress bar */
.progress-bar {
    height: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--bock-green);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--blue-gray);
    text-align: center;
}

/* Collapsible language picker. Replaces the flag row on narrow screens - see layout.html for
   why there are two switchers rather than one restyled. Hidden here, shown in the mobile
   block. */
.lang-menu {
    display: none;
    margin-left: auto;
    position: relative;
}

.lang-menu > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    /* The tap target, not the 28px flag inside it. */
    padding: 0.5rem 0.6rem;
    border: 2px solid transparent;
    border-radius: 3px;
}

/* Safari draws its own triangle through a pseudo-element the standard rule does not cover. */
.lang-menu > summary::-webkit-details-marker {
    display: none;
}

.lang-menu[open] > summary {
    border-color: var(--bock-green);
}

.lang-menu > summary img {
    display: block;
}

/* Overlays the page rather than pushing the header taller, which would shift the content
   under the reader's thumb every time the menu opens. */
.lang-menu-list {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 20;
    background: var(--white);
    border: 1px solid var(--blue-gray);
    border-radius: var(--radius);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    padding: 0.25rem;
    min-width: 10rem;
}

.lang-menu-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    /* 44px tall: this is a menu meant to be used with a thumb. */
    padding: 0.7rem 0.75rem;
    text-decoration: none;
    color: var(--text-dark);
    font-size: 0.95rem;
    border-radius: 3px;
}

.lang-menu-item.active {
    background: rgba(149, 193, 31, 0.15);
    font-weight: 700;
}

.lang-menu-item img {
    display: block;
    flex: none;
}

/* The row that ends a wizard step: primary button, plus a secondary link and/or a status. */
.step-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
}

/* Step 2 has three items (verify, resend, status) rather than two at the edges. */
.step-actions-verify {
    justify-content: flex-start;
    gap: 1rem;
}

/* Download page: "send code" button beside its status message. */
.dl-verify-row {
    display: flex;
    gap: 0.5rem;
    margin: 0.75rem 0;
    align-items: center;
}

/* ============================================================
   Mobile
   ============================================================

   THE ONE THAT MATTERS MOST
   iOS Safari zooms the whole page when a text field with font-size below 16px receives
   focus, and it does not zoom back out. Every input here was 0.95rem (~15.2px), so tapping
   the very first field on the very first step threw the layout off and left it that way -
   for a service whose entire purpose is that an outside partner can use it without
   instructions. 16px is not a preference, it is the threshold. */
@media (max-width: 700px) {
    /* 1rem = 16px, stated as rem so a user's larger base size still scales it up. */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    select,
    textarea,
    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="password"],
    .form-group input[type="date"],
    .form-group textarea,
    .recipient-row .rcpt-email,
    .recipient-row .rcpt-lang {
        font-size: 1rem;
    }

    /* Screen space. 2rem of main padding plus 2rem of card padding left 248px of usable
       width on a 360px phone, which is where the cramped feel came from. */
    .main {
        padding: 1rem 0.75rem;
    }

    .card {
        padding: 1.25rem 1rem;
    }

    .card h1,
    .wizard-step h1 {
        font-size: 1.15rem;
    }

    /* Header: logo and language menu only.
       The subtitle is translated, and Spanish ("Transferencia segura de archivos") cannot
       share a line with a logo and a language picker at this width - something had to give,
       and the subtitle is the part the <title> already says. */
    .header-inner {
        gap: 0.5rem;
        flex-wrap: nowrap;
    }

    .header-title {
        display: none;
    }

    /* Five flags side by side do not fit; the collapsible menu takes over. */
    .lang-switcher {
        display: none;
    }

    .lang-menu {
        display: block;
    }

    /* The step pills wrap already; smaller so they take two rows rather than three. */
    .steps {
        gap: 0.2rem;
        margin-bottom: 1rem;
    }

    .step {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }

    /* THE RECIPIENT ROW
       It was email input + a FIXED 120px language select + a remove button on one line. On a
       360px screen that left roughly 130px for the address - unusable, and the field where
       typing accuracy matters most. Stacked, each control gets the full width. */
    .rcpt-head {
        display: none;
    }

    .recipient-row {
        flex-wrap: wrap;
        gap: 0.35rem;
        padding-bottom: 0.75rem;
        margin-bottom: 0.75rem;
        border-bottom: 1px solid var(--bg-light);
    }

    .rcpt-email-wrap {
        flex: 1 1 100%;
    }

    .recipient-row .rcpt-lang {
        flex: 1;
        width: auto;
    }

    .btn-remove-rcpt {
        flex: none;
        /* A real target, not a 1.1rem glyph with 0.4rem of side padding. */
        padding: 0.5rem 0.9rem;
    }

    /* Buttons: full width, and tall enough to hit. The wizard's primary action is always
       the only button on its step, so nothing is competing for the row. */
    .btn {
        min-height: 2.75rem;
    }

    .btn-primary,
    #btn-step1,
    #btn-step2,
    #btn-step3,
    #btn-step4 {
        display: block;
        width: 100%;
        text-align: center;
    }

    /* #add-recipient and the "clear saved" links are secondary - they stay inline so they
       cannot be mistaken for the way forward. */
    #add-recipient {
        width: auto;
        display: inline-block;
    }

    /* A full-width button inside a space-between row would squeeze the secondary link next to
       it down to nothing. The row stacks instead: action first, then the link and status
       beneath it, left-aligned. */
    .step-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.6rem;
        margin-top: 0.75rem;
    }

    .step-actions > a,
    .step-actions > .hint {
        /* margin-left:auto is set inline on the step-2 status; on one line per item it would
           push it off to the right for no reason. */
        margin-left: 0 !important;
    }

    /* The label/value grid becomes label-above-value: two columns cannot hold an address
       and a heading side by side at this width without breaking the address mid-word. */
    .transfer-summary {
        grid-template-columns: 1fr;
        gap: 0.1rem;
        padding: 0.75rem;
    }

    .transfer-summary-label {
        margin-top: 0.4rem;
    }

    .transfer-summary-label:first-child {
        margin-top: 0;
    }

    .dropzone {
        padding: 1.5rem 1rem;
    }

    /* A long filename must wrap instead of pushing the size and the remove button off the
       right edge. min-width:0 is what allows a flex item to shrink below its content. */
    .file-item {
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .file-name {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    /* The suggestion list is anchored to the input, which is now full width, so it has room
       - but on a short screen with the keyboard open it must not run off the bottom. */
    .rcpt-suggest {
        max-height: 40vh;
    }

    /* Step 5 prints the transfer ID in a <code>, and the download page shows the sender and
       filenames. None of those may push the card wider than the screen - a horizontally
       scrolling page is how a mobile layout usually announces that it broke. */
    code,
    #summary-details,
    #transfer-from,
    #file-list-items {
        overflow-wrap: anywhere;
    }

    /* The button goes full width above, so the status message needs its own line rather
       than a 40px sliver beside it. */
    .dl-verify-row {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .dl-verify-row .hint {
        flex: 1 1 100%;
    }

    .footer-inner {
        flex-direction: column;
        gap: 0.25rem;
        text-align: center;
    }
}

/* Very narrow (older/smaller phones, and split-screen). */
@media (max-width: 380px) {
    .step {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }

    /* The menu is the only thing beside the logo now, so it can afford the full width it
       needs for the longest language name. */
    .lang-menu-list {
        min-width: 11rem;
    }
}
