/* Documentation Page Styles - Titan Dental Design */

/* ========================================
   Base & Layout - Sticky Footer Design
   ======================================== */

/* Set html/body to dark to prevent light bleed below footer */
html.documentation-page-html {
  background-color: #232323;
}

.documentation-page {
  font-family: 'Poppins', sans-serif;
  background-color: #FAFAFA;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Ensure footer spans full width with dark background */
.documentation-page #site-footer {
  position: relative;
  z-index: 50;
  clear: both;
  background-color: #232323;
  flex-shrink: 0;
  margin-top: auto;
}

.docs-container {
  display: flex;
  flex: 1 0 auto;
  position: relative;
  max-width: 100%;
  background-color: #FAFAFA;
  align-items: flex-start;
}

/* ========================================
   Sidebar
   ======================================== */

.docs-sidebar {
  width: 320px;
  min-width: 320px;
  background: #FFFFFF;
  border-right: 1px solid #E8EBF0;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  z-index: 100;
  border-radius: 0 0 12px 0;
}

.docs-sidebar.collapsed {
  width: 0;
  min-width: 0;
  overflow: visible;
  border-right: none;
}

.docs-sidebar.collapsed .docs-nav {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Keep toggle button visible when collapsed - move outside sidebar */
.docs-sidebar.collapsed .docs-sidebar-header {
  position: fixed;
  left: 16px;
  top: 200px;
  padding: 0;
  border: none;
  z-index: 500;
}

.docs-sidebar.collapsed .docs-sidebar-toggle {
  background: #0A6EFF;
  border-color: #0A6EFF;
  color: white;
  box-shadow: 0 2px 8px rgba(10, 110, 255, 0.3);
}

.docs-sidebar.collapsed .docs-sidebar-toggle:hover {
  background: #0856CC;
  border-color: #0856CC;
}

.docs-sidebar.collapsed .docs-sidebar-toggle svg {
  transform: rotate(180deg);
}

/* Sidebar Header with Toggle */
.docs-sidebar-header {
  padding: 12px 16px;
  border-bottom: 1px solid #E8EBF0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.docs-sidebar-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid #0A6EFF;
  border-radius: 8px;
  background: rgba(10, 110, 255, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0A6EFF;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.docs-sidebar-toggle:hover {
  background: rgba(10, 110, 255, 0.2);
  border-color: #0856CC;
  color: #0856CC;
}

/* Close button - hidden on desktop, shown on mobile */
.docs-sidebar-close {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: #F5F7FA;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: #243352;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.docs-sidebar-close:hover {
  background: #E8EBF0;
  color: #0A6EFF;
}

/* ========================================
   Full-width Search Bar
   ======================================== */

.docs-search-bar {
  background: #FFFFFF;
  padding: 24px 32px;
  margin-top: 120px;
  border-bottom: 1px solid #E8EBF0;
}

.docs-search-bar-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
}

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

.docs-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #7A7A7A;
  pointer-events: none;
}

.docs-search {
  width: 100%;
  padding: 14px 16px 14px 50px;
  border: 1px solid #E8EBF0;
  border-radius: 12px;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  color: #243352;
  background: #FAFAFA;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.docs-search:focus {
  outline: none;
  border-color: #0A6EFF;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(10, 110, 255, 0.1);
}

.docs-search::placeholder {
  color: #A0A0A0;
}

/* Navigation */
.docs-nav {
  padding: 16px 0;
}

.docs-nav-loading {
  padding: 20px;
  color: #7A7A7A;
  text-align: center;
  font-size: 0.95rem;
}

/* Topic Groups */
.docs-nav-topic {
  margin-bottom: 4px;
}

.docs-nav-topic-header {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  user-select: none;
}

.docs-nav-topic-header:hover {
  background-color: #F5F7FA;
}

.docs-nav-topic-expand {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  color: #7A7A7A;
  transition: transform 0.2s ease;
}

.docs-nav-topic.expanded > .docs-nav-topic-header .docs-nav-topic-expand {
  transform: rotate(90deg);
}

.docs-nav-topic-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #243352;
  flex: 1;
}

.docs-nav-topic-count {
  font-size: 0.8rem;
  color: #7A7A7A;
  background: #F0F2F5;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
}

/* Topic Children (documents or nested topics) */
.docs-nav-topic-children {
  display: none;
  padding-left: 12px;
}

.docs-nav-topic.expanded > .docs-nav-topic-children {
  display: block;
}

/* Nested Topic */
.docs-nav-subtopic {
  margin-bottom: 2px;
}

.docs-nav-subtopic-header {
  display: flex;
  align-items: center;
  padding: 8px 20px 8px 28px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.docs-nav-subtopic-header:hover {
  background-color: #F5F7FA;
}

.docs-nav-subtopic-expand {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  color: #A0A0A0;
  transition: transform 0.2s ease;
}

.docs-nav-subtopic.expanded > .docs-nav-subtopic-header .docs-nav-subtopic-expand {
  transform: rotate(90deg);
}

.docs-nav-subtopic-title {
  font-size: 1rem;
  font-weight: 500;
  color: #3D4E70;
}

.docs-nav-subtopic-children {
  display: none;
}

.docs-nav-subtopic.expanded > .docs-nav-subtopic-children {
  display: block;
}

/* Document Links */
.docs-nav-document {
  display: block;
  padding: 10px 20px 10px 48px;
  font-size: 1rem;
  color: #7A7A7A;
  text-decoration: none;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.docs-nav-document:hover {
  color: #243352;
  background-color: #F5F7FA;
}

.docs-nav-document.active {
  color: #0A6EFF;
  background-color: rgba(10, 110, 255, 0.08);
  border-left-color: #0A6EFF;
  font-weight: 500;
}

/* Nested document (inside subtopic) */
.docs-nav-subtopic .docs-nav-document {
  padding-left: 60px;
}

/* Search Results */
.docs-nav-search-result {
  padding: 12px 20px;
  border-bottom: 1px solid #F0F2F5;
}

.docs-nav-search-result:last-child {
  border-bottom: none;
}

.docs-nav-search-result a {
  display: block;
  text-decoration: none;
}

.docs-nav-search-result-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: #243352;
  margin-bottom: 4px;
}

.docs-nav-search-result-path {
  font-size: 0.8rem;
  color: #7A7A7A;
}

.docs-nav-no-results {
  padding: 20px;
  text-align: center;
  color: #7A7A7A;
  font-size: 0.9rem;
}

/* Mobile sidebar toggle */
.docs-sidebar-mobile-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #0A6EFF;
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(10, 110, 255, 0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.docs-sidebar-mobile-toggle:hover {
  background: #0856CC;
  transform: scale(1.05);
}

/* ========================================
   Content Area
   ======================================== */

.docs-content {
  flex: 1;
  min-width: 0;
  padding: 40px;
  overflow-y: auto;
}

.docs-content-inner {
  max-width: 900px;
  margin: 0 auto;
}

/* Welcome Screen */
.docs-welcome {
  text-align: center;
  padding: 60px 20px;
}

.docs-welcome h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #243352;
  margin-bottom: 16px;
}

.docs-welcome p {
  font-size: 1.2rem;
  color: #7A7A7A;
  max-width: 500px;
  margin: 0 auto 40px;
  line-height: 1.8;
}

.docs-quick-links {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  text-align: left;
  max-width: 400px;
  margin: 0 auto;
}

.docs-quick-links h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #243352;
  margin-bottom: 16px;
}

.docs-quick-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-quick-links li {
  margin-bottom: 8px;
}

.docs-quick-links a {
  color: #0A6EFF;
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.2s ease;
}

.docs-quick-links a:hover {
  color: #0856CC;
  text-decoration: underline;
}

/* ========================================
   Markdown Content Rendering
   ======================================== */

.docs-content-inner h1,
.docs-content-inner h2,
.docs-content-inner h3,
.docs-content-inner h4,
.docs-content-inner h5,
.docs-content-inner h6 {
  clear: both; /* Break out of floated images */
}

.docs-content-inner h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #243352;
  margin: 0 0 24px 0;
  padding-bottom: 16px;
  border-bottom: 2px solid #E8EBF0;
}

.docs-content-inner h2 {
  font-size: 1.8rem;
  font-weight: 600;
  color: #243352;
  margin: 48px 0 16px 0;
}

.docs-content-inner h3 {
  font-size: 1.4rem;
  font-weight: 600;
  color: #3D4E70;
  margin: 32px 0 12px 0;
}

.docs-content-inner h4 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #3D4E70;
  margin: 24px 0 10px 0;
}

.docs-content-inner h5,
.docs-content-inner h6 {
  font-size: 1rem;
  font-weight: 600;
  color: #3D4E70;
  margin: 20px 0 8px 0;
}

.docs-content-inner p {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #4A5568;
  margin: 0 0 16px 0;
}

.docs-content-inner a {
  color: #0A6EFF;
  text-decoration: none;
  transition: color 0.2s ease;
}

.docs-content-inner a:hover {
  color: #0856CC;
  text-decoration: underline;
}

.docs-content-inner ul,
.docs-content-inner ol {
  margin: 0 0 16px 0;
  padding-left: 24px;
}

.docs-content-inner li {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #4A5568;
  margin-bottom: 8px;
}

.docs-content-inner strong {
  font-weight: 600;
  color: #243352;
}

.docs-content-inner em {
  font-style: italic;
}

/* Images */
.docs-content-inner img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 24px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Video Embeds */
.docs-video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  margin: 24px 0;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.docs-video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Instagram Embed */
.docs-instagram-embed {
  margin: 24px 0;
  display: flex;
  justify-content: center;
}

.docs-instagram-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(45deg, #405DE6, #5851DB, #833AB4, #C13584, #E1306C, #FD1D1D);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.docs-instagram-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(131, 58, 180, 0.4);
  color: white;
  text-decoration: none;
}

/* Code blocks */
.docs-content-inner code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.9em;
  background: #F0F2F5;
  padding: 2px 6px;
  border-radius: 4px;
  color: #E53E3E;
}

.docs-content-inner pre {
  background: #1E1E1E;
  border-radius: 12px;
  padding: 20px;
  overflow-x: auto;
  margin: 24px 0;
}

.docs-content-inner pre code {
  background: none;
  padding: 0;
  color: #D4D4D4;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Blockquotes */
.docs-content-inner blockquote {
  border-left: 4px solid #0A6EFF;
  margin: 24px 0;
  padding: 16px 20px;
  background: #F5F7FA;
  border-radius: 0 8px 8px 0;
}

.docs-content-inner blockquote p {
  margin: 0;
  color: #3D4E70;
}

/* Tables */
.docs-content-inner table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.95rem;
}

.docs-content-inner th,
.docs-content-inner td {
  padding: 12px 16px;
  border: 1px solid #E8EBF0;
  text-align: left;
}

.docs-content-inner th {
  background: #F5F7FA;
  font-weight: 600;
  color: #243352;
}

.docs-content-inner td {
  color: #4A5568;
}

.docs-content-inner tr:hover td {
  background: #FAFAFA;
}

/* Horizontal Rule */
.docs-content-inner hr {
  border: none;
  border-top: 1px solid #E8EBF0;
  margin: 32px 0;
}

/* ========================================
   Loading & Error States
   ======================================== */

.docs-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #7A7A7A;
}

.docs-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #E8EBF0;
  border-top-color: #0A6EFF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.docs-error {
  text-align: center;
  padding: 60px 20px;
}

.docs-error h2 {
  color: #E53E3E;
  margin-bottom: 8px;
}

.docs-error p {
  color: #7A7A7A;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 1200px) {
  .docs-sidebar {
    width: 280px;
    min-width: 280px;
  }

  .docs-content {
    padding: 32px;
  }
}

@media (max-width: 1024px) {
  .docs-search-bar {
    margin-top: 140px;
    padding: 20px 24px;
  }

  .docs-search-bar-inner {
    flex-direction: row;
    gap: 12px;
  }

  .docs-search-wrapper {
    flex: 1;
    min-width: 0;
  }

  .docs-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    z-index: 500;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    border-radius: 0;
  }

  .docs-sidebar.open {
    transform: translateX(0);
  }

  .docs-sidebar-mobile-toggle {
    display: flex;
  }

  /* Show close button, hide collapse toggle on mobile */
  .docs-sidebar-close {
    display: flex;
  }

  .docs-sidebar-toggle {
    display: none;
  }

  .docs-sidebar-header {
    justify-content: space-between;
    padding: 16px 20px;
    padding-top: 110px; /* Push below fixed site header */
    transition: padding-top 0.3s ease;
  }

  /* Reduce padding when header is hidden */
  .header-is-hidden .docs-sidebar-header {
    padding-top: 16px;
  }

  /* Overlay when sidebar is open */
  .docs-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 400;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

  .docs-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }
}

@media (max-width: 768px) {
  .docs-search-bar {
    margin-top: 160px;
    padding: 16px;
  }

  .docs-content {
    padding: 24px 16px;
  }

  .docs-content-inner h1 {
    font-size: 2rem;
  }

  .docs-content-inner h2 {
    font-size: 1.5rem;
  }

  .docs-content-inner h3 {
    font-size: 1.25rem;
  }

  .docs-welcome h1 {
    font-size: 2rem;
  }

  .docs-welcome p {
    font-size: 1rem;
  }

  /* Footer adjustments */
  #site-footer .elementor-social-icons-wrapper {
    position: static !important;
    margin-top: 16px;
    justify-content: center;
  }

  #site-footer .e-con-inner > div:first-child {
    flex-direction: column !important;
  }
}

@media (max-width: 480px) {
  .docs-sidebar {
    width: 100%;
  }

  .docs-sidebar-mobile-toggle {
    bottom: 16px;
    left: 16px;
    width: 48px;
    height: 48px;
  }
}

/* ========================================
   Search Toggle & Content Search
   ======================================== */

.docs-search-options {
  flex-shrink: 0;
}

.docs-search-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.docs-search-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.docs-search-toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  background: #E8EBF0;
  border-radius: 20px;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.docs-search-toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.docs-search-toggle-input:checked + .docs-search-toggle-switch {
  background: #0A6EFF;
}

.docs-search-toggle-input:checked + .docs-search-toggle-switch::after {
  transform: translateX(16px);
}

.docs-search-toggle-text {
  font-size: 0.85rem;
  color: #7A7A7A;
  transition: color 0.2s ease;
}

.docs-search-toggle-input:checked ~ .docs-search-toggle-text {
  color: #243352;
}

/* Search Result Snippets */
.docs-nav-search-result-snippet {
  font-size: 0.8rem;
  color: #7A7A7A;
  margin-top: 6px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.docs-nav-search-result-snippet mark {
  background: rgba(10, 110, 255, 0.2);
  color: #0A6EFF;
  padding: 0 2px;
  border-radius: 2px;
}

/* Content search loading indicator */
.docs-search-loading {
  padding: 16px 20px;
  color: #7A7A7A;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.docs-search-loading::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid #E8EBF0;
  border-top-color: #0A6EFF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ========================================
   Footer - Match Doctors Page Layout
   ======================================== */

/* Override frontend.css that sets flex-direction: column */
.documentation-page #site-footer .hfe-nav-menu {
  flex-direction: row !important;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
  .docs-sidebar,
  .docs-sidebar-mobile-toggle,
  #site-header,
  #site-footer {
    display: none !important;
  }

  .docs-container {
    margin-top: 0;
  }

  .docs-content {
    padding: 0;
  }

  .docs-content-inner {
    max-width: 100%;
  }
}
