/* ============================================================
   Pad — Warm Editorial Theme
   ============================================================ */

:root {
  --bg: #faf6f1;
  --surface: #fff;
  --border: #e0d8ce;
  --border-light: #ece6dc;
  --text: #2c2825;
  --text-muted: #8a7f74;
  --text-faint: #b5aa9e;
  --accent: #c45a2d;
  --accent-hover: #a84b24;
  --accent-light: rgba(196, 90, 45, 0.08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lift: 0 4px 16px rgba(0, 0, 0, 0.08);
  --radius: 8px;
  --radius-lg: 12px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Menlo', monospace;
  --ease: 0.2s ease;
  --max-w: 720px;

  /* Badge colors */
  --badge-text-bg: #eef0f8;
  --badge-text-fg: #5566aa;
  --badge-file-bg: #fef3e8;
  --badge-file-fg: #c45a2d;
  --badge-md-bg: #eef6f0;
  --badge-md-fg: #3a7a50;
}

/* ---- Reset & Base ---- */

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

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--ease);
}

a:hover {
  color: var(--accent-hover);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
}

input, textarea {
  font-family: inherit;
  font-size: inherit;
  border: none;
  outline: none;
  background: none;
}

/* ---- Layout ---- */

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Landing Page ---- */

.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 48px 24px;
  text-align: center;
}

.landing-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 3.2rem;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 8px;
}

.landing-subtitle {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 40px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 12px 32px;
  border-radius: 100px;
  transition: background var(--ease), transform var(--ease), box-shadow var(--ease);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0);
}

.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 320px;
  margin: 28px 0;
  color: var(--text-faint);
  font-size: 0.8rem;
  font-weight: 300;
  text-transform: lowercase;
  letter-spacing: 0.05em;
}

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

.code-input-group {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}

.code-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 400;
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--ease), box-shadow var(--ease);
  text-align: center;
  letter-spacing: 0.04em;
}

.code-input::placeholder {
  color: var(--text-faint);
  font-weight: 300;
}

.code-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.btn-go {
  background: var(--surface);
  color: var(--accent);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 10px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--ease);
}

.btn-go:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.pad-history {
  margin-top: 28px;
  width: 100%;
  max-width: 360px;
}

.history-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  margin-bottom: 6px;
  background: var(--surface);
  transition: border-color 0.2s ease;
}

.history-item:hover {
  border-color: var(--border);
}

.history-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  gap: 4px;
}

.history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-hash {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text);
}

.history-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  flex-shrink: 0;
  margin-left: 12px;
}

.history-preview {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 1.4em;
}

.preview-badge {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 4px;
  border-radius: 3px;
  vertical-align: 1px;
}

.preview-text { background: #eef0f8; color: #5566aa; }
.preview-file { background: #fef3e8; color: var(--accent); }
.preview-md { background: #eef6f0; color: #3a7a50; }

.preview-sep {
  margin: 0 6px;
  color: var(--text-faint);
}

.history-remove {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-faint);
  cursor: pointer;
  padding: 10px 14px;
  line-height: 1;
  transition: color 0.2s ease;
  flex-shrink: 0;
  border-left: 1px solid var(--border-light);
}

.history-remove:hover {
  color: #c44;
}

.history-confirm {
  display: flex;
  flex-shrink: 0;
  border-left: 1px solid var(--border-light);
}

.history-confirm-yes {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  color: #c44;
  cursor: pointer;
  padding: 8px 10px;
  transition: background 0.2s ease;
}

.history-confirm-yes:hover {
  background: rgba(204, 68, 68, 0.06);
}

.history-confirm-no {
  background: none;
  border: none;
  border-left: 1px solid var(--border-light);
  font-size: 1rem;
  color: var(--text-faint);
  cursor: pointer;
  padding: 8px 10px;
  transition: color 0.2s ease;
}

.history-confirm-no:hover {
  color: var(--text);
}

/* ---- Pad View ---- */

.pad-view {
  padding: 32px 0 80px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding: 0 2px;
}

.home-link {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--ease);
}

.home-link:hover {
  color: var(--accent);
}

.pad-code {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: all var(--ease);
  letter-spacing: 0.02em;
}

.pad-code-hint {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-faint);
  margin-right: 4px;
  opacity: 0;
  transition: opacity var(--ease);
}

.pad-code:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.pad-code:hover .pad-code-hint {
  opacity: 1;
}

/* ---- Paste Zone ---- */

.paste-zone {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--ease);
  margin-bottom: 28px;
  position: relative;
}

.paste-zone:hover {
  border-color: #c9bfb3;
  box-shadow: var(--shadow-sm);
}

.paste-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 4px rgba(196, 90, 45, 0.06);
}

.paste-zone-icon {
  font-size: 1.6rem;
  margin-bottom: 8px;
  opacity: 0.35;
  display: block;
}

.paste-zone-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 300;
}

.paste-zone-text strong {
  font-weight: 500;
  color: var(--text);
}

.paste-zone-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.paste-zone-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.paste-zone-btn {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.paste-zone-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.paste-zone-file-input {
  display: none;
}

/* ---- Compose Area ---- */

.compose-area {
  margin-top: 16px;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
}

.compose-textarea {
  width: 100%;
  min-height: 80px;
  max-height: 300px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 300;
  line-height: 1.65;
  color: var(--text);
  background: transparent;
  resize: none;
  padding: 0;
  overflow-y: auto;
}

.compose-textarea::placeholder {
  color: var(--text-faint);
}

.compose-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.compose-hint {
  font-size: 0.72rem;
  color: var(--text-faint);
  font-weight: 300;
}

.btn-send {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  font-size: 0.8rem;
  padding: 6px 20px;
  border-radius: 100px;
  transition: all var(--ease);
}

.btn-send:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-send:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

/* ---- Entry List ---- */

.entries {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entries-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-faint);
  font-size: 0.88rem;
  font-weight: 300;
}

.entry {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  transition: all var(--ease);
  overflow: hidden;
}

.entry:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.entry-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}

.entry-header:hover {
  background: rgba(0, 0, 0, 0.01);
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 100px;
  flex-shrink: 0;
  line-height: 1.6;
}

.badge-text {
  background: var(--badge-text-bg);
  color: var(--badge-text-fg);
}

.badge-file {
  background: var(--badge-file-bg);
  color: var(--badge-file-fg);
}

.badge-markdown {
  background: var(--badge-md-bg);
  color: var(--badge-md-fg);
}

.entry-preview {
  flex: 1;
  min-width: 0;
  font-size: 0.88rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
}

.entry-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 300;
  color: var(--text-faint);
  flex-shrink: 0;
  letter-spacing: 0.01em;
}

.entry-chevron {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  transition: transform var(--ease);
}

.entry.expanded .entry-chevron {
  transform: rotate(90deg);
}

/* ---- Entry Expanded Content ---- */

.entry-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.entry.expanded .entry-body {
  max-height: 2000px;
}

.entry-content {
  padding: 0 16px 12px;
  border-top: 1px solid var(--border-light);
}

.entry-content pre {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 300;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  margin: 12px 0;
  padding: 0;
  background: none;
}

.entry-actions {
  display: flex;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  margin-top: 4px;
  min-height: 44px;
  align-items: center;
}

.btn-action {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 100px;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  transition: all var(--ease);
  background: transparent;
}

.btn-action:hover {
  border-color: var(--border);
  color: var(--text);
  background: rgba(0, 0, 0, 0.015);
}

.btn-action.delete:hover {
  border-color: #e0a8a8;
  color: #b33;
  background: rgba(180, 40, 40, 0.04);
}

/* ---- Delete Confirmation ---- */

.delete-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #f0dbd8;
  margin-top: 4px;
  min-height: 44px;
  font-size: 0.82rem;
  color: #7a3030;
}

.delete-confirm span {
  flex: 1;
  font-weight: 400;
}

.btn-confirm-delete {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 100px;
  background: #c44;
  color: #fff;
  transition: background var(--ease);
}

.btn-confirm-delete:hover {
  background: #a33;
}

.btn-cancel-delete {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 14px;
  border-radius: 100px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all var(--ease);
}

.btn-cancel-delete:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* ---- Image Preview ---- */

.image-preview {
  margin: 12px 0;
}

.image-preview img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.image-spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: img-spin 0.8s linear infinite;
}

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

.file-info {
  margin: 12px 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--text-muted);
}

.file-info-name {
  color: var(--text);
  font-weight: 400;
}

/* ---- Toast ---- */

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 10px 24px;
  border-radius: 100px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 1000;
  box-shadow: var(--shadow-lift);
}

#toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ---- Markdown Rendered Content ---- */

.markdown-content {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
  margin: 12px 0;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--text);
  margin: 1.2em 0 0.5em;
  line-height: 1.3;
}

.markdown-content h1 { font-size: 1.4rem; }
.markdown-content h2 { font-size: 1.2rem; }
.markdown-content h3 { font-size: 1.05rem; }
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 { font-size: 0.95rem; }

.markdown-content p {
  margin: 0.75em 0;
}

.markdown-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.markdown-content strong {
  font-weight: 600;
}

.markdown-content em {
  font-style: italic;
}

.markdown-content code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: #f5f0eb;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
}

.markdown-content pre {
  margin: 0.75em 0;
  padding: 14px 16px;
  background: #f9f6f2;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow-x: auto;
}

.markdown-content pre code {
  background: none;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1.6;
}

.markdown-content ul,
.markdown-content ol {
  margin: 0.75em 0;
  padding-left: 1.6em;
}

.markdown-content li {
  margin: 0.25em 0;
}

.markdown-content blockquote {
  margin: 0.75em 0;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
  font-style: italic;
}

/* ---- Drag Overlay ---- */

.drag-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(250, 246, 241, 0.92);
  border: 3px dashed var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.drag-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.drag-overlay-text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--accent);
}

/* ---- Responsive ---- */

@media (max-width: 640px) {
  .landing {
    padding: 32px 16px;
  }

  .landing-title {
    font-size: 2.4rem;
  }

  .pad-view {
    padding: 20px 0 60px;
  }

  .container {
    padding: 0 12px;
  }

  .paste-zone {
    padding: 24px 16px;
    border-radius: var(--radius);
  }

  .entry {
    border-radius: var(--radius);
  }

  .entry-header {
    padding: 10px 12px;
  }

  .entry-content {
    padding: 0 12px 10px;
  }

  .top-bar {
    margin-bottom: 20px;
  }

  .pad-code-hint {
    display: none;
  }

  .code-input-group {
    max-width: 280px;
  }
}

/* ---- Loading Spinner ---- */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: var(--text-faint);
  font-size: 0.85rem;
  font-weight: 300;
}

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

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 10px;
}
