/* ==========================================================================
   KCWA Transfer – Jirafeau Theme
   Aligned with KCWA Design System v3
   Fonts, reset, tokens and dark-mode base come from kcwa.css.
   
   NOTE: On the server, this file is style_css.php with PHP headers.
   Add these PHP lines at the very top before deploying:
   
      
   ========================================================================== */

   
@import url('https://tools.kcwa.de/kcwa.css');


/* ==========================================================================
   1 – Base
   ========================================================================== */

body {
  color: var(--kcwa-text);
  background: var(--kcwa-bg);
  font-family: var(--kcwa-font);
  font-weight: var(--kcwa-weight-normal);
  margin: 0;
  line-height: var(--kcwa-text-16-lh);
}

#content {
  padding: 0 var(--kcwa-page-margin);
}

/* Header – inline pattern (Logo | Title), matching tools.kcwa.de ----- */
h1 {
  display: flex;
  align-items: center;
  width: 100%;
  padding: var(--kcwa-sp-16) 0;
  margin: 0;
}

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

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;
}

h1 a::after {
  content: 'Transfer Portal';
  position: static;
  font-size: var(--kcwa-text-14);
  font-weight: var(--kcwa-weight-bold);
  line-height: 1;
  color: var(--kcwa-text);
  white-space: nowrap;
  border-left: 1px solid var(--kcwa-muted);
  padding-left: var(--kcwa-sp-12);
  margin-left: var(--kcwa-sp-12);
}

h2 {
  text-align: center;
  color: var(--kcwa-text);
  font-weight: var(--kcwa-weight-normal);
  font-size: var(--kcwa-h2-size);
  letter-spacing: 0.0125em;
  line-height: var(--kcwa-h2-lh);
}

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

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

legend {
  color: var(--kcwa-text);
  font-size: var(--kcwa-h1-size);
  font-weight: var(--kcwa-weight-normal);
  line-height: var(--kcwa-h1-lh);
  display: block;
  text-align: center;
  padding: 0 0 var(--kcwa-sp-32) 0;
}

table a { color: var(--kcwa-text); }
table a:hover,
table a:focus { text-decoration: none; }

/* Forms ------------------------------------------------------------- */
input[type="submit"] {
  background: var(--kcwa-btn-bg);
  padding: 0 var(--kcwa-sp-24);
  height: 3rem;
  font-size: var(--kcwa-text-16);
  font-family: var(--kcwa-font);
  font-weight: var(--kcwa-weight-bold);
  letter-spacing: 0.01em;
  color: var(--kcwa-btn-text);
  cursor: pointer;
  margin: 10px;
  border: none;
  border-radius: var(--kcwa-radius);
  line-height: 1;
  transition: background var(--kcwa-transition);
}

input[type="submit"]:hover,
input[type="submit"]:focus {
  background: var(--kcwa-btn-hover);
  border: none;
}

select,
input[type="text"],
input[type="password"] {
  border: 1px solid var(--kcwa-border);
  border-radius: var(--kcwa-radius);
  padding: var(--kcwa-sp-12) var(--kcwa-sp-16);
  font-size: var(--kcwa-text-16);
  font-family: var(--kcwa-font);
  background: var(--kcwa-white);
  color: var(--kcwa-text);
  outline: none;
  transition: border-color var(--kcwa-transition);
  width: 100%;
  box-sizing: border-box;
}

select:focus,
input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--kcwa-focus);
}

select {
  width: 100%;
  background: var(--kcwa-white);
  -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='%230a0a0a' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--kcwa-sp-16) center;
  padding-right: 2.5rem;
}

/* File input – v3: flat, no shadow */
input[type="file"] {
  font-family: var(--kcwa-font);
  font-size: 1.1rem;
  color: var(--kcwa-text);
  padding: 1em 1.2em;
  border: 1px solid var(--kcwa-border);
  background: var(--kcwa-white);
  border-radius: var(--kcwa-radius);
  cursor: pointer;
  width: 100%;
  box-shadow: none;
}

input[type="file"]::file-selector-button {
  font-family: var(--kcwa-font);
  font-size: 0.9rem;
  font-weight: var(--kcwa-weight-bold);
  letter-spacing: 0.02em;
  background: var(--kcwa-btn-bg);
  color: var(--kcwa-btn-text);
  border: none;
  padding: 0.5em 1.4em;
  border-radius: var(--kcwa-radius);
  cursor: pointer;
  margin-right: 1.2em;
  transition: background var(--kcwa-transition-micro);
}

input[type="file"]::file-selector-button:hover {
  background: var(--kcwa-btn-hover);
}

/* Upload area ------------------------------------------------------- */
.inner { margin-top: 3em; }

#upload fieldset {
  background: url(upload.svg) no-repeat center;
  transition: all var(--kcwa-transition-notable);
}

#upload fieldset:hover { border-color: var(--kcwa-border); }
#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: auto; }
#upload.file-selected fieldset { background-image: none; }


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

#copyright {
  text-align: center;
  font-size: 0.4em;
  color: var(--kcwa-muted);
  margin: 3em auto;
}

#copyright a { color: var(--kcwa-muted); text-decoration: none; }
#copyright a:hover,
#copyright a:focus { text-decoration: underline; }


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

#options {
  color: var(--kcwa-text);
  position: relative;
  z-index: 10;
  width: 100%;
  margin-top: var(--kcwa-sp-24);
}

#upload.file-selected #options {
  display: flex !important;
  flex-direction: column;
  align-items: center;
}

#options .config { display: none; }

#option_table {
  order: 1;
  margin-bottom: var(--kcwa-sp-16);
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  max-width: 480px;
  text-align: left;
}

#option_table tbody {
  display: flex;
  flex-direction: column;
  gap: var(--kcwa-sp-16);
}

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

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

#option_table tr:nth-child(2),
#option_table tr:nth-child(3) {
  display: flex;
  flex-direction: column;
  gap: var(--kcwa-sp-8);
}

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

#option_table tr:nth-child(2) td:first-child,
#option_table tr:nth-child(3) td:first-child {
  font-size: var(--kcwa-text-14);
  font-weight: var(--kcwa-weight-bold);
  letter-spacing: 0.02em;
  color: var(--kcwa-text);
  opacity: 0.7;
}

#options tr { height: auto; }

#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; }

/* Checkbox ---------------------------------------------------------- */
#one_time_download {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25em;
  height: 1.25em;
  border: 1.5px solid var(--kcwa-border);
  border-radius: var(--kcwa-radius-sm);
  background: var(--kcwa-white);
  margin: 0;
  cursor: pointer;
  position: relative;
  transition: all var(--kcwa-transition-micro);
  flex-shrink: 0;
}

#one_time_download:checked {
  background: var(--kcwa-text);
  border-color: var(--kcwa-text);
}

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

fieldset { border: none; }

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


/* ==========================================================================
   4 – Upload result
   ========================================================================== */

#upload_finished,
#uploading,
.message,
.info,
.error {
  text-align: center;
  color: var(--kcwa-text);
  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: var(--kcwa-text);
  text-transform: uppercase;
  font-weight: var(--kcwa-weight-bold);
  font-size: var(--kcwa-h4-size);
  letter-spacing: 0.08em;
  margin-bottom: var(--kcwa-sp-24);
}

#upload_finished a {
  text-decoration: none;
  color: var(--kcwa-text);
  font-weight: var(--kcwa-weight-bold);
}

#uploading a {
  font-weight: var(--kcwa-weight-bold);
  text-decoration: none;
  color: var(--kcwa-text);
}

#uploaded_percentage {
  font-size: var(--kcwa-h1-size);
  font-weight: var(--kcwa-weight-normal);
  line-height: 1.2;
}

#uploaded_speed {
  font-size: var(--kcwa-text-14);
  opacity: 0.5;
  margin-top: var(--kcwa-sp-4);
}

#uploaded_time {
  font-size: var(--kcwa-text-14);
  opacity: 0.5;
}

/* Result cards – v3: flat surface, no shadow, no radius */
#upload_finished_download_page,
#upload_finished_preview,
#upload_direct_download,
#upload_delete,
#upload_validity,
#show_password {
  background: var(--kcwa-surface);
  border-radius: 0;
  padding: var(--kcwa-sp-16) var(--kcwa-sp-24);
  margin-bottom: var(--kcwa-sp-12);
  width: 100%;
  max-width: 560px;
  box-shadow: none;
  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: var(--kcwa-sp-4) 0;
  font-size: var(--kcwa-text-14);
}

#upload_finished code {
  font-family: var(--kcwa-font);
  font-size: var(--kcwa-text-12);
  color: var(--kcwa-text);
  opacity: 0.6;
  word-break: break-all;
}

#upload_finished button {
  background: transparent;
  border: 1px solid var(--kcwa-border);
  border-radius: var(--kcwa-radius);
  padding: 0.3em 0.8em;
  font-size: var(--kcwa-text-12);
  cursor: pointer;
  transition: all var(--kcwa-transition-micro);
  margin-left: var(--kcwa-sp-8);
  vertical-align: middle;
}

#upload_finished button:hover {
  background: var(--kcwa-text);
  color: var(--kcwa-btn-text);
  border-color: var(--kcwa-text);
}

/* Validity line */
#upload_validity {
  background: transparent;
  box-shadow: none;
  text-align: center;
  opacity: 0.5;
  font-size: var(--kcwa-text-14);
  padding: var(--kcwa-sp-8) 0;
}

/* Copy-All Button – Baustein 9: higher specificity to beat #upload_finished button */
#upload_finished #kcwa_copy_all {
  display: inline-flex;
  align-items: center;
  gap: var(--kcwa-sp-8);
  margin-top: var(--kcwa-sp-16);
  margin-left: 0;
  padding: 0 var(--kcwa-sp-24);
  height: 3rem;
  background: var(--kcwa-btn-bg);
  color: var(--kcwa-btn-text);
  border: none;
  border-radius: var(--kcwa-radius);
  font-family: var(--kcwa-font);
  font-size: var(--kcwa-text-14);
  font-weight: var(--kcwa-weight-bold);
  cursor: pointer;
  transition: background var(--kcwa-transition-micro);
}

#upload_finished #kcwa_copy_all:hover { background: var(--kcwa-btn-hover); }
#kcwa_copy_all.copied { background: var(--kcwa-green); }
#kcwa_copy_all.copied::after { content: ' \2713'; }

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

.message,
.error {
  color: var(--kcwa-text);
  font-weight: var(--kcwa-weight-bold);
}

#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: var(--kcwa-text);
  font-family: var(--kcwa-font);
  background: none;
  margin: auto;
  display: block;
}

textarea[readonly="readonly"] + p,
textarea[readonly="readonly"] + p + p {
  text-align: center;
  color: var(--kcwa-text);
}

textarea[readonly="readonly"] + p a,
textarea[readonly="readonly"] + p + p a {
  font-weight: var(--kcwa-weight-bold);
  text-decoration: none;
  color: var(--kcwa-text);
}

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 var(--kcwa-text);
}

#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: var(--kcwa-surface); }

#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: var(--kcwa-text);
  font-weight: var(--kcwa-weight-bold);
  border-bottom: 0;
  height: auto;
}

#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 var(--kcwa-text);
}

#admin table,
#admin + fieldset table {
  width: 100%;
  border-collapse: collapse;
  border-bottom: 1px solid var(--kcwa-text);
}

#admin td,
#admin + fieldset td {
  padding: 0.5em 1em;
  border: 1px solid var(--kcwa-text);
  border-bottom: 0;
}

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

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

#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: var(--kcwa-text);
  font-weight: var(--kcwa-weight-bold);
  border-bottom: 0;
  height: auto;
}

#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: var(--kcwa-weight-bold);
  color: var(--kcwa-text);
  background-image: url('trash.png');
  background-size: 40px 40px;
  background-repeat: no-repeat;
  padding-top: 10px;
  padding-bottom: 10px;
}

/* Baustein 6 – Download page: button area in surface card */
#submit_post fieldset > table {
  background: var(--kcwa-surface);
  border-radius: 0;
  padding: var(--kcwa-sp-16) var(--kcwa-sp-24);
  max-width: 560px;
}


/* ==========================================================================
   DARK MODE
   kcwa.css v3 overrides all --kcwa-* tokens automatically.
   Below: only Jirafeau-specific elements that need manual handling.
   ========================================================================== */

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

  body { background: var(--kcwa-bg); }

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

  /* Select chevron */
  select {
    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");
  }

  /* Baustein 4 – Form field borders: 0.12 -> 0.25 for legible contrast */
  select,
  input[type="text"],
  input[type="password"] {
    border-color: rgba(255,255,255,0.25);
  }
  input[type="file"] {
    border-color: rgba(255,255,255,0.25);
  }

  /* File button */
  input[type="file"]::file-selector-button {
    background: var(--kcwa-btn-bg);
    color: var(--kcwa-btn-text);
  }

  /* Baustein 5 – Checkbox: border 0.2 -> 0.35 */
  #one_time_download {
    border-color: rgba(255,255,255,0.35);
    background: var(--kcwa-surface);
  }
  #one_time_download:checked {
    background: var(--kcwa-text);
    border-color: var(--kcwa-text);
  }
  #one_time_download:checked::after { border-color: var(--kcwa-bg); }

  /* Icons */
  .inside, fieldset img { filter: invert(1); }

  /* Baustein 2 – Upload icon: dedicated inverted SVG */
  #upload fieldset { background-image: url(upload-inverted.svg); }

  /* Result cards */
  #upload_finished_download_page,
  #upload_finished_preview,
  #upload_direct_download,
  #upload_delete,
  #upload_validity,
  #show_password { background: var(--kcwa-surface); }

  /* Baustein 3 – Clipboard copy buttons: color + stronger border */
  #upload_finished button {
    color: var(--kcwa-text);
    border-color: rgba(255,255,255,0.25);
  }
  #upload_finished button:hover {
    background: var(--kcwa-text);
    color: var(--kcwa-bg);
    border-color: var(--kcwa-text);
  }

  /* Baustein 3 – Copy-All button */
  #upload_finished #kcwa_copy_all {
    background: var(--kcwa-btn-bg);
    color: var(--kcwa-btn-text);
  }
  #upload_finished #kcwa_copy_all:hover { background: var(--kcwa-btn-hover); }

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