/* ==========================================================================
   RESULT PILLAR PAGES – 3‑COLUMN LAYOUT
   ========================================================================== */

.datochai-pillar-wrapper {
  display: grid;
  grid-template-columns: 250px 1fr 280px;
  gap: 30px;
  max-width: 1400px;
  margin: 40px auto;
  padding: 0 20px;
  align-items: start;
}

.pillar-sidebar {
  position: -webkit-sticky !important;
  position: sticky !important;
  top: 120px !important;
  align-self: start;
  height: fit-content;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  z-index: 10;
  min-height: 0;
  flex-shrink: 0;
}

/* Sidebar widget base */
.pillar-widget {
  background: var(--color-surface-primary);
  border: 1px solid var(--color-border-secondary);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.widget-title {
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--color-text-primary);
  border-bottom: 2px solid var(--color-accent);
  padding-bottom: 10px;
  margin-top: 0;
  margin-bottom: 15px;
}

/* TOC – desktop always open */
.toc-toggle-btn { display: none; }
.toc-collapsible-area { display: block; }

/* ---------- Automatic Table of Contents (used by JS) ---------- */
.datochai-auto-toc {
  list-style: none;
  padding: 0;
  margin: 0;
}

.datochai-auto-toc li {
  margin-bottom: 8px;
  line-height: 1.4;
}

.datochai-auto-toc a {
  text-decoration: none;
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s ease, padding-left 0.2s ease;
  display: block;
}

.datochai-auto-toc a:hover {
  color: var(--color-accent);
  padding-left: 5px;
}

/* Hierarchy indentation */
.toc-item-h2 { margin-left: 0; margin-top: 15px; }
.toc-item-h2 a { font-weight: 700; color: var(--color-text-primary); }
.toc-item-h3 { margin-left: 15px; }
.toc-item-h3 a { font-size: 13px; font-weight: 500; }
.toc-item-h4 { margin-left: 30px; }
.toc-item-h4 a { font-size: 12px; color: var(--color-text-secondary); font-weight: normal; }

/* ---------- Right Sidebar: Other Lotteries Buttons ---------- */
.other-lotteries-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lottery-sidebar-btn {
  display: block;
  background: var(--color-surface-tertiary);
  color: var(--color-text-primary);
  padding: 10px 15px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border-left: 4px solid var(--color-accent);
  transition: all 0.2s ease;
}

.lottery-sidebar-btn:hover {
  background: var(--color-accent);
  color: #fff;
  transform: translateX(3px);
}

/* ---------- Centre column ---------- */
.pillar-main-content {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  width: 100%;
}

.datochai-title {
  text-align: center;
}

/* ---------- Tablet / Mobile ---------- */
@media (max-width: 1024px) {
  .datochai-pillar-wrapper {
    grid-template-columns: 1fr 250px;
  }
  .left-sidebar {
    grid-column: 1; grid-row: 1;
    position: relative; top: 0;
    margin-bottom: -10px;
  }
  .pillar-main-content {
    grid-column: 1; grid-row: 2;
  }
  .right-sidebar {
    grid-column: 2; grid-row: 1 / span 2;
    position: sticky; top: 100px;
  }
  .left-sidebar .pillar-widget { padding: 15px 20px; }
  .widget-title.toc-title {
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; margin-bottom: 0; border-bottom: none;
  }
  .toc-toggle-btn {
    display: block; font-size: 16px; color: var(--color-accent);
    transition: transform 0.3s ease;
  }
  .toc-collapsible-area {
    display: none; padding-top: 15px; margin-top: 10px;
    border-top: 1px solid var(--color-border-secondary);
  }
  .toc-collapsible-area.active { display: block; }
  .widget-title.toc-title.active .toc-toggle-btn { transform: rotate(180deg); }
}

@media (max-width: 768px) {
  .datochai-pillar-wrapper {
    grid-template-columns: 1fr; display: flex; flex-direction: column;
  }
  .left-sidebar { order: 1; margin-bottom: 20px; width: 100%; }
  .pillar-main-content { order: 2; width: 100%; }
  .right-sidebar { order: 3; margin-top: 30px; width: 100%; position: relative; top: 0; }
  .other-lotteries-grid { flex-direction: row; flex-wrap: wrap; }
  .lottery-sidebar-btn { flex: 1 1 45%; text-align: center; padding: 12px 10px; }
}

.datochai-pillar-wrapper,
.layout-wrapper {
  overflow: visible !important;
}