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

:root {
  --dark:    #111111;
  --mid:     #1e1e1e;
  --border:  #2e2e2e;
  --border-l:#e2e6ea;
  --accent:  #b8975a;
  --text:    #1a1d23;
  --muted:   #6c757d;
  --bg:      #f8f9fa;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}


/* ════════════════════════════════════════
   UPLOAD PAGE
   ════════════════════════════════════════ */

body.upload-page {
  background: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 2rem 1rem;
}

.upload-screen {
  width: 100%;
  max-width: 580px;
  text-align: center;
}

.upload-logo {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2.5rem;
}

.upload-headline {
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  font-weight: 300;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}

.upload-sub {
  color: rgba(255,255,255,0.45);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.upload-error {
  background: rgba(220,53,69,0.15);
  border: 1px solid rgba(220,53,69,0.4);
  color: #ff8080;
  padding: 0.7rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  text-align: left;
}

/* Drop zone */
.drop-zone-lg {
  border: 1.5px dashed rgba(255,255,255,0.2);
  border-radius: 10px;
  min-height: 220px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.drop-zone-lg:hover,
.drop-zone-lg.drag-over {
  border-color: var(--accent);
  background: rgba(184,151,90,0.06);
}

#dropPrompt {
  padding: 2rem;
  text-align: center;
  pointer-events: none;
}
#dropPrompt i {
  font-size: 2.5rem;
  color: rgba(255,255,255,0.25);
  display: block;
  margin-bottom: 0.75rem;
}
#dropPrompt p {
  color: rgba(255,255,255,0.55);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}
.browse-link {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  pointer-events: all;
}
.drop-hint {
  font-size: 0.78rem !important;
  color: rgba(255,255,255,0.25) !important;
}

/* Preview grid inside drop zone */
.preview-grid-lg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px;
  width: 100%;
  align-self: flex-start;
}
.preview-grid-lg .preview-item {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: 5px;
  overflow: hidden;
  background: #222;
}
.preview-grid-lg .preview-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.preview-grid-lg .pdf-tile {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px;
}
.preview-grid-lg .pdf-tile i {
  font-size: 1.4rem;
  color: #e06060;
}
.preview-grid-lg .pdf-tile span {
  font-size: 0.55rem;
  color: rgba(255,255,255,0.5);
  text-align: center;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.remove-file-btn {
  position: absolute;
  top: 3px; right: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.remove-file-btn:hover { background: #dc3545; }

/* File count row */
.file-count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.6rem;
  padding: 0 0.25rem;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.4);
}
.file-count-row button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
}
.file-count-row button:hover { color: rgba(255,255,255,0.6); }

/* Drive input */
.drive-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  padding: 0.6rem 0.85rem;
}
.drive-row i {
  color: rgba(255,255,255,0.3);
  font-size: 0.9rem;
  flex-shrink: 0;
}
.drive-row input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: rgba(255,255,255,0.75);
  font-size: 0.85rem;
}
.drive-row input::placeholder { color: rgba(255,255,255,0.25); }

/* Extra info textarea */
.extra-info-box {
  width: 100%;
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  color: rgba(255,255,255,0.75);
  font-size: 0.85rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}
.extra-info-box::placeholder { color: rgba(255,255,255,0.25); }
.extra-info-box:focus { border-color: rgba(255,255,255,0.3); }

/* Submit button */
.btn-create {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 1.25rem;
  padding: 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.btn-create:hover { background: #c9a76a; }
.btn-create:disabled { opacity: 0.5; cursor: default; }

/* Processing overlay */
.processing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.processing-card {
  text-align: center;
  color: #fff;
  padding: 3rem;
}
.processing-spinner {
  width: 52px; height: 52px;
  border: 4px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing-label {
  font-size: 1rem;
  font-weight: 300;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.02em;
  min-height: 1.5em;
}
.processing-bar-track {
  width: 260px;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  margin: 1.25rem auto 0;
  overflow: hidden;
}
.processing-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s ease;
}


/* ════════════════════════════════════════
   WORKSPACE PAGE (result)
   ════════════════════════════════════════ */

body.workspace-page {
  display: flex;
  flex-direction: column;
  background: #fff;
}

/* Header */
.workspace-header {
  height: 52px;
  flex-shrink: 0;
  background: var(--dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
}
.workspace-logo {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
}
.workspace-header-actions { display: flex; gap: 0.5rem; }
.header-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 5px;
  color: rgba(255,255,255,0.6);
  font-size: 0.78rem;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}
.header-btn:hover { color: #fff; border-color: rgba(255,255,255,0.4); }

/* Drive error bar */
.drive-error-bar {
  background: #2d1414;
  border-bottom: 1px solid #6b2d2d;
  color: #ff9a9a;
  font-size: 0.82rem;
  padding: 0.55rem 1.25rem;
  flex-shrink: 0;
}

/* Two-panel workspace */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 44% 56%;
  overflow: hidden;
  min-height: 0;
}

/* ── Photo panel ── */
.photo-panel {
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.gallery-area {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.gallery-hero-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: opacity 0.2s ease;
}
.no-photos {
  color: rgba(255,255,255,0.2);
  font-size: 0.85rem;
}

/* Thumbnail strip */
.thumb-strip {
  height: 66px;
  flex-shrink: 0;
  background: #000;
  display: flex;
  gap: 2px;
  padding: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}
.thumb-strip::-webkit-scrollbar { display: none; }
.thumb-btn {
  flex-shrink: 0;
  width: 94px;
  height: 60px;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  background: #111;
  opacity: 0.5;
  transition: opacity 0.2s, border-color 0.2s;
}
.thumb-btn:hover,
.thumb-btn.active {
  opacity: 1;
  border-color: var(--accent);
}
.thumb-btn img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}

/* Photo toolbar */
.photo-toolbar {
  height: 46px;
  flex-shrink: 0;
  background: var(--mid);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 0.85rem;
  gap: 0.5rem;
}
.toolbar-label {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}
.preset-group {
  display: flex;
  gap: 2px;
}
.preset-btn {
  padding: 0.25rem 0.6rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: rgba(255,255,255,0.45);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}
.preset-btn:hover {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.75);
}
.preset-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.preset-btn:disabled { opacity: 0.4; cursor: default; }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 5px;
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.icon-btn:hover { color: #fff; border-color: rgba(255,255,255,0.35); }
.ms-auto { margin-left: auto; }

/* ── Content panel ── */
.content-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content-toolbar {
  height: 46px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-l);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 0.4rem;
  background: #fafafa;
}
.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  background: none;
  border: 1px solid var(--border-l);
  border-radius: 5px;
  font-size: 0.8rem;
  color: #444;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.toolbar-btn:hover {
  background: #f0f0f0;
  border-color: #ccc;
  color: #111;
}
.toolbar-btn:disabled { opacity: 0.45; cursor: default; }
.toolbar-btn.primary {
  background: var(--dark);
  border-color: var(--dark);
  color: #fff;
}
.toolbar-btn.primary:hover { background: #2a2a2a; }
.toolbar-btn.success {
  background: #198754;
  border-color: #198754;
  color: #fff;
}
.toolbar-spacer { flex: 1; }

/* Listing editor */
.listing-editor {
  flex: 1;
  overflow-y: auto;
  padding: 2.5rem 3rem;
  outline: none;
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text);
  caret-color: var(--accent);
}
.listing-editor:focus { outline: none; }

/* Typography inside the editor */
.listing-editor h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 0.9rem;
  line-height: 1.25;
}
.listing-editor h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #222;
  margin: 1.6rem 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #eee;
}
.listing-editor h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  margin: 1.4rem 0 0.4rem;
}
.listing-editor p { margin-bottom: 0.85rem; }
.listing-editor ul {
  padding-left: 1.4rem;
  margin-bottom: 0.85rem;
}
.listing-editor li { margin-bottom: 0.3rem; }
.listing-editor strong { color: #111; }

/* Refine bar */
.refine-bar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-l);
  background: #fafafa;
}
.refine-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #999;
}
.refine-bar textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-l);
  border-radius: 5px;
  font-size: 0.85rem;
  font-family: inherit;
  line-height: 1.5;
  color: var(--text);
  background: #fff;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}
.refine-bar textarea:focus { border-color: #aaa; }
.refine-bar textarea::placeholder { color: #bbb; }
.refine-actions {
  display: flex;
  justify-content: flex-end;
}
.refine-bar button {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 1rem;
  background: var(--dark);
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.refine-bar button:hover { background: #2a2a2a; }
.refine-bar button:disabled { opacity: 0.5; cursor: default; }

/* Publish status */
.publish-status {
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  font-size: 0.83rem;
  border-top: 1px solid var(--border-l);
}
.publish-status.success {
  background: #d4edda;
  color: #155724;
}
.publish-status.success a { color: #0a3622; }
.publish-status.error {
  background: #f8d7da;
  color: #721c24;
}

/* Regenerate spin */
.spin { animation: spin 0.7s linear infinite; display: inline-block; }

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 40vh 1fr;
  }
  .listing-editor { padding: 1.5rem; }
}
