/* ═══════════════════════════════════════════════════════
   Fotobix Layout Designer – Basis & Branding
   ═══════════════════════════════════════════════════════ */

:root {
  --bg-dark:       #1a1a1d;
  --bg-panel:      #242428;
  --bg-panel-alt:  #2e2e33;
  --bg-hover:      #33333a;
  --border:        #3a3a42;
  --border-light:  #4a4a55;

  --gold:          #c9a968;
  --gold-light:    #e0c48a;
  --gold-dark:     #a88940;

  --text-primary:  #f0ece6;
  --text-secondary:#a8a49e;
  --text-hint:     #6a6660;

  --danger:        #e05a5a;
  --danger-hover:  #c84444;

  --radius-sm:     4px;
  --radius-md:     8px;
  --radius-lg:     12px;

  --shadow-sm:     0 2px 8px rgba(0,0,0,.4);
  --shadow-md:     0 4px 20px rgba(0,0,0,.5);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-dark);
  overflow: hidden;
}

/* ── Screens ─────────────────────────────────────── */
.screen {
  display: none;
  width: 100vw;
  height: 100vh;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/* ── Logo ─────────────────────────────────────────── */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* SVG-Logo: schwarz auf transparent → wird invertiert für dunkle Hintergründe */
.logo-img {
  height: 52px;
  width: auto;
  display: block;
  /* SVG hat schwarze Pfade → invert macht sie weiß auf dunklem Grund */
  filter: invert(1);
}

/* Im Editor-Header etwas kleiner */
.logo-img--header {
  height: 30px;
}

.logo-sub {
  font-size: .75rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════════════
   STARTSCREEN
══════════════════════════════════════════════════════ */
#screen-start {
  align-items: center;
  background: var(--bg-dark);
  background-image:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(201,169,104,.12) 0%, transparent 70%);
}

.start-header {
  width: 100%;
  padding: 28px 40px;
  border-bottom: 1px solid var(--border);
}

.start-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px;
  width: 100%;
  max-width: 700px;
  gap: 32px;
}

.start-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}
.start-subtitle {
  font-size: .9rem;
  color: var(--text-secondary);
  margin-top: -24px;
}

/* ── Layout-Karten ───────────────────────────────── */
.layout-selector {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.layout-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  background: var(--bg-panel);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s;
  min-width: 130px;
}
.layout-card:hover {
  border-color: var(--gold-dark);
  background: var(--bg-hover);
  transform: translateY(-2px);
}
.layout-card.selected {
  border-color: var(--gold);
  background: var(--bg-hover);
}

.layout-preview {
  background: var(--bg-panel-alt);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.strip-preview    { width: 38px;  height: 112px; }
.landscape-preview{ width: 112px; height: 75px;  }
.portrait-preview { width: 75px;  height: 112px; }

.preview-inner {
  position: absolute;
  inset: 6px;
  background: repeating-linear-gradient(
    45deg,
    rgba(201,169,104,.08) 0px,
    rgba(201,169,104,.08) 4px,
    transparent 4px,
    transparent 10px
  );
  border-radius: 2px;
}

.layout-card-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-primary);
}
.layout-card-dims {
  font-size: .75rem;
  color: var(--text-secondary);
}

/* ── Foto-Anzahl ─────────────────────────────────── */
.photo-count-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.section-label {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.photo-count-selector {
  display: flex;
  gap: 8px;
}
.count-btn {
  width: 42px;
  height: 42px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.count-btn:hover {
  border-color: var(--gold-dark);
  background: var(--bg-hover);
}
.count-btn.selected {
  border-color: var(--gold);
  background: var(--bg-hover);
  color: var(--gold);
}

/* ── Start-Divider & Load ────────────────────────── */
.start-divider {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
  color: var(--text-hint);
  font-size: .78rem;
  letter-spacing: .06em;
}
.start-divider::before,
.start-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
#btn-start-load {
  width: 100%;
  max-width: 320px;
  justify-content: center;
}

/* ══════════════════════════════════════════════════════
   EDITOR HEADER
══════════════════════════════════════════════════════ */
.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 52px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.editor-logo .logo-foto,
.editor-logo .logo-bix {
  font-size: 1.2rem;
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Layoutname + Eventdatum im Editor-Header */
.editor-naming {
  display: flex;
  align-items: center;
  gap: 14px;
}
.naming-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.naming-field input {
  height: 30px;
  padding: 0 8px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: .8rem;
}
.naming-field input#export-name { width: 190px; }
.naming-field input#export-date { width: 150px; color-scheme: dark; }

.separator {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 4px;
}

/* ══════════════════════════════════════════════════════
   EDITOR BODY
══════════════════════════════════════════════════════ */
.editor-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════
   BUTTONS (global)
══════════════════════════════════════════════════════ */
button {
  font-family: inherit;
  font-size: .85rem;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  transition: background .15s, opacity .15s;
}
button:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--gold);
  color: #1a1a1d;
  font-weight: 600;
  padding: 8px 16px;
}
.btn-primary:hover:not(:disabled) {
  background: var(--gold-light);
}

.btn-secondary {
  background: var(--bg-panel-alt);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 7px 14px;
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.btn-large {
  padding: 14px 36px;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 7px 14px;
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0;
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ══════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal.hidden {
  display: none;
}
/* Globale Utility: alles mit .hidden ausblenden (Buttons, Felder, Panels …) */
.hidden {
  display: none !important;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
}
.modal-box {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 400px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-box h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.modal-box textarea {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px;
  font-size: .9rem;
  font-family: inherit;
  resize: vertical;
}
.modal-box textarea:focus {
  outline: none;
  border-color: var(--gold);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Absende-Modal (Kundenansicht) */
.modal-hint {
  font-size: .85rem;
  color: var(--text-secondary);
  margin: 0 0 14px;
  text-align: left;
  line-height: 1.4;
}
.submit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  text-align: left;
}
.submit-field label {
  font-size: .78rem;
  color: var(--text-secondary);
}
.submit-field input,
.submit-field textarea {
  padding: 8px 10px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: .9rem;
  font-family: inherit;
}
.submit-field input:focus,
.submit-field textarea:focus {
  outline: none;
  border-color: var(--gold);
}
/* Honeypot: für Menschen unsichtbar, Bots füllen es aus */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.submit-status {
  font-size: .85rem;
  margin: 4px 0 0;
  line-height: 1.4;
  text-align: left;
}
.submit-status.ok  { color: #5bbf7a; }
.submit-status.err { color: #e0736b; }

/* Rechenaufgabe (Spam-Schutz) */
.captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
#sub-captcha-q {
  font-weight: 600;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 54px;
}
#sub-captcha {
  width: 72px;
  text-align: center;
}
#sub-captcha-reload {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
}
#sub-captcha-reload:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Datenschutz-Zustimmung */
.submit-consent {
  margin: 8px 0 4px;
  text-align: left;
}
.submit-consent label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: .78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  cursor: pointer;
}
.submit-consent input {
  margin-top: 2px;
  flex-shrink: 0;
}
.submit-consent a { color: var(--gold); }

/* ══════════════════════════════════════════════════════
   VORLAGEN-AUSWAHL
══════════════════════════════════════════════════════ */
#screen-templates {
  align-items: center;
  background: var(--bg-dark);
  background-image:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(201,169,104,.12) 0%, transparent 70%);
  overflow-y: auto;
}

.templates-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px 60px;
  width: 100%;
  max-width: 1080px;
  gap: 14px;
}

.btn-back {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: .9rem;
  cursor: pointer;
  padding: 6px 4px;
  transition: color .15s;
}
.btn-back:hover { color: var(--gold); }

.templates-hint {
  font-size: .85rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 560px;
  margin-top: -4px;
}

.template-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px;
  width: 100%;
  margin-top: 18px;
}

.templates-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 0;
}

.template-card {
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.template-card:hover {
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.template-thumb {
  width: 100%;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-panel-alt);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.template-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 3px 14px rgba(0,0,0,.45);
}
.template-thumb.loading::after {
  content: "…";
  color: var(--text-hint);
  font-size: 1.4rem;
}

.template-card-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}
.template-card-theme {
  font-size: .72rem;
  color: var(--text-hint);
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* Leeres Layout (white paper) */
.template-card.blank .template-thumb {
  border: 2px dashed var(--border-light);
  background: transparent;
  flex-direction: column;
  gap: 10px;
  color: var(--text-secondary);
}
.template-card.blank .template-thumb .blank-plus {
  font-size: 2.4rem;
  line-height: 1;
  color: var(--gold);
}
.template-card.blank .template-thumb .blank-label {
  font-size: .8rem;
}

/* ══════════════════════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════════════════════ */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: var(--bg-dark); }
::-webkit-scrollbar-thumb  { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-hint); }
