/**
 * ShadowReader - Notes Sidebar Component Styles
 * Parchment scroll-style sidebar for displaying user notes
 */

/* ===== Notes Sidebar Container ===== */
.notes-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 350px;
  height: 100vh;
  z-index: var(--z-sidebar);
  transform: translateX(100%);
  transition: transform var(--duration-normal) var(--easing-smooth);
  pointer-events: none;
}

.notes-sidebar.visible {
  transform: translateX(0);
  pointer-events: auto;
}

/* ===== Scroll Container ===== */
.scroll-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to right,
    rgba(26, 15, 15, 0.3) 0%,
    var(--color-parchment) 5%,
    var(--color-parchment) 95%,
    rgba(26, 15, 15, 0.3) 100%
  );
  background-image: 
    linear-gradient(
      to right,
      rgba(26, 15, 15, 0.3) 0%,
      var(--color-parchment) 5%,
      var(--color-parchment) 95%,
      rgba(26, 15, 15, 0.3) 100%
    ),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(196, 184, 154, 0.1) 2px,
      rgba(196, 184, 154, 0.1) 4px
    );
  box-shadow: 
    -8px 0 20px rgba(0, 0, 0, 0.5),
    inset 0 0 50px rgba(26, 15, 15, 0.1);
  padding: var(--spacing-xl) var(--spacing-lg);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Torn edges effect using clip-path */
.scroll-container::before,
.scroll-container::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 20px;
  background: inherit;
  z-index: 1;
  pointer-events: none;
}

.scroll-container::before {
  top: 0;
  clip-path: polygon(
    0% 0%, 5% 15%, 10% 5%, 15% 18%, 20% 8%, 25% 16%, 30% 6%, 
    35% 14%, 40% 7%, 45% 17%, 50% 5%, 55% 15%, 60% 8%, 65% 16%, 
    70% 6%, 75% 14%, 80% 9%, 85% 17%, 90% 7%, 95% 15%, 100% 0%,
    100% 100%, 0% 100%
  );
}

.scroll-container::after {
  bottom: 0;
  clip-path: polygon(
    0% 100%, 5% 85%, 10% 95%, 15% 82%, 20% 92%, 25% 84%, 30% 94%, 
    35% 86%, 40% 93%, 45% 83%, 50% 95%, 55% 85%, 60% 92%, 65% 84%, 
    70% 94%, 75% 86%, 80% 91%, 85% 83%, 90% 93%, 95% 85%, 100% 100%,
    100% 0%, 0% 0%
  );
}

/* Candle glow effects on sides */
.scroll-container::before {
  box-shadow: 
    -15px 0 30px rgba(255, 140, 66, 0.3),
    15px 0 30px rgba(255, 140, 66, 0.3);
}

/* ===== Scroll Title ===== */
.scroll-title {
  font-family: var(--font-handwritten);
  font-size: var(--font-size-2xl);
  color: var(--color-purple-deep);
  text-align: center;
  margin: 0 0 var(--spacing-xl) 0;
  text-shadow: 0 0 10px rgba(255, 140, 66, 0.3);
  letter-spacing: 1px;
  position: relative;
  z-index: 2;
}

/* ===== Notes List ===== */
.notes-list {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
  z-index: 2;
}

/* ===== Individual Note Item ===== */
.note-item {
  background: rgba(196, 184, 154, 0.3);
  border: 1px solid rgba(45, 27, 78, 0.2);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  cursor: pointer;
  transition: var(--transition-all);
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.note-item:hover {
  background: rgba(196, 184, 154, 0.5);
  border-color: var(--color-accent);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.3),
    0 0 15px rgba(255, 140, 66, 0.2);
  transform: translateX(-5px);
}

.note-item:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ===== Note Content Layout ===== */
.note-content-wrapper {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
}

/* ===== Ghost Icon ===== */
.ghost-icon {
  font-size: var(--font-size-xl);
  flex-shrink: 0;
  opacity: 0.7;
  filter: drop-shadow(0 0 5px rgba(255, 140, 66, 0.5));
}

/* ===== Note Content ===== */
.note-content {
  flex: 1;
  min-width: 0;
}

.note-text {
  font-family: var(--font-handwritten);
  font-size: var(--font-size-md);
  color: var(--color-text-primary);
  margin: 0 0 var(--spacing-xs) 0;
  line-height: 1.4;
  word-wrap: break-word;
  transform: rotate(-0.5deg);
}

.note-page {
  font-family: var(--font-gothic);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  opacity: 0.8;
  font-style: italic;
}

.note-date {
  font-family: var(--font-body);
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  opacity: 0.6;
  margin-top: var(--spacing-xs);
}

/* ===== Empty State ===== */
.notes-empty {
  text-align: center;
  padding: var(--spacing-xl) var(--spacing-md);
  color: var(--color-text-secondary);
  font-family: var(--font-handwritten);
  font-size: var(--font-size-lg);
  opacity: 0.7;
  font-style: italic;
}

.notes-empty-icon {
  font-size: 48px;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

/* ===== Wax Seal Close Button ===== */
.wax-seal-close {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  width: 50px;
  height: 50px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 10;
  transition: var(--transition-all);
}

.wax-seal-close:hover {
  transform: scale(1.1) rotate(5deg);
  filter: drop-shadow(0 0 10px rgba(255, 140, 66, 0.6));
}

.wax-seal-close:active {
  transform: scale(0.95) rotate(-5deg);
}

.wax-seal-close .wax-seal-svg {
  width: 100%;
  height: 100%;
  color: var(--color-accent);
}

/* ===== Scrollbar Styling ===== */
.scroll-container::-webkit-scrollbar {
  width: 8px;
}

.scroll-container::-webkit-scrollbar-track {
  background: rgba(26, 15, 15, 0.2);
  border-radius: var(--radius-sm);
}

.scroll-container::-webkit-scrollbar-thumb {
  background: rgba(45, 27, 78, 0.5);
  border-radius: var(--radius-sm);
}

.scroll-container::-webkit-scrollbar-thumb:hover {
  background: rgba(45, 27, 78, 0.7);
  box-shadow: 0 0 5px rgba(255, 140, 66, 0.3);
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
  .notes-sidebar {
    width: 300px;
  }
}

@media (max-width: 768px) {
  /* Transform to bottom drawer on mobile */
  .notes-sidebar {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60vh;
    max-height: 500px;
    transform: translateY(100%);
  }

  .notes-sidebar.visible {
    transform: translateY(0);
  }

  .scroll-container {
    background: linear-gradient(
      to bottom,
      rgba(26, 15, 15, 0.3) 0%,
      var(--color-parchment) 5%,
      var(--color-parchment) 100%
    );
  }

  .scroll-container::before {
    left: 0;
    width: 100%;
    height: 20px;
    clip-path: polygon(
      0% 0%, 5% 15%, 10% 5%, 15% 18%, 20% 8%, 25% 16%, 30% 6%, 
      35% 14%, 40% 7%, 45% 17%, 50% 5%, 55% 15%, 60% 8%, 65% 16%, 
      70% 6%, 75% 14%, 80% 9%, 85% 17%, 90% 7%, 95% 15%, 100% 0%,
      100% 100%, 0% 100%
    );
  }

  .wax-seal-close {
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    width: 40px;
    height: 40px;
  }

  .scroll-title {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-md);
  }

  .note-item {
    padding: var(--spacing-sm);
  }
}

/* ===== Animation for note addition ===== */
@keyframes noteSlideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.note-item.new {
  animation: noteSlideIn var(--duration-normal) var(--easing-smooth);
}

/* ===== Highlight indicator ===== */
.note-item.active {
  background: rgba(255, 140, 66, 0.2);
  border-color: var(--color-accent);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(255, 140, 66, 0.4);
}
