/* ==========================================================================
   娇娇 & 涵宝的恋爱日记 (JiaoJiao & HanBao's Love Journal)
   甜美手账风 (Sweet Scrapbook / Bullet Journal Aesthetic) 核心样式表
   ========================================================================== */

:root {
  --bg-cream: #FFFDF9;
  --bg-pink-grid: #FDEEF4;
  --peach: #FFB5C2;
  --strawberry: #FF8DA1;
  --strawberry-deep: #E86B84;
  --mint: #C8E6C9;
  --mint-deep: #4E8C5C;
  --butter: #FFF59D;
  --saltblue: #B8E0F6;
  --saltblue-deep: #4A89B0;
  --mocha: #5C4033;
  --mocha-soft: #8C6D5E;
  --paper-border: #F3D9E2;
  --shadow-paper: 0 8px 26px rgba(92, 64, 51, 0.08), 0 2px 6px rgba(92, 64, 51, 0.05);
  --shadow-hover: 0 16px 36px rgba(255, 141, 161, 0.22), 0 4px 12px rgba(92, 64, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* 奶油米白 + 浅粉色方格与点阵复合手账底纹 */
body {
  min-height: 100vh;
  background-color: var(--bg-cream);
  background-image:
    radial-gradient(#F6C6D4 1.15px, transparent 1.15px),
    linear-gradient(to right, rgba(253, 238, 244, 0.85) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(253, 238, 244, 0.85) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px, 24px 24px;
  background-position: 0 0, 12px 12px, 12px 12px;
  color: var(--mocha);
}

/* ---------------- 顶部小胶囊按钮 ---------------- */
.scrapbook-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  background: #FFFDF9;
  border: 1.5px dashed #F2BAC9;
  color: var(--mocha);
  box-shadow: 0 2px 6px rgba(92, 64, 51, 0.05);
  transition: all 0.2s ease;
}

.scrapbook-pill-btn:hover {
  transform: translateY(-2px);
  background: #FFF0F4;
  border-color: var(--strawberry);
  box-shadow: 0 4px 12px rgba(255, 141, 161, 0.25);
}

/* ---------------- 手账纸张卡片与虚线缝合线 ---------------- */
.scrapbook-card {
  position: relative;
  background: #FFFDF9;
  border-radius: 22px;
  border: 2px solid #F7E1E8;
  box-shadow: var(--shadow-paper);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
}

.scrapbook-card::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 16px;
  border: 1.5px dashed rgba(255, 141, 161, 0.38);
  pointer-events: none;
}

.scrapbook-card-interactive:hover {
  transform: translateY(-5px) rotate(0deg) !important;
  box-shadow: var(--shadow-hover);
}

/* 手账横线信纸背景 */
.lined-paper {
  background-image: repeating-linear-gradient(
    transparent,
    transparent 29px,
    rgba(255, 181, 194, 0.28) 29px,
    rgba(255, 181, 194, 0.28) 30px
  );
  line-height: 30px;
}

/* ---------------- 和纸胶带 (Washi Tape) ---------------- */
.washi-tape {
  position: absolute;
  top: -13px;
  left: 50%;
  width: 118px;
  height: 28px;
  transform: translateX(-50%) rotate(-2.5deg);
  z-index: 15;
  opacity: 0.88;
  box-shadow: 0 2px 5px rgba(92, 64, 51, 0.08);
  pointer-events: none;
  /* 左右锯齿撕边效果 */
  clip-path: polygon(
    0% 8%, 4% 0%, 96% 0%, 100% 10%,
    97% 28%, 100% 48%, 96% 68%, 100% 88%,
    96% 100%, 3% 100%, 0% 85%, 4% 62%, 0% 40%, 3% 20%
  );
}

.tape-pink {
  background-color: rgba(255, 181, 194, 0.82);
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.4) 0px,
    rgba(255, 255, 255, 0.4) 7px,
    transparent 7px,
    transparent 14px
  );
}

.tape-blue {
  background-color: rgba(184, 224, 246, 0.85);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.45) 0px,
    rgba(255, 255, 255, 0.45) 6px,
    transparent 6px,
    transparent 12px
  );
}

.tape-mint {
  background-color: rgba(200, 230, 201, 0.88);
  background-image: radial-gradient(rgba(255, 255, 255, 0.65) 2.5px, transparent 2.5px);
  background-size: 10px 10px;
}

.tape-butter {
  background-color: rgba(255, 245, 157, 0.88);
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 181, 194, 0.25) 0px,
    rgba(255, 181, 194, 0.25) 6px,
    transparent 6px,
    transparent 12px
  );
}

/* 四角斜贴胶带 */
.corner-tape-tl,
.corner-tape-tr {
  position: absolute;
  width: 68px;
  height: 22px;
  z-index: 15;
  opacity: 0.82;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(92, 64, 51, 0.08);
}

.corner-tape-tl {
  top: -6px;
  left: -14px;
  transform: rotate(-38deg);
}

.corner-tape-tr {
  top: -6px;
  right: -14px;
  transform: rotate(38deg);
}

/* ---------------- 拍立得相框 (Polaroid) ---------------- */
.polaroid-card {
  position: relative;
  background: #FFFFFF;
  padding: 10px 10px 30px 10px;
  border-radius: 6px;
  border: 1px solid #F0E4E8;
  box-shadow: 0 6px 18px rgba(92, 64, 51, 0.12), 0 1px 3px rgba(92, 64, 51, 0.08);
  transform: rotate(var(--tilt, -2deg));
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.32s ease;
  cursor: zoom-in;
}

.polaroid-card:hover {
  transform: rotate(0deg) scale(1.035) translateY(-4px);
  box-shadow: 0 14px 28px rgba(255, 141, 161, 0.26), 0 4px 10px rgba(92, 64, 51, 0.1);
  z-index: 20;
}

.polaroid-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 3px;
  background: linear-gradient(90deg, #FAF2F5 0%, #FFE8F0 50%, #FAF2F5 100%);
  background-size: 200% 100%;
  animation: shimmer-pulse 2.4s ease-in-out infinite;
}

.polaroid-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, opacity 0.3s ease;
}

.broken-fallback {
  object-fit: contain !important;
  background: #FFF7FA !important;
  padding: 8px;
}

.polaroid-card:hover .polaroid-img-wrap img {
  transform: scale(1.04);
}

.polaroid-caption {
  position: absolute;
  bottom: 5px;
  left: 10px;
  right: 10px;
  text-align: center;
  font-size: 13px;
  color: var(--mocha);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- 手账分类索引贴 (Scrapbook Index Tabs) ---------------- */
.scrapbook-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 14px;
  margin-bottom: -3px;
  position: relative;
  z-index: 20;
}

.scrapbook-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 14px 18px;
  border-radius: 18px 18px 0 0;
  border: 2px solid #F1D3DD;
  border-bottom: none;
  background: #FDF4F7;
  color: var(--mocha-soft);
  cursor: pointer;
  transform: translateY(4px);
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -3px 10px rgba(92, 64, 51, 0.04);
}

.scrapbook-tab:hover {
  transform: translateY(0px);
  color: var(--mocha);
}

.scrapbook-tab.active {
  transform: translateY(0px);
  color: var(--mocha);
  padding-bottom: 16px;
  z-index: 25;
  box-shadow: 0 -6px 18px rgba(255, 141, 161, 0.16);
}

.tab-dalian.active {
  background: linear-gradient(180deg, #E8F6FE 0%, #FFFDF9 90%);
  border-color: #9ED2F0;
}

.tab-grad.active {
  background: linear-gradient(180deg, #FFE8EE 0%, #FFFDF9 90%);
  border-color: #FFB5C2;
}

.tab-ortho.active {
  background: linear-gradient(180deg, #E6F7E8 0%, #FFFDF9 90%);
  border-color: #A6D9A8;
}

.tab-album.active {
  background: linear-gradient(180deg, #FFF7CC 0%, #FFFDF9 90%);
  border-color: #F4D06F;
}

.live-photo-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(58, 36, 27, 0.72);
  backdrop-filter: blur(4px);
  color: #FFFDF9;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.gallery-count-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.92);
  color: var(--mocha);
  font-size: 11.5px;
  font-weight: 700;
  border: 1px dashed var(--strawberry);
  box-shadow: 0 2px 6px rgba(92, 64, 51, 0.14);
}

.tab-hole {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--bg-cream);
  border: 1.5px solid rgba(92, 64, 51, 0.22);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.85);
  border: 1px dashed var(--strawberry);
  color: var(--strawberry-deep);
}

/* ---------------- 手账本主页面容器 ---------------- */
.scrapbook-notebook {
  position: relative;
  background: #FFFDF9;
  border-radius: 26px;
  border: 2.5px solid #F3D5E0;
  box-shadow: 0 14px 40px rgba(92, 64, 51, 0.09), 6px 6px 0px #FCE4EC;
  padding: 28px 24px 36px;
  min-height: 540px;
}

.scrapbook-notebook::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 19px;
  border: 1.5px dashed rgba(255, 141, 161, 0.35);
  pointer-events: none;
}

.notebook-rings {
  display: flex;
  justify-content: space-around;
  padding: 0 24px;
  margin-top: -38px;
  margin-bottom: 18px;
  pointer-events: none;
}

.notebook-rings span {
  width: 14px;
  height: 26px;
  border-radius: 99px;
  background: linear-gradient(180deg, #F8C9D4 0%, #FFFDF9 50%, #E7A1B0 100%);
  border: 2px solid #D98B9C;
  box-shadow: 0 3px 5px rgba(92, 64, 51, 0.15);
}

/* ---------------- 研究生阶段：纪念车票 / 登机牌存根 (Ticket Stub) ---------------- */
.ticket-stub {
  position: relative;
  background: linear-gradient(135deg, #FFF9FA 0%, #FFFDF5 100%);
  border: 2px solid #F2BAC9;
  border-radius: 16px;
  padding: 14px 18px;
  margin: 12px 0;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(255, 141, 161, 0.12);
}

.ticket-stub::before,
.ticket-stub::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #FFFDF9;
  border: 2px solid #F2BAC9;
  transform: translateY(-50%);
}

.ticket-stub::before {
  left: -12px;
}

.ticket-stub::after {
  right: -12px;
}

.ticket-barcode {
  height: 24px;
  background: repeating-linear-gradient(
    90deg,
    #5C4033 0px,
    #5C4033 2px,
    transparent 2px,
    transparent 5px,
    #5C4033 5px,
    #5C4033 6px,
    transparent 6px,
    transparent 9px,
    #5C4033 9px,
    #5C4033 12px,
    transparent 12px,
    transparent 15px
  );
  opacity: 0.45;
}

/* 邮戳印章 */
.postmark-stamp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border: 2px double var(--strawberry-deep);
  border-radius: 999px;
  color: var(--strawberry-deep);
  font-size: 11.5px;
  font-weight: 700;
  transform: rotate(-6deg);
  letter-spacing: 0.04em;
  background: rgba(255, 240, 244, 0.8);
}

/* ---------------- 右下角常驻「+ 写手账」悬浮贴纸按钮 ---------------- */
.fab-sticker {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px 12px 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, #FFFDF9 0%, #FFE9EF 100%);
  border: 2.5px solid var(--strawberry);
  box-shadow: 0 10px 28px rgba(255, 141, 161, 0.38), 0 3px 8px rgba(92, 64, 51, 0.12);
  cursor: pointer;
  transform: rotate(-2deg);
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.fab-sticker:hover {
  transform: rotate(0deg) translateY(-4px) scale(1.04);
  box-shadow: 0 14px 34px rgba(255, 141, 161, 0.5);
}

.fab-tape {
  position: absolute;
  top: -9px;
  left: 50%;
  width: 58px;
  height: 16px;
  transform: translateX(-50%) rotate(3deg);
  background: rgba(255, 245, 157, 0.88);
  border-radius: 2px;
}

/* ---------------- 轻提示 Toast ---------------- */
.toast-sticker {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translate(-50%, 24px);
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  padding: 10px 22px;
  border-radius: 999px;
  background: #5C4033;
  color: #FFFDF9;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 26px rgba(92, 64, 51, 0.28);
  border: 2px dashed #FFB5C2;
  transition: all 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.toast-sticker.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------------- 动画与装饰 ---------------- */
@keyframes bounce-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.animate-bounce-slow {
  animation: bounce-slow 2.8s ease-in-out infinite;
}

@keyframes tabFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tab-pane-enter {
  animation: tabFadeIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #FFFDF9;
}

::-webkit-scrollbar-thumb {
  background: #F6C2D0;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #FF8DA1;
}

@media (max-width: 640px) {
  .scrapbook-notebook {
    padding: 20px 14px 28px;
  }
  .scrapbook-tab {
    flex: 1 1 auto;
    padding: 10px 12px 12px;
    justify-content: center;
  }
  .fab-sticker {
    right: 14px;
    bottom: 16px;
    padding: 10px 16px;
  }
}

/* ---------------- 骨架屏脉冲动画 ---------------- */
@keyframes shimmer-pulse {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ---------------- 访客只读模式保护 ---------------- */
body.visitor-mode .master-only {
  display: none !important;
}

body.visitor-mode #fab-write {
  display: none !important;
}

/* ---------------- SQL 代码预览容器 ---------------- */
.sql-code-block {
  background: #2D231E;
  color: #F8E8EE;
  font-family: Consolas, Monaco, 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.5;
  border-radius: 12px;
  padding: 12px 14px;
  overflow-x: auto;
  max-height: 220px;
  border: 1px solid rgba(255, 181, 194, 0.3);
}
