/* ============================================================
   COMPONENTS.CSS — Mobile First
   Alle Komponenten starten mit Mobile-Styles,
   dann min-width Media Queries für größere Screens.
   ============================================================ */

/* ── PANEL ────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  /* Mobile: kleineres Padding */
  padding: var(--space-md);
}

@media (min-width: 480px) {
  .panel {
    padding: var(--space-lg);
  }
}

.panel-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

/* ── DIVIDER ──────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-md) 0;
}

/* ── FIELD ────────────────────────────────────────────────── */
.field {
  margin-bottom: var(--space-md);
}

.field:last-child {
  margin-bottom: 0;
}

/* Mobile: immer eine Spalte */
.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

/* Ab 480px: zwei Spalten */
@media (min-width: 480px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── LABELS ───────────────────────────────────────────────── */
label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

/* ── INPUTS ───────────────────────────────────────────────── */
input[type="text"],
input[type="url"],
textarea,
select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-mono);
  /* Mobile: etwas größere Schrift für bessere Lesbarkeit */
  font-size: 16px;
  /* Mobile: größeres Padding = leichter antippbar */
  padding: 13px 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

/* Verhindert iOS Auto-Zoom bei font-size < 16px */
@media (min-width: 480px) {
  input[type="text"],
  input[type="url"],
  textarea,
  select {
    font-size: 13px;
    padding: 11px 14px;
  }
}

input[type="text"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.1);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236a6a8a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

select option {
  background: var(--surface-2);
  color: var(--text);
}

/* ── RANGE SLIDER ─────────────────────────────────────────── */
.range-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.range-header label {
  margin-bottom: 0;
}

.range-value {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  min-width: 36px;
  text-align: right;
}

input[type="range"] {
  width: 100%;
  /* Mobile: dickere Track = leichter bedienbar */
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
  accent-color: var(--accent);
  border: none;
  padding: 0;
  /* Größere Touch-Fläche */
  touch-action: manipulation;
}

@media (min-width: 480px) {
  input[type="range"] {
    height: 4px;
  }
}

/* ── COLOR INPUTS ─────────────────────────────────────────── */
/* Mobile: 2 Spalten (je 2 Felder pro Zeile) */
.color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.color-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  /* Mobile: größeres Padding = leichter antippbar */
  padding: 12px;
  transition: border-color var(--transition);
}

.color-field:hover {
  border-color: rgba(0, 229, 255, 0.4);
}

input[type="color"] {
  /* Mobile: größerer Color-Picker */
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 0;
  flex-shrink: 0;
  touch-action: manipulation;
}

@media (min-width: 480px) {
  input[type="color"] {
    width: 26px;
    height: 26px;
  }
}

.color-label {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* ── TABS ─────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 3px;
  background: var(--surface-2);
  padding: 3px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  /* Mobile: horizontal scrollbar falls nötig */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1;
  /* Mobile: größere Touch-Fläche */
  padding: 10px 6px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  transition: all var(--transition);
  /* Verhindert versehentliches Auswählen beim Scrollen */
  white-space: nowrap;
  min-width: 44px;
  touch-action: manipulation;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ── PRESETS GRID ─────────────────────────────────────────── */
/* Mobile: 2 Spalten statt 3 – größere Buttons */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
}

@media (min-width: 480px) {
  .presets-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.preset-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  /* Mobile: mehr Padding = größere Touch-Fläche */
  padding: 14px 6px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all var(--transition);
  text-align: center;
  touch-action: manipulation;
}

@media (min-width: 480px) {
  .preset-btn {
    padding: 10px 6px;
  }
}

.preset-btn:hover {
  border-color: rgba(0, 229, 255, 0.5);
  color: var(--text);
}

.preset-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 229, 255, 0.06);
}

/* ── UPLOAD ZONE ──────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  touch-action: manipulation;
}

.upload-zone:hover,
.upload-zone:focus-visible {
  border-color: var(--accent);
  background: rgba(0, 229, 255, 0.04);
}

.upload-zone input[type="file"] {
  display: none;
}

.upload-icon {
  display: block;
  font-size: 28px;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  line-height: 1;
}

.upload-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

#logo-preview {
  max-width: 64px;
  max-height: 64px;
  margin: var(--space-sm) auto 0;
  border-radius: var(--radius-sm);
}

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  /* Mobile: größere Touch-Fläche (min. 44px Höhe) */
  padding: 13px var(--space-md);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  touch-action: manipulation;
  /* Verhindert versehentliches Markieren */
  user-select: none;
  -webkit-user-select: none;
}

@media (min-width: 480px) {
  .btn {
    padding: 11px var(--space-md);
  }
}

.btn--primary {
  background: var(--accent);
  color: #000;
  width: 100%;
  font-weight: 700;
}

.btn--primary:hover {
  background: #33eaff;
  transform: translateY(-1px);
  box-shadow: 0 4px 24px rgba(0, 229, 255, 0.3);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 229, 255, 0.04);
}

.btn--sm {
  padding: 10px var(--space-sm);
  font-size: 10px;
}

/* ── DOWNLOAD GRID ────────────────────────────────────────── */
.download-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

/* ── CONTENT PREVIEW ──────────────────────────────────────── */
.content-preview {
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-all;
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  min-height: 40px;
  line-height: 1.6;
}

/* ── HISTORY LIST ─────────────────────────────────────────── */
.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
  -webkit-overflow-scrolling: touch;
}

.history-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  /* Mobile: größeres Padding = leichter antippbar */
  padding: 12px var(--space-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  font-size: 12px;
  color: var(--text-muted);
  touch-action: manipulation;
}

.history-item:hover {
  border-color: rgba(0, 229, 255, 0.4);
  color: var(--text);
  background: rgba(0, 229, 255, 0.03);
}

.history-item__text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.history-item__delete {
  background: none;
  border: none;
  color: var(--text-muted);
  /* Mobile: größere Touch-Fläche */
  font-size: 22px;
  line-height: 1;
  padding: 0 4px;
  transition: color var(--transition);
  flex-shrink: 0;
  touch-action: manipulation;
}

.history-item__delete:hover {
  color: var(--accent-2);
}

.history-empty {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: var(--space-lg);
}

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar        { width: 4px; height: 4px; }
::-webkit-scrollbar-track  { background: var(--surface-2); }
::-webkit-scrollbar-thumb  { background: var(--border); border-radius: var(--radius-full); }

/* ── PDF BAR ──────────────────────────────────────────────── */
.pdf-bar {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  align-items: stretch;
}

.pdf-bar select {
  flex: 1;
  font-size: 11px;
  padding: 10px 36px 10px 12px;
  border-color: var(--border);
  color: var(--text-muted);
}

.pdf-bar select:focus {
  color: var(--text);
  border-color: var(--accent);
}

.pdf-bar .btn--ghost {
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 11px;
  padding: 10px 14px;
}

@media (max-width: 380px) {
  .pdf-bar {
    flex-direction: column;
  }
}

/* ── SHARE ROW ────────────────────────────────────────────── */
.share-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.share-row .btn--ghost {
  font-size: 11px;
}

/* Button Feedback-States */
.btn--feedback-success {
  border-color: #00cc66 !important;
  color: #00cc66 !important;
}

.btn--feedback-error {
  border-color: var(--accent-2) !important;
  color: var(--accent-2) !important;
}

/* ── INPUT VALIDATION ─────────────────────────────────────── */
.input-wrapper {
  position: relative;
}

.input-wrapper input,
.input-wrapper textarea {
  /* Platz für das Status-Icon rechts */
  padding-right: 36px;
}

.input-status-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  transition: color var(--transition);
}

.input-wrapper.is-valid .input-status-icon   { color: #00cc66; }
.input-wrapper.is-invalid .input-status-icon { color: var(--accent-2); }

.input-wrapper.is-valid input,
.input-wrapper.is-valid textarea {
  border-color: #00cc66;
}

.input-wrapper.is-invalid input,
.input-wrapper.is-invalid textarea {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(255, 60, 172, 0.1);
}

.input-error-msg {
  font-size: 11px;
  color: var(--accent-2);
  letter-spacing: 0.5px;
  margin-top: 5px;
  min-height: 16px;
}

/* Textarea: Icon oben rechts statt mittig */
.input-wrapper:has(textarea) .input-status-icon {
  top: 14px;
  transform: none;
}
