/* File: css/voltwiki-content.css - Dynamic wiki content styles */

/* CRITICAL: Main content container constraints */
main {
  min-width: 0;
  width: 100%;
}

#wikiContent {
  max-width: 100%;
  overflow: hidden;
  width: 100%;
}

/* Wiki Article Container - Prevent overflow */
.wiki-article {
  max-width: 100%;
  min-width: 0;
  width: 100%;
  color: #e5e7eb;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.wiki-article-header {
  border-bottom: 2px solid #374151;
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
  max-width: 100%;
  width: 100%;
  overflow-wrap: break-word;
}

.wiki-article-category {
  align-items: flex-start;
  max-width: 100%;
  min-width: 0;
}

.wiki-article-category-chip {
  max-width: 100%;
  min-width: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: break-word;
}

.wiki-ai-topics {
  max-width: 100%;
}

.wiki-ai-topics-label {
  margin: 0 0 0.625rem;
  color: #bfdbfe;
  font-size: 0.875rem;
  font-weight: 600;
}

.wiki-ai-topics-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 100%;
  min-width: 0;
}

.wiki-ai-topic {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-width: 0;
  padding: 0.375rem 0.75rem;
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 9999px;
  background: rgba(30, 64, 175, 0.28);
  color: #dbeafe;
  font-size: 0.75rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: break-word;
}

/* Wiki Article Content - Constrain all child elements */
.wiki-article-content {
  line-height: 1.7;
  max-width: 100%;
  width: 100%;
  overflow: hidden;
  word-break: break-word;
  hyphens: auto;
}

/* Force all content to respect container */
.wiki-article-content * {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.wiki-article-content h2 {
  color: #f9fafb;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #4b5563;
  overflow-wrap: break-word;
  width: 100%;
}

.wiki-article-content h3 {
  color: #f3f4f6;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  overflow-wrap: break-word;
  width: 100%;
}

.wiki-article-content p {
  margin-bottom: 1rem;
  color: #d1d5db;
  overflow-wrap: break-word;
  width: 100%;
}

.wiki-article-content ul, 
.wiki-article-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  max-width: 100%;
  width: 100%;
}

.wiki-article-content li {
  margin-bottom: 0.5rem;
  color: #d1d5db;
  overflow-wrap: break-word;
}

.wiki-article-content table {
  width: 100%;
  max-width: 100% !important;
  border-collapse: collapse;
  margin: 1.5rem 0;
  display: block;
  overflow-x: auto;
}

.wiki-article-content th,
.wiki-article-content td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #4b5563;
  min-width: fit-content;
}

.wiki-article-content th {
  background-color: #374151;
  font-weight: 600;
  color: #f9fafb;
}

/* Images - Responsive */
.wiki-article-content img {
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  display: block;
}

/* Videos and iframes - Responsive */
.wiki-article-content iframe,
.wiki-article-content video {
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
}

.wiki-article-footer {
  color: #9ca3af;
  font-size: 0.875rem;
  max-width: 100%;
  width: 100%;
}

/* Article Image - Between title and body */
.wiki-article-image {
  max-width: 100%;
  width: 100%;
  overflow: hidden;
  margin-bottom: 2rem;
}

.wiki-article-image img {
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: cover;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  cursor: pointer;
}

.wiki-article-image img:hover {
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

/* Article Video - Between body and share buttons */
.wiki-article-video {
  max-width: 100%;
  width: 100%;
  overflow: hidden;
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.wiki-article-video h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f9fafb;
  margin-bottom: 1rem;
}

.wiki-article-video .relative {
  position: relative;
  width: 100%;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.wiki-article-video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Legacy Media section - Keep for backward compatibility but less prominent */
.wiki-article-media {
  max-width: 100%;
  width: 100%;
  overflow: hidden;
}

.wiki-article-media img,
.wiki-article-media iframe {
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
}

/* Related articles - Constrain cards */
.related-articles {
  max-width: 100%;
  width: 100%;
}

.related-articles .bg-gray-700 {
  max-width: 100%;
  overflow: hidden;
}

.wiki-related-card {
  display: block;
  text-decoration: none;
}

.wiki-related-card:focus-visible,
.wiki-topic-cluster-links a:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 3px;
}

.wiki-related-context {
  margin-top: 0.75rem;
  color: #93c5fd;
  font-size: 0.75rem;
  line-height: 1.4;
}

.wiki-topic-cluster {
  max-width: 100%;
  padding: 1.25rem;
  border: 1px solid #374151;
  border-radius: 0.75rem;
  background: #111827;
}

.wiki-topic-cluster-description {
  margin: 0.375rem 0 0.875rem;
  color: #9ca3af;
  font-size: 0.875rem;
}

.wiki-topic-cluster-links {
  display: grid;
  gap: 0.625rem;
  margin: 0;
  padding-left: 1.25rem;
}

.wiki-topic-cluster-links a {
  color: #93c5fd;
  text-decoration: underline;
  text-decoration-color: rgba(147, 197, 253, 0.45);
  text-underline-offset: 0.2em;
}

.wiki-topic-cluster-links a:hover {
  color: #dbeafe;
}

/* Wiki Link Styles */
.wiki-link {
  display: block;
  padding: 0.5rem 0.75rem;
  color: #d1d5db;
  text-decoration: none;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.wiki-link:hover {
  background-color: #374151;
  color: #60a5fa;
  border-left-color: #60a5fa;
}

.wiki-link.active {
  background-color: #1e40af;
  color: #ffffff;
  border-left-color: #3b82f6;
}

.wiki-link-inline {
  color: #60a5fa;
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  background-color: #1f2937;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.wiki-link-inline:hover {
  background-color: #374151;
  color: #93c5fd;
}

/* Search Results */
.wiki-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  border: 1px solid #4b5563;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.wiki-search-results:empty {
  display: none;
}

/* Breadcrumb - Handle long text */
.wiki-breadcrumb nav {
  overflow-wrap: break-word;
  word-wrap: break-word;
  max-width: 100%;
  width: 100%;
}

/* Category Cards Animation */
.category-card {
  transition: all 0.3s ease;
  border: 1px solid transparent;
  max-width: 100%;
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  border-color: #4b5563;
}

/* Info Boxes */
.wiki-info-box {
  background: linear-gradient(135deg, #1e40af, #1e3a8a);
  border-left: 4px solid #60a5fa;
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1.5rem 0;
  max-width: 100%;
  width: 100%;
}

.wiki-warning-box {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  border-left: 4px solid #f87171;
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1.5rem 0;
  max-width: 100%;
  width: 100%;
}

.wiki-tip-box {
  background: linear-gradient(135deg, #16a34a, #15803d);
  border-left: 4px solid #4ade80;
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1.5rem 0;
  max-width: 100%;
  width: 100%;
}

/* Responsive Design */
@media (max-width: 1024px) {
  main {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden;
  }
  
  #wikiContent {
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (max-width: 768px) {
  .wiki-article-header h1 {
    font-size: 1.75rem;
  }
  
  .wiki-article-content h2 {
    font-size: 1.5rem;
  }
  
  .category-card {
    margin-bottom: 1rem;
  }
  
  .wiki-search-results {
    max-height: 200px;
  }
  
  /* Force mobile widths */
  main {
    padding: 0.5rem !important;
  }
  
  .wiki-article {
    padding: 1rem;
  }
  
  .wiki-article-content table {
    font-size: 0.875rem;
  }
}

@media (max-width: 640px) {
  .wiki-article-content h2 {
    font-size: 1.25rem;
  }
  
  .wiki-article-content h3 {
    font-size: 1.1rem;
  }
}

/* Animation pentru tranziții de conținut */
.wiki-content-enter {
  opacity: 0;
  transform: translateY(20px);
}

.wiki-content-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Stiluri pentru coduri și exemple */
.wiki-article-content code {
  background-color: #374151;
  color: #fbbf24;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.wiki-article-content pre {
  background-color: #1f2937;
  color: #e5e7eb;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1rem 0;
  max-width: 100%;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.wiki-article-content pre code {
  background: none;
  color: inherit;
  padding: 0;
}

/* Stiluri pentru progress bars */
.wiki-progress-bar {
  background-color: #374151;
  border-radius: 0.5rem;
  height: 0.5rem;
  overflow: hidden;
  max-width: 100%;
}

.wiki-progress-fill {
  height: 100%;
  border-radius: 0.5rem;
  transition: width 0.3s ease;
}

/* Stiluri pentru badge-uri */
.wiki-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  margin: 0.125rem;
}

.wiki-badge-primary {
  background-color: #3b82f6;
  color: white;
}

.wiki-badge-secondary {
  background-color: #6b7280;
  color: white;
}

.wiki-badge-success {
  background-color: #10b981;
  color: white;
}

.wiki-badge-warning {
  background-color: #f59e0b;
  color: white;
}

.wiki-badge-danger {
  background-color: #ef4444;
  color: white;
}

/* Loading states */
.wiki-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
  color: #9ca3af;
}

.wiki-loading-spinner {
  animation: spin 1s linear infinite;
  width: 2rem;
  height: 2rem;
  border: 2px solid #374151;
  border-top: 2px solid #60a5fa;
  border-radius: 50%;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
