/* ==========================================
   DSA ENGINE — Additive Styles
   Extends existing Study Hub design system.
   All styles use existing CSS variables.
   ========================================== */

/* ─── Category Group ─── */
.dsa-cat-group {
    margin-bottom: 1px;
}

/* ─── Category Button (nested inside DSA topic-list) ─── */
.dsa-cat-btn {
    width: 100%;
    padding: 0.55rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--sidebar-bg);
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background var(--transition-speed);
    text-align: left;
    position: relative;
}

.dsa-cat-btn:hover {
    background: var(--sidebar-hover);
}

.dsa-cat-btn .cat-icon {
    font-size: 0.9rem;
    opacity: 0.85;
}

.dsa-cat-btn .count {
    margin-left: auto;
    background: var(--surface);
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-family: var(--font-sans);
}

.dsa-cat-btn .arrow {
    font-size: 0.5rem;
    transition: transform 0.25s ease;
    color: var(--text-muted);
    margin-left: 0.35rem;
}

.dsa-cat-btn.open .arrow {
    transform: rotate(90deg);
}

/* ─── Category Progress Bar (inside button) ─── */
.dsa-cat-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
}

.dsa-cat-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--brand-gradient);
    border-radius: 0 1px 0 0;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Topics Container ─── */
.dsa-cat-topics {
    display: none;
}

.dsa-cat-topics.open {
    display: block;
    animation: slideDown 0.2s ease;
}

/* ─── Subcategory Label ─── */
.dsa-sub-label {
    padding: 0.45rem 1.25rem 0.25rem 2rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-display);
    border-top: 1px solid var(--border);
    margin-top: 0.15rem;
}

.dsa-sub-label:first-child {
    border-top: none;
    margin-top: 0;
}

/* ─── Topic links inside DSA categories ─── */
#dsaList .topic-link {
    padding-left: 2.2rem;
}

/* ─── Roadmap Link ─── */
.dsa-roadmap-link {
    padding: 0.4rem 0.5rem;
}

.dsa-roadmap-btn {
    width: 100%;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(139, 92, 246, 0.06);
    border: 1px dashed rgba(139, 92, 246, 0.25);
    border-radius: var(--radius-md);
    color: var(--accent-primary);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.dsa-roadmap-btn:hover {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: var(--shadow-glow);
}

/* ─── Previous / Next Navigation ─── */
.dsa-prev-next {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    backdrop-filter: blur(12px);
}

.dsa-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-speed);
    max-width: 45%;
    text-align: left;
    font-family: var(--font-sans);
}

.dsa-nav-btn:hover {
    background: var(--sidebar-hover);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.dsa-nav-next {
    margin-left: auto;
    text-align: right;
}

.dsa-nav-arrow {
    font-size: 1.1rem;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.dsa-nav-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dsa-nav-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 500;
}

.dsa-nav-title {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Search Suggestions ─── */
.dsa-search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 200;
    max-height: 320px;
    overflow-y: auto;
    margin-top: 4px;
}

.dsa-sg-group {
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border);
}

.dsa-sg-group:last-child {
    border-bottom: none;
}

.dsa-sg-category {
    padding: 0.4rem 0.85rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--accent-primary);
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dsa-sg-item {
    padding: 0.4rem 0.85rem 0.4rem 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    transition: background var(--transition-speed);
}

.dsa-sg-item:hover {
    background: var(--sidebar-hover);
}

.dsa-sg-title {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 500;
}

.dsa-sg-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ─── Breadcrumb Segments ─── */
.dsa-bc-segment {
    color: var(--text-muted);
    font-weight: 400;
}

.dsa-bc-sub {
    font-size: 0.78rem;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
    .dsa-prev-next {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .dsa-nav-btn {
        padding: 0.4rem 0.6rem;
        gap: 0.4rem;
    }

    .dsa-nav-title {
        font-size: 0.72rem;
    }
}

@media (max-width: 480px) {
    .dsa-nav-title {
        display: none;
    }

    .dsa-nav-label {
        font-size: 0.7rem;
    }
}
