/* ============================================================
   series.css — BeSecureWise Series Feature
   All CSS custom properties inherit from the main design system.
   --series-color is set inline per-card from accent_color.
   ============================================================ */


/* ── SECTION WRAPPER ────────────────────────────────────── */

#series-section .section-hero {
    background: radial-gradient(ellipse 80% 60% at 50% -10%,
            rgba(0, 191, 165, .12) 0%, transparent 70%),
        var(--section-bg-a, #0b1120);
    padding: 3.5rem 0 2.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(148, 163, 184, .08);
}

.series-hero__eyebrow {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #00BFA5;
    margin-bottom: .6rem;
}

.series-hero__title {
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    font-weight: 800;
    color: var(--text-primary, #e8f0fe);
    letter-spacing: -0.5px;
    margin: 0 0 .7rem;
}

.series-hero__sub {
    font-size: 1rem;
    color: var(--text-muted, #8899aa);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.6;
}


/* ── GRID ────────────────────────────────────────────────── */

.series-grid-wrap {
    padding: 2.5rem 0 4rem;
}

.series-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.4rem;
    align-items: start;
}

/* When a card is open it spans the full grid width */
.series-card.is-open {
    grid-column: 1 / -1;
}

@media (max-width: 700px) {
    .series-grid {
        grid-template-columns: 1fr;
    }
}


/* ── SERIES CARD ─────────────────────────────────────────── */

.series-card {
    --series-color: #00BFA5;
    /* overridden inline */
    background: rgba(15, 30, 53, .85);
    border: 1px solid rgba(148, 163, 184, .11);
    border-radius: 18px;
    overflow: hidden;
    transition: box-shadow .22s ease, transform .2s ease, border-color .2s ease;
    position: relative;
}

.series-card:not(.is-open):hover {
    transform: translateY(-4px);
    border-color: rgba(var(--series-color-rgb, 0, 191, 165), .3);
    box-shadow:
        0 18px 48px rgba(0, 0, 0, .35),
        0 0 0 1px rgba(var(--series-color-rgb, 0, 191, 165), .15),
        0 0 32px color-mix(in srgb, var(--series-color) 12%, transparent);
}

/* Top accent strip */
.series-card__strip {
    height: 4px;
    background: linear-gradient(90deg, var(--series-color), transparent 90%);
}


/* ── CARD HEADER ─────────────────────────────────────────── */

.series-card__head {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.3rem 1.4rem .85rem;
}

.series-card__icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 13px;
    background: color-mix(in srgb, var(--series-color) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--series-color) 30%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    transition: transform .2s;
}

.series-card:not(.is-open):hover .series-card__icon-wrap {
    transform: scale(1.08) rotate(-3deg);
}

.series-card__titles {
    flex: 1;
    min-width: 0;
}

.series-card__name {
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--text-primary, #e8f0fe);
    margin: 0 0 .35rem;
    line-height: 1.3;
}

.series-card__badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .3px;
    color: var(--series-color);
    background: color-mix(in srgb, var(--series-color) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--series-color) 25%, transparent);
    padding: .18rem .6rem;
    border-radius: 20px;
}

.series-card__desc {
    padding: 0 1.4rem .85rem;
    font-size: .875rem;
    color: var(--text-muted, #8899aa);
    line-height: 1.62;
}


/* ── ARTICLE PREVIEW (collapsed state) ───────────────────── */

.series-card__preview {
    margin: 0 1.4rem .9rem;
    display: flex;
    flex-direction: column;
    gap: .38rem;
    padding: .75rem 1rem;
    background: rgba(148, 163, 184, .04);
    border: 1px solid rgba(148, 163, 184, .08);
    border-radius: 10px;
}

.series-preview-row {
    display: flex;
    align-items: center;
    gap: .65rem;
    font-size: .82rem;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.4;
}

.series-preview-row__num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--series-color) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--series-color) 30%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .68rem;
    font-weight: 800;
    color: var(--series-color);
    flex-shrink: 0;
}

.series-preview-row__more {
    font-size: .78rem;
    color: var(--text-muted, #8899aa);
    padding-left: 1.7rem;
    font-style: italic;
}


/* ── CARD FOOTER ─────────────────────────────────────────── */

.series-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 1.4rem 1.1rem;
    border-top: 1px solid rgba(148, 163, 184, .07);
}

.series-card__cat {
    font-size: .75rem;
    color: var(--text-muted, #8899aa);
    display: flex;
    align-items: center;
    gap: .3rem;
}

.series-expand-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .82rem;
    font-weight: 700;
    color: var(--series-color);
    background: color-mix(in srgb, var(--series-color) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--series-color) 28%, transparent);
    border-radius: 9px;
    padding: .4rem .9rem;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .12s;
    white-space: nowrap;
}

.series-expand-btn:hover {
    background: color-mix(in srgb, var(--series-color) 16%, transparent);
    border-color: var(--series-color);
    transform: scale(1.02);
}

.series-expand-btn .btn-arrow {
    transition: transform .2s;
    display: inline-block;
}

.series-card.is-open .series-expand-btn .btn-arrow {
    transform: rotate(180deg);
}


/* ── EXPANDED PANEL ──────────────────────────────────────── */

.series-expanded-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height .42s cubic-bezier(.4, 0, .2, 1);
}

.series-card.is-open .series-expanded-panel {
    max-height: 3000px;
    /* large enough for any series */
}

.series-expanded-inner {
    border-top: 1px solid rgba(148, 163, 184, .09);
    padding: 1.6rem 1.4rem 1.8rem;
}

/* Two-column layout on wide screens */
.series-expanded-body {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2.4rem;
    align-items: start;
}

@media (max-width: 860px) {
    .series-expanded-body {
        grid-template-columns: 1fr;
        gap: 1.6rem;
    }
}

/* Left: series summary */
.series-expanded-meta {
    position: sticky;
    top: 1rem;
}

.series-expanded-meta__icon {
    font-size: 2.5rem;
    margin-bottom: .7rem;
}

.series-expanded-meta__title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary, #e8f0fe);
    line-height: 1.25;
    margin: 0 0 .5rem;
}

.series-expanded-meta__desc {
    font-size: .88rem;
    color: var(--text-muted, #8899aa);
    line-height: 1.65;
    margin: 0 0 1.2rem;
}

.series-progress {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.series-progress__label {
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted, #8899aa);
    letter-spacing: .3px;
    text-transform: uppercase;
}

.series-progress__bar-wrap {
    height: 5px;
    background: rgba(148, 163, 184, .12);
    border-radius: 3px;
    overflow: hidden;
}

.series-progress__bar {
    height: 100%;
    background: var(--series-color);
    border-radius: 3px;
    transition: width .5s ease;
}

.series-collapse-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted, #8899aa);
    background: none;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 8px;
    padding: .38rem .8rem;
    cursor: pointer;
    margin-top: 1.2rem;
    transition: color .15s, border-color .15s;
}

.series-collapse-btn:hover {
    color: var(--text-primary, #e8f0fe);
    border-color: rgba(148, 163, 184, .35);
}


/* ── ARTICLE TIMELINE ────────────────────────────────────── */

.series-timeline {
    position: relative;
    padding-left: 0;
}

/* Vertical connecting line */
.series-timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 24px;
    bottom: 24px;
    width: 2px;
    background: linear-gradient(to bottom,
            var(--series-color),
            color-mix(in srgb, var(--series-color) 20%, transparent));
    border-radius: 1px;
}

.series-step {
    display: flex;
    gap: 1.2rem;
    padding-bottom: 1.8rem;
    position: relative;
}

.series-step:last-child {
    padding-bottom: 0;
}

/* Number node */
.series-step__node {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--series-color);
    color: #fff;
    font-size: .75rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    box-shadow:
        0 0 0 4px color-mix(in srgb, var(--series-color) 16%, transparent),
        0 4px 12px color-mix(in srgb, var(--series-color) 35%, transparent);
    transition: transform .15s, box-shadow .15s;
}

.series-step:hover .series-step__node {
    transform: scale(1.12);
    box-shadow:
        0 0 0 6px color-mix(in srgb, var(--series-color) 20%, transparent),
        0 6px 18px color-mix(in srgb, var(--series-color) 45%, transparent);
}

.series-step__body {
    flex: 1;
    min-width: 0;
    padding-top: .2rem;
}

.series-step__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .8rem;
    margin-bottom: .35rem;
}

.series-step__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary, #e8f0fe);
    line-height: 1.35;
    flex: 1;
}

.series-step__excerpt {
    font-size: .845rem;
    color: var(--text-muted, #8899aa);
    line-height: 1.58;
    margin: 0 0 .75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.series-step__read {
    display: inline-flex;
    align-items: center;
    gap: .38rem;
    font-size: .8rem;
    font-weight: 700;
    color: #fff;
    background: var(--series-color);
    border: none;
    border-radius: 8px;
    padding: .4rem .9rem;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
}

.series-step__read:hover {
    opacity: .86;
}

.series-step__read:active {
    transform: scale(.97);
}

/* Connector dot to the line */
.series-step__node::after {
    content: '';
    display: none;
    /* line is handled by ::before on timeline */
}

/* Empty state */
.series-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted, #8899aa);
}

.series-empty__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: .5;
}

.series-empty__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #e8f0fe);
    margin: 0 0 .5rem;
}

/* Loading skeleton */
.series-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.4rem;
}

.series-skeleton__card {
    height: 280px;
    border-radius: 18px;
    background: linear-gradient(90deg,
            rgba(148, 163, 184, .06) 25%,
            rgba(148, 163, 184, .12) 50%,
            rgba(148, 163, 184, .06) 75%);
    background-size: 200% 100%;
    animation: series-shimmer 1.5s infinite;
}

@keyframes series-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* URL state indicator */
.series-breadcrumb {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .8rem;
    color: var(--text-muted, #8899aa);
    margin-bottom: 1.2rem;
    padding: .5rem 0;
}

.series-breadcrumb__link {
    color: var(--text-muted, #8899aa);
    cursor: pointer;
    text-decoration: none;
    transition: color .15s;
}

.series-breadcrumb__link:hover {
    color: #00BFA5;
}

.series-breadcrumb__sep {
    opacity: .4;
}


/* ── CMS SERIES MANAGEMENT ────────────────────────────────── */

.series-manage-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 640px) {
    .series-manage-grid {
        grid-template-columns: 1fr;
    }
}

.series-manage-card {
    background: rgba(148, 163, 184, .05);
    border: 1px solid rgba(148, 163, 184, .12);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
}

.series-manage-card__info {
    flex: 1;
}

.series-manage-card__name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: .95rem;
}

.series-manage-card__meta {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .15rem;
}

.series-manage-card__actions {
    display: flex;
    gap: .4rem;
}


/* ── CMS TAB BAR ─────────────────────────────────────────── */

.cms-tab-bar {
    display: flex;
    gap: .4rem;
    margin: 1rem 0 1.4rem;
    border-bottom: 1px solid rgba(148, 163, 184, .12);
    padding-bottom: 0;
}

.cms-tab {
    padding: .55rem 1.2rem;
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    border-radius: 0;
}

.cms-tab:hover {
    color: var(--text-primary);
}

.cms-tab.active {
    color: #00BFA5;
    border-bottom-color: #00BFA5;
}

.cms-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: .35rem;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    line-height: 1;
}

.cms-tab-badge.hidden {
    display: none;
}


/* ── SUGGESTIONS MODERATION ──────────────────────────────── */

.suggest-kind-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .25rem .6rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 600;
    white-space: nowrap;
}

.suggest-kind-badge--topic {
    background: rgba(20, 184, 166, .14);
    border: 1px solid rgba(20, 184, 166, .32);
    color: #5eead4;
}

.suggest-kind-badge--question {
    background: rgba(99, 102, 241, .14);
    border: 1px solid rgba(99, 102, 241, .32);
    color: #a5b4fc;
}

.suggest-body-cell {
    max-width: 360px;
    white-space: normal;
    line-height: 1.4;
}

.status-pill.status-new {
    background: rgba(56, 189, 248, .15);
    color: #7dd3fc;
}

.status-pill.status-reviewed {
    background: rgba(250, 204, 21, .15);
    color: #fde047;
}

.status-pill.status-answered {
    background: rgba(34, 197, 94, .15);
    color: #86efac;
}

.status-pill.status-archived {
    background: rgba(148, 163, 184, .15);
    color: #cbd5e1;
}


/* ── SERIES MANAGEMENT PANEL ─────────────────────────────── */

.series-mgmt-wrap {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 2rem;
    align-items: start;
    margin-top: .5rem;
}

@media (max-width: 860px) {
    .series-mgmt-wrap {
        grid-template-columns: 1fr;
    }
}

/* Existing series list */
.series-mgmt-list {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.series-mgmt-row {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .8rem 1rem;
    background: rgba(148, 163, 184, .05);
    border: 1px solid rgba(148, 163, 184, .1);
    border-radius: 10px;
    transition: border-color .15s, background .15s;
}

.series-mgmt-row:hover {
    background: rgba(148, 163, 184, .08);
    border-color: rgba(148, 163, 184, .2);
}

.series-mgmt-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    width: 38px;
    text-align: center;
}

.series-mgmt-info {
    flex: 1;
    min-width: 0;
}

.series-mgmt-info strong {
    display: block;
    font-size: .92rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.series-mgmt-info .cms-muted-light {
    font-size: .76rem;
    color: var(--text-muted);
}

.series-mgmt-actions {
    display: flex;
    gap: .35rem;
    flex-shrink: 0;
}

/* Create / edit form */
.series-mgmt-form-wrap {
    background: rgba(148, 163, 184, .04);
    border: 1px solid rgba(148, 163, 184, .1);
    border-radius: 14px;
    padding: 1.4rem 1.5rem 1.5rem;
}

.series-mgmt-form-wrap h3 {
    margin: 0 0 1.1rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.series-mgmt-form {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 540px) {
    .series-mgmt-form {
        grid-template-columns: 1fr;
    }
}

.series-mgmt-row.is-start-here {
    border-color: rgba(232, 93, 4, .4);
}

.series-sh-tag {
    font-size: .7rem;
    font-weight: 600;
    color: #E85D04;
    margin-left: .4rem;
}

.btn-sh-active {
    color: #E85D04;
    border-color: rgba(232, 93, 4, .35);
    background: rgba(232, 93, 4, .12);
}