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

:root {
  --bg: #1a1a2e;
  --bg-surface: #16213e;
  --bg-card: #0f3460;
  --text: #eee;
  --text-muted: #a0a0b8;
  --accent: #e94560;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Nav ── */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--bg-surface);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-icon {
  color: var(--accent);
  font-size: 20px;
}

.nav-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 4px;
}

.nav-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-tab:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-tab.active { color: var(--text); background: var(--accent); }

/* ── Views ── */
.view { display: none; }
.view.active { display: block; min-height: calc(100vh - 65px); }

/* ── Board Header ── */
.board-header {
  text-align: center;
  padding: 48px 32px 24px;
}

.board-header h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #FFD166, #EF476F, #06D6A0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  font-size: 16px;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Board Layout ── */
.board-layout {
  display: flex;
  gap: 40px;
  padding: 24px 40px 60px;
  max-width: 1400px;
  margin: 0 auto;
  align-items: flex-start;
}

.piles-area {
  display: flex;
  gap: 32px;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Post-It Piles ── */
.pile {
  position: relative;
  width: 200px;
  height: 200px;
  cursor: pointer;
  transition: transform 0.3s ease;
  user-select: none;
}

.pile:hover { transform: translateY(-8px) scale(1.03); }
.pile.dragging { opacity: 0.5; transform: scale(0.95); }

.pile-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-shadow: 2px 3px 12px rgba(0,0,0,0.25), 0 1px 0 rgba(255,255,255,0.1) inset;
  transition: transform 0.3s ease;
}

.pile:hover .pile-card:nth-child(1) { transform: rotate(-4deg) translateY(4px); }
.pile:hover .pile-card:nth-child(2) { transform: rotate(2deg) translateY(-2px); }

.pile-card-icon { font-size: 36px; margin-bottom: 8px; }

.pile-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1.3;
  margin-bottom: 6px;
}

.pile-card-count {
  font-size: 12px;
  color: rgba(26,26,46,0.6);
  font-weight: 500;
}

.pile-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(233,69,96,0.4);
}

/* ── Action Zones ── */
.action-zones {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 220px;
}

.action-zone {
  background: var(--bg-surface);
  border: 2px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: default;
}

.action-zone.drop-ready {
  border-color: var(--accent);
  background: rgba(233,69,96,0.05);
  animation: pulse-border 1.5s infinite;
}

.action-zone.drop-hover {
  border-style: solid;
  border-color: var(--accent);
  background: rgba(233,69,96,0.15);
  transform: scale(1.05);
  box-shadow: 0 0 24px rgba(233,69,96,0.3);
}

.action-zone.activated {
  border-color: #06D6A0;
  background: rgba(6,214,160,0.15);
  animation: success-flash 0.6s ease;
}

@keyframes pulse-border {
  0%, 100% { border-color: var(--accent); }
  50% { border-color: rgba(233,69,96,0.3); }
}

@keyframes success-flash {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.zone-icon { font-size: 28px; margin-bottom: 6px; }
.zone-label { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.zone-desc { font-size: 11px; color: var(--text-muted); }

/* ── Pile Viewer (Modal) ── */
.pile-viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.pile-viewer-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.pile-viewer {
  position: relative;
  width: 520px;
  max-width: 90vw;
  text-align: center;
}

.viewer-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: white;
  font-size: 32px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.viewer-close:hover { opacity: 1; }

.viewer-theme-label {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 20px;
}

.viewer-card-container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.viewer-card {
  flex: 1;
  min-height: 200px;
  border-radius: 4px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 4px 6px 24px rgba(0,0,0,0.3);
  transform: rotate(-1deg);
  transition: transform 0.3s, background-color 0.3s;
}

.viewer-card-text {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a2e;
  line-height: 1.5;
  margin-bottom: 16px;
}

.viewer-card-meta {
  font-size: 13px;
  color: rgba(26,26,46,0.5);
  font-weight: 500;
}

.viewer-nav {
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  font-size: 36px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.viewer-nav:hover { background: rgba(255,255,255,0.2); }

.viewer-counter {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Action Modal ── */
.action-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

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

.action-modal {
  background: var(--bg-surface);
  border-radius: 16px;
  width: 560px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.action-modal-header {
  padding: 28px 28px 16px;
  text-align: center;
}

.action-modal-icon { font-size: 40px; margin-bottom: 8px; }

.action-modal-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.action-modal-theme {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  color: #1a1a2e;
}

.action-modal-body {
  padding: 0 28px 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-muted);
}

.action-modal-body p { margin-bottom: 12px; }
.action-modal-body ul, .action-modal-body ol { margin-left: 20px; margin-bottom: 12px; }
.action-modal-body li { margin-bottom: 6px; }
.action-modal-body strong { color: var(--text); }
.event-detail { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

.action-modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 28px 24px;
  justify-content: flex-end;
}

/* ── Buttons ── */
.btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: #d63b54; transform: translateY(-1px); }

.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
}
.btn-secondary:hover { background: rgba(255,255,255,0.12); color: var(--text); }

.btn-small {
  padding: 6px 14px;
  font-size: 12px;
}

.btn-icon { font-size: 14px; }

.btn.generated {
  background: #06D6A0;
  color: #1a1a2e;
  pointer-events: none;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: #06D6A0;
  color: #1a1a2e;
  padding: 14px 28px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(6,214,160,0.3);
  z-index: 400;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.active { transform: translateX(-50%) translateY(0); }
.toast-icon { font-size: 20px; }

/* ── Manila Folder ── */
.boardpack-layout {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 32px 60px;
}

.manila-folder {
  width: 400px;
  margin: 40px auto;
  cursor: pointer;
  transition: transform 0.3s;
  perspective: 800px;
}

.manila-folder:hover { transform: scale(1.03); }

.manila-folder.opening {
  animation: folder-open 0.6s ease forwards;
}

/* When folder contents are visible, hide the header */
.folder-contents.active ~ .manila-folder,
.boardpack-layout:has(.folder-contents.active) .manila-folder {
  display: none;
}

#boardpack-view:has(.folder-contents.active) .board-header {
  display: none;
}

@keyframes folder-open {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1) rotateX(-10deg); opacity: 0.8; }
  100% { transform: scale(0.9) rotateX(-20deg); opacity: 0; }
}

.folder-tab {
  background: #D4A574;
  color: #4a2c0a;
  padding: 10px 24px;
  border-radius: 8px 8px 0 0;
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  margin-left: 24px;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.folder-body {
  background: linear-gradient(180deg, #E8C89E 0%, #D4A574 100%);
  border-radius: 0 12px 12px 12px;
  padding: 60px 40px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 2px 0 rgba(255,255,255,0.15) inset;
  position: relative;
  overflow: hidden;
}

.folder-body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.2);
}

.folder-icon-large { font-size: 64px; margin-bottom: 12px; }

.folder-prompt {
  color: #4a2c0a;
  font-size: 16px;
  font-weight: 600;
  opacity: 0.7;
}

/* ── Folder Contents ── */
.folder-contents {
  display: none;
  animation: fade-in 0.4s ease;
}

.folder-contents.active { display: block; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.folder-contents-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  padding-top: 16px;
}

.folder-contents-header h2 {
  font-size: 24px;
  font-weight: 700;
}

.folder-back {
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}
.folder-back:hover { background: rgba(255,255,255,0.12); color: var(--text); }

.folder-section {
  margin-bottom: 28px;
}

.folder-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.folder-section-icon { font-size: 22px; }
.folder-section-header h3 { font-size: 16px; font-weight: 700; flex: 1; }

.folder-section-count {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.06);
  padding: 4px 10px;
  border-radius: 12px;
}

.folder-docs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 20px;
}

.folder-doc {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  transition: background 0.2s;
}

.folder-doc:hover { background: rgba(255,255,255,0.06); }

.folder-doc-icon { font-size: 24px; flex-shrink: 0; }

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

.folder-doc-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.folder-doc-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── Mailhook ── */
.mailhook-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.mailhook-card {
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-card));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 32px;
}

.mailhook-icon { font-size: 40px; margin-bottom: 12px; }

.mailhook-card h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.mailhook-card p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.mailhook-card ul {
  list-style: none;
  margin-bottom: 20px;
}

.mailhook-card li {
  padding: 6px 0;
  font-size: 14px;
  color: var(--text-muted);
}

.mailhook-card li::before {
  content: '>';
  color: #06D6A0;
  font-weight: 700;
  margin-right: 10px;
}

.mailhook-demo {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.mailhook-address {
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 10px 16px;
  flex: 1;
  min-width: 280px;
}

.mailhook-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mailhook-address code {
  font-size: 14px;
  color: #06D6A0;
  font-weight: 600;
}

/* ── Mailhook Results ── */
.mailhook-results {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  animation: fade-in 0.5s ease;
}

.mailhook-results h4 {
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--text);
}

.mailhook-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.mailhook-result-card {
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
}

.result-number {
  font-size: 36px;
  font-weight: 800;
  color: #06D6A0;
  line-height: 1;
  margin-bottom: 6px;
}

.result-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── Responsive ── */
@media (max-width: 900px) {
  .board-layout {
    flex-direction: column;
    align-items: center;
  }

  .action-zones {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    min-width: auto;
  }

  .action-zone {
    flex: 1;
    min-width: 120px;
  }

  .board-header h1 { font-size: 28px; }
}

@media (max-width: 600px) {
  .piles-area { gap: 20px; }
  .pile { width: 160px; height: 160px; }
  .top-nav { flex-direction: column; gap: 12px; padding: 12px 16px; }
  .board-layout { padding: 16px; }
}

/* ── Result Dialog (what would be created) ── */
.result-modal-overlay,
.doc-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 350;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.result-modal-overlay.active,
.doc-preview-overlay.active { opacity: 1; pointer-events: all; }

.result-modal,
.doc-preview-modal {
  background: var(--bg-surface);
  border-radius: 16px;
  width: 620px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  position: relative;
}

.result-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}
.result-close:hover { background: rgba(255,255,255,0.12); color: var(--text); }

.result-header,
.doc-preview-header {
  padding: 28px 28px 16px;
  text-align: center;
}

.result-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(6,214,160,0.12);
  color: #06D6A0;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}

.result-status-icon { font-size: 16px; }

.result-header h2,
.doc-preview-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.result-body,
.doc-preview-body {
  padding: 0 28px 20px;
}

.result-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.result-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  border-radius: 8px;
  transition: background 0.2s;
}

.result-list li:hover { background: rgba(255,255,255,0.03); }

.result-check {
  color: #06D6A0;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.result-footer,
.doc-preview-footer {
  display: flex;
  gap: 12px;
  padding: 16px 28px 24px;
  justify-content: flex-end;
}

/* ── Document Preview ── */
.doc-preview-icon { font-size: 40px; margin-bottom: 8px; }

.doc-preview-badge {
  display: inline-block;
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.doc-preview-content {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 24px;
  position: relative;
}

.doc-section {
  margin-bottom: 20px;
}

.doc-section:last-of-type { margin-bottom: 12px; }

.doc-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.doc-section p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.doc-preview-fade {
  height: 40px;
  background: linear-gradient(transparent, rgba(22,33,62,0.9));
  margin: -40px -24px 16px;
  padding: 0 24px;
  position: relative;
}

.doc-preview-note {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
  opacity: 0.7;
}
