/* Story Page Styles */

/* Story Hero Section */
.story-hero {
  background: linear-gradient(135deg, var(--pastel-pink), var(--pastel-blue));
  padding: 3rem 0 2rem;
  position: relative;
  overflow: hidden;
}

.story-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="story-pattern" x="0" y="0" width="30" height="30" patternUnits="userSpaceOnUse"><circle cx="15" cy="15" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="5" cy="25" r="1" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23story-pattern)"/></svg>');
  opacity: 0.4;
}

.story-header {
  text-align: center;
  color: var(--white);
  position: relative;
  z-index: 2;
}

.story-title {
  font-family: 'VT323', monospace;
  font-size: 3.5rem;
  margin-bottom: 1rem;
  letter-spacing: 3px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.story-subtitle {
  font-size: 1.5rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 1.5rem;
  font-weight: 500;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.story-description {
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.85);
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.7;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Story Content Section */
.story-content {
  padding: 4rem 0;
  background: var(--soft-bg);
  min-height: 70vh;
}

/* Submission CTA */
.submission-cta {
  background: linear-gradient(135deg, var(--horror-red), #e53e3e);
  border-radius: 1rem;
  padding: 3rem 2rem;
  text-align: center;
  margin-bottom: 4rem;
  box-shadow: 0 10px 30px rgba(255, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.submission-cta::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.cta-content h2 {
  font-family: 'VT323', monospace;
  font-size: 2.5rem;
  color: var(--white);
  margin-bottom: 1rem;
  letter-spacing: 2px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.cta-content p {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 2rem;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.submit-story-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--white);
  color: var(--horror-red);
  padding: 1rem 2rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.125rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  position: relative;
  z-index: 2;
}

.submit-story-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  background: #f7fafc;
}

.submit-icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* Story Module */
.story-module {
  background: var(--white);
  border-radius: 1rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  overflow: hidden;
}

/* Story Tabs */
.story-tabs {
  display: flex;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-300);
}

.story-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem 2rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-600);
}

.story-tab:hover {
  background: rgba(255, 192, 203, 0.1);
  color: var(--text-dark);
}

.story-tab.active {
  background: var(--white);
  color: var(--horror-red);
  border-bottom: 3px solid var(--horror-red);
}

.tab-icon {
  font-size: 1.5rem;
}

.tab-count {
  background: var(--pastel-blue);
  color: var(--text-dark);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: bold;
  min-width: 2rem;
  text-align: center;
}

.story-tab.active .tab-count {
  background: var(--horror-red);
  color: var(--white);
}

/* Story Controls */
.story-controls {
  padding: 2rem;
  border-bottom: 1px solid var(--gray-300);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sort-label {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: 2px solid var(--gray-300);
  border-radius: 0.5rem;
  background: var(--white);
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 0.875rem;
}

.sort-btn:hover {
  border-color: var(--pastel-pink);
  background: rgba(255, 192, 203, 0.05);
}

.sort-btn.active {
  border-color: var(--horror-red);
  background: var(--horror-red);
  color: var(--white);
}

.sort-icon {
  width: 1rem;
  height: 1rem;
}

/* Loading State */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.loading-spinner {
  width: 3rem;
  height: 3rem;
  border: 3px solid var(--gray-300);
  border-top: 3px solid var(--horror-red);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-container p {
  color: var(--gray-600);
  font-size: 1.125rem;
}

/* Story Grid */
.story-grid {
  padding: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  min-height: 400px;
}

/* Sticky Note Cards */
.sticky-note {
  background: linear-gradient(135deg, #fff9c4, #fff7a6);
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
  position: relative;
  border-left: 4px solid var(--orange-400);
  transform: rotate(-0.5deg);
  cursor: pointer;
  user-select: none;
}

.sticky-note:nth-child(even) {
  background: linear-gradient(135deg, #e6fffa, #b2f5ea);
  border-left-color: var(--teal-400);
  transform: rotate(0.5deg);
}

.sticky-note:nth-child(3n) {
  background: linear-gradient(135deg, #fef5e7, #fed7aa);
  border-left-color: var(--orange-500);
  transform: rotate(-0.3deg);
}

.sticky-note:hover {
  transform: rotate(0deg) translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15), 0 4px 8px rgba(0,0,0,0.1);
}

.sticky-note h3 {
  font-family: 'VT323', monospace;
  font-size: 1.5rem;
  color: var(--text-dark);
  margin-bottom: 1rem;
  letter-spacing: 1px;
  line-height: 1.3;
}

/* UPDATED: Handwritten font for sticky note content with high specificity */
.story-grid .sticky-note .note-content {
  font-family: 'Kalam', cursive;
  color: var(--gray-700);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  font-size: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
}

.note-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--gray-600);
}

.note-meta span {
  display: block;
}

.note-meta a {
  color: var(--horror-red);
  text-decoration: none;
  font-weight: 500;
}

.note-meta a:hover {
  text-decoration: underline;
}

.note-actions {
  display: flex;
  align-items: center;
}

.like-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  color: #9ca3af;
}

.like-btn:hover {
  background: rgba(219, 112, 147, 0.1);
  color: #db7093;
  transform: scale(1.05);
}

.like-btn.liked {
  color: #9932cc;
}

.like-btn.liked .like-icon {
  animation: gearSpin 0.8s ease-in-out;
}

.like-btn.loading {
  opacity: 0.6;
  cursor: not-allowed;
}

.clicks-count {
  font-weight: 600;
  font-size: 0.875rem;
  min-width: 1.5rem;
  text-align: center;
}

.like-icon {
  width: 1.25rem;
  height: 1.25rem;
  transition: all 0.3s ease;
}

.like-btn:hover .like-icon {
  animation: heartbeat 0.6s ease-in-out;
}

@keyframes heartbeat {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes gearSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(90deg); }
}

/* Pagination */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding: 2rem;
  border-top: 1px solid var(--gray-300);
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--gray-300);
  border-radius: 0.5rem;
  background: var(--white);
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--horror-red);
  color: var(--horror-red);
  transform: translateY(-2px);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.pagination-icon {
  width: 1rem;
  height: 1rem;
}

.pagination-info {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 1rem;
}

/* Story FAQ Section */
.story-faq {
  padding: 4rem 0;
  background: var(--white);
}

.faq-title {
  text-align: center;
  font-family: 'VT323', monospace;
  font-size: 2.5rem;
  color: var(--text-dark);
  margin-bottom: 3rem;
  letter-spacing: 2px;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.faq-item {
  background: var(--gray-100);
  padding: 2rem;
  border-radius: 0.75rem;
  border-left: 4px solid var(--horror-red);
  transition: all 0.3s ease;
}

.faq-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.faq-question {
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 1rem;
  font-size: 1.125rem;
}

.faq-answer {
  color: var(--gray-700);
  line-height: 1.6;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--gray-600);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  display: block;
}

.empty-state h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--gray-700);
}

.empty-state p {
  font-size: 1rem;
  line-height: 1.6;
}

/* Author inspiration styling */
.author-inspiration {
  background: rgba(255, 255, 255, 0.7);
  padding: 0.5rem;
  border-radius: 0.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  border-left: 2px solid var(--pastel-pink);
}

.author-inspiration em {
  color: var(--gray-600);
  font-style: italic;
}

/* Tab descriptions */
.tab-description-area {
  padding: 2rem;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-300);
}

.tab-description {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.tab-description h3 {
  font-family: 'VT323', monospace;
  font-size: 1.5rem;
  color: var(--horror-red);
  margin-bottom: 1rem;
  letter-spacing: 1px;
}

.tab-description p {
  color: var(--gray-700);
  line-height: 1.6;
  font-size: 1rem;
}

/* Story Modal */
.story-modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.story-modal.visible {
  opacity: 1;
  pointer-events: auto;
}

/* In story-style.css */

/* Replace your existing .story-modal-content AND .letter-paper rules with this */
.story-modal-content {
  position: relative;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;

  /* Letter Paper Styling - MOVED HERE */
  background-color: #fffaf0; /* Creamy paper color */
  background-image: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 31px,
      rgba(0,0,0,0.1) 32px
    );
  padding: 4rem;
  border-radius: 5px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  color: #333;
}


.modal-story-content {
  font-family: 'Kalam', cursive;
  line-height: 1.9;
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.modal-author-info {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid rgba(219, 112, 147, 0.3);
}

.modal-author-info .author-inspiration {
  background: rgba(219, 112, 147, 0.1);
  border-left: 3px solid #db7093;
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 0.5rem;
}

.author-details {
  text-align: center;
  font-size: 0.9rem;
  color: var(--gray-600);
}

.author-details a {
  color: var(--horror-red);
  text-decoration: none;
  font-weight: 600;
}

.author-details a:hover {
  text-decoration: underline;
}

.close-modal-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  cursor: pointer;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.close-modal-btn:hover {
  background: white;
  transform: scale(1.1);
}

.close-modal-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Story count display styling */
.story-count-display {
  font-size: 1.125rem !important;
  margin-bottom: 1rem !important;
  color: rgba(255, 255, 255, 0.95) !important;
  font-weight: 500 !important;
}

.story-count-display strong {
  color: #fff !important;
  font-size: 1.25rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
  .story-title {
    font-size: 2.5rem;
  }

  .story-subtitle {
    font-size: 1.25rem;
  }

  .submission-cta {
    padding: 2rem 1.5rem;
    margin-bottom: 2rem;
  }

  .cta-content h2 {
    font-size: 2rem;
  }

  .story-tabs {
    flex-direction: column;
  }

  .story-tab {
    padding: 1rem 1.5rem;
  }

  .story-controls {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem;
  }

  .sort-controls {
    width: 100%;
    justify-content: center;
  }

  .story-grid {
    grid-template-columns: 1fr;
    padding: 1.5rem;
    gap: 1.5rem;
  }

  .pagination-container {
    flex-direction: column;
    gap: 1rem;
  }

  .faq-grid {
    grid-template-columns: 1fr;
  }

  .story-modal-content {
    width: 95%;
    max-height: 95vh;
  }

  
  .tab-description-area {
    padding: 1.5rem;
  }

  .author-inspiration {
    padding: 0.75rem;
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .story-hero {
    padding: 2rem 0 1.5rem;
  }

  .story-title {
    font-size: 2rem;
  }

  .story-description {
    font-size: 1rem;
  }

  .submission-cta {
    padding: 1.5rem 1rem;
  }

  .cta-content h2 {
    font-size: 1.75rem;
  }

  .submit-story-btn {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }

  .story-grid {
    padding: 1rem;
    gap: 1rem;
  }

  .sticky-note {
    padding: 1.25rem;
  }

  .sticky-note h3 {
    font-size: 1.25rem;
  }

  .faq-item {
    padding: 1.5rem;
  }
}

/* Accessibility and High Contrast */
@media (prefers-contrast: high) {
  .sticky-note {
    border: 2px solid var(--text-dark);
  }

  .sort-btn,
  .pagination-btn {
    border-width: 3px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .sticky-note {
    transform: none;
  }

  .sticky-note:hover {
    transform: none;
  }

  .loading-spinner {
    animation: none;
  }

  .like-btn:hover .like-icon {
    animation: none;
  }
}

/* Print Styles */
@media print {
  .story-hero,
  .submission-cta,
  .story-controls,
  .pagination-container,
  .note-actions {
    display: none;
  }

  .sticky-note {
    break-inside: avoid;
    transform: none;
    box-shadow: none;
    border: 1px solid var(--gray-300);
    margin-bottom: 1rem;
  }
}