/* CaveRenderPro Documentation Stylesheet */

:root {
  --primary-color: #d060ff;
  --secondary-color: #dd70ff;
  --accent-color: #f0b0ff;
  --text-dark: #000000;
  --text-light: #333333;
  --bg-light: #f9fafb;
  --bg-white: #ffffff;
  --border-color: #d060ff;
}

html.dark-mode {
  --primary-color: #a855f7;
  --secondary-color: #c084fc;
  --accent-color: #9333ea;
  --text-dark: #ffffff;
  --text-light: #ffffff;
  --bg-light: #1f2937;
  --bg-white: #111827;
  --border-color: #a855f7;
}

html.dark-mode body {
  background-color: #0f172a;
}

html.dark-mode header {
  background-color: #1f2937;
  color: #f3f4f6;
}

html.dark-mode .nav a,
html.dark-mode .nav button {
  color: #f3f4f6;
}

html.dark-mode .sidebar {
  background-color: #1f2937;
  border-color: #4b5563;
}

html.dark-mode .content {
  background-color: #111827;
  border-color: #4b5563;
}

html.dark-mode .sidebar h3 {
  border-bottom-color: #4b5563;
}

html.dark-mode .content h1 {
  border-bottom-color: #4b5563;
}

html.dark-mode .details-box {
  border-color: #4b5563;
}

html.dark-mode .info-box,
html.dark-mode .warning-box,
html.dark-mode .success-box {
  border-color: #4b5563;
}

html.dark-mode table {
  border-color: #4b5563;
}

html.dark-mode table th,
html.dark-mode table td {
  border-bottom-color: #4b5563;
}

html.dark-mode pre {
  border-color: #4b5563;
}

html.dark-mode table th {
  background-color: #1f2937;
  color: #f3f4f6;
}

html.dark-mode table tr:hover {
  background-color: #1f2937;
}

html.dark-mode footer {
  background-color: #1f2937;
  color: #f3f4f6;
}

html.dark-mode .info-box {
  background-color: #152d5c;
}

html.dark-mode .warning-box {
  background-color: #451a03;
}

html.dark-mode .success-box {
  background-color: #0b2818;
}

html.dark-mode a {
  color: #818cf8;
}

html.dark-mode a:visited {
  color: #c084fc;
}

html.dark-mode .quick-link-info {
  background-color: #152d5c;
}

html.dark-mode .quick-link-success {
  background-color: #0b2818;
}

html.dark-mode .quick-link-warning {
  background-color: #451a03;
}

html.dark-mode .btn.btn-gray {
  background-color: #4b5563;
}

html.dark-mode .btn.btn-gray:hover {
  background-color: #2d3748;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text-dark);
  line-height: 1.6;
  background-color: var(--bg-light);
}

/* Header & Navigation */
header {
  background-color: #e5e7eb;
  color: #1f2937;
  padding: 0.5rem 0;
  position: sticky;
  top: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 100;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
  color: white;
}

.nav {
  display: flex;
  gap: 1rem;
  list-style: none;
  flex-wrap: nowrap;
}

.nav a,
.nav button {
  color: #1f2937;
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.3s;
  font-family: inherit;
}

.nav a:hover {
  color: var(--primary-color);
}

/* Main Content */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

main {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 3rem;
  margin: 3rem auto;
  min-height: 70vh;
}

/* Sidebar Navigation */
.sidebar {
  background-color: var(--bg-white);
  padding: 1.5rem;
  border-radius: 8px;
  height: fit-content;
  border: 1px solid #6b7280;
}

.sidebar h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
  border-bottom: 2px solid #6b7280;
  padding-bottom: 0.5rem;
}

.sidebar ul {
  list-style: none;
}

.sidebar li {
  margin: 0.5rem 0;
}

.sidebar a {
  color: var(--text-dark);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid transparent;
  display: block;
  transition: all 0.3s;
}

.sidebar a:hover,
.sidebar a.active {
  color: var(--primary-color);
  border-left-color: var(--accent-color);
  background-color: var(--bg-light);
}

/* Content Area */
.content {
  background-color: var(--bg-white);
  padding: 2rem;
  border-radius: 8px;
  border: 1px solid #6b7280;
  overflow-x: auto;
}

.content h1 {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  border-bottom: 3px solid #6b7280;
  padding-bottom: 1rem;
}

.content h2 {
  font-size: 1.8rem;
  color: var(--primary-color);
  margin-top: 2rem;
  margin-bottom: 1rem;
  scroll-margin-top: 100px;
}

.content h3 {
  font-size: 1.3rem;
  color: var(--primary-color);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.content h4 {
  font-size: 1.1rem;
  color: var(--primary-color);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.content p {
  margin-bottom: 1rem;
  color: var(--text-light);
  line-height: 1.8;
}

.content ul, .content ol {
  margin: 1rem 0 1rem 2rem;
  color: var(--text-light);
}

.content li {
  margin-bottom: 0.5rem;
}

/* Highlight Boxes */
.info-box {
  background-color: #d1e7fd;
  border-left: 4px solid #6b7280;
  padding: 1rem;
  margin: 1.5rem 0;
  border-radius: 4px;
}

.info-box strong {
  color: var(--primary-color);
}

.warning-box {
  background-color: #fff3cd;
  border-left: 4px solid #6b7280;
  padding: 1rem;
  margin: 1.5rem 0;
  border-radius: 4px;
}

.warning-box strong {
  color: #d97706;
}

.success-box {
  background-color: #d4edda;
  border-left: 4px solid #6b7280;
  padding: 1rem;
  margin: 1.5rem 0;
  border-radius: 4px;
}

.success-box strong {
  color: #059669;
}

/* Details/Collapsible Boxes */
.details-box {
  margin: 0.5rem 0;
  padding: 1rem;
  border: 1px solid #6b7280;
  border-radius: 4px;
  background-color: var(--bg-light);
}

.details-box summary {
  cursor: pointer;
  font-weight: bold;
  color: var(--primary-color);
  margin: -1rem -1rem 0 -1rem;
  padding: 1rem;
}

/* Chapter Cards */
.chapter-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.chapter-card {
  background-color: var(--bg-light);
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
}

.chapter-card.secondary {
  border-left-color: var(--secondary-color);
}

.chapter-card h3 {
  color: var(--primary-color);
  margin-top: 0;
}

/* Quick Links */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.quick-link {
  padding: 1.5rem;
  border-radius: 8px;
}

.quick-link h4 {
  color: var(--primary-color);
}

.quick-link-info {
  background-color: #d1e7fd;
}

.quick-link-info h4 {
  color: var(--primary-color);
}

.quick-link-success {
  background-color: #d4edda;
}

.quick-link-success h4 {
  color: #059669;
}

.quick-link-warning {
  background-color: #fff3cd;
}

.quick-link-warning h4 {
  color: #d97706;
}

/* Code Blocks */
code {
  background-color: var(--bg-light);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Monaco', 'Courier New', monospace;
  color: #e83e8c;
}

pre {
  background-color: var(--bg-light);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid #6b7280;
}

pre code {
  background-color: transparent;
  padding: 0;
  color: var(--text-dark);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.3s;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.btn:hover {
  background-color: var(--secondary-color);
}

.btn.btn-gray {
  background-color: #9ca3af;
}

.btn.btn-gray:hover {
  background-color: #6b7280;
}

.btn-secondary {
  background-color: var(--accent-color);
  color: white;
}

.btn-secondary:hover {
  background-color: #d97706;
}

.btn-secondary.btn-gray {
  background-color: #9ca3af;
}

.btn-secondary.btn-gray:hover {
  background-color: #6b7280;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

table th,
table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #6b7280;
}

table th {
  background-color: #e5e7eb;
  color: #1f2937;
  font-weight: bold;
}

table tr:hover {
  background-color: var(--bg-light);
}

/* Footer */
footer {
  background-color: #e5e7eb;
  color: #1f2937;
  padding: 2rem 0;
  margin-top: 3rem;
  text-align: center;
}

footer a {
  color: var(--primary-color);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-light);
  font-size: 0.9rem;
}

.breadcrumb a {
  color: var(--primary-color);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  main {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .nav {
    gap: 0.75rem;
  }

  .content h1 {
    font-size: 1.8rem;
  }

  .header-container {
    flex-direction: column;
    gap: 1rem;
  }

}

/* Mobile Optimization (Handy < 480px) */
@media (max-width: 480px) {
  .header-container {
    padding: 0 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .container {
    padding: 0 1rem;
  }

  .logo {
    font-size: 1.2rem;
  }

  .logo img {
    height: 40px !important;
  }

  .nav {
    gap: 0.5rem;
    font-size: 0.8rem;
    flex-direction: row;
  }

  .nav a,
  .nav button {
    font-size: 0.75rem;
    padding: 0.4rem 0.5rem;
    white-space: nowrap;
  }

  main {
    margin: 1.5rem auto;
  }

  .sidebar {
    padding: 1rem;
  }

  .sidebar h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }

  .sidebar a {
    padding: 0.4rem 0.5rem;
    font-size: 0.9rem;
  }

  .content {
    padding: 1.5rem;
  }

  .content h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
  }

  .content h2 {
    font-size: 1.3rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
  }

  .content h3 {
    font-size: 1.1rem;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
  }

  .content h4 {
    font-size: 1rem;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
  }

  .content p {
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
  }

  .content ul,
  .content ol {
    margin: 0.75rem 0 0.75rem 1.5rem;
    font-size: 0.95rem;
  }

  .content li {
    margin-bottom: 0.4rem;
  }

  .btn {
    padding: 0.75rem 1rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    font-size: 0.95rem;
  }

  .info-box,
  .warning-box,
  .success-box {
    padding: 0.75rem;
    margin: 1rem 0;
    font-size: 0.9rem;
  }

  .details-box {
    padding: 0.75rem;
    margin: 0.5rem 0;
  }

  .details-box summary {
    font-size: 0.95rem;
    margin: -0.75rem -0.75rem 0 -0.75rem;
    padding: 0.75rem;
  }

  table {
    font-size: 0.85rem;
    margin: 1rem 0;
  }

  table th,
  table td {
    padding: 0.5rem;
  }

  code {
    font-size: 0.85rem;
  }

  pre {
    padding: 0.75rem;
    font-size: 0.8rem;
    margin: 0.75rem 0;
  }

  .chapter-cards {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1rem 0;
  }

  .chapter-card {
    padding: 1rem;
  }

  .quick-links {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1rem 0;
  }

  .quick-link {
    padding: 1rem;
  }

  .breadcrumb {
    font-size: 0.8rem;
    margin-bottom: 1rem;
  }

  footer {
    padding: 1.5rem 1rem;
    font-size: 0.85rem;
  }
}

/* Image Hover Zoom */
img[data-hover-zoom] {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  transform-origin: top left;
}

img[data-hover-zoom]:nth-child(4) {
  transform-origin: top right;
}

img[data-hover-zoom]:nth-child(3) {
  transform-origin: top center;
}

img[data-hover-zoom]:hover {
  transform: scale(3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 10;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  justify-content: center;
  align-items: center;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
}

.lightbox-image {
  width: auto;
  height: auto;
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: -16px;
  right: 40px;
  font-size: 2rem;
  font-weight: bold;
  color: #999;
  cursor: pointer;
  transition: color 0.3s;
  padding: 10px;
  line-height: 1;
}

.lightbox-close:hover {
  color: #555;
}

/* Scroll-to-Top Button */
#scroll-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 99;
}

#scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}

#scroll-to-top:hover {
  background-color: var(--secondary-color);
  transform: translateY(-3px);
}

html.dark-mode #scroll-to-top {
  background-color: var(--primary-color);
}

html.dark-mode #scroll-to-top:hover {
  background-color: var(--secondary-color);
}

/* Print Styles */
@media print {
  header, footer, .sidebar {
    display: none;
  }

  main {
    grid-template-columns: 1fr;
  }

  .content {
    border: none;
    padding: 0;
  }
}
