/* =============================================================
   Moonshot Labs — Shared Theme
   Mid-century modern design system
   Used by: Snag-O-Matic, Wish-O-Matic
   ============================================================= */

/* ── FONTS ── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Nunito:wght@300;400;600;700&display=swap');

/* ── DESIGN TOKENS ── */
:root {
  --bg:        #1c1a15;
  --surface:   #252318;
  --card:      #2e2b1f;
  --border:    rgba(255,255,255,0.07);
  --amber:     #e8a020;
  --avocado:   #7a9e4e;
  --teal:      #3a8c82;
  --rust:      #c45c2a;
  --mustard:   #d4b84a;
  --dusty-red: #b94040;
  --cream:     #f2e8d0;
  --sage:      #8aab72;
  --slate:     #5b7fa6;
  --text:      #f0e8d5;
  --muted:     #8a826e;
  --faint:     #3a362a;
  --gold:      #c9a84c;
}

/* ── BASE RESET ── */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { overflow-x: hidden; max-width: 100vw; }

/* ── BODY ──
   Noise texture + safe-area insets for notched/home-indicator devices.
   Note: padding-bottom includes 80px for the app's fixed bottom UI —
   override per-app if that clearance differs.
   ── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
  padding-left:  env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  /* Subtle noise texture overlay */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
}

/* ── MODALS ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--card);
  border-radius: 20px;
  padding: 26px 22px;
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--border);
  transform: translateY(20px);
  transition: transform 0.2s;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  color: var(--cream);
  margin-bottom: 16px;
}

.modal-field { margin-bottom: 14px; }

.modal-field-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.modal input[type="text"],
.modal input[type="number"],
.modal input[type="url"],
.modal input[type="email"],
.modal input[type="password"],
.modal textarea {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.modal input:focus,
.modal textarea:focus { border-color: var(--amber); }
.modal input::placeholder,
.modal textarea::placeholder { color: var(--muted); }

.modal textarea {
  resize: vertical;
  min-height: 72px;
  font-size: 14px;
  line-height: 1.5;
}

.modal-actions { display: flex; gap: 10px; margin-top: 18px; }

/* ── BUTTONS ── */
.btn-cancel {
  flex: 1;
  background: var(--faint);
  color: var(--muted);
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.btn-confirm {
  flex: 2;
  background: var(--amber);
  color: #1c1a15;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.1s;
}

.btn-confirm:active { transform: scale(0.97); }

/* ── COLOR PICKER ── */
.color-picker { display: flex; gap: 10px; flex-wrap: wrap; }

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
}

.color-swatch.selected { border-color: white; transform: scale(1.15); }

/* ── TOAST NOTIFICATION ── */
.undo-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--amber);
  color: var(--cream);
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 300;
  white-space: nowrap;
  transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1), opacity 0.28s;
  opacity: 0;
}

.undo-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── KEYFRAMES ── */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  0%   { opacity: 1; transform: translateX(0); max-height: 50px; padding-top: 9px; padding-bottom: 9px; }
  60%  { opacity: 0; transform: translateX(30px); max-height: 50px; }
  100% { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── AUTH MODAL ── */
.auth-overlay { z-index: 400; }  /* above app modals */

.auth-modal { max-width: 360px; }

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--amber);
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: 0.02em;
}

.auth-modal h2 {
  margin-bottom: 20px;
}

.auth-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-magic-btn {
  width: 100%;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 11px;
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.auth-magic-btn:hover { border-color: var(--amber); color: var(--amber); }
.auth-magic-btn:disabled { opacity: 0.4; cursor: default; }

.auth-error {
  min-height: 18px;
  margin-top: 12px;
  color: #e07070;
  font-size: 13px;
  text-align: center;
}

.auth-sent-msg {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  padding: 8px 0;
}

.auth-sent-msg strong {
  display: block;
  margin-top: 6px;
  color: var(--cream);
  font-size: 15px;
}
