/* ============================================
   灵感记录页 - 便签风格
   ============================================ */

@import url('style.css');

:root {
  --note-yellow: #FFF9C4;
  --note-yellow-dark: #F9E976;
  --note-pink: #FFE0EC;
  --note-pink-dark: #F8BBD0;
  --note-blue: #E3F2FD;
  --note-blue-dark: #90CAF9;
  --note-green: #E8F5E9;
  --note-green-dark: #A5D6A7;
  --note-lavender: #F3E5F5;
  --note-lavender-dark: #CE93D8;
  --note-orange: #FFF3E0;
  --note-orange-dark: #FFCC80;
}

body {
  background: #F5F0E8;
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(155, 89, 182, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(255, 126, 179, 0.03) 0%, transparent 50%);
}

.bg-texture {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='1' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* ---------- 页头 ---------- */
.inspire-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  max-width: 900px;
  margin: 0 auto;
}

.back-btn {
  font-family: var(--font-body);
  text-decoration: none;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--color-card-border);
}

.back-btn:hover {
  background: white;
  color: var(--color-primary);
  border-color: var(--color-primary-light);
}

.inspire-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--color-primary-dark);
}

/* ---------- 新建便签 ---------- */
.new-note-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 20px;
  max-width: 600px;
  margin: 0 auto 32px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

#note-editor {
  width: 100%;
  border: none;
  resize: vertical;
  font-family: 'Ma Shan Zheng', var(--font-body);
  font-size: 1.1rem;
  line-height: 1.8;
  padding: 8px;
  outline: none;
  min-height: 100px;
  color: var(--color-text);
  background: transparent;
}

#note-editor::placeholder {
  color: var(--color-text-light);
  font-family: var(--font-body);
  font-size: 1rem;
}

.note-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--color-card-border);
}

.note-count {
  font-size: 0.8rem;
  color: var(--color-text-light);
  font-weight: 300;
}

.btn-save-note {
  padding: 10px 24px;
  border: none;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-save-note:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(155, 89, 182, 0.3);
}

/* ---------- 便签墙 ---------- */
.notes-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  padding: 0 24px 40px;
  max-width: 1100px;
  margin: 0 auto;
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--color-text-light);
  font-size: 0.9rem;
  padding: 40px;
}

/* ---------- 单张便签 (固定大小) ---------- */
.note {
  position: relative;
  padding: 18px 18px 42px;
  border-radius: 2px;
  height: 200px;
  overflow: hidden;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all var(--transition);
  animation: floatIn 0.4s ease backwards;
  cursor: pointer;
}

.note:hover {
  transform: translateY(-4px) rotate(0.5deg);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.12),
    0 2px 4px rgba(0, 0, 0, 0.06);
}

/* 每种便签颜色的渐隐遮罩 */
.note::after {
  content: '';
  position: absolute;
  bottom: 42px;
  left: 0;
  right: 0;
  height: 36px;
  pointer-events: none;
}
.note.color-yellow::after { background: linear-gradient(transparent, var(--note-yellow)); }
.note.color-pink::after { background: linear-gradient(transparent, var(--note-pink)); }
.note.color-blue::after { background: linear-gradient(transparent, var(--note-blue)); }
.note.color-green::after { background: linear-gradient(transparent, var(--note-green)); }
.note.color-lavender::after { background: linear-gradient(transparent, var(--note-lavender)); }
.note.color-orange::after { background: linear-gradient(transparent, var(--note-orange)); }

/* 便签颜色 */
.note.color-yellow { background: var(--note-yellow); }
.note.color-pink { background: var(--note-pink); }
.note.color-blue { background: var(--note-blue); }
.note.color-green { background: var(--note-green); }
.note.color-lavender { background: var(--note-lavender); }
.note.color-orange { background: var(--note-orange); }

/* 便签顶部折角 */
.note::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  border-width: 0 20px 20px 0;
  border-style: solid;
}

.note.color-yellow::before { border-color: transparent var(--note-yellow-dark) transparent transparent; }
.note.color-pink::before { border-color: transparent var(--note-pink-dark) transparent transparent; }
.note.color-blue::before { border-color: transparent var(--note-blue-dark) transparent transparent; }
.note.color-green::before { border-color: transparent var(--note-green-dark) transparent transparent; }
.note.color-lavender::before { border-color: transparent var(--note-lavender-dark) transparent transparent; }
.note.color-orange::before { border-color: transparent var(--note-orange-dark) transparent transparent; }

/* 便签内容 (撑满固定高度) */
.note-content {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  height: calc(100% - 42px);
}

/* 便签底部 */
.note-footer {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  opacity: 0;
  transition: opacity var(--transition);
}

.note:hover .note-footer {
  opacity: 1;
}

.note-time {
  font-size: 0.7rem;
  color: var(--color-text-light);
  font-family: var(--font-body);
  font-weight: 300;
}

.note-delete {
  background: none;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--color-text-light);
  transition: all var(--transition);
  font-family: var(--font-body);
}

.note-delete:hover {
  background: rgba(235, 87, 87, 0.1);
  color: var(--color-danger);
}

/* 空状态 */
.empty-notes {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--color-text-light);
  font-size: 1rem;
  padding: 60px 20px;
  line-height: 2;
}

/* ---------- 便签放大弹窗 ---------- */
.expand-card {
  background: #FFFEF5;
  border-radius: 8px;
  padding: 28px;
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  position: relative;
  animation: floatIn 0.3s ease;
}

.expand-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0e8d8;
}

.expand-actions {
  display: flex;
  gap: 8px;
}

.expand-actions button {
  background: none;
  border: 1px solid transparent;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all var(--transition);
}

.expand-actions button:hover {
  background: rgba(155, 89, 182, 0.08);
  border-color: var(--color-card-border);
}

.expand-text {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 1.2rem;
  line-height: 2;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--color-text);
}

.expand-textarea {
  width: 100%;
  min-height: 300px;
  border: 1px solid var(--color-card-border);
  border-radius: 8px;
  padding: 16px;
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 1.2rem;
  line-height: 2;
  resize: vertical;
  outline: none;
  background: #FFFDF5;
}

.expand-textarea:focus {
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.08);
}

/* ---------- 翻页 ---------- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 12px 24px 40px;
  max-width: 1100px;
  margin: 0 auto;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--color-card-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-btn:hover:not(:disabled):not(.active) {
  border-color: var(--color-primary-light);
  color: var(--color-primary);
  background: white;
}

.page-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ---------- 动画 ---------- */
@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 便签入场延迟 */
.note:nth-child(1) { animation-delay: 0s; }
.note:nth-child(2) { animation-delay: 0.05s; }
.note:nth-child(3) { animation-delay: 0.1s; }
.note:nth-child(4) { animation-delay: 0.15s; }
.note:nth-child(5) { animation-delay: 0.2s; }
.note:nth-child(6) { animation-delay: 0.25s; }
.note:nth-child(7) { animation-delay: 0.3s; }
.note:nth-child(8) { animation-delay: 0.35s; }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .inspire-header {
    padding: 14px 16px;
  }

  .inspire-title {
    font-size: 1.2rem;
  }

  .new-note-card {
    margin: 0 14px 24px;
  }

  .notes-wall {
    grid-template-columns: 1fr;
    padding: 0 14px 30px;
    gap: 16px;
  }

  .note-footer {
    opacity: 1;
  }

  .note {
    height: 180px;
    padding: 14px 14px 40px;
  }

  .note-content {
    height: calc(100% - 40px);
  }

  .note::after {
    bottom: 40px;
    height: 30px;
  }
}

@media (max-width: 380px) {
  .back-btn {
    font-size: 0.8rem;
    padding: 6px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .note {
    animation: none;
  }
  .note:hover {
    transform: none;
  }
}
