/*
Theme Name: QRplify Divi Child
Theme URI: https://qrplify.com
Description: Child theme for Divi with QRplify blog styles and branding customizations
Author: QRplify
Author URI: https://qrplify.com
Template: Divi
Version: 1.3.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: qrplify-divi-child
*/

/* =========================================================
   QRPLIFY BLOG STYLES (Divi)
   Scoped to single posts only: .single-post

   Key goal: consistent spacing without "double gaps"
   ========================================================= */

/* =========================
   1) LAYOUT + HERO
   ========================= */

.single-post #main-content,
.single-post .et_pb_post,
.single-post #left-area {
  padding-top: 0 !important;
}

/* Hero wrapper */
.single-post .et_post_meta_wrapper {
  background: linear-gradient(135deg, #0B0327 0%, #1a0a4a 50%, #6D53DE 100%) !important;
  padding: 80px 40px 60px 40px !important;
  margin: 0 0 30px 0 !important;
  border-radius: 20px !important;
  position: relative;
}

/* Title */
.single-post .entry-title,
.single-post h1.entry-title {
  color: #FFFFFF !important;
  font-family: 'Manrope', sans-serif !important;
  font-size: 42px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  margin: 0 0 20px 0 !important;
  position: relative;
  z-index: 1;
}

/* Meta */
.single-post .et_post_meta_wrapper p.post-meta,
.single-post .post-meta {
  color: rgba(255, 255, 255, 0.8) !important;
  font-family: 'Manrope', sans-serif !important;
  font-size: 14px !important;
  position: relative;
  z-index: 1;
  margin: 0 !important;
}

.single-post .post-meta a {
  color: #FFFFFF !important;
  text-decoration: none !important;
  font-weight: 500;
  border-bottom: 1px solid rgba(255,255,255,0.3);
  transition: all 0.3s ease;
}

.single-post .post-meta a:hover {
  color: #8b6ce6 !important;
  border-bottom-color: #8b6ce6;
}

/* Reset secondary meta wrappers (comments section etc.) */
.single-post .entry-content ~ .et_post_meta_wrapper,
.single-post article ~ .et_post_meta_wrapper,
.single-post #comment-wrap .et_post_meta_wrapper,
.single-post #comments .et_post_meta_wrapper {
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

.single-post .et_post_meta_wrapper:empty {
  display: none !important;
}

/* =========================
   2) CONTENT CARD
   ========================= */

.single-post .entry-content,
.single-post #left-area article .entry-content {
  background: #FFFFFF !important;
  padding: 40px !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
  margin: 0 0 30px 0 !important;
}

/* =========================
   3) TYPOGRAPHY + SPACING SYSTEM
   ========================= */

/* Base type */
.single-post .entry-content {
  font-family: 'Manrope', sans-serif !important;
  font-size: 17px !important;
  line-height: 1.8 !important;
  color: #2c3e50 !important;
}

/* Core spacing reset (baseline) - exclude TOC */
.single-post .entry-content p,
.single-post .entry-content ul:not(.qrplify-toc-list):not(.qrplify-toc-sublist),
.single-post .entry-content ol:not(.qrplify-toc-list):not(.qrplify-toc-sublist),
.single-post .entry-content blockquote,
.single-post .entry-content pre,
.single-post .entry-content table,
.single-post .entry-content figure,
.single-post .entry-content img {
  margin-top: 0 !important;
  margin-bottom: 14px !important;
}

/* Remove empty paragraphs (WP sometimes injects these) */
.single-post .entry-content p:empty {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* First paragraph slightly larger */
.single-post .entry-content > p:first-of-type {
  font-size: 20px !important;
  line-height: 1.7 !important;
  color: #1a1a1a !important;
  font-weight: 400;
  margin-bottom: 16px !important;
}

/* Headings */
.single-post .entry-content h2,
.single-post .entry-content h3,
.single-post .entry-content h4 {
  font-family: 'Manrope', sans-serif !important;
  color: #0B0327 !important;
  margin-top: 30px !important;
  margin-bottom: 12px !important;
}

.single-post .entry-content h2 {
  font-size: 32px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  padding-bottom: 15px !important;
  border-bottom: 3px solid #6D53DE !important;
}

.single-post .entry-content h3 {
  font-size: 26px !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
}

.single-post .entry-content h4 {
  font-size: 22px !important;
  font-weight: 600 !important;
}

/* Tighten heading spacing when following another block */
.single-post .entry-content p + h2,
.single-post .entry-content ul + h2,
.single-post .entry-content ol + h2,
.single-post .entry-content blockquote + h2,
.single-post .entry-content pre + h2,
.single-post .entry-content table + h2 {
  margin-top: 24px !important;
}

.single-post .entry-content p + h3,
.single-post .entry-content ul + h3,
.single-post .entry-content ol + h3,
.single-post .entry-content blockquote + h3,
.single-post .entry-content pre + h3,
.single-post .entry-content table + h3 {
  margin-top: 18px !important;
}

/* Links (exclude TOC links) */
.single-post .entry-content a:not(.qrplify-toc-container a) {
  color: #6D53DE !important;
  text-decoration: none !important;
  border-bottom: 2px solid rgba(109, 83, 222, 0.3);
  transition: all 0.3s ease;
  font-weight: 500;
}

.single-post .entry-content a:not(.qrplify-toc-container a):hover {
  color: #5a42c4 !important;
  border-bottom-color: #5a42c4;
}

/* =========================
   4) LISTS (Fix stacked spacing)
   ========================= */

/* Exclude TOC lists from blog styling */
.single-post .entry-content ul:not(.qrplify-toc-list):not(.qrplify-toc-sublist),
.single-post .entry-content ol:not(.qrplify-toc-list):not(.qrplify-toc-sublist) {
  padding-left: 0 !important;
  margin-top: 8px !important;
  margin-bottom: 14px !important;
}

/* Nested list indentation (prevents everything aligning to the same left edge) */
.single-post .entry-content li:not(.qrplify-toc-item) > ul:not(.qrplify-toc-sublist),
.single-post .entry-content li:not(.qrplify-toc-item) > ol:not(.qrplify-toc-sublist) {
  margin-left: 18px !important;
  margin-top: 8px !important;
}

/* UL custom bullets (exclude TOC) */
.single-post .entry-content ul:not(.qrplify-toc-list):not(.qrplify-toc-sublist) {
  list-style: none !important;
}

.single-post .entry-content ul:not(.qrplify-toc-list):not(.qrplify-toc-sublist) > li:not(.qrplify-toc-item) {
  position: relative;
  padding-left: 30px !important;
  margin: 0 0 8px 0 !important;
  line-height: 1.7 !important;
}

.single-post .entry-content ul:not(.qrplify-toc-list):not(.qrplify-toc-sublist) > li:not(.qrplify-toc-item)::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 8px;
  height: 8px;
  background: #6D53DE;
  border-radius: 50%;
}

/* OL custom counters (exclude TOC) */
.single-post .entry-content ol:not(.qrplify-toc-list):not(.qrplify-toc-sublist) {
  list-style: none !important;
  counter-reset: item;
}

.single-post .entry-content ol:not(.qrplify-toc-list):not(.qrplify-toc-sublist) > li:not(.qrplify-toc-item) {
  position: relative;
  padding-left: 45px !important;
  margin: 0 0 10px 0 !important;
  counter-increment: item;
  line-height: 1.7 !important;
}

.single-post .entry-content ol:not(.qrplify-toc-list):not(.qrplify-toc-sublist) > li:not(.qrplify-toc-item)::before {
  content: counter(item);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #6D53DE, #8b6ce6);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

/* Nested list differentiation (top bullets vs sub bullets) - exclude TOC */

/* Second level UL bullets: hollow, smaller */
.single-post .entry-content ul:not(.qrplify-toc-list):not(.qrplify-toc-sublist) ul:not(.qrplify-toc-sublist) > li:not(.qrplify-toc-item),
.single-post .entry-content ol:not(.qrplify-toc-list):not(.qrplify-toc-sublist) ul:not(.qrplify-toc-sublist) > li:not(.qrplify-toc-item) {
  padding-left: 26px !important;
}

.single-post .entry-content ul:not(.qrplify-toc-list):not(.qrplify-toc-sublist) ul:not(.qrplify-toc-sublist) > li:not(.qrplify-toc-item)::before,
.single-post .entry-content ol:not(.qrplify-toc-list):not(.qrplify-toc-sublist) ul:not(.qrplify-toc-sublist) > li:not(.qrplify-toc-item)::before {
  width: 6px;
  height: 6px;
  background: transparent;
  border: 2px solid #6D53DE;
  border-radius: 50%;
  top: 11px;
}

/* Third level UL bullets: small square, lighter */
.single-post .entry-content ul:not(.qrplify-toc-list):not(.qrplify-toc-sublist) ul:not(.qrplify-toc-sublist) ul:not(.qrplify-toc-sublist) > li:not(.qrplify-toc-item)::before,
.single-post .entry-content ol:not(.qrplify-toc-list):not(.qrplify-toc-sublist) ul:not(.qrplify-toc-sublist) ul:not(.qrplify-toc-sublist) > li:not(.qrplify-toc-item)::before {
  width: 6px;
  height: 6px;
  background: #6D53DE;
  border: none;
  border-radius: 2px;
  opacity: 0.6;
  top: 11px;
}

/* Nested OL counters: smaller than top level */
.single-post .entry-content ol:not(.qrplify-toc-list):not(.qrplify-toc-sublist) ol:not(.qrplify-toc-sublist) > li:not(.qrplify-toc-item) {
  padding-left: 40px !important;
}

.single-post .entry-content ol:not(.qrplify-toc-list):not(.qrplify-toc-sublist) ol:not(.qrplify-toc-sublist) > li:not(.qrplify-toc-item)::before {
  width: 26px;
  height: 26px;
  font-size: 12px;
  top: 2px;
}

/* Critical: kill paragraph spacing inside list items (exclude TOC) */
.single-post .entry-content li:not(.qrplify-toc-item) p {
  margin: 0 !important;
  padding: 0 !important;
}

/* Kill "double gap" when list follows a paragraph (exclude TOC) */
.single-post .entry-content p + ul:not(.qrplify-toc-list):not(.qrplify-toc-sublist),
.single-post .entry-content p + ol:not(.qrplify-toc-list):not(.qrplify-toc-sublist) {
  margin-top: -4px !important;
}

/* Kill "double gap" when paragraph follows a list (exclude TOC) */
.single-post .entry-content ul:not(.qrplify-toc-list):not(.qrplify-toc-sublist) + p,
.single-post .entry-content ol:not(.qrplify-toc-list):not(.qrplify-toc-sublist) + p {
  margin-top: 0 !important;
}

/* =========================
   5) BLOCKQUOTES
   ========================= */

.single-post .entry-content blockquote {
  background: linear-gradient(135deg, #f8f6ff 0%, #f0ebff 100%) !important;
  border-left: 5px solid #6D53DE !important;
  border-radius: 0 12px 12px 0 !important;
  padding: 30px 35px !important;
  margin: 18px 0 !important;
  font-size: 19px !important;
  font-style: italic !important;
  color: #2c3e50 !important;
  line-height: 1.7 !important;
  position: relative;
}

.single-post .entry-content blockquote::before {
  content: '"';
  position: absolute;
  top: 15px;
  left: 15px;
  font-size: 60px;
  color: #6D53DE;
  opacity: 0.2;
  font-family: Georgia, serif;
  line-height: 1;
}

.single-post .entry-content blockquote p {
  margin: 0 !important;
  font-size: inherit !important;
}

/* =========================
   6) TABLES
   ========================= */

.single-post .entry-content table {
  max-width: 100% !important;
  border-collapse: collapse !important;
  margin: 18px 0 !important;
  background: #FFFFFF !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08) !important;
}

.single-post .entry-content table thead tr {
  background: #f5f5f5 !important;
}

.single-post .entry-content table th {
  color: #2c3e50 !important;
  font-family: 'Manrope', sans-serif !important;
  font-weight: 600 !important;
  padding: 18px 20px !important;
  text-align: left !important;
  font-size: 15px !important;
}

.single-post .entry-content table td {
  padding: 16px 20px !important;
  border-bottom: 1px solid #eee !important;
  font-size: 15px !important;
  color: #2c3e50 !important;
}

.single-post .entry-content table tbody tr:nth-child(even) {
  background: #f9f9fb !important;
}

.single-post .entry-content table tbody tr:hover {
  background: #f0ebff !important;
}

/* Table scroll wrapper (for wide tables on all screen sizes) */
.single-post .entry-content .qrplify-table-scroll {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  margin: 18px 0 !important;
}

.single-post .entry-content .qrplify-table-scroll table {
  margin: 0 !important;
  min-width: 100% !important;
  width: max-content !important;
}

/* =========================
   7) CODE
   ========================= */

.single-post .entry-content code {
  background: #f4f3f8 !important;
  color: #6D53DE !important;
  padding: 3px 8px !important;
  border-radius: 4px !important;
  font-family: 'Fira Code', 'Monaco', monospace !important;
  font-size: 14px !important;
}

.single-post .entry-content pre {
  background: #0B0327 !important;
  color: #e0e0e0 !important;
  padding: 25px !important;
  border-radius: 12px !important;
  overflow-x: auto !important;
  margin: 18px 0 !important;
  font-family: 'Fira Code', 'Monaco', monospace !important;
  font-size: 14px !important;
  line-height: 1.6 !important;
}

.single-post .entry-content pre code {
  background: transparent !important;
  color: inherit !important;
  padding: 0 !important;
}

/* =========================
   8) IMAGES
   ========================= */

.single-post .entry-content img {
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
  margin: 18px 0 !important;
  max-width: 100% !important;
  height: auto !important;
}

.single-post .entry-content .wp-caption-text,
.single-post .entry-content figcaption {
  font-size: 14px !important;
  color: #666 !important;
  text-align: center !important;
  margin-top: 10px !important;
  font-style: italic;
}

/* =========================
   9) SIDEBAR
   ========================= */

.single-post div.container::before,
.single-post .container::before {
  display: none !important;
}

.single-post #left-area {
  padding-right: 15px !important;
}

.single-post #sidebar {
  padding-left: 15px !important;
}

.single-post #main-content .container {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.single-post #sidebar .et_pb_widget,
.single-post #sidebar .widget {
  background: #FFFFFF !important;
  border-radius: 12px !important;
  padding: 25px !important;
  margin: 0 0 25px 0 !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08) !important;
}

.single-post #sidebar .et_pb_widget h4,
.single-post #sidebar .widget-title {
  font-family: 'Manrope', sans-serif !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #0B0327 !important;
  margin: 0 0 20px 0 !important;
  padding-bottom: 12px !important;
  border-bottom: 3px solid #6D53DE !important;
}

/* Recent Posts widget */
.single-post #sidebar .wp-block-latest-posts {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.single-post #sidebar .wp-block-latest-posts li {
  border-bottom: 1px solid #eee !important;
  margin: 0 !important;
  padding: 8px 0 !important;
}

.single-post #sidebar .wp-block-latest-posts li:last-child {
  border-bottom: none !important;
}

/* =========================
   10) TABLE WRAPPER (scroll)
   ========================= */

.single-post .entry-content .table-wrapper {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  margin: 18px 0 !important;
}

.single-post .entry-content .table-wrapper table {
  margin: 0 !important;
  min-width: 500px !important;
}

/* =========================
   11) TABLET
   ========================= */

@media (max-width: 991px) {
  .single-post .et_post_meta_wrapper {
    padding: 40px 25px 35px 25px !important;
    margin: 0 0 25px 0 !important;
  }

  .single-post .entry-title,
  .single-post h1.entry-title,
  .single-post #left-area .entry-title,
  .single-post #left-area h1.entry-title,
  .single-post article .entry-title {
    font-size: 28px !important;
    line-height: 1.3 !important;
  }

  .single-post .entry-content {
    padding: 30px 20px !important;
  }
}

/* =========================
   12) MOBILE
   ========================= */

@media (max-width: 767px) {
  .single-post #main-content .container {
    box-sizing: border-box !important;
    max-width: calc(100% - 43px) !important;
    margin: 0 auto !important;
  }

  .single-post #left-area {
    padding-right: 0 !important;
  }

  .single-post .et_post_meta_wrapper {
    padding: 24px 20px 20px 20px !important;
    margin: 0 0 16px 0 !important;
    border-radius: 16px !important;
  }

  .single-post .entry-title,
  .single-post h1.entry-title,
  .single-post #left-area .entry-title,
  .single-post #left-area h1.entry-title,
  .single-post article .entry-title {
    font-size: 24px !important;
    line-height: 1.3 !important;
  }

  .single-post .entry-content,
  .single-post #left-area article .entry-content {
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  .single-post .entry-content {
    font-size: 16px !important;
    line-height: 1.7 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .single-post .entry-content h2 {
    font-size: 22px !important;
    margin-top: 24px !important;
    margin-bottom: 10px !important;
    padding-bottom: 10px !important;
  }

  .single-post .entry-content h3 {
    font-size: 19px !important;
    margin-top: 18px !important;
  }

  .single-post .entry-content h4 {
    font-size: 17px !important;
  }

  .single-post .entry-content blockquote {
    padding: 12px 16px !important;
    font-size: 15px !important;
    margin: 14px 0 !important;
  }

  .single-post .entry-content ul:not(.qrplify-toc-list):not(.qrplify-toc-sublist) > li:not(.qrplify-toc-item),
  .single-post .entry-content ol:not(.qrplify-toc-list):not(.qrplify-toc-sublist) > li:not(.qrplify-toc-item) {
    padding-left: 25px !important;
    margin-bottom: 8px !important;
  }

  .single-post .entry-content ol:not(.qrplify-toc-list):not(.qrplify-toc-sublist) > li:not(.qrplify-toc-item) {
    padding-left: 40px !important;
  }

  .single-post .entry-content ol:not(.qrplify-toc-list):not(.qrplify-toc-sublist) > li:not(.qrplify-toc-item)::before {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .single-post .entry-content figure.wp-block-table,
  .single-post .entry-content .table-wrapper {
    display: block !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 14px 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Table scroll wrapper (injected by plugin) and Gutenberg figure */
  .single-post .entry-content .qrplify-table-scroll,
  .single-post .entry-content figure.wp-block-table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 14px 0 !important;
  }

  /* Tables inside scroll wrapper - keep table semantics */
  .single-post .entry-content .qrplify-table-scroll table,
  .single-post .entry-content figure.wp-block-table table {
    display: table !important;
    min-width: 600px !important;
    width: max-content !important;
    margin: 0 !important;
  }

  .single-post .entry-content table th,
  .single-post .entry-content table td {
    padding: 8px 10px !important;
    font-size: 13px !important;
    white-space: normal !important;
    word-wrap: break-word !important;
  }

  .single-post .entry-content pre {
    margin: 14px 0 !important;
    border-radius: 8px !important;
    padding: 16px !important;
    font-size: 13px !important;
  }

  .single-post .entry-content img {
    margin: 14px 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 8px !important;
  }

  .single-post #sidebar {
    padding: 12px !important;
    margin-top: 30px !important;
  }

  .single-post #sidebar .et_pb_widget,
  .single-post #sidebar .widget {
    padding: 20px !important;
    margin: 0 0 20px 0 !important;
  }
}

/* =========================
   MENU CTA BUTTON (site-wide)
   ========================= */

.menu-main-button a {
  background-color: #F74D00 !important;
  color: #ffffff !important;
  padding: 12px 20px 14px 20px !important;
  border-radius: 6px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 0.5px;
  transition: all 0.25s ease-in-out !important;
  display: inline-block;
  text-decoration: none !important;
  border: none;
  white-space: nowrap;
}

.menu-main-button a:hover {
  background-color: #d63f00 !important;
  color: #ffffff !important;
}

#main-header.et-fixed-header .menu-main-button a {
  padding: 8px 16px !important;
  font-size: 13px !important;
  transition: all 0.25s ease-in-out !important;
}

@media (max-width: 480px) {
  .menu-main-button a {
    background-color: transparent !important;
    color: #F74D00 !important;
    font-size: 14px !important;
    padding: 10px 0 !important;
    border: none !important;
    border-radius: 0 !important;
  }

  .menu-main-button a:hover {
    background-color: transparent !important;
    color: #d63f00 !important;
  }
}
