/* ── Card Printer UI ── */

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

:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --surface2:  #22263a;
  --border:    #2e3347;
  --accent:    #6c63ff;
  --accent2:   #a78bfa;
  --text:      #e2e8f0;
  --muted:     #8892a4;
  --danger:    #f87171;
  --radius:    12px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 3rem;
}
.logo { font-size: 3rem; margin-bottom: .5rem; }
h1 {
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.subtitle { color: var(--muted); margin-top: .25rem; }

/* Alert */
.alert {
  padding: .9rem 1.2rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: .9rem;
}
.alert-error { background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.3); color: var(--danger); }

/* Sections */
.card-section {
  display: flex;
  gap: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.section-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: .15rem;
}
.section-body { flex: 1; }
.section-body h2 { font-size: 1.1rem; margin-bottom: .35rem; }
.section-body p  { color: var(--muted); font-size: .88rem; margin-bottom: 1rem; }

code {
  background: var(--surface2);
  padding: .15em .45em;
  border-radius: 5px;
  font-size: .85em;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  color: var(--accent2);
}

/* File drop zone */
.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: 1.5rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.file-drop:hover { border-color: var(--accent); background: rgba(108,99,255,.05); }
.file-drop input[type="file"] { display: none; }
.file-icon { font-size: 2rem; }
.file-label { color: var(--muted); font-size: .88rem; }

/* Design preview */
.preview-wrap {
  margin-top: 1rem;
  text-align: center;
}
#design-preview {
  max-height: 220px;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}

/* Tabs */
.tab-bar {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
}
.tab {
  padding: .4rem .9rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: .88rem;
  transition: all .2s;
}
.tab.active, .tab:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: .75rem 1rem;
  font-family: 'Fira Code', monospace;
  font-size: .88rem;
  resize: vertical;
  outline: none;
  transition: border-color .2s;
}
textarea:focus { border-color: var(--accent); }

/* Options grid */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.option-group label {
  display: block;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: .35rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.option-group select,
.option-group input[type="color"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: .55rem .75rem;
  font-size: .9rem;
  outline: none;
  cursor: pointer;
  transition: border-color .2s;
}
.option-group select:focus { border-color: var(--accent); }
.option-group input[type="color"] {
  height: 42px;
  padding: .2rem .4rem;
}

/* Submit */
.submit-wrap { text-align: center; margin-top: 2rem; }
.btn-generate {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .9rem 2.5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  box-shadow: 0 4px 20px rgba(108,99,255,.35);
}
.btn-generate:hover { opacity: .9; transform: translateY(-1px); }
.btn-generate:active { transform: translateY(0); }
.submit-hint { color: var(--muted); font-size: .85rem; margin-top: .75rem; }

/* Footer */
footer {
  text-align: center;
  margin-top: 3rem;
  color: var(--muted);
  font-size: .8rem;
}

.rfb-link {
  display: inline-block;
  margin-top: .5rem;
  padding: .45rem 1.1rem;
  background: rgba(108,99,255,.15);
  border: 1px solid rgba(108,99,255,.35);
  border-radius: 8px;
  color: #a89dff;
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s;
}
.rfb-link:hover { background: rgba(108,99,255,.3); color: #c4bcff; }

/* Design mode toggle */
.design-mode-toggle {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
}
.design-mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  transition: all .15s;
}
.design-mode-btn input { display: none; }
.design-mode-btn.active {
  border-color: var(--accent);
  background: rgba(108,99,255,.15);
  color: var(--text);
}
.design-mode-btn:hover { border-color: var(--accent); color: var(--text); }

.gradient-info {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.25rem;
  background: rgba(108,99,255,.1);
  border: 1px dashed rgba(108,99,255,.4);
  border-radius: 10px;
  font-size: .88rem;
}
.gradient-info span { font-size: 2rem; }
.gradient-info p { color: var(--muted); margin-top: .2rem; }
