@import "frontend/variables";
@import "frontend/predefine";
@import "frontend/doclist";
@import "frontend/single_file-attached";

/** === AJAX doc loading state === **/
.doc-middle-content {
  &.ezd-is-loading {
    position: relative;
    min-height: 240px;

    // Dim + freeze the outgoing content while the next doc is fetched.
    > *:not(.ezd-ajax-loader) {
      opacity: 0.45;
      pointer-events: none;
      transition: opacity 0.2s ease;
    }
  }

  .ezd-ajax-loader {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;

    .ezd-ajax-spinner {
      width: 38px;
      height: 38px;
      border: 3px solid var(--ezd_brand_color_10, rgba(8, 112, 255, 0.1));
      border-top-color: var(--ezd_brand_color, #0870ff);
      border-radius: 50%;
      animation: ezd-ajax-spin 0.7s linear infinite;
    }

    .screen-reader-text {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }
  }

  .ezd-ajax-error {
    padding: 16px 20px;
    margin: 12px 0;
    color: #842029;
    background-color: #f8d7da;
    border: 1px solid #f5c2c7;
    border-radius: 6px;
  }
}

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

.modal-content .shortcode_info .row {
  margin-top: 20px;
}

/** === Comments === **/
.eazydocs-comments-wrap {
  padding-bottom: 100px;

  .comments-area {
    .comments-title {
      margin-bottom: 20px;
    }

    .comment-list {
      list-style: none;
      margin-left: 0;

      .comment {
        & + .comment {
          margin-top: 25px;
        }
      }
    }
  }
}

p .footnotes-link {
  color: var(--ezd_brand_color) !important;
}

p .footnotes-link::after {
  display: none;
}

.eazydocs-comments-wrap .blog_comment_box.no_comments {
  padding-top: 40px;
}

.doc_left_sidebarlist .doc-title {
  font-size: 24px;
  font-weight: 500;
  padding-right: 10px;
  color: var(--black_800);
  margin-bottom: 15px;
  line-height: 1.4;
}

.nav-sidebar .nav-item .dropdown_nav ul {
  padding-left: 10px !important;
}

.nav-sidebar .nav-item .dropdown_nav {
  .nav-item {
    span.icon {
      display: flex;
    }

    .dropdown_nav {
      display: none !important;
      transition: 0.3s all;
    }

    &.active > .dropdown_nav {
      display: block !important;
    }
  }
}

// Doc Filter form
.filter_form {
  margin-bottom: 30px;
  margin-right: 30px;
  padding: 0 5px 0 0;
  position: relative;

  input, input[type="search"] {
    border: 1px solid var(--black_50) !important;
    width: 100%;
    padding: 3px 18px;
    outline: none;
    margin: 0;
    font-size: 12px;
    line-height: 30px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    background: var(--black_25);
    color: var(--black_800) !important;
    height: 48px;

    &:focus {
      outline: none;
      background-color: var(--bs-white)
    }

    &::placeholder {
      color: var(--black_400);
    }
  }

  .filter_no_result {
    display: none;
    font-weight: 400;
    color: var(--black_500);
    font-size: 14px;
    margin-top: 5px;
  }
}

.left-sidebar-toggle {
  position: absolute;
  top: 80px;
  color: #656565;
  line-height: 22px;
  cursor: pointer;
  height: 24px;
  text-align: left;
  z-index: 1;
  font-size: 0.95rem;
  margin-left: -90px;

  .left-arrow {
    display: block;
    border: var(--black_50) solid 1px;
    border-radius: 20px;
    background: var(--black_25);
    padding: 3px 8px 0 3.5px;
    height: 24px;
    transition: padding 0.2s;
    font-size: 16px;

    &:hover {
      color: #ffffff;
      background: var(--ezd_brand_color);
      border-color: var(--ezd_brand_color);
      padding: 3px 16px 0 3.5px;
    }
  }

  .right-arrow {
    display: none;
    border: var(--black_50) solid 1px;
    border-radius: 20px;
    background: var(--black_25);
    padding: 3px 7.5px 3px 9px;
    height: 24px;
    transition: padding 0.2s;
    font-size: 16px;

    &:hover {
      color: #ffffff;
      background: var(--ezd_brand_color);
      border-color: var(--ezd_brand_color);
      padding: 3px 8px 3px 16px;
    }
  }
}

.single-docs .doc_full_width .doc_rightsidebar {
  width: 100%;

  .pageSideSection {
    padding-left: 25px;
  }

  .toc_right .nav-link.active::before {
    left: -25px;
  }
}

.opened .open_icon {
  i {
    display: none;

    + i {
      display: inline-block;
    }
  }
}

.topic_list_item ul li:last-child {
  margin-bottom: 0;
}

.body_fixed {
  .left-sidebar-toggle {
    position: fixed;
  }
}

.nav-sidebar .nav-item.no_icon.active .nav-link img + img {
  display: inline;
}

.load-more {
  &:hover {
    cursor: pointer;
    color: var(--ezd_brand_color);
    text-decoration: underline;
  }

  ion-icon {
    margin-bottom: -2px;
  }
}

.doc-meta {
  font-size: 14px;
  color: var(--black_500);
  position: relative;
  z-index: 1;

  ion-icon {
    margin-bottom: -2px;
  }

  .views {
    margin-left: 10px;
  }
}

.nav-sidebar .nav-item.no_icon.active .nav-link img,
.nav-sidebar .nav-item.no_icon .nav-link img.open {
  display: none;
}

.nav-sidebar .nav-item.no_icon.active .nav-link img.open {
  display: block;
}

.fadeGradient {
  position: relative;
  height: 50px;
  margin-top: -50px;
  overflow-x: hidden;
  background: -moz-linear-gradient(
                  bottom,
                  rgb(255, 255, 255) 15%,
                  rgba(255, 255, 255, 0) 100%
  );
  background: -webkit-linear-gradient(
                  bottom,
                  rgb(255, 255, 255) 15%,
                  rgba(255, 255, 255, 0) 100%
  );
  background: -o-linear-gradient(
                  bottom,
                  rgb(255, 255, 255) 15%,
                  rgba(255, 255, 255, 0) 100%
  );
  background: -ms-linear-gradient(
                  bottom,
                  rgb(255, 255, 255) 15%,
                  rgba(255, 255, 255, 0) 100%
  );
  filter: progid:DXImageTransform.Microsoft.gradient(
                  startColorstr='#03ffffff',
                  endColorstr='#ffffff', GradientType=0
  );
  background: linear-gradient(
                  bottom,
                  rgb(255, 255, 255) 15%,
                  rgba(255, 255, 255, 0) 100%
  );
  display: block;
}

.doc-scrollable {
  img {
    max-width: 100%;
    height: auto;
  }

  ul:not([class]),
  ul.wp-block-list,
  ol:not([class]),
  ol.wp-block-list {
    padding-left: 20px;
    margin: 10px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 20px;

    li {
      margin-bottom: 0 !important;
    }
  }

  ul {
    list-style: disc;
  }
}

.doc-excerpt {
  margin-bottom: 30px;
}

.border_bottom {
  width: 100%;
  height: 1px;
  background: #e8f0f1;
}

.section.eazydocx-credit-text {
  margin-bottom: 0;
  padding-top: 30px;
  background: #fafcfc;
  padding-bottom: 30px;
}

.single-docs #post {
  h2 {
    font-weight: 600;
    font-size: 1.8em;
    display: flex;
    align-items: center;
  }

  h2, h3, h4, h5, h6 {
    scroll-margin-top: 0px;
  }

  h3 {
    font-size: 1.5em;
  }

  h4 {
    font-size: 1.3em;
  }

  h5 {
    font-size: 1em;
  }

  h6 {
    font-size: 0.8em;
  }

  p {
    font-weight: 400;
    margin-top: 0;
    line-height: 1.9;
  }
}
body{
  &.admin-bar {
    h2, h3, h4, h5, h6 {
      scroll-margin-top: -32px !important;
    }
  }
}

.form-control {
  width: 100%;
}

.anchor-enabled h2 {
  padding-top: 80px;
  margin-top: -80px;
  color: #0c0d0e;
}

.toggle_btn {
  margin-top: 0.25rem !important;
}

.doc_tag .nav-item .nav-link {
  letter-spacing: 0.5px;
}

.doc_documentation_area {
  padding: 0 !important;
  margin: 0 !important;
  flex: auto !important;
}

.eazydocx-credit-text {
  p {
    font-size: 14px;
    color: var(--black_400);
  }
}

body:not(.woocommerce-page)
button:not([class^="fl-"]):not(.hestia-scroll-to-top):not(.navbar-toggle):not(.close) {
  box-shadow: none;
}

/** === Popular Themes Support === **/
body.single-docs {
  .container.grid-container,
  .site-content,
  .col-full,
  #main .fusion-row,
  .site-content .ast-container {
    display: block;
    padding: 0;
    max-width: 100%;
  }

  &.theme-Avada main#main {
    padding: 0;
  }

  &.oceanwp-theme .page-header {
    display: none;
  }

  /* WoodMart: reset content layout wrapper */
  &.wp-theme-woodmart .wd-content-layout,
  &.wp-theme-woodmart main#main-content {
    display: block;
    padding: 0;
    max-width: 100%;
  }

  #main .doc_left_sidebarlist h2.doc-title {
    margin-bottom: 25px;
  }
}

// select css

.bootstrap-select.open > .dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  -webkit-transform: scale(1) translateY(0);
  -ms-transform: scale(1) translateY(0);
  transform: scale(1) translateY(0);
}

.bootstrap-select > .dropdown-menu {
  opacity: 0;
  max-height: 330px !important;
  visibility: hidden;
  overflow: hidden;
  -webkit-transform-origin: 50% 0;
  -ms-transform-origin: 50% 0;
  transform-origin: 50% 0;
  -webkit-transform: scale(0.85) translateY(-5px);
  -ms-transform: scale(0.85) translateY(-5px);
  transform: scale(0.85) translateY(-5px);
  -webkit-transition: all 0.2s cubic-bezier(0.5, 0, 0, 1.25),
  opacity 0.15s ease-out;
  transition: all 0.2s cubic-bezier(0.5, 0, 0, 1.25), opacity 0.15s ease-out;
}

.bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) {
  width: 100%;
}

.contribut-btns {
  flex-wrap: wrap;
}

@media (max-width: 1440px) {
  .contribut-btns a {
    margin-bottom: 3px;
  }
}

.wp-block-navigation__responsive-container {
  &.is-menu-open {
    padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40) !important;
  }
}

// Google Login Button
.ezd-google-login-container {
    margin: 20px 0;
}

.ezd-google-login-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 24px;
    background: #fff;
    border: 2px solid #dadce0;
    border-radius: 6px;
    text-decoration: none;
    color: #3c4043;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    gap: 7px;
}

.ezd-google-login-btn:hover {
    background: #f8f9fa;
    border-color: #dadce0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    color: #3c4043;
}

.ezd-google-login-btn:active {
    background: #f1f3f4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.google-icon {
    margin-right: 12px;
    flex-shrink: 0;
}

.ezd-google-login-btn span {
    white-space: nowrap;
}

/* Login form specific styling */
#loginform .ezd-google-login-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

#loginform .ezd-google-login-btn {
    width: 100%;
    box-sizing: border-box;
}

.wp-theme-twentytwentyfive,
.wp-theme-twentytwentyfour,
.wp-theme-twentytwentythree{
  .left-sidebar-toggle{
    .left-arrow{
      line-height: 21px !important;
    }
  }
  .doc_rightsidebar,.doc_left_sidebarlist{
    .open_icon{
      .arrow_carrot-left,
      .arrow_carrot-right{
        line-height: 35px;
      }
    }
  }
}

.wp-theme-hello-elementor{
  .left-sidebar-toggle{
    .left-arrow{
      line-height: 17px !important;
    }
  }
  .doc_rightsidebar,.doc_left_sidebarlist{
    .open_icon{
      .arrow_carrot-left,
      .arrow_carrot-right{
        line-height: 35px;
      }
    }
  }
}
/**
 * WoodMart Theme Compatibility
 *
 * WoodMart wraps content inside .wd-content-layout which applies its own
 * CSS grid, padding, and container styles. These conflict with EazyDocs'
 * custom grid system (.ezd-grid, .ezd-container). The fixes below
 * neutralize those conflicting styles on EazyDocs pages.
 */
.wp-theme-woodmart {
  .doc_left_sidebarlist {
    .filter_form {
      .filterform {
        overflow: hidden;
      }
    }
  }

  .left-sidebar-toggle {
    .left-arrow {
      line-height: 17px !important;
    }
  }

  .doc_rightsidebar,
  .doc_left_sidebarlist {
    .open_icon {
      .arrow_carrot-left,
      .arrow_carrot-right {
        line-height: 35px;
      }
    }
  }

  /**
   * Reset WoodMart's main content layout wrapper on EazyDocs pages.
   * WoodMart's .wd-content-layout sets padding-block and a grid context
   * via :where(.wd-content-layout > div) { grid-column: auto/span var(--wd-col) }
   * which breaks EazyDocs' own 12-column CSS grid.
   */
  &.single-docs {
    /* Neutralize WoodMart's main content wrapper layout */
    .wd-content-layout {
      display: block !important;
      padding: 0 !important;
      max-width: 100% !important;
    }

    /* Prevent WoodMart's page wrapper from constraining width */
    .wd-page-content {
      max-width: 100% !important;
    }

    /* Reset WoodMart's .container override on EazyDocs containers */
    .doc_documentation_area .ezd-container,
    .doc_documentation_area .ezd-custom-container {
      max-width: 1470px;
      padding-left: 0.75rem;
      padding-right: 0.75rem;
      margin-left: auto;
      margin-right: auto;
      width: 100%;
      box-sizing: border-box;
    }

    /* Ensure EazyDocs' 12-column grid displays correctly */
    .doc_documentation_area .ezd-grid {
      display: grid !important;
    }

    .doc_documentation_area .ezd-grid.ezd-grid-cols-12 {
      grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
    }

    /* Prevent WoodMart's global `.title` rule from overriding EazyDocs titles */
    .doc_documentation_area .shortcode_title .title,
    .doc_documentation_area .shortcode_title .s_title {
      color: inherit;
      text-transform: none;
      font-family: inherit;
      font-weight: inherit;
      font-style: normal;
    }

    /* Reset WoodMart heading margin overrides inside doc content */
    .doc-scrollable h1,
    .doc-scrollable h2,
    .doc-scrollable h3,
    .doc-scrollable h4,
    .doc-scrollable h5,
    .doc-scrollable h6 {
      margin-bottom: revert;
    }

    /* WoodMart hides the page title – allow EazyDocs to control visibility */
    .wd-page-title {
      display: none;
    }

    /* Ensure breadcrumbs render with EazyDocs' own styles */
    .ezd-breadcrumb {
      font-family: inherit;
    }
    .ezd_search_form .input-wrapper input{
      @media (max-width: 375px) {
        width: 80% !important;
      }
    }
  }
  .eazydocs-assistant-wrapper{
    .chatbox-wrapper{
      bottom: 120px !important;
    }
  }
}

/**
 * Native browser print (mobile Print menu / Ctrl+P).
 *
 * The left/right doc sidebars are sticky/off-canvas navigation chrome.
 * When the page is sent to the printer their positioning collapses and
 * they overlap the article content. Hide them — along with the toggle
 * buttons and assistant widget — and let the middle content span the
 * full grid so only the documentation body is printed.
 */
@media print {
  // Navigation, sidebars and page chrome.
  .navbar,
  .doc_right_mobile_menu,
  .doc_left_sidebarlist,
  .doc_mobile_menu.left-column,
  #mobile-right-toggle,
  #mobile-left-toggle,
  .left-sidebar-toggle,
  .eazydocs-assistant-wrapper,
  .eazydocs-footer,
  // Post-content sections that aren't part of the article body.
  .related-recent-docs,
  .eazydocs-comments-wrap,
  .eazydocs-feedback-wrap,
  // Article meta row (reading time, views, contributors) and in-content
  // navigation lists (child docs / pagination).
  .ezd-meta,
  .d-items.doc-items,
  .recently_added,
  .page-links {
    display: none !important;
  }

  .doc-middle-content {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  // Expand external link destinations for paper readers.
  .doc-post-content a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 85%;
    color: #6b7280;
    word-break: break-all;
  }

  // Keep atomic blocks intact and headings attached to their content.
  .doc-post-content {
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      break-after: avoid;
      page-break-after: avoid;
    }

    pre,
    blockquote,
    table,
    figure,
    img {
      break-inside: avoid;
      page-break-inside: avoid;
    }
  }
}