/* Container */
.imran-toc-card {
    width: 100%;
    max-width: 380px;
    background: #ffffff;
    border-radius: 12px;
    padding: 10px;
    border: 0px;
    margin-bottom: 15px;
}

.imran-toc-card.auto-toc {
    padding: 20px;
    max-width: 100%;
}
@media (max-width: 767px) {
  .imran-toc-card.auto-toc {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    border: 1px solid #f0f0f0;
  }
}

/* Header */
.imran-toc-header {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding-bottom: 5px;
}

.imran-toc-icon {
    color: #0066ff;
    display: flex;
    align-items: center;
}

.toc-icon {
    transition: transform 0.3s ease;
}

.imran-toc-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a202c;
}

/* Timeline List */
.imran-toc-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 20px 0 0 8px !important;
    position: relative;
    max-height: 2000px; /* Large height for smooth transition */
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    opacity: 1;
    text-align: left;
}

/* The Vertical Line */
.imran-toc-list::after {
    content: "";
    position: absolute;
    left: 8px;
    top: 10px;
    bottom: 20px;
    width: 2px;
    background: #f1f3f5;
    z-index: 1;
}

/* List Items */
.imran-toc-list li {
    position: relative;
    padding-left: 32px;
    margin-bottom: 22px;
    display: block;
}

.imran-toc-list li:last-child {
    margin-bottom: 5px;
}

/* The Dots */
.imran-toc-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 5px;
    width: 14px;
    height: 14px;
    background: #e2e8f0; /* Default Grey Dot */
    border: 3px solid #fff;
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 0 0 1px #f1f3f5;
}

/* Active/First Dot (Blue) */
.imran-toc-list li:first-child::before {
    background: #0066ff;
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.1);
}

/* Links */
.imran-toc-list a {
    color: #6B7280;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500 !important;
    line-height: 1.4;
    transition: color 0.2s;
}

.imran-toc-list li:first-child a {
    color: #0066ff;
    font-weight: 600;
}

.imran-toc-list a:hover {
    color: #0066ff;
}

/* ===============================
   TOGGLE LOGIC (JS COMPATIBLE)
================================ */

/* Initial state for auto-toc: Hide until opened */
.imran-toc-card.auto-toc:not(.opened) .imran-toc-list {
    max-height: 0;
    opacity: 0;
    margin-top: 0 !important;
}

/* Manual toggle state */
.imran-toc-card.collapsed .imran-toc-list {
    max-height: 0;
    opacity: 0;
    margin-top: 0 !important;
}

/* Rotate Icon when closed */
.imran-toc-card.auto-toc:not(.opened) .toc-icon,
.imran-toc-card.collapsed .toc-icon {
    transform: rotate(-90deg);
}

/* Desktop Logic */
@media (min-width: 769px) {
    .imran-toc-card.auto-toc { display: none !important; }
}