/* ============================================================
   Upload wizard styles — scoped under .upload-wizard
   Designed to inherit from the site's existing theme tokens
   when possible, but ships with sensible defaults of its own.
   ============================================================ */

.upload-wizard {
  max-width: 920px;
  margin: 4rem auto 8rem;
  padding: 0 1.5rem;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  color: inherit;
}

/* Make the `hidden` HTML attribute win over any flex/grid display rules
   we set on .uw-processing, .uw-step, etc. */
.upload-wizard [hidden] {
  display: none !important;
}

.upload-wizard .uw-header {
  margin-bottom: 2rem;
}

.upload-wizard .uw-title {
  font-size: 2.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

.upload-wizard .uw-subtitle {
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
  opacity: 0.75;
  max-width: 60ch;
  line-height: 1.5;
}

/* Progress steps */
.upload-wizard .uw-progress {
  margin-top: 1rem;
}

.upload-wizard .uw-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.upload-wizard .uw-steps li {
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.08);
  opacity: 0.4;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.upload-wizard .uw-steps li.is-active {
  opacity: 1;
  background: rgba(127, 127, 127, 0.18);
  border-color: rgba(127, 127, 127, 0.35);
}

.upload-wizard .uw-steps li.is-done {
  opacity: 0.85;
  background: rgba(80, 160, 110, 0.18);
  border-color: rgba(80, 160, 110, 0.35);
}

/* Panels & steps */
.upload-wizard .uw-step,
.upload-wizard .uw-panel {
  background: rgba(127, 127, 127, 0.04);
  border: 1px solid rgba(127, 127, 127, 0.18);
  border-radius: 14px;
  padding: 1.75rem 1.75rem 1.5rem;
  margin-bottom: 1rem;
}

.upload-wizard .uw-panel-warning {
  border-color: rgba(220, 140, 60, 0.45);
  background: rgba(220, 140, 60, 0.08);
}

.upload-wizard .uw-step h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  letter-spacing: -0.005em;
}

.upload-wizard .uw-step p {
  margin: 0.4rem 0 1rem;
  opacity: 0.85;
  line-height: 1.5;
}

.upload-wizard .uw-hint {
  font-size: 0.85rem;
  opacity: 0.65;
  display: block;
  margin-top: 0.35rem;
}

.upload-wizard code {
  background: rgba(127, 127, 127, 0.15);
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
}

/* Buttons */
.upload-wizard .uw-btn {
  display: inline-block;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  border: 1px solid rgba(127, 127, 127, 0.3);
  background: transparent;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  color: inherit;
  transition: all 0.15s ease;
}

.upload-wizard .uw-btn:hover:not(:disabled) {
  background: rgba(127, 127, 127, 0.1);
  border-color: rgba(127, 127, 127, 0.5);
}

.upload-wizard .uw-btn-primary {
  background: #2c2c2c;
  color: #fff;
  border-color: #2c2c2c;
}
.upload-wizard .uw-btn-primary:hover:not(:disabled) {
  background: #000;
}

body.dark-theme .upload-wizard .uw-btn-primary,
body.dark .upload-wizard .uw-btn-primary {
  background: #f0f0f0;
  color: #1a1a1a;
  border-color: #f0f0f0;
}
body.dark-theme .upload-wizard .uw-btn-primary:hover:not(:disabled),
body.dark .upload-wizard .uw-btn-primary:hover:not(:disabled) {
  background: #fff;
}

.upload-wizard .uw-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.upload-wizard .uw-step-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.upload-wizard .uw-step-actions .uw-btn-primary {
  margin-left: auto;
}

/* Status messages */
.upload-wizard .uw-status {
  margin-top: 1rem;
  font-size: 0.9rem;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  display: none;
}
.upload-wizard .uw-status.is-ok {
  display: block;
  background: rgba(80, 160, 110, 0.12);
  border: 1px solid rgba(80, 160, 110, 0.4);
}
.upload-wizard .uw-status.is-err {
  display: block;
  background: rgba(220, 80, 80, 0.12);
  border: 1px solid rgba(220, 80, 80, 0.4);
}
.upload-wizard .uw-status.is-info {
  display: block;
  background: rgba(80, 130, 220, 0.12);
  border: 1px solid rgba(80, 130, 220, 0.35);
}

/* Dropzone */
.upload-wizard .uw-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 160px;
  border: 2px dashed rgba(127, 127, 127, 0.4);
  border-radius: 12px;
  cursor: pointer;
  padding: 2rem;
  margin-bottom: 1rem;
  transition: all 0.15s ease;
}
.upload-wizard .uw-dropzone:hover,
.upload-wizard .uw-dropzone.is-dragging {
  border-color: rgba(127, 127, 127, 0.7);
  background: rgba(127, 127, 127, 0.06);
}
.upload-wizard .uw-dropzone-prompt strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}
.upload-wizard .uw-dropzone-prompt span {
  font-size: 0.85rem;
  opacity: 0.6;
}

/* Image grid */
.upload-wizard .uw-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0;
}
.upload-wizard .uw-image-grid:empty {
  display: none;
}

.upload-wizard .uw-image-tile {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(127, 127, 127, 0.1);
  aspect-ratio: 1 / 1;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.upload-wizard .uw-image-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.upload-wizard .uw-image-tile .uw-image-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.6rem 0.4rem 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-wizard .uw-image-tile .uw-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: none;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.upload-wizard .uw-image-tile:hover .uw-remove {
  opacity: 1;
}

.upload-wizard .uw-image-grid-pickable .uw-image-tile {
  cursor: pointer;
}
.upload-wizard .uw-image-tile.is-selected {
  border-color: rgba(80, 130, 220, 0.85);
  box-shadow: 0 0 0 3px rgba(80, 130, 220, 0.25);
}
.upload-wizard .uw-image-tile.is-selected::after {
  content: "✓";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(80, 130, 220, 0.95);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
}
.upload-wizard .uw-image-tile.is-cover-country::before {
  content: "★";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(220, 160, 60, 0.95);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  z-index: 2;
}

/* Form */
.upload-wizard .uw-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 600px) {
  .upload-wizard .uw-form {
    grid-template-columns: 1fr 1fr;
  }
  .upload-wizard .uw-form .uw-field-wide {
    grid-column: 1 / -1;
  }
}

.upload-wizard .uw-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.upload-wizard .uw-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  opacity: 0.8;
}
.upload-wizard .uw-label em {
  font-style: normal;
  font-weight: 400;
  opacity: 0.55;
  margin-left: 0.4em;
  text-transform: none;
  letter-spacing: 0;
}

.upload-wizard input[type="text"],
.upload-wizard input[type="number"],
.upload-wizard input[type="file"],
.upload-wizard textarea {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 0.75rem;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(127, 127, 127, 0.3);
  border-radius: 8px;
  color: inherit;
  width: 100%;
  box-sizing: border-box;
}
body.dark-theme .upload-wizard input[type="text"],
body.dark-theme .upload-wizard input[type="number"],
body.dark-theme .upload-wizard textarea,
body.dark .upload-wizard input[type="text"],
body.dark .upload-wizard input[type="number"],
body.dark .upload-wizard textarea {
  background: rgba(255, 255, 255, 0.08);
}

.upload-wizard input:focus,
.upload-wizard textarea:focus {
  outline: none;
  border-color: rgba(80, 130, 220, 0.7);
  box-shadow: 0 0 0 3px rgba(80, 130, 220, 0.15);
}

.upload-wizard textarea {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  resize: vertical;
}

/* Flag upload card */
.upload-wizard .uw-flag-upload {
  display: block;
  padding: 0.85rem 1rem;
  border: 1px dashed rgba(127, 127, 127, 0.45);
  border-radius: 8px;
  cursor: pointer;
  background: rgba(127, 127, 127, 0.04);
  font-size: 0.9rem;
}
.upload-wizard .uw-flag-upload:hover {
  background: rgba(127, 127, 127, 0.1);
}

.upload-wizard #uw-flag-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  opacity: 0.85;
}
.upload-wizard #uw-flag-preview img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(127, 127, 127, 0.1);
}

/* Preview pane */
.upload-wizard .uw-preview {
  font-size: 0.9rem;
  line-height: 1.55;
}
.upload-wizard .uw-preview h3 {
  font-size: 1rem;
  margin: 1.25rem 0 0.5rem;
  font-weight: 600;
}
.upload-wizard .uw-preview h3:first-child {
  margin-top: 0;
}
.upload-wizard .uw-preview ul {
  margin: 0.25rem 0 0.75rem 1.25rem;
  padding: 0;
}
.upload-wizard .uw-preview li {
  margin: 0.15rem 0;
}
.upload-wizard .uw-preview pre {
  background: rgba(127, 127, 127, 0.08);
  border: 1px solid rgba(127, 127, 127, 0.18);
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  font-size: 0.8rem;
  overflow-x: auto;
  white-space: pre;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
}

/* Processing overlay */
.upload-wizard .uw-processing {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}
.upload-wizard .uw-processing-card {
  background: #fff;
  color: #1a1a1a;
  width: min(520px, 92vw);
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
body.dark-theme .upload-wizard .uw-processing-card,
body.dark .upload-wizard .uw-processing-card {
  background: #1d1d1d;
  color: #f0f0f0;
}
.upload-wizard .uw-processing-card h3 {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
  font-weight: 600;
}
.upload-wizard .uw-processing-bar {
  height: 6px;
  background: rgba(127, 127, 127, 0.18);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.85rem;
}
.upload-wizard #uw-processing-bar-fill {
  height: 100%;
  width: 0;
  background: rgb(80, 130, 220);
  transition: width 0.25s ease;
}
.upload-wizard .uw-processing-status {
  font-size: 0.9rem;
  margin: 0 0 0.6rem;
  min-height: 1.4em;
}
.upload-wizard .uw-processing-log {
  max-height: 200px;
  overflow: auto;
  font-size: 0.78rem;
  background: rgba(127, 127, 127, 0.08);
  padding: 0.6rem;
  border-radius: 6px;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  margin: 0;
  white-space: pre-wrap;
}

/* Header upload button */
.uw-header-button {
  cursor: pointer;
}
.uw-header-button h1 {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}
.uw-header-button h1::before {
  content: "↑";
  font-weight: bold;
}
