/**
 * Shared Styles for All Pages
 * Contains navigation, layout, and common component styles
 */

/* Navigation Styles */
.page-shell {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.page-shell-footer {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
}

.page-shell-footer-wide {
  max-width: 1200px;
  padding: 0 20px;
}

.nav-buttons {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 18px;
  padding: 20px 35px;
  flex-wrap: wrap;
  border-top: 2px solid var(--secondary-color);
}

.nav-button {
  display: inline-block;
  padding: 6px 12px;
  background-color: transparent;
  color: var(--secondary-color);
  font-weight: 500;
  font-size: 14px;
  transition: all 0.25s ease;
  text-align: center;
  border: 1px solid transparent;
  border-radius: 4px;
}

.nav-button:hover {
  color: var(--secondary-color);
  background-color: var(--hover-bg);
}

/* Theme Toggle Button - Sun/Moon Icons */
.theme-toggle {
  background: transparent;
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: var(--text-color);
  padding: 6px;
}

.theme-toggle:hover {
  background-color: var(--hover-bg);
  color: var(--secondary-color);
}

.theme-toggle:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* Navigation Active State */
.nav-button[aria-current="page"] {
  color: #ffffff;
  font-weight: 600;
  background-color: var(--secondary-color);
  border-color: #ffffff;
  box-shadow: 0 0 0 1px var(--secondary-color);
}

/* Main Content Layout - Only applies to pages without specific overrides */

/* List Spacing */
.section-spacing ul,
.section-spacing ul.publication-list,
td ul {
  margin-top: 0px !important;
  margin-bottom: 0px !important;
}

.section-spacing li,
.section-spacing ul li,
td li,
td ul li,
li {
  margin-bottom: 8px !important;
  margin-top: 0px !important;
  padding-bottom: 0px !important;
  padding-top: 0px !important;
}

.publication-list li,
ul.publication-list li {
  margin-bottom: 12px !important;
  margin-top: 0px !important;
  padding-bottom: 0px !important;
  padding-top: 0px !important;
}

li p {
  margin: 0px !important;
  padding: 0px !important;
}

/* Publication Styles - Consistent indentation */
.publication-list {
  list-style-type: none !important;
  padding-left: 0 !important;
  margin: 0 0 20px 0 !important;
}

/* Ensure all lists have consistent indentation */
ul, ol {
  list-style-type: none !important;
  padding-left: 0 !important;
  margin: 0 0 20px 0 !important;
}

/* Override any specific list variations */
#projects-list, #research-experience-list, #academic-services-list, #teaching-list, #honors-list {
  list-style-type: none !important;
  padding-left: 0 !important;
  margin: 0 0 20px 0 !important;
}

/* Ensure all content inside main-content-wrapper is properly aligned */
.main-content-wrapper > * {
  box-sizing: border-box;
}

.publication-list li {
  margin-bottom: 16px;
}

.papertitle {
  margin-bottom: 6px;
}

.new-badge {
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-right: 8px;
}

[data-theme="dark"] .new-badge {
  color: #9ca3af;
}

.paper_rest {
  margin-bottom: 6px;
}

.paper_rest b,
.paper_rest strong {
  color: var(--secondary-color);
  font-weight: 800;
  font-size: 1.06em;
}

.paper-venue {
  color: #9ca3af;
}

[data-theme="dark"] .paper-venue {
  color: #888;
}

.paper-links {
  font-size: 16px;
}

.paper-links a {
  color: var(--primary-color);
  font-weight: 400;
  transition: color 0.2s ease;
}

.paper-links a:hover,
.paper-links a:focus-visible {
  color: var(--secondary-color);
  outline: none;
}

.paper-links a:focus {
  outline: none;
}

.detail-container,
.abstract-container,
.citation-container {
  margin-top: 12px;
}

.abstract-toggle,
.citation-toggle {
  display: inline;
  padding: 0;
  margin: 0;
  font-size: 16px;
  font-family: inherit;
  font-weight: 400;
  color: var(--primary-color);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s ease;
}

.abstract-toggle:hover,
.abstract-toggle:focus-visible,
.citation-toggle:hover,
.citation-toggle:focus-visible {
  color: var(--secondary-color);
}

.abstract-toggle:focus,
.citation-toggle:focus {
  outline: none;
}

.abstract-toggle[aria-expanded="true"],
.citation-toggle[aria-expanded="true"] {
  color: var(--secondary-color);
}

.detail-content {
  margin-top: 10px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  line-height: 1.6;
  font-size: 16px;
}

.abstract-content {
  text-align: justify;
  text-justify: inter-word;
}

.detail-content p {
  margin: 0 0 10px 0;
}

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

.detail-content pre {
  margin: 0;
  padding: 12px 14px;
  background-color: var(--section-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  overflow: auto;
}

/* Page Title Styles */
.page-title {
  text-align: left;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  color: #1a1a1a;
}

/* Responsive Design */
@media screen and (max-width: 1315px) {
  .nav-buttons {
    justify-content: center;
    gap: 12px 16px;
    padding: 12px 16px;
  }

  .nav-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    font-size: 16px;
  }

  .theme-toggle {
    order: -1; /* Move theme toggle to the left */
  }

  .main-content-wrapper:not(.page-shell) {
    padding: 0 15px;
  }
}

@media screen and (max-width: 768px) {
  .page-shell {
    padding: 24px 16px 40px;
  }

  .page-shell-footer {
    padding: 0 16px;
  }

  .page-shell-footer-wide {
    padding: 0 10px;
  }
}

@media screen and (max-width: 600px) {
  .theme-toggle {
    width: 32px;
    height: 32px;
  }

  .theme-toggle svg {
    width: 18px;
    height: 18px;
  }
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background-color: var(--secondary-color);
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}

/* Enhanced Footer - Refined styling with subtle hover effects */
.site-footer {
  border-top: 1px solid var(--border-color);
  margin-top: 40px;
  padding: 30px 20px;
  text-align: center;
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 18px;
}

.footer-social a {
  color: var(--text-color);
  opacity: 0.6;
  transition: all 0.3s ease;
}

.footer-social a:hover {
  color: var(--primary-color);
  opacity: 1;
  transform: translateY(-2px);
}

.footer-social svg {
  width: 22px;
  height: 22px;
}

.footer-copyright {
  font-size: 13px;
  color: var(--text-color);
  opacity: 0.6;
  margin: 0;
}

@media screen and (max-width: 600px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
  }

  .footer-social {
    gap: 15px;
  }

  .footer-social svg {
    width: 20px;
    height: 20px;
  }
}
