@import url('https://fonts.googleapis.com/css2?family=Cabinet+Grotesk:wght@400;500;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #F4F4F0;
  --fg: #0A0A0A;
  --fg-muted: #555555;
  --surface: #FFFFFF;
  --border: #0A0A0A;
  --accent: #4353FF; 
  --accent-fg: #FFFFFF;
  --shadow-hard: 6px 6px 0px #0A0A0A;
  --shadow-hard-hover: 2px 2px 0px #0A0A0A;
  --ease: cubic-bezier(0.85, 0, 0.15, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', -apple-system, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

h1, h2, h3, .eyebrow {
  font-family: 'Cabinet Grotesk', system-ui, sans-serif;
}

.shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 24px;
}

.hero {
  margin-bottom: 60px;
  grid-template-columns: 1fr;
  text-align: left;
  border-bottom: 2px solid var(--border);
  padding-bottom: 40px;
}

.eyebrow {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 20px;
  display: inline-block;
  background: var(--fg);
  color: var(--surface);
  padding: 6px 14px;
  border-radius: 999px; /* little pill shape */
}

h1 {
  font-size: clamp(3rem, 6vw, 6rem);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
  max-width: 18ch;
  text-transform: uppercase;
  color: var(--fg);
}

.lede {
  margin-top: 24px;
  font-size: clamp(1.125rem, 1.5vw, 1.5rem);
  color: var(--fg-muted);
  max-width: 600px;
}

/* Mode Nav */
.mode-nav {
  display: flex;
  gap: 16px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.mode-btn {
  font-family: 'Cabinet Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
  background: var(--bg);
  border: 2px solid var(--border);
  padding: 12px 24px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.3s var(--ease);
  box-shadow: var(--shadow-hard);
}

.mode-btn:hover {
  transform: translate(4px, 4px);
  box-shadow: var(--shadow-hard-hover);
}

.mode-btn.active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--border);
}

/* Layout */
.workspace {
  display: grid;
  gap: 32px;
  grid-template-columns: 380px 1fr;
}

#mergeWorkspace:not([hidden]),
#organizeWorkspace:not([hidden]) {
  grid-template-columns: 1fr;
}

.tool-workspace[hidden] {
  display: none !important;
}

/* Panels & Viewers */
.panel, .viewer {
  background: var(--surface);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-hard);
}

.panel {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.viewer {
  padding: 32px;
  display: flex;
  flex-direction: column;
}

.panel-block {
  border-bottom: 2px dashed var(--border);
  padding-bottom: 24px;
}
.panel-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.panel-title-row, .viewer-topbar, .nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.panel h2 {
  font-size: 1.4rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge {
  font-family: 'Cabinet Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  background: var(--fg);
  color: var(--surface);
  padding: 4px 14px;
  border-radius: 999px;
}

.status-chip {
  font-family: 'Cabinet Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 8px 16px;
  border: 2px solid var(--border);
  text-transform: uppercase;
  border-radius: 999px;
}

/* Buttons */
.secondary-btn, .download-btn, .file-picker, .selection-remove, .btn-remove, .btn-restore {
  font-family: 'Cabinet Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 12px 20px;
  border: 2px solid var(--border);
  cursor: pointer;
  background: var(--surface);
  color: var(--fg);
  transition: all 0.3s var(--ease);
  box-shadow: 4px 4px 0px var(--border);
  text-align: center;
  display: inline-block;
}

.secondary-btn:hover:not(:disabled), .file-picker:hover:not(:disabled), .download-btn:hover:not(:disabled), .selection-remove:hover:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0px var(--border);
}

.download-btn {
  width: 100%;
  background: var(--fg);
  color: var(--surface);
  font-size: 1.125rem;
  padding: 16px;
}
.file-picker {
  width: 100%;
  background: var(--accent);
  color: var(--accent-fg);
}

button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none !important;
  transform: none !important;
}

.btn-remove {
  background: #E83F3F;
  color: white;
}
.btn-restore {
  background: #10B981;
  color: white;
}

/* Selection List */
.selection-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 8px;
  margin-top: 16px;
}
.empty-state {
  font-family: 'Cabinet Grotesk', sans-serif;
  font-size: 1.1rem;
  color: var(--fg-muted);
  text-align: left;
}

.selection-item {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 2px solid var(--border);
  background: var(--bg);
  cursor: grab;
  transition: background 0.3s;
}
.selection-item:hover {
  background: var(--surface);
}

.selection-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.selection-meta strong {
  font-family: 'Cabinet Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
}
.selection-meta span {
  font-size: 0.9rem;
  color: var(--fg-muted);
}

.item-thumbnail {
  width: 90px;
  height: 120px;
  border: 2px solid var(--border);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.item-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Stage */
.viewer {
  position: relative;
}

.page-stage {
  margin-top: 32px;
  position: relative;
  min-height: 600px;
  background: #E5E5E5;
  border: 2px solid var(--border);
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.placeholder-card {
  text-align: center;
  max-width: 500px;
  background: var(--surface);
  border: 2px solid var(--border);
  padding: 48px 32px;
  box-shadow: var(--shadow-hard);
}

.placeholder-card h3 {
  font-size: 2.2rem;
  margin-bottom: 16px;
  font-weight: 800;
  text-transform: uppercase;
}

.placeholder-card p {
  color: var(--fg);
  font-size: 1.1rem;
  margin-bottom: 32px;
}

.file-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

#pdfCanvas, #overlayCanvas {
  display: none;
  border: 2px solid var(--border);
}
#overlayCanvas {
  position: absolute;
  cursor: crosshair;
}

/* Pager */
.pager-bar {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 2px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pager-info {
  display: flex;
  gap: 16px;
  align-items: center;
  font-family: 'Cabinet Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
}

.pager-actions {
  display: flex;
  gap: 12px;
}

/* Switch */
.preview-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-family: 'Cabinet Grotesk', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
}
.preview-switch input {
  display: none;
}
.switch-track {
  width: 56px;
  height: 32px;
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  position: relative;
  transition: background 0.3s;
}
.switch-thumb {
  width: 24px;
  height: 24px;
  background: var(--fg);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.3s var(--ease);
}
.preview-switch input:checked + .switch-track {
  background: var(--accent);
}
.preview-switch input:checked + .switch-track .switch-thumb {
  transform: translateX(24px);
  background: var(--surface);
}

/* Responsive */
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}
