/* ========================================
   Design System — Monochrome Minimal
   ======================================== */
:root {
  --bg: #0e0e0e;
  --bg-card: #161616;
  --border: #252525;
  --border-focus: #555;

  --text: #eee;
  --text-secondary: #888;
  --text-muted: #555;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: var(--text-secondary);
  text-decoration: none;
}

a:hover {
  color: var(--text);
}

/* ---- Layout ---- */
.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 0 20px;
}

.main {
  width: 100%;
  max-width: 500px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding-bottom: 40px;
}

/* ---- Header ---- */
.header {
  width: 100%;
  max-width: 500px;
  padding: 28px 0 8px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 24px;
  height: 24px;
  color: #fff;
}

.logo-text {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ---- Hero ---- */
.hero {
  text-align: center;
  padding: 16px 0 0;
}

.hero-title {
  font-size: clamp(1.4rem, 4.5vw, 1.8rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.hero-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---- Type Selector ---- */
.type-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  width: 100%;
}

.type-btn {
  padding: 7px 16px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
}

.type-btn:hover {
  color: var(--text);
  border-color: #444;
}

.type-btn.active {
  color: #000;
  background: #fff;
  border-color: #fff;
}

/* ---- Card ---- */
.card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* ---- Form Panels ---- */
.form-panel {
  display: none;
}

.form-panel.active {
  display: block;
}

/* ---- Inputs ---- */
.input-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.mt {
  margin-top: 14px;
}

.text-input {
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.2s;
}

.text-input::placeholder {
  color: var(--text-muted);
}

.text-input:focus {
  border-color: var(--border-focus);
}

.textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.select option {
  background: #1a1a1a;
  color: var(--text);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-col {
  flex: 1;
  min-width: 0;
}

.hint {
  margin-top: 10px;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Phone row */
.phone-row {
  display: flex;
  gap: 8px;
}

.country-code {
  width: 110px;
  flex-shrink: 0;
  padding-right: 28px;
}

.phone-input {
  flex: 1;
  min-width: 0;
}

/* ---- Generate Button ---- */
.generate-btn {
  width: 100%;
  margin-top: 20px;
  padding: 13px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: #000;
  background: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s var(--ease);
}

.generate-btn:hover {
  background: #ddd;
}

.generate-btn:active {
  transform: scale(0.98);
}

/* ---- Customize ---- */
.customize-card {
  padding: 0;
}

.customize-toggle {
  padding: 16px 24px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s;
}

.customize-toggle:hover {
  color: var(--text);
}

.customize-toggle::before {
  content: '＋';
  font-size: 0.9rem;
  transition: transform 0.2s;
}

details[open] .customize-toggle::before {
  content: '−';
}

.customize-toggle::-webkit-details-marker {
  display: none;
}

.customize-body {
  padding: 0 24px 24px;
}

/* Presets */
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.preset {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px 5px 6px;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
}

.preset:hover {
  color: var(--text);
  border-color: #444;
}

.preset.active {
  color: var(--text);
  border-color: #555;
  background: rgba(255, 255, 255, 0.06);
}

.preset-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 3px;
  overflow: hidden;
}

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

.upload-btn {
  padding: 7px 14px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.upload-btn:hover {
  color: var(--text);
  border-color: #444;
}

.logo-filename {
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-logo-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.remove-logo-btn:hover {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
}

.remove-logo-btn.hidden {
  display: none;
}

.logo-preview {
  margin-top: 10px;
}

.logo-preview.hidden {
  display: none;
}

.logo-preview img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
}

/* Color Picker */
.color-pick {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-pick input[type="color"] {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  padding: 2px;
}

.color-pick input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-pick input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.color-hex {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  font-family: 'Inter', monospace;
}

/* ---- Result ---- */
.result-section {
  width: 100%;
  max-width: 500px;
}

.result-section.hidden {
  display: none;
}

.result-section.visible {
  animation: fadeIn 0.35s var(--ease) both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.qr-preview {
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-preview canvas {
  display: block;
  width: 200px !important;
  height: 200px !important;
}

/* Downloads */
.download-section {
  width: 100%;
  text-align: center;
}

.download-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.download-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.download-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 18px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
}

.download-btn:hover {
  color: #fff;
  border-color: #555;
}

/* ---- Footer ---- */
.footer {
  padding: 20px 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ---- Shake ---- */
@keyframes shake {

  0%,
  100% {
    translate: 0 0;
  }

  20% {
    translate: -5px 0;
  }

  40% {
    translate: 5px 0;
  }

  60% {
    translate: -3px 0;
  }

  80% {
    translate: 3px 0;
  }
}

.shake {
  animation: shake 0.35s var(--ease);
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .card {
    padding: 18px;
  }

  .customize-toggle {
    padding: 14px 18px;
  }

  .customize-body {
    padding: 0 18px 18px;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .form-row .form-col+.form-col {
    margin-top: 14px;
  }

  .download-btn {
    padding: 7px 14px;
    font-size: 0.75rem;
  }

  .qr-preview canvas {
    width: 160px !important;
    height: 160px !important;
  }
}