/* Basic, intentionally simple styles */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: #222;
  /* Use viewport-relative gradients and prevent tiling to avoid stripes when zoomed out */
  background:
    radial-gradient(60vw 40vh at 12% 12%, rgba(105, 202, 127, 0.35) 0%, rgba(105, 202, 127, 0) 60%) no-repeat fixed,
    radial-gradient(50vw 35vh at 88% -8%, rgba(42, 123, 155, 0.35) 0%, rgba(42, 123, 155, 0) 60%) no-repeat fixed,
    linear-gradient(135deg, #2A7B9B 0%, #57C785 58%, #69CA7F 100%) fixed;
  background-size: auto, auto, cover;
}

.wrap {
  max-width: 600px;
  margin: 40px auto;
  padding: 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 18px;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

/* Drag & Drop section */
.dropzone {
  border: 2px dashed rgba(100, 100, 200, 0.5);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  color: #2a2a5a;
  margin-bottom: 12px;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.dropzone:focus-visible { outline: 2px solid #409eff; outline-offset: 2px; }
.dropzone.dragover {
  background: rgba(100, 100, 200, 0.1);
  border-color: rgba(100, 100, 200, 0.9);
  transform: translateY(-1px);
}
.dropzone .dz-inner { pointer-events: none; font-size: 14px; }


.recent_uploads {
  border-radius: 1em;
}


.button-clear{
  background: #ffffff;
  color: #c62828;
  border: 1px solid #e57373;
  border-radius: 6px;
  font-weight: 600;
  padding: 8px 18px;
  line-height: 1.1;
  box-shadow: 2px 3px 2px rgba(0, 0, 0, 0.5);
  transition: background .15s ease, color .15s ease, box-shadow .15s ease, transform .12s ease, border-color .15s;
}

.button-publish{
  background: #ffffff;
  color: #2A7B9B;
  border: 1px solid #2A7B9B;
  border-radius: 6px;
  font-weight: 600;
  padding: 8px 18px;
  margin-left: 10px;
  line-height: 1.1;
  box-shadow: 2px 3px 2px rgba(0, 0, 0, 0.5);
  transition: background .15s ease, color .15s ease, box-shadow .15s ease, transform .12s ease, border-color .15s;
}


.upload_button {
  background: #ffffff;
  color: #0a6a17;
  border: 1px solid #0a6a17;
  border-radius: 10px;
  font-weight: 700;
  padding: 10px 20px;
  line-height: 1.1;
  box-shadow: 0 6px 14px rgba(10, 106, 23, 0.25);
  transition: background .18s ease, color .18s ease, box-shadow .18s ease, transform .12s ease, border-color .18s;
}


.upload_button:hover, .upload_button:active {
  transform: translateY(2px);
  color: white;
  background: #0a6a17;
}

.button-clear:hover, .button-clear:active {
  transform: translateY(3px);
  color: white;
  background: #e57373;
}

.button-publish:hover, .button-publish:active {
  transform: translateY(3px);
  color: white;
  background: #2A7B9B;
}

.button-clear:focus-visible {
  outline: 2px solid #ff8a80;
  outline-offset: 2px;
}

.button-clear:disabled, .button-publish:disabled {
  opacity: .55;
  cursor: not-allowed;
  box-shadow: none;
}

h1 { margin: 0 0 8px; font-size: 22px; }
.hint { margin: 0 0 12px; color: #666; }

.file_input {
  /* Robust visually-hidden pattern to keep the input accessible but invisible */
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.file_info { font-size: 14px; color: #555; margin: 8px 0; margin-top: 20px;}



  .custom-file-upload{
    background: white;
    color: rgb(100, 100, 200);
    border: 1px solid rgba(100, 100, 200, .8);
    box-shadow: 0 6px 14px rgba(100, 100, 200, 0.25);
    border-radius: 10px;
    padding: 10px 18px;
    margin-bottom: 0.75em;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
  }

  /* When files are selected, script.js toggles this class */
  .custom-file-upload.has-files{
    background: rgb(100, 100, 200);
    color: white;
  }
.file_list { list-style: none; margin: 8px 0; padding: 0; }
.file_list li { padding: 4px 0; border-bottom: 1px solid #eee; font-size: 14px; }
.file_list li {
  position: relative;
}
/* Background progress bar behind each selected file row */
.file_list li::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: var(--pf-width, 0%);
  background: linear-gradient(90deg, rgba(105,202,127,0.35) 0%, rgba(42,123,155,0.35) 100%);
  opacity: 0; /* hidden until progress starts */
  transition: width .2s ease, opacity .12s ease;
}
.file_list li.uploading::before { opacity: 1; }
.file_list li.invalid { color: #a11616; }
.file_list li .reason { font-style: italic; margin-left: 4px; color: #a11616; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; }
.total_size { font-size: 14px; color: #333; }

.upload_options {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid #d0d7de;
  border-radius: 12px;
  background: #f9fbff;
}
.upload_options h2 {
  margin: 0 0 10px;
  font-size: 16px;
  color: #205c73;
}
.option_row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.option_row label { font-weight: 600; font-size: 14px; color: #234; }
.option_input_group {
  display: flex;
  gap: 8px;
  align-items: center;
}
.option_input_group input[type="password"] {
  flex: 1 1 auto;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
}
.option_input_group button {
  padding: 8px 14px;
  border: 1px solid #2A7B9B;
  background: #ffffff;
  color: #2A7B9B;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.option_input_group button:hover:not(:disabled),
.option_input_group button:active:not(:disabled) {
  background: #2A7B9B;
  color: #ffffff;
}
.option_input_group button:disabled {
  opacity: .6;
  cursor: not-allowed;
}
.option_status {
  min-height: 16px;
  font-size: 12px;
  color: #0a6a17;
}
.option_status.error { color: #a11616; }
.option_hint {
  font-size: 12px;
  color: #666;
}
.option_checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #234;
}

.upload_button, .clear_button {
  padding: 8px 16px;
  cursor: pointer;
}
.upload_button:disabled, .clear_button:disabled { opacity: 0.6; cursor: not-allowed; }

/* Icon share button */
.icon-btn.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: #ffffff;
  border: 1px solid #d2d6dc;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
  position: relative;
}
.icon-btn.share-btn img { pointer-events: none; opacity: .85; }
.icon-btn.share-btn:hover:not(:disabled) { background:#f3f6f9; }
.icon-btn.share-btn:active:not(:disabled) { background:#e6eaee; }
.icon-btn.share-btn.busy { opacity:.6; cursor: progress; }
.icon-btn.share-btn.ok { box-shadow: 0 0 0 2px #c8f7d0 inset; border-color:#6ac87a; }
.icon-btn.share-btn.err { box-shadow: 0 0 0 2px #f7d0d0 inset; border-color:#d9534f; }
.icon-btn.share-btn:focus-visible { outline:2px solid #409eff; outline-offset:2px; }

.upload_status {
  margin-top: 12px;
  font-size: 14px;
  min-height: 18px;
  color: #333;
  word-break: break-word;
}
.upload_status.success { color: #0a6a17; }
.upload_status.error { color: #a11616; }

.quota_status {
  margin-top: 6px;
  font-size: 13px;
  color: #0a6a17;
  min-height: 16px;
}

/* Upload progress bar */
.upload_progress {
  margin-top: 8px;
  height: 10px;
  background: #e9ecef;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  overflow: hidden;
}
.upload_progress .bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #69ca7f 0%, #2a7b9b 100%);
  transition: width 0.2s ease;
}

/* Indeterminate animation when progress is not computable */
.upload_progress.indeterminate .bar {
  width: 30%;
  animation: indet 1.2s infinite ease-in-out;
  background: linear-gradient(90deg, #69ca7f 0%, #2a7b9b 100%);
}
@keyframes indet {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(10%); }
  100% { transform: translateX(100%); }
}

/* Cancel upload button */
.upload_cancel {
  margin-top: 8px;
  background: #fff;
  color: #a11616;
  border: 1px solid #e0a4a4;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}
.upload_cancel:hover { background: #fff2f2; }
.upload_cancel:focus-visible { outline: 2px solid #f8c4c4; outline-offset: 2px; }


/* Offline / API override panel */
.api_offline { margin-top: 24px; padding: 16px; border: 1px solid #f0c8c8; background: #fff5f5; }
.api_offline h2 { margin: 0 0 8px; font-size: 18px; }
.api_offline .offline_msg { margin: 0 0 12px; font-size: 14px; color: #444; }
.api_form_row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 8px; }
.api_input { flex: 1; padding: 8px; border: 1px solid #ccc; font-size: 14px; }
.api_apply { padding: 8px 16px; border: 1px solid #ccc; background: #eee; cursor: pointer; }
.api_probe_status { font-size: 13px; min-height: 18px; }
.offline_help summary { cursor: pointer; }
.hidden { display: none !important; }

/* Recent uploads panel */
.recent_uploads { margin-top: 24px; border: 1px solid #ddd; padding: 8px 10px; background:#fafafa; }
.recent_uploads h2 { margin: 4px 0 8px; font-size:16px; }
.recent_list { list-style:none; margin:0; padding:0; max-height:140px; overflow-y:auto; }
.recent_list li { font-size:13px; padding:3px 0; border-bottom:1px solid #eee; }
.recent_list li:last-child { border-bottom:none; }
.recent_list li.mine { background:#eef8ff; }
.recent_list .meta { color:#666; font-size:11px; }
.recent_status { font-size:12px; color:#666; margin-bottom:4px; }

/* Tag for password-protected files (matches one-time badge style) */
.tag-lock {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  font-size: 11px;
  line-height: 1.4;
  color: #334155;
  background: #eef2ff;
}
.tag-once {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.2);
  color: #92400e;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid rgba(250, 204, 21, 0.45);
  line-height: 1.2;
  margin-left: 6px;
}

/* Let the filename span take remaining space (no link) */
#recent-list li > .file-name,
#file-list li > .file-name {
  flex: 1 1 auto;
  display: inline-block;
  color: #222;
  text-decoration: none;
  cursor: default;
}

/* Ensure list rows align content nicely */
#recent-list li,
#file-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Icon button size stays consistent */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}
.icon-btn img,
.icon-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Make Delete match Clear button and align center */
.button-clear {
  display: inline-flex;
  align-items: center;
  height: 28px;
  line-height: 28px; /* ensure text is centered */
  padding: 0 10px;
}

/* Optional: tidy spacing when buttons are adjacent */
.share-btn + .button-clear {
  margin-left: 6px;
}

/* Drag & Drop highlight on the upload label */
.custom-file-upload.dragover {
  border: 2px dashed rgba(100, 100, 200, 0.9);
  background: rgba(100, 100, 200, 0.08);
}

/* Per-file progress bar (created dynamically per list item) */
.file_progress {
  margin-top: 4px;
  height: 6px;
  background: #eef2f6;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  overflow: hidden;
}
.file_progress .bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #69ca7f 0%, #2a7b9b 100%);
  transition: width 0.2s ease;
}

/* Entrance reveal: fade/slide in when app is ready */
.js .wrap { opacity: 0; transform: translateY(8px) scale(0.995); }
.js.app-ready .wrap { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; }

/* Staggered children reveal for a smoother sequence */
.js .wrap h1,
.js .wrap .hint,
.js .wrap .dropzone,
.js .wrap .custom-file-upload,
.js .wrap #file-info,
.js .wrap #file-list,
.js .wrap #total-size,
.js .wrap #upload-options,
.js .wrap .row,
.js .wrap #upload-button,
.js .wrap #upload-status,
.js .wrap #quota-status,
.js .wrap #upload-progress,
.js .wrap #upload-cancel,
.js .wrap #recent-uploads {
  opacity: 0;
  transform: translateY(6px);
}
.js.app-ready .wrap h1 { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; transition-delay: .05s; }
.js.app-ready .wrap .hint { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; transition-delay: .10s; }
.js.app-ready .wrap .dropzone { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; transition-delay: .15s; }
.js.app-ready .wrap .custom-file-upload { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; transition-delay: .20s; }
.js.app-ready .wrap #file-info { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; transition-delay: .25s; }
.js.app-ready .wrap #file-list { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; transition-delay: .30s; }
.js.app-ready .wrap #total-size { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; transition-delay: .32s; }
.js.app-ready .wrap #upload-options { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; transition-delay: .38s; }
.js.app-ready .wrap .row { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; transition-delay: .42s; }
.js.app-ready .wrap #upload-button { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; transition-delay: .46s; }
.js.app-ready .wrap #upload-status { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; transition-delay: .50s; }
.js.app-ready .wrap #quota-status { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; transition-delay: .54s; }
.js.app-ready .wrap #upload-progress { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; transition-delay: .58s; }
.js.app-ready .wrap #upload-cancel { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; transition-delay: .62s; }
.js.app-ready .wrap #recent-uploads { opacity: 1; transform: none; transition: opacity .45s ease, transform .45s ease; transition-delay: .66s; }

@media (prefers-reduced-motion: reduce) {
  .js .wrap,
  .js .wrap h1,
  .js .wrap .hint,
  .js .wrap .dropzone,
  .js .wrap .custom-file-upload,
  .js .wrap #file-info,
  .js .wrap #file-list,
  .js .wrap #total-size,
  .js .wrap #upload-options,
  .js .wrap .row,
  .js .wrap #upload-button,
  .js .wrap #upload-status,
  .js .wrap #quota-status,
  .js .wrap #upload-progress,
  .js .wrap #upload-cancel,
  .js .wrap #recent-uploads { opacity: 1 !important; transform: none !important; }
}
/* Full-page loader */
.app_loader {
  position: fixed;
  inset: 0;
  background: radial-gradient(1200px 600px at 10% 10%, rgba(105, 202, 127, 0.35), transparent 60%),
              radial-gradient(900px 600px at 90% 0%, rgba(42, 123, 155, 0.35), transparent 60%),
              linear-gradient(135deg, #2A7B9B 0%, #57C785 58%, #69CA7F 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity .25s ease, visibility .25s ease;
}
.app_loader.hidden { opacity: 0; visibility: hidden; }
.app_loader_inner { text-align: center; color: #fff; }
.app_loader_inner .logo { font-size: 28px; font-weight: 800; letter-spacing: .02em; text-shadow: 0 2px 10px rgba(0,0,0,.25); }
.app_loader_inner .subtitle { margin-top: 10px; opacity: 0.9; font-weight: 600; }
.spinner { position: relative; width: 64px; height: 64px; margin: 16px auto 8px; }
.spinner span { position: absolute; inset: 0; border: 4px solid rgba(255,255,255,.5); border-radius: 50%; animation: spin 1.4s cubic-bezier(.6,.2,.4,.8) infinite; border-top-color: rgba(255,255,255,.95); }
.spinner span:nth-child(2) { inset: 6px; animation-delay: .1s; border-width: 4px; border-top-color: rgba(255,255,255,.85); }
.spinner span:nth-child(3) { inset: 12px; animation-delay: .2s; border-width: 3px; border-top-color: rgba(255,255,255,.75); }
.spinner span:nth-child(4) { inset: 18px; animation-delay: .3s; border-width: 2px; border-top-color: rgba(255,255,255,.65); }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
