/* ============================================================
   Julie's AI Listing Assistant — style.css
   Clean, premium, mobile-first. Inspired by Depop/Vinted/Poshmark.
   ============================================================ */

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

:root {
  --brand-primary:   #7c3aed;
  --brand-secondary: #db2777;
  --brand-light:     #f5f3ff;
  --brand-mid:       #ede9fe;
  --bg:              #f4f4f8;
  --surface:         #ffffff;
  --border:          #e8e8ef;
  --border-strong:   #d1d1db;
  --text-main:       #0f0f14;
  --text-secondary:  #3d3d4e;
  --text-muted:      #71717a;
  --success:         #059669;
  --success-bg:      #ecfdf5;
  --error:           #dc2626;
  --error-bg:        #fef2f2;
  --info:            #2563eb;
  --info-bg:         #eff6ff;
  --warning:         #d97706;
  --radius-lg:       16px;
  --radius:          12px;
  --radius-sm:       8px;
  --radius-xs:       6px;
  --shadow-sm:       0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:          0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg:       0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  --min-tap:         48px;

  /* Platform brand colors */
  --ebay:       #e53238;
  --vinted:     #09b1ba;
  --facebook:   #1877f2;
  --poshmark:   #c41230;
  --depop:      #ff4040;
  --fb-market:  #1877f2;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   AUTH PAGE
   ============================================================ */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  background: linear-gradient(145deg, #f5f3ff 0%, #fdf2f8 50%, #eff6ff 100%);
}

.auth-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 28px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 10px;
  filter: drop-shadow(0 2px 8px rgba(124,58,237,0.3));
}

.auth-logo h1 {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.auth-tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 6px;
}

.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 28px;
  gap: 4px;
  border: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  height: var(--min-tap);
  border: none;
  background: transparent;
  border-radius: var(--radius-xs);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.tab-btn.active {
  background: var(--surface);
  color: var(--brand-primary);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.auth-form { display: none; }
.auth-form.active { display: block; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: 20px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.auth-message {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.4;
}

.auth-message:empty { display: none; }
.auth-message.success { background: var(--success-bg); color: var(--success); border: 1px solid #a7f3d0; }
.auth-message.error   { background: var(--error-bg);   color: var(--error);   border: 1px solid #fecaca; }
.auth-message.info    { background: var(--info-bg);    color: var(--info);    border: 1px solid #bfdbfe; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  height: var(--min-tap);
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--text-main);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.form-group textarea {
  height: auto;
  min-height: 100px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.5;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.required { color: var(--error); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--min-tap);
  padding: 0 20px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
  font-family: inherit;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-primary), #6d28d9);
  color: #fff;
  box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(124,58,237,0.4);
}

.btn-secondary {
  background: var(--brand-light);
  color: var(--brand-primary);
  border: 1.5px solid var(--brand-mid);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--brand-mid);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}

.btn-danger {
  background: var(--error);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-full { width: 100%; }

.btn-sm {
  height: 36px;
  padding: 0 14px;
  font-size: 0.85rem;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-bar h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.top-bar-brand {
  font-size: 1.05rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 100;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-decoration: none;
  gap: 3px;
  transition: color 0.15s;
  min-height: var(--min-tap);
  cursor: pointer;
  border: none;
  background: transparent;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  position: relative;
}

.nav-item.active { color: var(--brand-primary); }

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: var(--brand-primary);
  border-radius: 0 0 4px 4px;
}

.nav-icon { font-size: 1.25rem; }

.page-content {
  padding: 16px 16px 88px;
  max-width: 640px;
  margin: 0 auto;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-draft    { background: #f4f4f5; color: var(--text-muted); }
.badge-listed   { background: var(--info-bg); color: var(--info); }
.badge-sold     { background: var(--success-bg); color: var(--success); }

/* ============================================================
   SPINNER
   ============================================================ */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--brand-mid);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   PHOTO UPLOAD
   ============================================================ */
.photo-drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  min-height: 130px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  overflow: hidden;
}

.photo-drop-zone:hover,
.photo-drop-zone.drag-over {
  border-color: var(--brand-primary);
  background: var(--brand-light);
}

.drop-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  text-align: center;
  gap: 4px;
}

.drop-zone-inner p { font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); }
.drop-zone-inner .hint { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; }

.photo-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
}

.photo-thumb-wrapper {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
}

.photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  font-size: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   RESULTS PAGE
   ============================================================ */

/* Item summary bar */
.item-summary-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.summary-photos {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.summary-photo {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
}

.summary-info { flex: 1; min-width: 0; }

.summary-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.summary-price {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--brand-primary);
  flex-shrink: 0;
}

/* Platform cards */
.platform-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.platform-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.platform-color-bar {
  width: 4px;
  height: 28px;
  border-radius: 4px;
  flex-shrink: 0;
}

.platform-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  flex: 1;
}

.platform-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.platform-card-photos {
  display: flex;
  gap: 6px;
  padding: 12px 16px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.platform-card-photos:empty { display: none; }

.platform-photo-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.photo-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 6px 16px 0;
}

.listing-text-box {
  margin: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow-y: auto;
  color: var(--text-secondary);
}

.platform-card-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px 14px;
}

/* Platform color theming */
.platform-card[data-platform="eBay"] .platform-color-bar { background: var(--ebay); }
.platform-card[data-platform="Vinted"] .platform-color-bar { background: var(--vinted); }
.platform-card[data-platform="Facebook Group"] .platform-color-bar { background: var(--facebook); }
.platform-card[data-platform="Facebook Marketplace"] .platform-color-bar { background: var(--fb-market); }
.platform-card[data-platform="Poshmark"] .platform-color-bar { background: var(--poshmark); }
.platform-card[data-platform="Depop"] .platform-color-bar { background: var(--depop); }

.platform-card[data-platform="eBay"] .platform-badge { background: #fff0f0; color: var(--ebay); }
.platform-card[data-platform="Vinted"] .platform-badge { background: #f0fafa; color: var(--vinted); }
.platform-card[data-platform="Facebook Group"] .platform-badge { background: #eff6ff; color: var(--facebook); }
.platform-card[data-platform="Facebook Marketplace"] .platform-badge { background: #eff6ff; color: var(--fb-market); }
.platform-card[data-platform="Poshmark"] .platform-badge { background: #fff0f2; color: var(--poshmark); }
.platform-card[data-platform="Depop"] .platform-badge { background: #fff0f0; color: var(--depop); }

/* Copy success animation */
.btn-copied {
  background: linear-gradient(135deg, var(--success), #047857) !important;
  box-shadow: 0 2px 8px rgba(5,150,105,0.3) !important;
}

/* Loading screen */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  gap: 16px;
  text-align: center;
}

.loading-screen .spinner {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

.loading-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.loading-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 240px;
}

/* Loading dots animation */
.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20%  { content: ''; }
  40%      { content: '.'; }
  60%      { content: '..'; }
  80%,100% { content: '...'; }
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.stat-card.highlight .stat-value {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* New listing FAB button */
.fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: #fff;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(124,58,237,0.4);
  text-decoration: none;
  z-index: 99;
  transition: transform 0.15s, box-shadow 0.15s;
}

.fab:active {
  transform: scale(0.93);
  box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}

/* ============================================================
   UTILITY
   ============================================================ */
.mt-8   { margin-top: 8px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.mb-8   { margin-bottom: 8px; }
.mb-12  { margin-bottom: 12px; }
.mb-16  { margin-bottom: 16px; }
.text-muted    { color: var(--text-muted); font-size: 0.875rem; }
.text-center   { text-align: center; }
.text-small    { font-size: 0.8rem; }
.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.gap-8         { gap: 8px; }
.gap-12        { gap: 12px; }
.w-full        { width: 100%; }
/* ============================================================
   Julie's AI Listing Assistant — style.css ADDITIONS
   Paste this block anywhere in your existing style.css file.
   These replace every inline style="..." that was removed.
   ============================================================ */

/* ── Drop zone (new-listing.html) ────────────────────────── */
.drop-icon {
  font-size: 2.5rem;
  display: block;
}

.drop-title {
  font-weight: 600;
  margin-top: 8px;
}

.drop-hint {
  font-size: 0.85rem;
}

/* ── Platform cards (results.js) ─────────────────────────── */

/* Platform icon emoji in card header */
.platform-icon {
  font-size: 1.3rem;
}

/* Listing text box — white-space: pre-wrap is the key rule.
   It tells the browser to render \n characters as line breaks
   without needing <br> tags, which means .textContent round-trips
   perfectly: set it as a string, copy it back as a string. */
.listing-text-box {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Card action row — flex layout without inline style="flex:1;" */
.platform-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* Each action button/link takes equal width in the row */
.btn-card-action {
  flex: 1;
  text-align: center;
  text-decoration: none; /* for <a> elements styled as buttons */
}

/* Make <a class="btn"> look and feel the same as <button class="btn"> */
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

/* ── Copy button feedback states ──────────────────────────── */
.btn-copied {
  background-color: #22c55e !important; /* green */
  color: #fff !important;
  border-color: #22c55e !important;
}

.btn-copy-failed {
  background-color: #f59e0b !important; /* amber */
  color: #fff !important;
  border-color: #f59e0b !important;
}

/* ── Error card (results.html) ───────────────────────────── */
.card-padded {
  padding: 32px 24px;
}

.error-icon {
  font-size: 2.5rem;
}

.error-message-text {
  font-weight: 700;
  margin-top: 12px;
  font-size: 1.05rem;
}