/**
 * preparedEPA Poster Tool — Branding & Layout
 * Schriften und Farben aus naming-branding.md
 */
:root {
  --font-heading: "Lexend Deca", sans-serif;
  --font-text: "Open Sans", Arial, sans-serif;
  --color-corporate: #333333;
  --color-prepared-epa: #0095D0;
  --color-prepared-epa-100: #CCEAF6;
  --color-prepared-epa-200: #99D5EC;
  --color-prepared-epa-600: #0077A6;
  --color-prepared-epa-700: #00597D;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-text);
  font-size: 1rem;
  color: var(--color-corporate);
  background: #fff;
  min-height: 100vh;
  padding-bottom: 5rem;
}

.hidden {
  display: none !important;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--color-prepared-epa);
  color: #fff;
}

.header-logo {
  height: 48px;
  width: auto;
}

.header-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
}

/* Step Navigation */
.steps {
  display: flex;
  gap: 0;
  padding: 0.5rem 1.5rem;
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
}

.step {
  flex: 1;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  font-family: var(--font-text);
  font-size: 1rem;
  color: #666;
  cursor: pointer;
  text-align: center;
}

.step:hover {
  color: var(--color-corporate);
}

.step.active {
  color: var(--color-prepared-epa);
  font-weight: 600;
}

.step.done {
  color: #888;
}

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

.step-panel h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-corporate);
  margin-bottom: 1.5rem;
}

.step-panel h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
}

/* Intro (Step 0) */
.intro {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.intro-text {
  flex: 1;
  min-width: 0;
}

.intro-text p {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
}

.poster-preview {
  flex-shrink: 0;
  margin: 0;
  text-align: center;
}

.poster-preview img {
  width: 140px;
  height: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.poster-preview figcaption {
  margin-top: 0.35rem;
  font-size: 0.875rem;
  color: #666;
}

/* Text + Preview (Step 3 Texte) */
.text-preview-row {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.text-fields {
  flex: 1;
  min-width: 0;
}

#sticker-text-note {
  margin: 0.5rem 0 0;
  color: #666;
  font-size: 0.95rem;
}

.poster-preview-step2 img {
  width: 140px;
}

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

.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 500;
  font-size: 1rem;
}

.form-group select,
.form-group input[type="text"] {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  font-family: var(--font-text);
  border: 1px solid #ccc;
  border-radius: 4px;
}

.form-group select:focus,
.form-group input:focus {
  outline: none;
  border-color: var(--color-prepared-epa);
  box-shadow: 0 0 0 2px var(--color-prepared-epa-100);
}

/* EPA Selection Row (tree + selected list) */
.epa-selection-row {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.epa-tree-wrap {
  flex: 1;
  min-width: 0;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.epa-selected-list-wrap {
  flex-shrink: 0;
  width: 280px;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.epa-tree-wrap,
.epa-selected-list-wrap {
  align-self: flex-start;
}

.epa-selected-list-wrap h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.epa-selected-list-wrap h3 .epa-counter {
  font-weight: 600;
}

.epa-selected-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.epa-selected-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.epa-selected-item:last-child {
  border-bottom: none;
}

.epa-selected-item:hover {
  color: var(--color-prepared-epa);
}

.epa-selected-item .remove-btn {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: none;
  background: transparent;
  color: #999;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
}

.epa-selected-item .remove-btn:hover {
  color: #c00;
  background: rgba(204,0,0,0.1);
}

/* EPA Tree */
.epa-tree {
  max-height: 60vh;
  overflow-y: auto;
}

.epa-domain {
  margin: 0.5rem 0;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fafafa;
}

.epa-domain summary {
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-weight: 500;
}

.epa-domain-inner {
  padding: 0.5rem 1rem 1rem 1.5rem;
}

.epa-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  cursor: pointer;
}

.epa-item input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--color-prepared-epa);
}

/* EPA Labels */
.epa-label-row {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.75rem;
  align-items: center;
  background: var(--color-prepared-epa-100);
  border-radius: 6px;
  border: 1px solid var(--color-prepared-epa-200);
}

.epa-drag-handle {
  cursor: grab;
  color: #999;
  font-size: 1rem;
  padding: 0.25rem;
  user-select: none;
  line-height: 1;
}

.epa-drag-handle:active {
  cursor: grabbing;
}

.epa-label-row.dragging {
  opacity: 0.5;
}

.epa-label-original {
  font-size: 1rem;
  color: #555;
}

.epa-label-input {
  padding: 0.4rem 0.6rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* PDF */
.pdf-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  width: 58%;
  max-width: 620px;
  margin: 0 0 1.5rem 0;
  padding: 0;
}

.pdf-status.loading {
  color: var(--color-accent);
}

.pdf-status.error {
  color: #c00;
}

.pdf-preview {
  width: 58%;
  max-width: 620px;
  margin: 0;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
}

.pdf-preview iframe {
  width: 100%;
  aspect-ratio: 1 / 1.5;
  height: auto;
  border: none;
  display: block;
}

@media (max-width: 900px) {
  .pdf-actions {
    width: 100%;
    max-width: none;
  }

  .pdf-preview {
    width: 100%;
  }
}

/* Buttons */
.btn {
  padding: 0.5rem 1.25rem;
  font-family: var(--font-text);
  font-size: 1rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #ccc;
  background: #fff;
}

.btn:hover:not(:disabled) {
  background: #f5f5f5;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-prepared-epa);
  color: #fff;
  border-color: var(--color-prepared-epa);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-prepared-epa-600);
}

.btn-secondary {
  display: inline-block;
  text-decoration: none;
  color: var(--color-prepared-epa);
  border-color: var(--color-prepared-epa);
}

.btn-secondary:hover {
  background: var(--color-prepared-epa-100);
}

/* Footer */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.5rem;
  background: #fff;
  border-top: 2px solid #e0e0e0;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}

.epa-counter {
  font-size: 1rem;
  font-weight: 600;
}

.epa-counter.ok {
  color: #2c8838;
}

.epa-counter.warn {
  color: #cc0000;
}

.epa-counter.empty {
  color: #999;
}

.error {
  padding: 2rem;
  color: #c00;
  font-size: 1rem;
}

/* Tom Select — preparedEPA Branding, klare UX */
.ts-wrapper.single .ts-control {
  border: 2px solid #ccc;
  border-radius: 6px;
  font-family: var(--font-text);
  font-size: 1rem;
  min-height: 2.5rem;
  padding: 0.4rem 0.75rem;
  background: #fff;
}
.ts-wrapper.focus .ts-control,
.ts-wrapper.single.focus .ts-control {
  border-color: var(--color-prepared-epa);
  box-shadow: 0 0 0 3px var(--color-prepared-epa-100);
  background: #fff;
}
.ts-wrapper.dropdown-active .ts-control {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: #e0e0e0;
}

/* Dropdown-Liste klar abgegrenzt */
.ts-dropdown {
  border: 2px solid var(--color-prepared-epa);
  border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  background: #fff;
  max-height: 280px;
}
.ts-dropdown .option,
.ts-dropdown .option.active {
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  min-height: 2.5rem;
  line-height: 1.3;
}
.ts-dropdown .option:hover,
.ts-dropdown .option.active {
  background: var(--color-prepared-epa-100);
  color: var(--color-prepared-epa-700);
}
.ts-dropdown .input {
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border-bottom: 1px solid #e0e0e0;
}
