/* Material Design 3 - Topic Detail Page */

/* Topic Detail Section */
#topic-detail {
  min-height: calc(100vh - var(--header-height));
  padding: 80px 0;
  background-color: var(--md-sys-color-surface);
}

.topic-detail-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  font-size: var(--md-sys-typescale-body-small-font-size);
  color: var(--md-sys-color-on-surface-variant);
  opacity: 0;
  animation: fadeIn var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard) forwards;
}

.breadcrumb-item {
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.breadcrumb-item:hover {
  color: var(--md-sys-color-primary);
}

.breadcrumb-item svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.breadcrumb-separator {
  color: var(--md-sys-color-outline);
}

.breadcrumb-current {
  color: var(--md-sys-color-on-surface);
}

/* Topic Article */
.topic-article {
  background-color: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-large);
  padding: 0;
  overflow: hidden;
  box-shadow: 
    0px 1px 2px 0px rgba(0, 0, 0, 0.30),
    0px 1px 3px 1px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(20px);
  animation: slideUp var(--md-sys-motion-duration-long3) var(--md-sys-motion-easing-emphasized-decelerate) 0.1s forwards;
}

/* Topic Header */
.topic-header {
  background-color: var(--md-sys-color-surface-container-low);
  padding: 32px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.topic-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.topic-date {
  font-size: var(--md-sys-typescale-label-medium-font-size);
  color: var(--md-sys-color-on-surface-variant);
  background-color: var(--md-sys-color-surface-container);
  padding: 4px 12px;
  border-radius: var(--md-sys-shape-corner-small);
}

.topic-category {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--md-sys-shape-corner-small);
  font-size: var(--md-sys-typescale-label-small-font-size);
  font-weight: var(--md-sys-typescale-label-small-font-weight);
}

.category-news {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.category-press {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.category-ir {
  background-color: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
}

.category-blog {
  background-color: var(--md-sys-color-surface-variant);
  color: var(--md-sys-color-on-surface-variant);
}

.topic-title {
  font-size: var(--md-sys-typescale-display-medium-font-size);
  font-weight: var(--md-sys-typescale-display-medium-font-weight);
  line-height: var(--md-sys-typescale-display-medium-line-height);
  color: var(--md-sys-color-on-surface);
  margin: 0;
}

/* Topic Content */
.topic-content {
  padding: 32px;
  font-size: var(--md-sys-typescale-body-large-font-size);
  line-height: var(--md-sys-typescale-body-large-line-height);
  color: var(--md-sys-color-on-surface);
}

.topic-excerpt {
  background-color: var(--md-sys-color-surface-container-low);
  border-left: 4px solid var(--md-sys-color-primary);
  padding: 20px 24px;
  margin-bottom: 32px;
  border-radius: var(--md-sys-shape-corner-medium);
  font-size: var(--md-sys-typescale-title-medium-font-size);
  line-height: 1.6;
  color: var(--md-sys-color-on-surface);
}

/* Typography for content */
.topic-content h2 {
  font-size: var(--md-sys-typescale-headline-large-font-size);
  font-weight: var(--md-sys-typescale-headline-large-font-weight);
  color: var(--md-sys-color-on-surface);
  margin: 32px 0 16px 0;
}

.topic-content h3 {
  font-size: var(--md-sys-typescale-headline-medium-font-size);
  font-weight: var(--md-sys-typescale-headline-medium-font-weight);
  color: var(--md-sys-color-on-surface);
  margin: 24px 0 12px 0;
}

.topic-content h4 {
  font-size: var(--md-sys-typescale-title-large-font-size);
  font-weight: var(--md-sys-typescale-title-large-font-weight);
  color: var(--md-sys-color-on-surface);
  margin: 20px 0 12px 0;
}

.topic-content h5,
.topic-content h6 {
  font-size: var(--md-sys-typescale-title-medium-font-size);
  font-weight: var(--md-sys-typescale-title-medium-font-weight);
  color: var(--md-sys-color-on-surface);
  margin: 16px 0 8px 0;
}

.topic-content p {
  margin-bottom: 16px;
  color: var(--md-sys-color-on-surface);
}

.topic-content ul,
.topic-content ol {
  margin-bottom: 16px;
  padding-left: 32px;
  color: var(--md-sys-color-on-surface);
}

.topic-content li {
  margin-bottom: 8px;
  color: var(--md-sys-color-on-surface);
}

.topic-content strong {
  font-weight: var(--md-sys-typescale-body-large-font-weight);
  color: var(--md-sys-color-on-surface);
}

.topic-content em {
  font-style: italic;
  color: var(--md-sys-color-on-surface);
}

.topic-content a {
  color: var(--md-sys-color-primary);
  text-decoration: underline;
  transition: color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.topic-content a:hover {
  color: var(--md-sys-color-primary-variant);
}

/* Code blocks */
.topic-content pre {
  background-color: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-small);
  padding: 16px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.topic-content code {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
  background-color: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  padding: 2px 6px;
  border-radius: var(--md-sys-shape-corner-extra-small);
}

.topic-content pre code {
  background-color: transparent;
  padding: 0;
  color: var(--md-sys-color-on-surface);
}

/* Blockquotes */
.topic-content blockquote {
  border-left: 4px solid var(--md-sys-color-outline);
  background-color: var(--md-sys-color-surface-container-low);
  padding: 16px 20px;
  margin: 0 0 16px 0;
  border-radius: var(--md-sys-shape-corner-small);
  color: var(--md-sys-color-on-surface-variant);
}

.topic-content blockquote p:last-child {
  margin-bottom: 0;
}

/* Horizontal rules */
.topic-content hr {
  border: none;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  margin: 32px 0;
}

/* Images */
.topic-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--md-sys-shape-corner-medium);
  margin: 16px 0;
}

/* Tables */
.topic-table {
  margin: 24px 0;
  overflow-x: auto;
}

.topic-table table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-medium);
  overflow: hidden;
  box-shadow: 
    0px 1px 2px 0px rgba(0, 0, 0, 0.30),
    0px 1px 3px 1px rgba(0, 0, 0, 0.15);
}

.topic-table th {
  background-color: var(--md-sys-color-surface-container);
  padding: 16px;
  text-align: left;
  font-weight: var(--md-sys-typescale-title-small-font-weight);
  color: var(--md-sys-color-on-surface);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.topic-table td {
  padding: 16px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
}

.topic-table tr:last-child td {
  border-bottom: none;
}

.topic-table tr:hover td {
  background-color: var(--md-sys-color-surface-container-low);
}

/* Share Section */
.topic-share {
  background-color: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-large);
  padding: 24px;
  margin: 32px 0;
  opacity: 0;
  transform: translateY(20px);
  animation: slideUp var(--md-sys-motion-duration-long3) var(--md-sys-motion-easing-emphasized-decelerate) 0.3s forwards;
}

.share-text {
  font-size: var(--md-sys-typescale-title-small-font-size);
  font-weight: var(--md-sys-typescale-title-small-font-weight);
  color: var(--md-sys-color-on-surface);
  margin-bottom: 16px;
  display: block;
}

.share-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.share-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-full);
  text-decoration: none;
  font-size: var(--md-sys-typescale-label-large-font-size);
  font-weight: var(--md-sys-typescale-label-large-font-weight);
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
  position: relative;
  overflow: hidden;
}

.share-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: currentColor;
  opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.share-button:hover {
  transform: translateY(-2px);
  box-shadow: 
    0px 2px 3px 0px rgba(0, 0, 0, 0.30),
    0px 6px 10px 4px rgba(0, 0, 0, 0.15);
}

.share-button:hover::before {
  opacity: var(--md-sys-state-hover-opacity);
}

.share-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: none;
}

.share-button.twitter {
  color: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
}

.share-button.facebook {
  color: #1877f2;
  border-color: #1877f2;
}

/* Navigation Section */
.topic-navigation {
  background-color: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-large);
  padding: 24px;
  margin: 32px 0;
  opacity: 0;
  transform: translateY(20px);
  animation: slideUp var(--md-sys-motion-duration-long3) var(--md-sys-motion-easing-emphasized-decelerate) 0.4s forwards;
}

.topic-nav-heading {
  font-size: var(--md-sys-typescale-title-medium-font-size);
  font-weight: var(--md-sys-typescale-title-medium-font-weight);
  color: var(--md-sys-color-on-surface);
  margin-bottom: 16px;
}

.topic-nav-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.topic-nav-button {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  text-decoration: none;
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.topic-nav-button:hover {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-color: transparent;
  transform: translateX(4px);
}

.nav-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
}

/* Action Buttons */
.topic-actions {
  border-top: 1px solid var(--md-sys-color-outline-variant);
  padding-top: 32px;
  margin-top: 48px;
  opacity: 0;
  animation: fadeIn var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard) 0.5s forwards;
}

.action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.back-btn,
.home-btn {
  flex: 1;
  min-width: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background-color: transparent;
  color: var(--md-sys-color-primary);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-full);
  text-decoration: none;
  font-size: var(--md-sys-typescale-label-large-font-size);
  font-weight: var(--md-sys-typescale-label-large-font-weight);
  transition: all var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.back-btn:hover,
.home-btn:hover {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border-color: var(--md-sys-color-primary);
}

.back-icon,
.home-icon-small {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
}

/* Animations */
@keyframes slideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 839px) {
  .topic-detail-container {
    padding: 0 16px;
  }
  
  .topic-article {
    border-radius: 0;
  }
  
  .topic-header,
  .topic-content {
    padding: 24px;
  }
  
  .topic-title {
    font-size: var(--md-sys-typescale-display-small-font-size);
  }
}

@media (max-width: 599px) {
  #topic-detail {
    padding: 48px 0;
  }
  
  .topic-header,
  .topic-content {
    padding: 20px;
  }
  
  .topic-title {
    font-size: var(--md-sys-typescale-headline-large-font-size);
  }
  
  .topic-nav-button {
    min-width: 100%;
  }
  
  .share-button {
    padding: 10px 16px;
    font-size: var(--md-sys-typescale-label-medium-font-size);
  }
  
  .share-button span {
    display: none;
  }
  
  .back-btn,
  .home-btn {
    min-width: 100%;
  }
}

/* Dark Theme Adjustments */
[data-theme="dark"] .topic-article {
  background-color: var(--md-sys-color-surface-container);
}

[data-theme="dark"] .topic-header {
  background-color: var(--md-sys-color-surface-container-high);
}

[data-theme="dark"] .topic-date {
  background-color: var(--md-sys-color-surface-container-highest);
}

[data-theme="dark"] .topic-excerpt {
  background-color: var(--md-sys-color-surface-container-high);
}

[data-theme="dark"] .topic-table table {
  background-color: var(--md-sys-color-surface-container);
}

[data-theme="dark"] .topic-table th {
  background-color: var(--md-sys-color-surface-container-high);
}

[data-theme="dark"] .topic-share,
[data-theme="dark"] .topic-navigation {
  background-color: var(--md-sys-color-surface-container);
}

[data-theme="dark"] .share-button,
[data-theme="dark"] .topic-nav-button {
  background-color: var(--md-sys-color-surface-container-high);
  border-color: var(--md-sys-color-outline);
}

[data-theme="dark"] .topic-nav-button:hover {
  background-color: var(--md-sys-color-primary-container);
}

/* Dark mode specific styles for Markdown content */
[data-theme="dark"] .topic-content h1,
[data-theme="dark"] .topic-content h2,
[data-theme="dark"] .topic-content h3,
[data-theme="dark"] .topic-content h4,
[data-theme="dark"] .topic-content h5,
[data-theme="dark"] .topic-content h6 {
  color: #f0f6fc; /* Bright white for headers */
}

[data-theme="dark"] .topic-content p,
[data-theme="dark"] .topic-content li {
  color: #e6edf3; /* Slightly dimmed white for body text */
}

[data-theme="dark"] .topic-content strong {
  color: #ffffff; /* Pure white for bold text */
  font-weight: 600;
}

[data-theme="dark"] .topic-content em {
  color: #f0f6fc;
}

[data-theme="dark"] .topic-content a {
  color: #58a6ff; /* Bright blue for links */
}

[data-theme="dark"] .topic-content a:hover {
  color: #79c0ff; /* Even brighter blue on hover */
  text-decoration: underline;
}

/* Code blocks in dark mode */
[data-theme="dark"] .topic-content pre {
  background-color: #161b22;
  border-color: #30363d;
}

[data-theme="dark"] .topic-content code {
  background-color: #1c2128;
  color: #e6edf3;
}

[data-theme="dark"] .topic-content pre code {
  color: #e6edf3;
}

/* Blockquotes in dark mode */
[data-theme="dark"] .topic-content blockquote {
  background-color: #161b22;
  border-left-color: #3b82f6;
  color: #e6edf3;
}

/* Horizontal rules in dark mode */
[data-theme="dark"] .topic-content hr {
  border-top-color: #30363d;
}

/* Tables in dark mode */
[data-theme="dark"] .topic-content table {
  background-color: #0d1117;
  color: #e6edf3;
}

[data-theme="dark"] .topic-content th {
  background-color: #161b22;
  color: #f0f6fc;
  border-color: #30363d;
}

[data-theme="dark"] .topic-content td {
  background-color: #0d1117;
  color: #e6edf3;
  border-color: #30363d;
}

[data-theme="dark"] .topic-content tr:hover td {
  background-color: #161b22;
}

/* List markers in dark mode */
[data-theme="dark"] .topic-content ul li::marker,
[data-theme="dark"] .topic-content ol li::marker {
  color: #8b949e;
}

/* Generic HTML elements in topic content - Dark mode */
[data-theme="dark"] .topic-content div,
[data-theme="dark"] .topic-content section,
[data-theme="dark"] .topic-content article,
[data-theme="dark"] .topic-content aside,
[data-theme="dark"] .topic-content span,
[data-theme="dark"] .topic-content small,
[data-theme="dark"] .topic-content mark,
[data-theme="dark"] .topic-content del,
[data-theme="dark"] .topic-content ins,
[data-theme="dark"] .topic-content sub,
[data-theme="dark"] .topic-content sup {
  color: #e6edf3;
  background-color: transparent;
}

/* Ensure nested elements inherit colors */
[data-theme="dark"] .topic-content * {
  color: inherit;
  background-color: inherit;
}

/* Override for specific styled divs */
[data-theme="dark"] .topic-content div[style*="background"],
[data-theme="dark"] .topic-content span[style*="background"] {
  /* For elements with inline background styles, ensure text is readable */
  color: #000000 !important;
}

/* Special handling for common HTML patterns */
[data-theme="dark"] .topic-content .highlight,
[data-theme="dark"] .topic-content .note,
[data-theme="dark"] .topic-content .warning,
[data-theme="dark"] .topic-content .info {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  padding: 16px;
  border-radius: var(--md-sys-shape-corner-small);
  border: 1px solid var(--md-sys-color-outline-variant);
}

/* Mark tag special styling */
[data-theme="dark"] .topic-content mark {
  background-color: rgba(255, 235, 59, 0.3);
  color: #ffffff;
  padding: 2px 4px;
  border-radius: 2px;
}

/* Del and Ins tags */
[data-theme="dark"] .topic-content del {
  text-decoration: line-through;
  color: #ff6b6b;
}

[data-theme="dark"] .topic-content ins {
  text-decoration: underline;
  color: #51cf66;
}