/* ==========================================================================
   KCWA Transfer – Jirafeau Theme
   Aligned with KCWA Approval Pages Design System
   ========================================================================== */

/* Font Faces – Roboto lokal gehostet (CORS-frei) */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('fonts/roboto-v18-latin-300.woff2') format('woff2');
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/roboto-v18-latin-regular.woff') format('woff');
}

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/roboto-v47-latin-600.woff2') format('woff2');
}

/* ==========================================================================
   1 = Basic Style
   ========================================================================== */

body {
  color: #141414;
  background: #e6e5df;
  font-family: 'Roboto', Arial, sans-serif;
  font-weight: 400;
  margin: 0;
  line-height: 1.625;
}

#content {
  padding: 0 5%;
}

/* Header: Logo links, Linie darunter – wie Approval-Seiten */
h1 {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  padding: 1rem 0 0.5rem 0;
  margin: 0 0 5rem 0;
  position: relative;
}

h1::after {
  content: '';
  display: block;
  width: 100vw;
  height: 1px;
  background-color: #141414;
  position: absolute;
  bottom: -10px;
  left: calc(-5vw);
}

h1 a {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: none;
  text-indent: 0;
  font-size: 0;
  color: transparent;
  width: auto;
  height: auto;
  margin: 0;
  text-decoration: none;
}

/* Logo als Pseudo-Element (ersetzt background-image) */
h1 a::before {
  content: '';
  display: block;
  width: 57.5px;
  height: 12.5px;
  background: url(Logo_KCWA_2018_pos.svg) no-repeat center / contain;
  flex-shrink: 0;
}

/* Label unterhalb der Linie – wie .nav-title auf tools.kcwa.de */
h1 a::after {
  content: 'Transfer Portal';
  position: absolute;
  left: 0;
  top: calc(100% + 10px + 0.75rem);
  font-size: 1.4375rem;
  font-weight: 400;
  line-height: 1.625rem;
  color: #141414;
  white-space: nowrap;
}

h2 {
  text-align: center;
  color: #141414;
  font-weight: 400;
  font-size: 2rem;
  letter-spacing: 0.0125em;
  line-height: 2.25rem;
}

fieldset {
  border: 0;
  padding: 1.5em;
  margin: 0 auto;
  width: 20em;
  min-height: 15em;
  min-width: 30em;
  position: relative;
}

/* Upload-Bereich vertikal zentrieren */
#upload {
  min-height: calc(100vh - 10rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

legend {
  color: #141414;
  font-size: 2.75rem;
  font-weight: 400;
  line-height: 2.75rem;
  display: block;
  text-align: center;
  padding: 0 0 2rem 0;
}

table a {
  color: #141414;
}

table a:hover,
table a:focus {
  text-decoration: none;
}

input[type="submit"] {
  background: #141414;
  padding: 0.7em 3em;
  font-size: 1rem;
  font-family: 'Roboto', Arial, sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #e6e5df;
  cursor: pointer;
  margin: 10px;
  border: none;
  border-radius: 8px;
  line-height: 1.5;
  transition: all 200ms;
}

select,
input[type="text"],
input[type="password"] {
  border: 1px solid #c5c4be;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: 'Roboto', Arial, sans-serif;
  background: #fff;
  color: #141414;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  box-sizing: border-box;
}

select:focus,
input[type="text"]:focus,
input[type="password"]:focus {
  border-color: #141414;
}

select {
  width: 100%;
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23141414' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* File-Input: Card-Stil */
input[type="file"] {
  font-family: 'Roboto', Arial, sans-serif;
  font-size: 1.1rem;
  color: #141414;
  padding: 1em 1.2em;
  border: none;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

input[type="file"]::file-selector-button {
  font-family: 'Roboto', Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: #141414;
  color: #e6e5df;
  border: none;
  padding: 0.5em 1.4em;
  border-radius: 6px;
  cursor: pointer;
  margin-right: 1.2em;
  transition: all 200ms;
}

input[type="file"]::file-selector-button:hover {
  background: #333;
}

input[type="submit"]:hover,
input[type="submit"]:focus {
  background: #333;
  border: none;
}

.inner {
  margin-top: 3em;
}

#upload fieldset {
  background: url(upload.svg) no-repeat center;
  transition: all 0.5s ease;
}

#upload fieldset:hover {
  border-color: #c5c4be;
}

#upload > form {
  text-align: center;
}

#upload p {
  margin: 0;
}

#file_select {
  position: relative;
  width: 100%;
  height: 16em;
  cursor: pointer;
  opacity: 0;
}

#upload.file-selected #file_select {
  opacity: 1;
  height: 2em;
}

#upload.file-selected fieldset {
  background-image: none;
}

/* ==========================================================================
   2 = Copyright
   ========================================================================== */

#copyright {
  text-align: center;
  font-size: 0.4em;
  color: #a0a09a;
  margin: 3em auto;
}

#copyright a {
  color: #a0a09a;
  text-decoration: none;
}

#copyright a:hover,
#copyright a:focus {
  text-decoration: underline;
}

/* ==========================================================================
   3 = Options
   ========================================================================== */

#options {
  color: #141414;
  position: relative;
  z-index: 10;
  width: 100%;
  margin-top: 1.5rem;
}

/* Wenn Datei gewaehlt: Flex-Layout erzwingen (JS setzt display:block inline) */
#upload.file-selected #options {
  display: flex !important;
  flex-direction: column;
  align-items: center;
}

#options .config {
  display: none;
}

/* Optionen-Tabelle vor den Button */
#option_table {
  order: 1;
  margin-bottom: 1rem;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  max-width: 480px;
}

/* Tbody als Flex-Container fuer Reihenfolge */
#option_table tbody {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Reihenfolge: Passwort, Ablauffrist, Einmaliges Herunterladen */
#option_table tr:nth-child(2) { order: 1; } /* Passwort */
#option_table tr:nth-child(3) { order: 2; } /* Ablauffrist */
#option_table tr:first-child  { order: 3; } /* Einmaliges Herunterladen */

/* Button ans Ende */
#options > p:last-of-type {
  order: 2;
  width: 100%;
  text-align: center;
}

/* Passwort + Ablauffrist: Label oben, Input unten */
#option_table tr:nth-child(2),
#option_table tr:nth-child(3) {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#option_table tr:nth-child(2) td,
#option_table tr:nth-child(3) td {
  padding: 0;
}

/* Labels */
#option_table tr:nth-child(2) td:first-child,
#option_table tr:nth-child(3) td:first-child {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #141414;
  opacity: 0.7;
}

#options tr {
  height: auto;
}

/* Checkbox-Zeile: Checkbox vor dem Label */
#option_table tr:first-child {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-items: center;
  gap: 0.6em;
  padding: 0.6em 0 0;
  height: auto;
}

#option_table tr:first-child td {
  display: inline;
  padding: 0;
}

/* Custom Checkbox */
#one_time_download {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25em;
  height: 1.25em;
  border: 1.5px solid #999;
  border-radius: 4px;
  background: #fff;
  margin: 0;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
  flex-shrink: 0;
}

#one_time_download:checked {
  background: #141414;
  border-color: #141414;
}

#one_time_download:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Fieldset: kein Rahmen */
fieldset {
  border: none;
}

#options input[type="submit"] {
  position: relative;
  margin: 1em auto;
}

/* ==========================================================================
   4 = Upload
   ========================================================================== */

#upload_finished,
#uploading,
.message,
.info,
.error {
  text-align: center;
  color: #141414;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 12rem);
}

#upload_finished > p:nth-child(1) {
  color: #141414;
  text-transform: uppercase;
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  margin-bottom: 1.5rem;
}

#upload_finished a {
  text-decoration: none;
  color: #141414;
  font-weight: 600;
}

#uploading a {
  font-weight: 600;
  text-decoration: none;
  color: #141414;
}

#uploaded_percentage {
  font-size: 2.75rem;
  font-weight: 400;
  line-height: 1.2;
}

#uploaded_speed {
  font-size: 0.875rem;
  opacity: 0.5;
  margin-top: 0.25rem;
}

#uploaded_time {
  font-size: 0.875rem;
  opacity: 0.5;
}

/* Result card sections */
#upload_finished_download_page,
#upload_finished_preview,
#upload_direct_download,
#upload_delete,
#upload_validity,
#show_password {
  background: #fff;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-bottom: 0.75rem;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  text-align: left;
}

#upload_finished_download_page p,
#upload_finished_preview p,
#upload_direct_download p,
#upload_delete p,
#upload_validity p,
#show_password p {
  margin: 0.25rem 0;
  font-size: 0.875rem;
}

#upload_finished code {
  font-family: 'Roboto', Arial, sans-serif;
  font-size: 0.8125rem;
  color: #141414;
  opacity: 0.6;
  word-break: break-all;
}

#upload_finished button {
  background: transparent;
  border: 1px solid #c5c4be;
  border-radius: 6px;
  padding: 0.3em 0.8em;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  margin-left: 0.5rem;
  vertical-align: middle;
}

#upload_finished button:hover {
  background: #141414;
  color: #e6e5df;
  border-color: #141414;
}

/* Validity date */
#upload_validity {
  background: transparent;
  box-shadow: none;
  text-align: center;
  opacity: 0.5;
  font-size: 0.8125rem;
  padding: 0.5rem 0;
}

/* Copy-All Button */
#kcwa_copy_all {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.7em 2.5em;
  background: #141414;
  color: #e6e5df;
  border: none;
  border-radius: 8px;
  font-family: 'Roboto', Arial, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

#kcwa_copy_all:hover {
  background: #333;
}

#kcwa_copy_all.copied {
  background: #2e7d32;
}

#kcwa_copy_all.copied::after {
  content: ' ✓';
}

#upload_finished a:hover,
#uploading a:hover,
#upload_finished a:focus,
#uploading a:focus {
  text-decoration: underline;
}

.message,
.error {
  color: #141414;
  font-weight: 600;
}

#upload_link_email {
  margin-left: 10px;
}

#upload_image_email {
  padding-left: 20px;
  padding-bottom: 15px;
  background: url(email.png) no-repeat;
}

/* ==========================================================================
   5 = Terms of service
   ========================================================================== */

textarea[readonly="readonly"] {
  border: 0;
  color: #141414;
  font-family: 'Roboto', Arial, sans-serif;
  background: none;
  margin: auto;
  display: block;
}

textarea[readonly="readonly"] + p,
textarea[readonly="readonly"] + p + p {
  text-align: center;
  color: #141414;
}

textarea[readonly="readonly"] + p a,
textarea[readonly="readonly"] + p + p a {
  font-weight: 600;
  text-decoration: none;
  color: #141414;
}

textarea[readonly="readonly"] + p a:hover,
textarea[readonly="readonly"] + p + p a:hover,
textarea[readonly="readonly"] + p a:focus,
textarea[readonly="readonly"] + p + p a:focus {
  text-decoration: underline;
}

/* ==========================================================================
   6 = Install
   ========================================================================== */

#install fieldset,
#install + fieldset {
  width: auto;
  max-width: 50em;
  border: 2px solid #141414;
}

#install table,
#install + fieldset table {
  width: 100%;
  border-collapse: collapse;
}

#install td,
#install + fieldset td {
  padding: 0.5em 1em;
  border-bottom: 0;
}

#install td:empty {
  width: 13.1em;
}

#install table form:nth-child(odd),
#install + fieldset tr:nth-child(odd) {
  background: #d6d5cf;
}

#install fieldset > form {
  margin-top: 2em;
  text-align: center;
}

#install form {
  display: table;
  width: 100%;
}

#install td:last-child {
  text-align: left;
}

#install .info {
  width: 19em;
}

#install input[type="submit"] {
  min-width: 10.5em;
}

#install + fieldset table {
  font-size: 0.9em;
}

#install + fieldset td:first-child input[type="submit"] {
  background: none;
  padding: 0;
  color: #141414;
  font-weight: 600;
  border-bottom: 0;
}

#install + fieldset td:first-child input[type="submit"]:hover,
#install + fieldset td:first-child input[type="submit"]:focus {
  text-decoration: underline;
}

/* ==========================================================================
   7 = Admin
   ========================================================================== */

#admin fieldset,
#admin + fieldset {
  width: auto;
  max-width: 60em;
  border: 2px solid #141414;
}

#admin table,
#admin + fieldset table {
  width: 100%;
  border-collapse: collapse;
  border-bottom: 1px solid #141414;
}

#admin td,
#admin + fieldset td {
  padding: 0.5em 1em;
  border: 1px solid #141414;
  border-bottom: 0;
}

#admin td:empty {
  width: 13.1em;
}

#admin table form:nth-child(odd),
#admin + fieldset tr:nth-child(odd) {
  background: #d6d5cf;
}

#admin fieldset > form {
  margin-top: 2em;
  text-align: center;
}

#admin form {
  display: table;
  width: 100%;
}

#admin td:last-child {
  text-align: left;
}

#admin .info {
  width: 19em;
}

#admin input[type="submit"] {
  min-width: 10.5em;
}

#admin + fieldset table {
  font-size: 0.9em;
}

#admin + fieldset td:first-child input[type="submit"] {
  background: none;
  padding: 0;
  color: #141414;
  font-weight: 600;
  border-bottom: 0;
}

#admin + fieldset td:first-child input[type="submit"]:hover,
#admin + fieldset td:first-child input[type="submit"]:focus {
  text-decoration: underline;
}

/* ==========================================================================
   8 = Download page
   ========================================================================== */

#self_destruct {
  font-weight: 600;
  color: #141414;
  background-image: url('trash.png');
  background-size: 40px 40px;
  background-repeat: no-repeat;
  padding-top: 10px;
  padding-bottom: 10px;
}

/* ==========================================================================
   DARK MODE
   ========================================================================== */

@media (prefers-color-scheme: dark) {

  body {
    background: #141414;
    color: #e6e5df;
  }

  /* Header */
  h1::after {
    background-color: rgba(230,229,223,0.3);
  }

  h1 a::before {
    filter: invert(1);
  }

  h1 a::after {
    color: #e6e5df;
  }

  /* Headings */
  h2, h3, h4, legend {
    color: #e6e5df;
  }

  legend {
    color: #e6e5df;
  }

  /* Links */
  a {
    color: #c5c4be;
  }

  /* Form elements */
  input[type="text"],
  input[type="password"],
  input[type="number"],
  select,
  textarea {
    color: #e6e5df;
    border-color: #444;
    background: #1e1e1e;
  }

  input[type="text"]:focus,
  input[type="password"]:focus,
  input[type="number"]:focus,
  select:focus {
    border-color: #e6e5df;
  }

  input::placeholder {
    color: #666;
  }

  select {
    background-color: #1e1e1e;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23e6e5df' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  }

  /* File input */
  input[type="file"] {
    background: #1e1e1e;
    color: #e6e5df;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  }

  input[type="file"]::file-selector-button {
    background: #e6e5df;
    color: #141414;
  }

  /* Buttons */
  input[type="submit"],
  button,
  .btn {
    background: #e6e5df;
    color: #141414;
  }

  input[type="submit"]:hover,
  button:hover,
  .btn:hover {
    background: #c5c4be;
  }

  /* Checkbox */
  #one_time_download {
    border-color: #666;
    background: #1e1e1e;
  }

  #one_time_download:checked {
    background: #e6e5df;
    border-color: #e6e5df;
  }

  #one_time_download:checked::after {
    border-color: #141414;
  }

  /* Upload icon */
  .inside {
    filter: invert(1);
  }

  fieldset img {
    filter: invert(1);
  }

  /* Table + option labels */
  td, label, span {
    color: #e6e5df;
  }

  /* Option labels */
  #option_table tr:nth-child(2) td:first-child,
  #option_table tr:nth-child(3) td:first-child {
    color: #e6e5df;
  }

  /* Result cards */
  #upload_finished_download_page,
  #upload_finished_preview,
  #upload_direct_download,
  #upload_delete,
  #upload_validity,
  #show_password {
    background: #1e1e1e;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  }

  #upload_finished > p:nth-child(1) {
    color: #e6e5df;
  }

  #upload_finished a {
    color: #e6e5df;
  }

  #upload_finished code {
    color: #e6e5df;
  }

  #upload_finished button {
    border-color: #555;
    color: #e6e5df;
  }

  #upload_finished button:hover {
    background: #e6e5df;
    color: #141414;
    border-color: #e6e5df;
  }

  #uploaded_percentage {
    color: #e6e5df;
  }

  /* Copy-All Button */
  #kcwa_copy_all {
    background: #e6e5df;
    color: #141414;
  }

  #kcwa_copy_all:hover {
    background: #c5c4be;
  }

  /* Footer */
  #footer {
    color: #e6e5df;
  }

  #footer a {
    color: #c5c4be;
  }

  /* Self destruct */
  #self_destruct {
    color: #e6e5df;
    filter: invert(1);
  }

  /* Copy link area */
  #upload_link,
  #upload_link_email {
    color: #e6e5df;
  }
}
