/* Insights specific styles */

#content-library {
  padding: var(--spacing-lg) 0;
  min-height: 80vh;
  background-color: #ffffff;
}

.library-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

/* Header Section */
.library-header {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.library-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.library-description {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
  max-width: 800px;
  justify-content: flex-start;
}

.library-description svg {
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.library-description p {
  margin: 0;
  line-height: 1.5;
  font-size: 0.875rem;
}

.library-controls {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
}

.search-container {
  display: flex;
  gap: 0.75rem;
  flex: 1;
  max-width: 500px;
}

.filter-container {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.filter-select {
  padding: 0.6rem 1rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
  background-color: #ffffff;
  color: var(--text-primary);
  cursor: pointer;
  min-width: 150px;
}

.filter-select:focus {
  border-color: #3300FF;
}

.filter-select:hover {
  border-color: rgba(51, 0, 255, 0.3);
}

.search-input-wrapper {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
}

#search-input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

#search-input:focus {
  border-color: #3300FF;
}

#search-btn {
  padding: 0.6rem 1.5rem;
  font-size: 0.85rem;
}

.results-count {
  color: var(--text-secondary);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Content Grid Container */
.content-grid-container {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  min-height: 400px;
}

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

/* Card Styles */
.content-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 0;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.content-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.08);
  border-color: rgba(51, 0, 255, 0.3);
}

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background-color: #e5e7eb;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.card-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.content-card h3 {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.4;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: auto;
}

.card-meta svg {
  color: var(--text-secondary);
}

/* Article Detail Layout */
#article-detail {
  padding: 32px 0;
  min-height: 80vh;
  background-color: #ffffff;
}

.article-layout-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 4rem;
}

/* Sidebar Styles */
.article-sidebar {
  position: relative;
}

.sidebar-content {
  position: sticky;
  top: 100px; /* Adjust based on header height */
  padding-right: 1rem;
  align-self: flex-start;
}

.sidebar-content h3 {
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

/* Generate the ToC from article headers */
.table-of-contents {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.8rem;
  align-items: flex-start;
  padding: 0 0px;
}

.toc-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
  line-height: 1.5;
  position: relative;
  padding-left: 8px;
  border-left: 2px solid transparent;
  display: block;
  text-align: left;
  width: 100%;
}

.toc-link.toc-h2 {
  padding-left: 8px;
  font-weight: 500;
}

.toc-link.toc-h3 {
  padding-left: 24px;
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.toc-link:hover,
.toc-link.active {
  color: var(--text-primary);
}

.toc-link.toc-h2:hover,
.toc-link.toc-h2.active {
  font-weight: 600;
}

.toc-link.toc-h3:hover,
.toc-link.toc-h3.active {
  font-weight: 500;
}

.toc-link.active {
  border-left-color: #3300FF;
  color: #3300FF;
}

/* Article Main Content */
.article-main-content {
  max-width: 800px;
  position: relative;
}

.article-header {
  margin-bottom: 0.5rem;
  padding: 0;
  position: relative;
}

.article-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0;
  line-height: 1.2;
}

.article-meta-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 0;
  margin-bottom: 1rem;
}

.article-hero-image {
  width: 100%;
  height: auto;
  border-radius: 16px;
  margin-bottom: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  object-fit: cover;
  max-height: 500px;
}

/* Typography for Article Body */
.article-body {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-primary);
  font-family: 'Lato', sans-serif;
}

.article-body p,
.article-body div {
  font-family: 'Lato', sans-serif;
}

.article-body h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.article-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.article-body p {
  margin-bottom: 16px;
}

.article-body ul, 
.article-body ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.article-body li {
  margin-bottom: 0.5rem;
}

.article-body blockquote {
  border-left: 4px solid #3300FF;
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Article tables: fix alignment and overflow */
.article-body .table-responsive {
  overflow-x: auto;
  margin: 1.5rem 0;
  -webkit-overflow-scrolling: touch;
}

.article-body table {
  width: 100%;
  min-width: 400px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.article-body table th,
.article-body table td {
  vertical-align: top;
  text-align: left;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.article-body table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: var(--text-primary);
}

.article-body table tr:nth-child(even) td {
  background-color: rgba(0, 0, 0, 0.02);
}

.article-body table .product-name {
  white-space: normal;
  word-break: break-word;
}

/* Navigation Button Style Override for Insights Pages */
.nav-links .btn-primary {
  color: #ffffff !important; /* Force white text */
  background-color: #3300FF;
  transform: none; /* Remove transform on hover/active */
  box-shadow: none; /* Remove shadow if any */
  border-radius: 6px;
  font-weight: 500;
  font-size: 12px;
  padding: 0.5rem 1.5rem;
}

.nav-links .btn-primary:hover {
  background-color: #3300FF;
  transform: none;
  color: #ffffff !important;
}

.nav-links a.active {
  color: #3300FF;
  font-weight: 700;
}

/* Responsive */
@media (max-width: 900px) {
  .article-layout-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .article-sidebar {
    display: none; /* Hide sidebar on mobile/tablet for now */
  }
}

/* Responsive */
@media (max-width: 768px) {
  .library-header {
    padding: 1.5rem;
  }
  
  .content-grid-container {
    padding: 1.5rem;
  }

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

  .library-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-container {
    width: 100%;
    max-width: none;
  }
  
  .filter-container {
    width: 100%;
    flex-direction: column;
  }
  
  .filter-select {
    width: 100%;
    min-width: auto;
  }
}

/* Access Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background-color: #ffffff;
  padding: 2.5rem;
  border-radius: 16px;
  max-width: 500px;
  width: 90%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-content h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.modal-content p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-email-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.modal-email-input:focus {
  border-color: #3300FF;
}

.modal-submit-btn {
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(to right, #3300FF, #a855f7);
  color: white;
  border: none;
  border-radius: 6px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}

.modal-submit-btn:hover {
  opacity: 0.9;
}

.modal-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.modal-message {
  margin-top: 1rem;
  font-size: 0.9rem;
  min-height: 1.5em;
  text-align: center;
}
