/* Landing page, password prompt and creator. */

/* ---- Landing page ---- */
.fallback-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
  width: 100%;
}

.fallback-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.fallback-icon-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 1rem;
}

.fallback-icon {
  width: 52px;
  height: 52px;
  color: var(--accent-pastel);
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* no double-tap zoom while tapping fast */
}

.fallback-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.fallback-icon.is-hopping {
  animation: giftHop 0.28s cubic-bezier(0.3, 0.7, 0.4, 1);
}

@keyframes giftHop {
  0%   { transform: translateY(0); }
  40%  { transform: translateY(-5px); }
  100% { transform: translateY(0); }
}

/* Countdown of the remaining taps, floating up from the icon */
.tap-countdown {
  position: absolute;
  left: 50%;
  top: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
  user-select: none;
  opacity: 0;
  animation: tapCountFloat 0.9s ease-out forwards;
}

@keyframes tapCountFloat {
  0%   { transform: translate(-50%, 0); opacity: 0; }
  20%  { opacity: 0.35; }
  100% { transform: translate(-50%, -26px); opacity: 0; }
}

.fallback-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

.fallback-description {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ---- Password prompt (reuses the landing page box) ---- */
.unlock-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.unlock-box .fallback-icon {
  cursor: default;
}

.unlock-input {
  margin-top: 1.5rem;
  text-align: center;
}

.unlock-error {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: #dc2626;
}

.unlock-btn {
  margin-top: 1rem;
}

.unlock-box.is-shaking {
  animation: unlockShake 0.35s ease;
}

@keyframes unlockShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.creator-stage {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* ---- Creator layout ---- */
.generator-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: start;
}

@media (min-width: 1024px) {
  .generator-layout {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }
}

.section-header {
  margin-bottom: 1.75rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ---- Form controls ---- */
.card-config-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-subtle);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.label-with-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theme-family-indicator {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-pastel);
  background: var(--accent-soft);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
}

.form-row-grid {
  display: grid;
  gap: 1rem;
}

.grid-2 {
  grid-template-columns: 1fr;
}

@media (min-width: 580px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.15s ease;
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.form-textarea {
  resize: vertical;
  min-height: 70px;
}

.input-with-addon {
  display: flex;
  align-items: stretch;
}

/* Select fused to the start of an input (currency)... */
.input-with-addon .addon.addon-select {
  flex-shrink: 0;
  min-width: 4.25rem;
  padding-right: 1.6rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235a6578' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}

.input-with-addon .addon.addon-select:focus {
  border-color: var(--border-focus);
}

.input-with-addon .addon {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  padding: 0.65rem 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
}

.input-with-addon .form-input {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  min-width: 0;
}

/* ...or to its end (logo backing) */
.input-with-addon--end .addon {
  order: 2;
  border-right: 1px solid var(--border-light);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.input-with-addon--end .form-input {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-with-addon .addon.addon-select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* ---- Theme picker ---- */
.theme-family-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  background: var(--bg-subtle);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  margin-bottom: 0.5rem;
}

.family-tab-btn {
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

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

.family-tab-btn.active {
  background: #ffffff;
  color: var(--accent-pastel);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.theme-swatches-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.theme-card-pill {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.theme-card-pill:hover {
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.theme-card-pill.active {
  border-color: var(--accent-pastel);
  background: rgba(124, 58, 237, 0.04);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.swatch-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.swatch-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.char-counter {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.form-actions {
  margin-top: 0.5rem;
}

.btn-primary-generate {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--accent-pastel);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.2);
}

.btn-primary-generate:hover:not(:disabled) {
  background: var(--accent-pastel-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.3);
}

.btn-primary-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---- Preview and share panel ---- */
.generator-preview-sidebar {
  width: 100%;
}

/* The sidebar itself is the sticky grid item, so it stays pinned for the full height of
   the form and scrolls internally when taller than the viewport. Padding plus an equal
   negative margin keeps the card shadow from being clipped by the overflow. */
@media (min-width: 1024px) {
  .generator-preview-sidebar {
    position: sticky;
    top: 0.5rem;
    align-self: start;
    max-height: calc(100vh - 1rem);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    padding: 1.5rem;
    margin: -1.5rem;
    width: auto;
  }
}

.card-preview-stage {
  margin-bottom: 1.5rem;
}

.result-share-box {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-box-header {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.85rem;
}

.result-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.result-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.share-url-container {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.share-url-input {
  flex: 1;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  outline: none;
}

.btn-copy-url {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--accent-pastel);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.btn-copy-url:hover {
  background: var(--accent-pastel-hover);
}

.result-actions-row {
  display: flex;
  gap: 0.5rem;
}

.btn-test-link,
.btn-show-qr {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-test-link:hover,
.btn-show-qr:hover {
  background: #ede6dc;
  color: var(--text-primary);
}

.share-qr-panel {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.qr-info-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.share-qr-code img {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  margin: 0 auto;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.share-qr-actions {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.btn-qr-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.85rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-qr-action:hover {
  background: #ede6dc;
  color: var(--text-primary);
}

.btn-qr-action[hidden] {
  display: none;
}
