/* ============================================
   Paper by WeTransfer Style Journal App - 3D ENHANCED
   ============================================ */

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* CSS Variables */
:root {
  --bg-primary: #9a97bb;
  --bg-secondary: #8a87ad;
  --bg-gradient: radial-gradient(circle at top, #a9a5c4 0%, var(--bg-primary) 40%, var(--bg-secondary) 100%);
  --white: #ffffff;
  --white-soft: rgba(255, 255, 255, 0.12);
  --white-ring: rgba(255, 255, 255, 0.2);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.85);
  --text-dark: #333333;
  --accent-purple: #8d8aad;
  --delete-red: #e74c3c;
  --shadow-book: 0 20px 40px rgba(45, 45, 70, 0.25);
  --shadow-button: 0 12px 28px rgba(30, 30, 50, 0.15);
  --shadow-popup: 0 16px 32px rgba(25, 24, 43, 0.2);
  --shadow-modal: 0 20px 45px rgba(0, 0, 0, 0.2);
  --book-cover: #c4b89a;
  --book-cover-light: #d4c9ad;
  --book-spine: #d9a81f;
  --book-spine-light: #f5c533;
  --frame-max-width: 430px;
  --book-width: 260px;
  --book-height: 380px;
  --spine-width: 28px;
  
  /* 3D Perspective */
  --book-perspective: 1000px;
}

/* Body - Full page background */
body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-gradient);
  overflow-x: hidden;
}

/* App Shell - Main container */
.app-shell {
  width: 100%;
  min-height: 100vh;
  padding: 20px;
}

/* Phone Frame - Removed for website look */
.phone-frame {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  min-height: calc(100vh - 40px);
  position: relative;
  overflow: hidden;
  background: transparent;
}

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 0 4px;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.circle-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--white-ring);
  background: var(--white-soft);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(4px);
}

.circle-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.num-icon {
  font-weight: 700;
  font-size: 18px;
}

/* Title Block */
.title-block {
  text-align: center;
  color: var(--text-primary);
  margin-top: 60px;
  margin-bottom: 20px;
}

.title-block h1 {
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
}

.current-book-title {
  font-size: 24px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 16px;
  min-height: 32px;
  transition: all 0.3s ease;
}

.sub-info {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 18px;
  font-weight: 600;
}

/* Main Area */
.main-area {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Carousel Container */
.carousel-container {
  width: 100%;
  height: 440px;
  position: relative;
  overflow: hidden;
  cursor: grab;
  touch-action: pan-y;
}

.carousel-container:active {
  cursor: grabbing;
}

/* Carousel Track */
.carousel-track {
  display: flex;
  gap: 20px;
  height: 100%;
  padding: 30px calc(50% - var(--book-width) / 2);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  perspective: 1200px;
  transform-style: preserve-3d;
}

/* ============================================
   3D BOOK CARDS - Enhanced Realistic Look
   ============================================ */
.book-card {
  flex: 0 0 var(--book-width);
  height: var(--book-height);
  position: relative;
  display: flex;
  border-radius: 0 8px 8px 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  perspective: 1000px;
}

/* Realistic 3D Book Shadow */
.book-card {
  box-shadow: 
    /* Main shadow */
    0 25px 50px rgba(0, 0, 0, 0.35),
    /* Closer shadow for depth */
    0 15px 25px rgba(0, 0, 0, 0.25),
    /* Subtle shadow */
    0 5px 15px rgba(0, 0, 0, 0.15);
}

/* Hover effect - lift and rotate slightly */
.book-card:hover {
  transform: translateY(-10px) rotateY(-5deg) scale(1.02);
  box-shadow: 
    0 35px 60px rgba(0, 0, 0, 0.4),
    0 20px 40px rgba(0, 0, 0, 0.3),
    0 8px 20px rgba(0, 0, 0, 0.2);
}

/* Book Spine - Enhanced with 3D embossed look */
.book-spine {
  width: var(--spine-width);
  position: relative;
  border-radius: 4px 0 0 4px;
  transform-style: preserve-3d;
  /* Gold/leather gradient with multiple stops for realism */
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.3) 0%,
    var(--book-spine) 15%,
    var(--book-spine-light) 50%,
    var(--book-spine) 85%,
    rgba(0, 0, 0, 0.3) 100%
  );
}

/* Spine embossed lines - decorative grooves */
.book-spine::before,
.book-spine::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 215, 0, 0.4) 20%,
    rgba(255, 215, 0, 0.6) 50%,
    rgba(255, 215, 0, 0.4) 80%,
    transparent 100%
  );
  border-radius: 1px;
  box-shadow: 0 0 3px rgba(255, 215, 0, 0.3);
}

.book-spine::before { left: 8px; }
.book-spine::after { left: 16px; }

/* Spine top and bottom edge highlight */
.book-spine::after {
  content: "";
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.3) 0%,
    transparent 30%,
    transparent 70%,
    rgba(0, 0, 0, 0.2) 100%
  );
}

/* Book Cover - 3D depth effect */
.book-cover {
  flex: 1;
  position: relative;
  border-radius: 0 8px 8px 0;
  overflow: visible;
  /* Leather/paper texture gradient */
  background: linear-gradient(
    135deg,
    var(--book-cover-light) 0%,
    var(--book-cover) 40%,
    var(--book-cover) 100%
  );
  transform-style: preserve-3d;
}

/* Cover sheen/shine effect */
.book-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  /* Diagonal light reflection */
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.1) 20%,
    transparent 40%,
    rgba(0, 0, 0, 0.05) 80%,
    rgba(0, 0, 0, 0.1) 100%
  );
  pointer-events: none;
  border-radius: inherit;
}

/* Cover edge shadow for 3D depth */
.book-cover::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0, 0, 0, 0.1) 50%,
    rgba(0, 0, 0, 0.15) 100%
  );
  pointer-events: none;
  border-radius: 0 8px 8px 0;
}

/* Page edges visible on the right side - creates thickness illusion */
.book-card::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 4px;
  bottom: 4px;
  width: 6px;
  background: linear-gradient(
    90deg,
    #f5f0e6 0%,
    #e8e0d4 30%,
    #f0e8dc 70%,
    #f5f0e6 100%
  );
  border-radius: 0 4px 4px 0;
  box-shadow: 
    -2px 0 4px rgba(0, 0, 0, 0.1),
    inset 1px 0 2px rgba(0, 0, 0, 0.05);
  transform: translateZ(-5px);
}

/* Page lines effect on spine side */
.book-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.1) 0px,
    rgba(255, 255, 255, 0.1) 2px,
    transparent 2px,
    transparent 8px
  );
  border-radius: 4px 0 0 4px;
  transform: translateZ(-3px);
}

.settings-dot {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(60, 55, 45, 0.7);
  color: var(--white);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.customize-dot {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(60, 55, 45, 0.7);
  color: var(--white);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.customize-dot:hover {
  background: rgba(80, 75, 60, 0.8);
  transform: scale(1.1);
}

/* Active Book */
.book-card.active {
  transform: scale(1.05);
}

.book-card.prev,
.book-card.next {
  opacity: 0.6;
  transform: scale(0.9);
}

.book-card.prev { transform-origin: right center; }
.book-card.next { transform-origin: left center; }

/* Instruction Text */
.instruction-text {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  margin-top: 24px;
  opacity: 0.8;
}

/* Floating Actions */
.floating-actions {
  display: flex;
  gap: 16px;
  margin-top: 20px;
  z-index: 10;
}

.action-wrap {
  position: relative;
}

.action-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: var(--white);
  color: var(--text-dark);
  font-size: 26px;
  box-shadow: var(--shadow-button);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 35px rgba(30, 30, 50, 0.2);
}

.action-btn.primary { font-size: 30px; }
.action-btn.delete-btn { color: var(--delete-red); }

/* Popup Menu */
.popup-menu {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 240px;
  background: var(--white);
  border-radius: 20px;
  overflow: visible;
  box-shadow: var(--shadow-popup);
  z-index: 50;
  animation: popupFadeIn 0.2s ease;
}

@keyframes popupFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.popup-menu::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 20px;
  height: 20px;
  background: var(--white);
  transform: translateX(-50%) rotate(45deg);
  border-radius: 4px;
}

.popup-item {
  width: 100%;
  border: none;
  background: transparent;
  padding: 18px 20px;
  font-size: 17px;
  color: var(--text-dark);
  cursor: pointer;
  text-align: left;
}

.popup-item:first-child { border-radius: 20px 20px 0 0; }
.popup-item:last-child { border-radius: 0 0 20px 20px; }
.popup-item:hover { background: #f5f5f5; }

.hidden { display: none !important; }

/* Modal Styles */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 35, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
  backdrop-filter: blur(4px);
  animation: modalFadeIn 0.25s ease;
  pointer-events: auto;
}

@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--white);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow-modal);
  animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  position: relative;
  z-index: 201;
}

/* Smooth scrollbar */
.modal-card::-webkit-scrollbar {
  width: 6px;
}

.modal-card::-webkit-scrollbar-track {
  background: transparent;
}

.modal-card::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.modal-card::-webkit-scrollbar-thumb:hover {
  background: #999;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.small-modal { max-width: 360px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 { font-size: 22px; color: var(--text-dark); font-weight: 600; }

.close-btn {
  border: none;
  background: transparent;
  font-size: 32px;
  cursor: pointer;
  color: #888;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close-btn:hover { background: #f0f0f0; color: #333; }

.modal-card input,
.modal-card textarea {
  width: 100%;
  border: 1px solid #e0e0e0;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  margin-bottom: 14px;
  outline: none;
}

.modal-card input:focus,
.modal-card textarea:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(141, 138, 173, 0.15);
}

.modal-card textarea { min-height: 160px; resize: vertical; }

.save-btn {
  width: 100%;
  border: none;
  background: var(--accent-purple);
  color: var(--white);
  padding: 16px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}

.save-btn:hover { background: #7f7ba0; }

/* Books List */
.books-list,
.menu-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 350px;
  overflow-y: auto;
}

.book-list-item,
.menu-item {
  width: 100%;
  border: none;
  background: #f8f8f8;
  color: var(--text-dark);
  border-radius: 14px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-item i { width: 20px; text-align: center; color: #666; }
.book-list-item:hover,
.menu-item:hover { background: #eeeeee; }
.book-list-item.active { background: #e8e6f2; border: 2px solid var(--accent-purple); }
.book-list-item strong { display: block; margin-bottom: 4px; font-size: 16px; font-weight: 600; }
.book-list-item span { font-size: 13px; color: #666; }
.empty-message { font-size: 14px; color: #888; padding: 16px; text-align: center; }

/* Responsive */
@media (max-width: 480px) {
  .app-shell { padding: 0; }
  .phone-frame { min-height: 100vh; border-radius: 0; padding: 20px 16px 28px; }
  .title-block { margin-top: 40px; }
  .title-block h1 { font-size: 36px; }
  .current-book-title { font-size: 18px; }
  .sub-info { font-size: 16px; }
  .carousel-container { height: 380px; }
  :root {
    --book-width: 220px;
    --book-height: 330px;
    --spine-width: 24px;
  }
  .action-btn { width: 58px; height: 58px; font-size: 24px; }
  .circle-btn { width: 46px; height: 46px; font-size: 18px; }
  .num-icon { font-size: 16px; }
  .popup-menu { min-width: 210px; }
  .popup-item { font-size: 15px; padding: 16px; }
}

.carousel-container.dragging .book-card {
  user-select: none;
}

/* ============================================
   Notebook View Styles - Realistic Two-Page Spread
   ============================================ */

.notebook-view {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-gradient);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: notebookFadeIn 0.3s ease;
}

@keyframes notebookFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Main Notebook Spread Container - The Book */
.notebook-spread {
  display: flex;
  width: 100%;
  max-width: 900px;
  height: calc(100vh - 60px);
  max-height: 700px;
  position: relative;
  transform-style: preserve-3d;
  perspective: 1200px;
  /* 3D Transform for realistic open book effect */
  transform: rotateY(0deg);
}

/* Individual Notebook Page */
.notebook-page {
  flex: 1;
  position: relative;
  background: linear-gradient(
    135deg,
    #fdfbf7 0%,
    #f9f5ef 50%,
    #f5f0e6 100%
  );
  overflow: hidden;
  /* Create page thickness illusion */
  backface-visibility: hidden;
}

/* Left Page - Slightly darker for shadow effect */
.notebook-page.left-page {
  border-radius: 8px 0 0 8px;
  background: linear-gradient(
    100deg,
    #f0ebe0 0%,
    #f5f0e6 20%,
    #f8f4ea 50%,
    #fdfbf7 100%
  );
  /* Left edge shadow for depth */
  box-shadow: 
    inset -15px 0 25px -10px rgba(0, 0, 0, 0.15),
    inset -3px 0 8px rgba(0, 0, 0, 0.05),
    -12px 0 25px rgba(0, 0, 0, 0.2),
    -4px 0 10px rgba(0, 0, 0, 0.15);
  /* Slight rotation for 3D effect */
  transform: perspective(1000px) rotateY(2deg);
  transform-origin: right center;
}

/* Right Page */
.notebook-page.right-page {
  border-radius: 0 8px 8px 0;
  background: linear-gradient(
    -100deg,
    #f0ebe0 0%,
    #f5f0e6 20%,
    #fcf8f2 50%,
    #fffefc 100%
  );
  /* Right edge shadow for depth */
  box-shadow: 
    inset 15px 0 25px -10px rgba(0, 0, 0, 0.15),
    inset 3px 0 8px rgba(0, 0, 0, 0.05),
    12px 0 25px rgba(0, 0, 0, 0.2),
    4px 0 10px rgba(0, 0, 0, 0.15);
  /* Slight rotation for 3D effect */
  transform: perspective(1000px) rotateY(-2deg);
  transform-origin: left center;
}

/* Golden Outer Border with depth */
.notebook-spread::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 3px solid #c9a227;
  border-radius: 8px;
  pointer-events: none;
  z-index: 10;
  box-shadow: 
    inset 0 0 0 1px rgba(201, 162, 39, 0.4),
    0 0 0 1px rgba(201, 162, 39, 0.2),
    0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Center Fold / Gutter - More dramatic 3D effect */
.center-fold {
  width: 24px;
  position: relative;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.12) 0%,
    rgba(0, 0, 0, 0.25) 20%,
    rgba(0, 0, 0, 0.35) 50%,
    rgba(0, 0, 0, 0.25) 80%,
    rgba(0, 0, 0, 0.12) 100%
  );
  /* Strong shadow to create depth at the spine */
  box-shadow: 
    inset 0 0 20px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(0, 0, 0, 0.4);
  z-index: 5;
}

/* Simulate the binding ridge at center */
.center-fold::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 100%;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.2) 0%,
    rgba(0, 0, 0, 0.35) 20%,
    rgba(0, 0, 0, 0.35) 80%,
    rgba(0, 0, 0, 0.2) 100%
  );
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

/* Page edge effect - creates illusion of page thickness */
.notebook-page::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  pointer-events: none;
  z-index: 3;
}

.left-page::before {
  right: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(230, 220, 200, 0.5) 50%,
    rgba(200, 190, 170, 0.3) 100%
  );
  border-radius: 0 4px 4px 0;
}

.right-page::before {
  left: 0;
  background: linear-gradient(
    270deg,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(230, 220, 200, 0.5) 50%,
    rgba(200, 190, 170, 0.3) 100%
  );
  border-radius: 4px 0 0 4px;
}

/* Page Content Area */
.page-content {
  position: absolute;
  top: 40px;
  left: 25px;
  right: 25px;
  bottom: 50px;
  overflow-y: auto;
  padding: 20px;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.8;
  color: #2c2416;
  background: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 31px,
      rgba(180, 170, 150, 0.15) 31px,
      rgba(180, 170, 150, 0.15) 32px
    );
  outline: none;
}

/* Placeholder styling for contenteditable */
.page-content:empty::before {
  content: attr(placeholder);
  color: #bbb;
  font-style: italic;
  pointer-events: none;
}

.page-content:focus {
  outline: none;
}

/* Page Numbers */
.page-number {
  position: absolute;
  bottom: 18px;
  font-family: 'Georgia', serif;
  font-size: 14px;
  color: #999;
  opacity: 0.6;
}

.page-number.left-number {
  left: 30px;
}

.page-number.right-number {
  right: 30px;
}

/* Paper texture overlay */
.notebook-page::after {
  content: "";
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 30%, rgba(255, 255, 255, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(200, 190, 170, 0.1) 0%, transparent 40%);
  pointer-events: none;
}

/* Header Overlay */
.notebook-header-overlay {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 30px;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  z-index: 20;
  backdrop-filter: blur(10px);
}

.notebook-back-btn,
.notebook-save-btn,
.notebook-add-page-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-primary);
  color: var(--white);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.notebook-back-btn:hover,
.notebook-save-btn:hover,
.notebook-add-page-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.notebook-delete-page-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--white);
  color: var(--delete-red);
  border: 2px solid var(--delete-red);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.notebook-delete-page-btn:hover {
  background: var(--delete-red);
  color: var(--white);
  border-color: var(--delete-red);
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.notebook-add-page-btn {
  background: var(--accent-purple);
}

.notebook-title-input {
  min-width: 180px;
  border: none;
  background: transparent;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
  padding: 8px 12px;
  outline: none;
  font-family: inherit;
  text-align: center;
}

.notebook-title-input::placeholder {
  color: #aaa;
}

/* Hidden textarea for content editing */
.notebook-textarea {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  resize: none;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 17px;
  line-height: 32px;
  color: #2c2416;
  padding: 0;
  outline: none;
}

.notebook-textarea::placeholder {
  color: #ccc;
  font-style: italic;
}

/* ============================================
   MOOD BAR - Bottom Positioned
   ============================================ */

#moodBar {
  position: fixed !important;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 170;
}

#moodBarShowBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 170;
}

@media (max-width: 768px) {
  #moodBar {
    bottom: 90px;
    padding: 8px 14px;
    font-size: 18px;
  }

  #moodBarShowBtn {
    bottom: 90px;
    width: 44px;
    height: 44px;
  }
}

/* ============================================
   MOBILE HALF-PAGE NOTEBOOK VIEW
   ============================================ */

/* Mobile expand/collapse button */
.notebook-expand-btn {
  position: fixed;
  bottom: 110px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent-purple);
  color: var(--white);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  z-index: 180;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: slideUpIn 0.4s ease;
}

@keyframes slideUpIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notebook-expand-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.notebook-expand-btn:active {
  transform: scale(0.95);
}

/* Hide on desktop */
@media (min-width: 769px) {
  .notebook-expand-btn {
    display: none !important;
  }
}

/* Notebook Responsive */
@media (max-width: 768px) {
  .notebook-view {
    padding: 10px;
  }

  .notebook-spread {
    height: calc(100vh - 30px);
    max-height: none;
    border-radius: 6px;
    width: 100%;
    overflow: visible;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* MOBILE: Hide right page by default */
  .notebook-spread:not(.expanded) {
    width: 100%;
  }

  .notebook-spread:not(.expanded) .notebook-page.right-page {
    position: absolute;
    right: -100%;
    opacity: 0;
    pointer-events: none;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease 0.1s,
                width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* MOBILE: Only show left page by default */
  .notebook-spread:not(.expanded) .notebook-page.left-page {
    width: 100%;
    border-radius: 6px;
    box-shadow: 
      0 15px 35px rgba(0, 0, 0, 0.2),
      inset -8px 0 15px -5px rgba(0, 0, 0, 0.1);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s ease;
  }

  /* MOBILE: When expanded, show both pages side by side */
  .notebook-spread.expanded {
    display: flex;
    width: 100%;
  }

  .notebook-spread.expanded .notebook-page.left-page {
    width: 50%;
    border-radius: 6px 0 0 6px;
    box-shadow: 
      inset -15px 0 25px -10px rgba(0, 0, 0, 0.15),
      inset -3px 0 8px rgba(0, 0, 0, 0.05),
      -12px 0 25px rgba(0, 0, 0, 0.2);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s ease;
  }

  .notebook-spread.expanded .notebook-page.right-page {
    width: 50%;
    border-radius: 0 6px 6px 0;
    position: relative;
    right: 0;
    opacity: 1;
    pointer-events: auto;
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    box-shadow: 
      inset 15px 0 25px -10px rgba(0, 0, 0, 0.15),
      inset 3px 0 8px rgba(0, 0, 0, 0.05),
      12px 0 25px rgba(0, 0, 0, 0.2);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s ease;
  }

  @keyframes slideInRight {
    from {
      opacity: 0;
      transform: translateX(30px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  /* Show expand button when in half-page mode */
  .notebook-view.mobile-half-mode .notebook-expand-btn {
    display: flex;
  }

  /* Keep expand button visible when expanded (for collapsing) */
  .notebook-view.mobile-expanded .notebook-expand-btn {
    display: flex;
  }

  .notebook-page.left-page {
    border-radius: 6px 0 0 6px;
  }

  .notebook-page.right-page {
    border-radius: 0 6px 6px 0;
  }

  .page-content {
    top: 35px;
    left: 15px;
    right: 15px;
    bottom: 40px;
    font-size: 15px;
    padding: 15px;
  }

  .notebook-header-overlay {
    top: 8px;
    padding: 8px 12px;
    gap: 6px;
  }

  .notebook-back-btn,
  .notebook-save-btn,
  .notebook-more-btn {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .notebook-delete-page-btn {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .notebook-add-page-btn {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .notebook-title-input {
    font-size: 14px;
    min-width: 100px;
    padding: 4px 6px;
  }

  .center-fold {
    width: 12px;
  }

  .page-number {
    bottom: 14px;
    font-size: 12px;
  }

  .page-number.left-number {
    left: 18px;
  }

  .page-number.right-number {
    right: 18px;
  }
}

@media (min-width: 1024px) {
  .notebook-spread {
    max-width: 1000px;
    max-height: 750px;
  }

  .page-content {
    font-size: 18px;
    line-height: 34px;
  }

  .notebook-header-overlay {
    padding: 14px 24px;
  }

  .notebook-title-input {
    min-width: 220px;
    font-size: 20px;
  }
}

/* ============================================
   Responsive Breakpoints for Website Look
   ============================================ */

/* Tablet Styles (768px and up) */
@media (min-width: 768px) {
  .app-shell {
    padding: 30px;
  }

  .phone-frame {
    max-width: 900px;
    padding: 30px;
  }

  .title-block {
    margin-top: 40px;
  }

  .title-block h1 {
    font-size: 56px;
  }

  .carousel-container {
    height: 480px;
  }

  :root {
    --book-width: 280px;
    --book-height: 400px;
  }

  /* Show more books in view */
  .carousel-track {
    padding: 40px calc(50% - (var(--book-width) + 20px));
  }

  .floating-actions {
    gap: 20px;
  }

  .action-btn {
    width: 68px;
    height: 68px;
  }
}

/* Desktop Styles (1024px and up) */
@media (min-width: 1024px) {
  .app-shell {
    padding: 40px;
  }

  .phone-frame {
    max-width: 1100px;
    padding: 40px;
  }

  /* Website-like header */
  .top-bar {
    padding: 0 20px;
    margin-top: 20px;
  }

  .title-block {
    margin-top: 80px;
    margin-bottom: 40px;
  }

  .title-block h1 {
    font-size: 64px;
  }

  .sub-info {
    font-size: 20px;
  }

  /* Wider carousel */
  .carousel-container {
    height: 520px;
  }

  :root {
    --book-width: 300px;
    --book-height: 420px;
    --spine-width: 32px;
  }

  /* Show multiple books side by side */
  .carousel-track {
    gap: 30px;
    padding: 50px calc(50% - ((var(--book-width) * 2) + 30px));
  }

  /* Adjacent books more visible */
  .book-card.prev,
  .book-card.next {
    opacity: 0.75;
    transform: scale(0.92);
  }

  .book-card.prev-2,
  .book-card.next-2 {
    opacity: 0.4;
    transform: scale(0.8);
  }

  .main-area {
    margin-top: 40px;
  }

  .instruction-text {
    font-size: 16px;
    margin-top: 30px;
  }

  .floating-actions {
    margin-top: 30px;
    gap: 24px;
  }

  .action-btn {
    width: 72px;
    height: 72px;
    font-size: 28px;
  }

  .action-btn.primary {
    font-size: 32px;
  }

  /* Larger popup menu */
  .popup-menu {
    min-width: 260px;
  }

  .popup-item {
    padding: 20px 24px;
    font-size: 18px;
  }
}

/* Large Desktop Styles (1440px and up) */
@media (min-width: 1440px) {
  .phone-frame {
    max-width: 1300px;
  }

  .title-block h1 {
    font-size: 72px;
  }

  .carousel-container {
    height: 560px;
  }

  :root {
    --book-width: 320px;
    --book-height: 450px;
  }

  .carousel-track {
    padding: 60px calc(50% - ((var(--book-width) * 2.5) + 40px));
  }
}

/* ============================================
   Customize Modal Styles
   ============================================ */

.customize-section {
  margin-bottom: 20px;
}

.customize-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

.color-option {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.color-option:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.color-option.selected {
  border-color: var(--accent-purple);
  transform: scale(1.1);
  box-shadow: 0 0 0 3px rgba(141, 138, 173, 0.3);
}

/* Template Picker */
.template-picker {
  display: flex;
  gap: 12px;
  justify-content: flex-start;
}

.template-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  background: #f8f8f8;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 70px;
}

.template-option:hover {
  border-color: #ccc;
  background: #f0f0f0;
}

.template-option.selected {
  border-color: var(--accent-purple);
  background: #e8e6f2;
}

.template-option span {
  font-size: 12px;
  color: var(--text-dark);
  font-weight: 500;
}

/* Template Preview Boxes */
.template-preview {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #ddd;
  position: relative;
  overflow: hidden;
}

/* Plain - just white */
.plain-preview {
  background: #fff;
}

/* Lined - horizontal lines */
.lined-preview {
  background: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 9px,
      #b4a796 9px,
      #b4a796 10px
    );
}

/* Graph - grid */
.graph-preview {
  background: 
    linear-gradient(#b4a796 1px, transparent 1px),
    linear-gradient(90deg, #b4a796 1px, transparent 1px);
  background-size: 10px 10px;
}

/* Dot - dot grid */
.dot-preview {
  background-image: radial-gradient(#b4a796 1.5px, transparent 1.5px);
  background-size: 10px 10px;
}

/* Pre-design Picker */
.predesign-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

.predesign-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  background: #f8f8f8;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 70px;
}

.predesign-option:hover {
  border-color: #ccc;
  background: #f0f0f0;
}

.predesign-option.selected {
  border-color: var(--accent-purple);
  background: #e8e6f2;
}

.predesign-option span {
  font-size: 11px;
  color: var(--text-dark);
  font-weight: 500;
}

.predesign-preview {
  width: 45px;
  height: 55px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.predesign-cover {
  width: 100%;
  height: 100%;
  border-radius: 0 4px 4px 0;
  position: relative;
  display: flex;
}

.predesign-spine {
  width: 8px;
  height: 100%;
}

/* Cover Image Picker */
.cover-image-picker {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cover-image-preview {
  width: 100%;
  height: 120px;
  border-radius: 12px;
  border: 2px dashed #ccc;
  background: #f8f8f8;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.cover-image-preview.has-image {
  border-style: solid;
  border-color: var(--accent-purple);
}

.cover-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.no-image-text {
  color: #999;
  font-size: 14px;
}

.cover-image-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.cover-image-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--accent-purple);
  color: var(--white);
  border: none;
}

.cover-image-btn:hover {
  background: #7f7ba0;
}

.cover-image-btn.remove-btn {
  background: #e74c3c;
}

.cover-image-btn.remove-btn:hover {
  background: #c0392b;
}

/* ============================================
   Notebook More Options Button & Popup
   ============================================ */

.notebook-more-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-primary);
  color: var(--white);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.notebook-more-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Notebook Popup Menu */
.notebook-popup {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 200px;
  background: var(--white);
  border-radius: 16px;
  overflow: visible;
  box-shadow: 0 16px 32px rgba(25, 24, 43, 0.25);
  z-index: 100;
  animation: notebookPopupFadeIn 0.2s ease;
}

@keyframes notebookPopupFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.notebook-popup::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -10px;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  background: var(--white);
  transform: translateX(-50%) rotate(45deg);
  border-radius: 4px;
}

.notebook-popup-item {
  width: 100%;
  border: none;
  background: transparent;
  padding: 14px 18px;
  font-size: 15px;
  color: var(--text-dark);
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}

.notebook-popup-item i {
  width: 18px;
  text-align: center;
  color: #666;
}

.notebook-popup-item:first-child { border-radius: 16px 16px 0 0; }
.notebook-popup-item:last-child { border-radius: 0 0 16px 16px; }
.notebook-popup-item:hover { background: #f5f5f5; }

.notebook-popup-item.delete-page-btn {
  color: var(--delete-red);
}

.notebook-popup-item.delete-page-btn i {
  color: var(--delete-red);
}

/* ============================================
   Draggable Text Notes
   ============================================ */

.text-note {
  position: absolute;
  min-width: 150px;
  min-height: 80px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  cursor: move;
  z-index: 5;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 14px;
  line-height: 1.5;
  color: #2c2416;
}

.text-note:focus {
  outline: 2px solid var(--accent-purple);
  outline-offset: 2px;
}

.text-note .delete-note-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--delete-red);
  color: var(--white);
  font-size: 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.text-note:hover .delete-note-btn,
.text-note.selected .delete-note-btn {
  display: flex;
}

/* ============================================
   Draggable Images
   ============================================ */

.draggable-image {
  position: absolute;
  cursor: move;
  z-index: 5;
  border: 2px solid transparent;
  border-radius: 4px;
  transition: border-color 0.2s ease;
}

.draggable-image:hover {
  border-color: var(--accent-purple);
}

/* Selected state */
.draggable-image.selected,
.text-note.selected {
  border: 2px dashed var(--accent-purple);
  background: rgba(141, 138, 173, 0.05);
}

.draggable-image img {
  display: block;
  max-width: 300px;
  max-height: 250px;
  border-radius: 4px;
  pointer-events: none;
  width: 100%;
  height: auto;
}

/* Resize handles container */
.resize-handles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  pointer-events: none;
}

.draggable-image.selected .resize-handles,
.text-note.selected .resize-handles,
.image-wrapper.selected .resize-handles {
  display: block;
}

/* Individual resize handles */
.resize-handle-nw,
.resize-handle-n,
.resize-handle-ne,
.resize-handle-e,
.resize-handle-se,
.resize-handle-s,
.resize-handle-sw,
.resize-handle-w {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--white);
  border: 2px solid var(--accent-purple);
  border-radius: 50%;
  pointer-events: auto;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Corner handles */
.resize-handle-nw {
  top: -6px;
  left: -6px;
  cursor: nw-resize;
}

.resize-handle-ne {
  top: -6px;
  right: -6px;
  cursor: ne-resize;
}

.resize-handle-sw {
  bottom: -6px;
  left: -6px;
  cursor: sw-resize;
}

.resize-handle-se {
  bottom: -6px;
  right: -6px;
  cursor: se-resize;
}

/* Edge handles */
.resize-handle-n {
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  cursor: n-resize;
}

.resize-handle-s {
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  cursor: s-resize;
}

.resize-handle-e {
  top: 50%;
  right: -6px;
  transform: translateY(-50%);
  cursor: e-resize;
}

.resize-handle-w {
  top: 50%;
  left: -6px;
  transform: translateY(-50%);
  cursor: w-resize;
}

.draggable-image .resize-handle,
.text-note .resize-handle,
.image-wrapper .resize-handle {
  display: none;
}

.draggable-image .delete-image-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--delete-red);
  color: var(--white);
  font-size: 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.image-wrapper .delete-image-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--delete-red);
  color: var(--white);
  font-size: 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.image-wrapper:hover .delete-image-btn,
.image-wrapper.selected .delete-image-btn {
  display: flex;
}

/* Image wrapper for direct image resizing */
.image-wrapper {
  position: absolute;
  cursor: move;
  z-index: 5;
  border: 2px solid transparent;
  border-radius: 4px;
  transition: border-color 0.2s ease;
}

.image-wrapper:hover {
  border-color: var(--accent-purple);
}

/* Selected state for image wrapper */
.image-wrapper.selected {
  border: 2px dashed var(--accent-purple);
  background: rgba(141, 138, 173, 0.05);
}

.image-wrapper img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  pointer-events: none;
}

/* ============================================
   Canvas Drawing Overlay
   ============================================ */

.drawing-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  z-index: 8;
  pointer-events: auto;
}

.drawing-canvas.hidden {
  display: none;
}

.drawing-active .page-content {
  cursor: crosshair;
}

/* Pen tool button active state */
.notebook-popup-item.pen-active {
  background: #e8e6f2;
  color: var(--accent-purple);
}

.notebook-popup-item.pen-active i {
  color: var(--accent-purple);
}

/* Clear Drawing Button */
.notebook-clear-drawing-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--delete-red);
  color: var(--white);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.notebook-clear-drawing-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  background: #c0392b;
}

/* Eraser Active State */
.notebook-clear-drawing-btn.eraser-active {
  background: var(--accent-purple);
}

.notebook-clear-drawing-btn.eraser-active:hover {
  background: #7f7ba0;
}

/* ============================================
   Realistic Page Flip Animation - CSS Classes used by JavaScript
   ============================================ */

/* Ensure 3D transform on notebook spread */
.notebook-spread {
  transform-style: preserve-3d;
  perspective: 1500px;
}

/* Individual pages need preserve-3d */
.notebook-page {
  transform-style: preserve-3d;
  backface-visibility: hidden;
  transition: transform 0.5s cubic-bezier(0.4, 0.0, 0.2, 1),
              opacity 0.3s ease,
              box-shadow 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Left page flipping out to the right */
.notebook-page.left-page.flipping-out-left {
  transform: rotateY(-130deg) !important;
  opacity: 0.2;
  z-index: 100;
  box-shadow: -40px 0 60px rgba(0, 0, 0, 0.6) !important;
}

/* New page flipping in from left */
.notebook-page.left-page.flipping-in-left {
  transform: rotateY(80deg) !important;
  opacity: 0;
  z-index: 50;
}

/* Right page flipping out to the left */
.notebook-page.right-page.flipping-out-right {
  transform: rotateY(130deg) !important;
  opacity: 0.2;
  z-index: 100;
  box-shadow: 40px 0 60px rgba(0, 0, 0, 0.6) !important;
}

/* New page flipping in from right */
.notebook-page.right-page.flipping-in-right {
  transform: rotateY(-80deg) !important;
  opacity: 0;
  z-index: 50;
}

/* Page curl effect during flip - adds realistic shadow and highlight */
.notebook-page.left-page.flipping-out-left::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.5) 20%,
    rgba(255, 255, 255, 0.3) 40%,
    rgba(200, 190, 170, 0.2) 70%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 60;
}

.notebook-page.right-page.flipping-out-right::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    -105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.5) 20%,
    rgba(255, 255, 255, 0.3) 40%,
    rgba(200, 190, 170, 0.2) 70%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 60;
}

/* ============================================
   Calendar View Styles
   ============================================ */

.calendar-view {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-gradient);
  z-index: 150;
  display: flex;
  flex-direction: column;
  padding: 20px;
  animation: notebookFadeIn 0.3s ease;
  overflow-y: auto;
}

.calendar-header-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 30px;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  z-index: 20;
  backdrop-filter: blur(10px);
  margin: 0 auto 20px;
  max-width: 400px;
}

.calendar-back-btn,
.calendar-add-btn,
.calendar-sync-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-primary);
  color: var(--white);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.calendar-back-btn:hover,
.calendar-add-btn:hover,
.calendar-sync-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.calendar-add-btn {
  background: var(--accent-purple);
}

.calendar-sync-btn {
  background: #4285f4;
}

.calendar-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-dark);
  min-width: 100px;
  text-align: center;
}

/* Calendar Navigation */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
}

.calendar-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.3);
  color: var(--white);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.calendar-nav-btn:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
}

.calendar-month-year {
  font-size: 18px;
  font-weight: 600;
  color: var(--white);
  min-width: 150px;
  text-align: center;
}

/* Calendar Grid */
.calendar-grid {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  max-width: 500px;
  margin: 0 auto 20px;
  width: 100%;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-bottom: 10px;
}

.calendar-weekdays div {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  padding: 8px 0;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 4px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  background: transparent;
  min-height: 60px;
  position: relative;
}

.calendar-day:hover {
  background: rgba(141, 138, 173, 0.1);
}

.calendar-day.other-month {
  color: #ccc;
}

.calendar-day.today {
  background: var(--accent-purple);
  color: var(--white);
}

.calendar-day.has-event {
  background: #e8f5e9;
}

.calendar-day.has-event.today {
  background: var(--accent-purple);
}

.calendar-day.has-event::after {
  content: "";
  position: absolute;
  bottom: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4caf50;
}

.calendar-day.has-event.today::after {
  background: var(--white);
}

.day-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  margin-top: 4px;
  max-height: 40px;
  overflow: hidden;
}

.day-event-dot {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #4caf50;
  font-size: 8px;
  color: #333;
  padding: 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Upcoming Events Section */
.upcoming-events-section {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

/* ============================================
   Saved Images & Drawings in Page Content
   ============================================ */

/* Saved images from imported photos */
.page-content .saved-image {
  max-width: 100%;
  height: auto;
  display: inline-block;
  margin: 5px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.page-content .saved-image:hover {
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Saved drawing from pen tool */
.page-content .saved-drawing {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 10px 0;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.upcoming-events-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 16px;
}

.upcoming-events-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.upcoming-event-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: #f8f8f8;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upcoming-event-item:hover {
  background: #f0f0f0;
  transform: translateX(4px);
}

.event-date-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  background: var(--accent-purple);
  border-radius: 10px;
  color: var(--white);
  flex-shrink: 0;
}

.event-month {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.event-day {
  font-size: 18px;
  font-weight: 700;
}

.event-details {
  flex: 1;
}

.event-title-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.event-time-text {
  font-size: 13px;
  color: #666;
}

.event-delete-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.event-delete-btn:hover {
  background: var(--delete-red);
  color: var(--white);
}

.empty-events-message {
  text-align: center;
  padding: 30px;
  color: #888;
  font-size: 14px;
}

/* Event Modal Styles */
.event-date-time-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.event-date-time-row input {
  flex: 1;
}

/* Google Sign In Styles */
.google-signin-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
}

.google-icon-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285f4, #34a853, #fbbc04, #ea4335);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.google-icon-wrapper i {
  font-size: 40px;
  color: var(--white);
}

.google-signin-text {
  font-size: 14px;
  color: #666;
  text-align: center;
  margin-bottom: 20px;
}

.google-signin-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  background: #4285f4;
  color: var(--white);
  border: none;
  transition: all 0.2s ease;
}

.google-signin-btn:hover {
  background: #3367d6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4);
}

.google-signin-status {
  margin-top: 16px;
  font-size: 14px;
  text-align: center;
}

.google-signin-status.success {
  color: #4caf50;
}

.google-signin-status.error {
  color: var(--delete-red);
}

/* Calendar Responsive */
@media (max-width: 480px) {
  .calendar-view {
    padding: 10px;
  }
  
  .calendar-header-overlay {
    padding: 10px 16px;
    gap: 8px;
  }
  
  .calendar-title {
    font-size: 18px;
  }
  
  .calendar-grid {
    padding: 12px;
  }
  
  .calendar-day {
    font-size: 12px;
    padding: 4px 2px;
    min-height: 50px;
  }
  
  .calendar-day.has-event::after {
    width: 4px;
    height: 4px;
    bottom: 4px;
  }
}


/* ============================================================
   LOADING & TOAST NOTIFICATIONS
   ============================================================ */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.loading-spinner {
  background: white;
  border-radius: 15px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.loading-spinner i {
  font-size: 48px;
  color: var(--accent-purple);
  animation: spin 1s linear infinite;
  display: block;
  margin-bottom: 15px;
}

.loading-text {
  font-size: 16px;
  font-weight: 500;
  color: #333;
  margin: 0;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Toast Notifications */
.error-toast,
.success-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(200px);
  background: white;
  border-radius: 12px;
  padding: 16px 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  max-width: 400px;
  word-wrap: break-word;
}

.error-toast.show,
.success-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.error-toast {
  color: #e74c3c;
  background: #fff5f5;
  border-left: 4px solid #e74c3c;
}

.success-toast {
  color: #27ae60;
  background: #f0fff4;
  border-left: 4px solid #27ae60;
}

/* Empty State Messages */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.5;
}
