/* ========== ALBUM APP ========== */
.album-app {
  min-height: 100vh;
  background: #3d4f6f;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ========== ALBUM HEADER ========== */
.album-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 10;
}

.album-back-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 50%;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}

.album-back-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.album-header-center {
  text-align: center;
  flex: 1;
}

.album-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
  letter-spacing: 0.02em;
}

.album-page-count {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0.2rem 0 0;
}

.album-header-actions {
  display: flex;
  gap: 0.5rem;
}

.album-icon-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 50%;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}

.album-icon-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* ========== ALBUM VIEWER ========== */
.album-viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 1rem;
  overflow: hidden;
}

.album-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
}

.album-empty p {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.album-add-first-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 0.7rem 2rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.album-add-first-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ========== FAN CONTAINER ========== */
.fan-container {
  width: 100%;
  max-width: 1200px;
  height: 650px;
  perspective: 1200px;
  perspective-origin: 50% 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.fan-pages {
  position: relative;
  width: 180px;
  height: 240px;
  transform-style: preserve-3d;
}

/* ========== FAN PAGE ========== */
.fan-page {
  position: absolute;
  width: 180px;
  height: 240px;
  left: 0;
  top: 0;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
  cursor: pointer;
  background: #fff;
  backface-visibility: hidden;
  transform-origin: 50% 50%;
}

.fan-page:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/* Page content inside fan */
.fan-page-inner {
  width: 100%;
  height: 100%;
  padding: 1rem;
  box-sizing: border-box;
  overflow: hidden;
  background: #f8f6f1;
}

/* ========== PHOTO COLLAGE ========== */
.photo-collage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 0.5rem;
  height: 100%;
}

.collage-item {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  background: #e8e4dd;
  min-height: 0;
}

.collage-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.collage-item.large {
  grid-row: span 2;
}

.collage-item.wide {
  grid-column: span 2;
}

.collage-item.tall {
  grid-row: span 2;
}

.collage-annotation {
  position: absolute;
  font-family: 'Segoe Script', 'Comic Sans MS', cursive;
  font-size: 0.85rem;
  color: #555;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.collage-annotation.top-left {
  top: 0.5rem;
  left: 0.5rem;
}

.collage-annotation.top-right {
  top: 0.5rem;
  right: 0.5rem;
}

.collage-annotation.bottom-left {
  bottom: 0.5rem;
  left: 0.5rem;
}

.collage-annotation.bottom-right {
  bottom: 0.5rem;
  right: 0.5rem;
}

/* ========== COVER PAGE IN FAN ========== */
.fan-page.cover-page .fan-page-inner {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--book-bg, #f7f2e7);
}

.fan-cover-card {
  width: 100%;
  height: 100%;
  position: relative;
}

.fan-cover-card .book-cover-container {
  height: 100%;
  border-radius: 0;
}

.fan-cover-card .book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fan-cover-card .book-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  background: linear-gradient(135deg, #d4c5a9 0%, #b8a88a 100%);
  color: var(--text-muted);
}

.fan-cover-title {
  position: absolute;
  bottom: 2rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 1.3rem;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  padding: 0 1rem;
}

/* ========== FULL PHOTO PAGE ========== */
.fan-page-inner.fan-photo-page {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f6f1;
  position: relative;
}

.fan-photo-full {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.fan-photo-caption {
  position: absolute;
  bottom: 1.5rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 1.1rem;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  padding: 0 1rem;
}

/* ========== FAN NAV HINT ========== */
.fan-nav-hint {
  margin-top: 1.5rem;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.85rem;
  transition: opacity 0.3s;
}

/* ========== ALBUM FOOTER ========== */
.album-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.2rem 1.5rem;
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
}

.album-footer-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.album-footer-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.album-footer-btn-add {
  background: var(--accent, rgb(217, 56, 30));
  color: #fff;
}

.album-footer-btn-add:hover {
  background: var(--accent-hover, rgb(184, 24, 0));
}

.album-footer-btn-danger {
  color: #dc2626;
}

.album-footer-btn-danger:hover {
  background: #dc2626;
  color: #fff;
}

/* ========== ALBUM CARD (on homepage) ========== */
.album-card {
  --pages: 8px;
  --spine-1: #663300;
  --spine-2: #996633;
  --spine-3: #CCCCCC;
  display: inline-block;
  position: relative;
  background-color: var(--book-bg);
  border-radius: 3px;
  box-shadow: 0 1px 1px #999;
  cursor: pointer;
  filter: grayscale(0);
  left: 0;
  opacity: 1;
  transform: skewY(-2.5deg);
  transition: box-shadow .4s, filter .4s, left .2s, opacity .66s, transform .2s;
  margin-left: calc(0.6rem + var(--pages) * 1.618);
  margin-right: 10px;
  margin-top: calc(var(--pages) * 1.2);
  margin-bottom: 1rem;
  width: 120px;
}

.album-card::before {
  content: "";
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 3px 3px 5px 15px;
  border-bottom: 1px solid #666;
  transform: skewY(45deg);
  transform-origin: right bottom;
  transition: opacity .2s;
  left: calc(-1 * (var(--pages) * 0.8));
  width: calc(var(--pages) * 0.8);
  background: linear-gradient(to bottom, var(--spine-1) 33%, var(--spine-2) 66%, var(--spine-3) 99%);
}

.album-card::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  border-radius: 3px 5px 5px 12px;
  transform: skewX(45deg);
  transform-origin: bottom left;
  transition: opacity 0.2s;
  height: calc(var(--pages) * 0.8);
  top: calc(-1 * (var(--pages) * 0.8));
  background:
    repeating-linear-gradient(0deg, transparent, transparent 1.5px, rgb(0 0 0 / 10%) 1.5px, rgb(0 0 0 / 10%) 3px),
    linear-gradient(to top, rgb(0 0 0 / 5%), rgb(0 0 0 / 10%));
}

.album-card:hover {
  transform: skewY(0deg) scale(1.1);
  left: calc(-1 * var(--pages) * 0.33);
  box-shadow: 0 4px calc(var(--pages) * 0.8) #0006;
  border-radius: 2px 2px 5px 5px;
  z-index: 50;
}

.album-card:hover::before,
.album-card:hover::after {
  opacity: 0;
}

.album-card .book-cover-container {
  height: 169px;
}

.album-card .book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.album-card .book-info {
  padding: 0.5rem 0.3rem;
}

.album-card .book-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: #333;
  line-height: 1.3;
  margin-bottom: 0.2rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-all;
}

.album-card .book-tags {
  font-size: 0.65rem;
  color: var(--text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== HOMEPAGE ALBUMS SECTION ========== */
.albums-section {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.albums-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0 0.5rem;
}

.albums-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.albums-create-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  transition: all 0.2s;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.albums-create-btn:hover {
  background: var(--accent);
  color: white;
}

.albums-create-btn span {
  font-size: 1.1rem;
  font-weight: bold;
}

.albums-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  padding: 0.5rem 0 1rem;
}

.albums-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: italic;
}

/* ========== PHOTO PREVIEW GRID ========== */
.photo-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.photo-preview-item {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.photo-preview-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.photo-remove-btn:hover {
  background: rgba(220, 38, 38, 0.9);
}

/* ========== CONVERSATIONS SECTION ========== */
.conversations-section {
  padding: 1.5rem 0 0.5rem;
}

.conversations-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0 0.5rem;
}

.conversations-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .fan-container {
    height: 400px;
  }

  .fan-pages {
    width: 140px;
    height: 190px;
  }

  .fan-page {
    width: 140px;
    height: 190px;
  }

  .fan-page-inner {
    padding: 0.6rem;
  }

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

  .album-footer-btn {
    width: 42px;
    height: 42px;
  }
}
