/**
 * Learning Paths page — tabs, flowcharts, badges (Google Cloud Docs style).
 */

.learning-paths-page {
    background: #ffffff;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.learning-paths-layout {
    display: block;
}

.learning-paths-content {
    flex: 1;
    padding: 40px 48px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.learning-paths-content > .content-header {
    margin-bottom: 24px;
    padding: 18px 28px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 50%, #f8f9fa 100%);
    border-radius: 8px;
    border: 1px solid #e8eaed;
}

.learning-paths-content > .content-header .content-title {
    font-size: 28px;
    font-weight: 400;
    color: #202124;
    margin: 0 0 6px;
    line-height: 1.2;
}

.learning-paths-content > .content-header .content-subtitle {
    font-size: 15px;
    color: #5f6368;
    margin: 0;
    line-height: 1.5;
}

.content-header {
    margin-bottom: 32px;
    padding: 32px 40px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 50%, #f8f9fa 100%);
    border-radius: 8px;
    border: 1px solid #e8eaed;
}

.content-title {
    font-size: 32px;
    font-weight: 400;
    color: #202124;
    margin: 0 0 12px;
    line-height: 1.2;
}

.content-subtitle {
    font-size: 16px;
    color: #5f6368;
    margin: 0;
    line-height: 1.6;
}

/* ── Sticky tab bar ─────────────────────────────────────────────── */
.lp-tab-nav {
    position: sticky;
    top: var(--sdc-header-h, 3.5rem);
    z-index: 90;
    background: #ffffff;
    border-bottom: 1px solid #e8eaed;
    margin: 0 -48px 0;
    padding: 0 48px;
}

body.admin-bar .lp-tab-nav {
    top: calc(var(--sdc-header-h, 3.5rem) + 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar .lp-tab-nav {
        top: calc(var(--sdc-header-h, 3.5rem) + 46px);
    }
}

.lp-tab-inner {
    display: flex;
    gap: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.lp-tab-inner::-webkit-scrollbar {
    display: none;
}

.lp-tab {
    flex-shrink: 0;
    scroll-snap-align: start;
    padding: 14px 20px;
    font-size: 13px;
    font-weight: 500;
    color: #5f6368;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    font-family: inherit;
}

.lp-tab:hover {
    color: #202124;
}

.lp-tab.active {
    color: #1a73e8;
    border-bottom-color: #1a73e8;
}

.lp-panel {
    display: none;
    padding: 40px 0;
}

.lp-panel.active {
    display: block;
}

.lp-how-to {
    margin-bottom: 24px;
}

.lp-how-to h2 {
    font-size: 20px;
    font-weight: 500;
    color: #202124;
    margin: 0 0 8px;
}

.lp-how-to p {
    font-size: 14px;
    color: #5f6368;
    line-height: 1.6;
    margin: 0;
}

.track-section-title {
    font-size: 24px;
    font-weight: 500;
    color: #202124;
    margin: 0 0 8px;
}

.track-section-desc {
    font-size: 14px;
    color: #5f6368;
    margin: 0 0 24px;
    line-height: 1.6;
}

/* ── Level badges ─────────────────────────────────────────────────── */
.level-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
}

.level-badge.l1 { background: #EAF3DE; color: #3B6D11; }
.level-badge.l2 { background: #E6F1FB; color: #185FA5; }
.level-badge.l3 { background: #FAEEDA; color: #854F0B; }
.level-badge.l4 { background: #EEEDFE; color: #534AB7; }
.level-badge.l5 { background: #FAECE7; color: #993C1D; }
.level-badge.gap {
    background: transparent;
    border: 1.5px dashed #888780;
    color: #5F5E5A;
}

.path-card .level-badge {
    position: absolute;
    top: 12px;
    right: 12px;
}

.lp-all-course-card {
    position: relative;
    display: block;
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.lp-all-course-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #dadce0;
    transform: translateY(-2px);
}

.lp-all-course-card .level-badge {
    position: static;
}

.lp-all-course-badges {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
    max-width: calc(100% - 20px);
}

.lp-track-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    border: 1px solid transparent;
}

.lp-track-badge-java { background: #E6F4F0; color: #0F6E56; border-color: #B8E0D4; }
.lp-track-badge-ai { background: #EEEDFE; color: #534AB7; border-color: #D4D2F7; }
.lp-track-badge-devops { background: #FAEEDA; color: #854F0B; border-color: #F0D9A8; }
.lp-track-badge-electives { background: #F1F3F4; color: #5F6368; border-color: #DADCE0; }

.path-card .path-badges .lp-track-badge {
    position: static;
}

.lp-electives-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid #e8eaed;
}

.lp-all-courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* ── Flowchart containers (match category diagram) ────────────────── */
.learning-paths-content,
.learning-paths-page .lp-panel {
    overflow-x: visible;
}

.lp-flowchart-container,
.category-diagram-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 40px;
    border: 1px solid #e8eaed;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.lp-flowchart,
.category-diagram {
    width: 100%;
    min-height: 300px;
    position: relative;
}

.lp-flowchart svg,
.category-diagram svg {
    display: block;
    margin: 0 auto;
    max-width: none;
    min-width: 320px;
}

.lp-flowchart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-top: 16px;
    font-size: 12px;
    color: #5f6368;
}

.lp-flowchart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.lp-legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.lp-legend-swatch.dashed {
    background: #fff;
    border: 1.5px dashed #888780;
}

.lp-legend-swatch.connector {
    width: 28px;
    height: 14px;
    background: transparent;
    border: none;
    border-radius: 0;
    position: relative;
    overflow: visible;
}

.lp-legend-swatch.connector::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 18px;
    height: 0;
    border-top: 2px dashed #dadce0;
    transform: translateY(-50%);
}

.lp-legend-swatch.connector::after {
    content: '';
    position: absolute;
    right: 1px;
    top: 50%;
    transform: translateY(-50%);
    border: 4px solid transparent;
    border-left: 6px solid #dadce0;
}

.lp-edge-line {
    stroke: #dadce0;
    stroke-width: 2;
    stroke-dasharray: 4, 4;
    stroke-linecap: round;
}

/* Mobile stepper fallback */
.lp-flowchart-stepper {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: lp-step;
}

.lp-flowchart-stepper li {
    counter-increment: lp-step;
    position: relative;
    padding: 0 0 20px 36px;
    border-left: 2px dashed #dadce0;
    margin-left: 12px;
}

.lp-flowchart-stepper li:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.lp-flowchart-stepper li::before {
    content: counter(lp-step);
    position: absolute;
    left: -13px;
    top: 0;
    width: 24px;
    height: 24px;
    background: #1a73e8;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lp-stepper-title {
    font-size: 14px;
    font-weight: 600;
    color: #202124;
    margin: 0 0 4px;
}

.lp-stepper-sub {
    font-size: 12px;
    color: #5f6368;
    margin: 0 0 4px;
}

.lp-stepper-meta {
    font-size: 11px;
    color: #5f6368;
}

@media (max-width: 767px) {
    .lp-flowchart svg {
        display: none !important;
    }

    .lp-flowchart-stepper {
        display: block;
        padding: 20px 16px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .lp-flowchart .annotation {
        display: none;
    }
}

/* ── Technology areas grid ──────────────────────────────────────── */
.tech-areas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.tech-area-card {
    background: #ffffff;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    padding: 24px;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.tech-area-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #dadce0;
    transform: translateY(-2px);
}

.tech-areas-grid .tech-area-card .tech-area-description {
    display: none;
}

.tech-area-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
}

.tech-area-icon {
    font-size: 32px;
    margin-right: 16px;
    flex-shrink: 0;
}

.tech-area-title {
    font-size: 20px;
    font-weight: 400;
    color: #202124;
    margin: 0 0 4px;
}

.tech-area-count {
    font-size: 14px;
    color: #5f6368;
    margin: 0;
}

.tech-area-description {
    font-size: 14px;
    color: #5f6368;
    line-height: 1.6;
    margin: 0;
    flex-grow: 1;
}

/* ── Path cards ───────────────────────────────────────────────────── */
.paths-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.path-card {
    background: #ffffff;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    padding: 24px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.path-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #dadce0;
    transform: translateY(-2px);
}

.path-card-title {
    font-size: 18px;
    font-weight: 500;
    color: #1a73e8;
    margin: 0 0 12px;
    line-height: 1.4;
    padding-right: 48px;
}

.path-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.path-badge {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
    background: #f1f3f4;
    color: #5f6368;
}

.path-badge-beginner { background: #e8f5e9; color: #2e7d32; }
.path-badge-intermediate { background: #e3f2fd; color: #1976d2; }
.path-badge-advanced { background: #fff3e0; color: #e65100; }

.path-description {
    font-size: 14px;
    color: #5f6368;
    line-height: 1.6;
    margin: 0 0 12px;
    flex-grow: 1;
}

.path-tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

.tech-tag {
    font-size: 11px;
    padding: 3px 8px;
    background: #f8f9fa;
    color: #5f6368;
    border-radius: 3px;
}

/* ── Featured paths ───────────────────────────────────────────────── */
.featured-learning-paths-section {
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid #e8eaed;
}

.featured-paths-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.featured-path-card {
    background: #ffffff;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.featured-path-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #dadce0;
    transform: translateY(-2px);
}

.category-section {
    margin-bottom: 48px;
    padding-top: 24px;
    border-top: 1px solid #e8eaed;
}

.category-section:first-of-type {
    border-top: none;
    padding-top: 0;
}

/* ── Coming soon / gap cards ──────────────────────────────────────── */
.lp-gap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.lp-gap-card {
    position: relative;
    background: #fff;
    border: 1.5px dashed var(--gap-color, #888780);
    border-radius: 8px;
    padding: 20px;
}

.lp-gap-card h3 {
    font-size: 16px;
    font-weight: 500;
    color: #202124;
    margin: 0 0 8px;
    padding-right: 80px;
}

.coming-soon-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #FAEEDA;
    color: #854F0B;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.lp-gap-track {
    font-size: 12px;
    color: #5f6368;
    margin: 0 0 8px;
}

.lp-gap-desc {
    font-size: 13px;
    color: #5f6368;
    line-height: 1.5;
    margin: 0 0 8px;
}

.lp-gap-price {
    font-size: 13px;
    font-weight: 600;
    color: #202124;
    margin: 0 0 12px;
}

.lp-gap-cta {
    font-size: 13px;
    font-weight: 500;
    color: #1a73e8;
    text-decoration: none;
}

.lp-gap-cta:hover {
    text-decoration: underline;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .learning-paths-content {
        padding: 24px 16px;
    }

    .lp-tab-nav {
        margin: 0 -16px;
        padding: 0 16px;
    }

    .learning-paths-content > .content-header {
        padding: 14px 18px;
    }

    .learning-paths-content > .content-header .content-title {
        font-size: 22px;
    }

    .content-header {
        padding: 24px 20px;
    }

    .paths-grid,
    .tech-areas-grid,
    .lp-all-courses-grid {
        grid-template-columns: 1fr;
    }
}

/* Dark mode — inherits from dark-mode.css overrides where present */
html[data-theme="dark"] .learning-paths-page,
html.dark .learning-paths-page {
    background: var(--sdc-rm-dark-bg, #0b0b0f);
}

html[data-theme="dark"] .lp-tab-nav,
html.dark .lp-tab-nav {
    background: var(--sdc-rm-dark-bg, #0b0b0f);
    border-color: #3f3f46;
}

html[data-theme="dark"] .lp-tab,
html.dark .lp-tab {
    color: #a1a1aa;
}

html[data-theme="dark"] .lp-tab.active,
html.dark .lp-tab.active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}

/* ── Admin flowchart editor ─────────────────────────────────────── */
.lp-editor-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: #202124;
    color: #fff;
    border-top: 2px solid #1a73e8;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.lp-editor-toolbar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
}

.lp-editor-label {
    font-size: 13px;
    font-weight: 600;
    margin-right: 8px;
}

.lp-editor-btn {
    font-size: 12px;
    font-weight: 500;
    padding: 8px 14px;
    border: 1px solid #5f6368;
    border-radius: 4px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
}

.lp-editor-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.lp-editor-btn-primary {
    background: #1a73e8;
    border-color: #1a73e8;
}

.lp-editor-btn-primary:hover {
    background: #1557b0;
}

.lp-editor-btn-danger {
    border-color: #d93025;
    color: #f28b82;
}

.lp-editor-status {
    font-size: 12px;
    color: #9aa0a6;
    margin-left: auto;
}

.lp-editor-status.is-ok {
    color: #81c995;
}

.lp-editor-status.is-error {
    color: #f28b82;
}

.lp-editor-hint {
    margin: 0;
    padding: 0 20px 10px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    font-size: 11px;
    color: #9aa0a6;
}

body.lp-editor-active {
    padding-bottom: 88px;
}

.lp-track-badge-system-design { background: #E8F0FE; color: #1a73e8; border-color: #AECBFA; }

body.lp-editor-active .lp-flow-node {
    filter: drop-shadow(0 2px 4px rgba(26, 115, 232, 0.15));
    pointer-events: none;
}

body.lp-editor-active .lp-flow-node .lp-node-hit {
    pointer-events: all;
    cursor: grab;
}

body.lp-editor-active .lp-flow-edges {
    pointer-events: all;
}

body.lp-editor-active .lp-flow-edge .lp-edge-hit {
    cursor: pointer;
}

body.lp-editor-active .lp-flow-edge .lp-edge-line {
    cursor: pointer;
}

body.lp-editor-active .lp-flow-edge-hover:not(.lp-flow-edge-selected) .lp-edge-line {
    stroke: #1a73e8;
    stroke-width: 2.5;
    filter: drop-shadow(0 0 3px rgba(26, 115, 232, 0.35));
}

body.lp-editor-active .lp-flow-node-dragging {
    filter: drop-shadow(0 6px 12px rgba(26, 115, 232, 0.35));
    opacity: 0.95;
}

body.lp-editor-active .lp-flow-edge-custom .lp-edge-line {
    stroke: #1a73e8;
    stroke-width: 2.5;
}

body.lp-editor-active .lp-flow-edge-selected .lp-edge-line {
    stroke: #1a73e8;
    stroke-width: 3;
    stroke-dasharray: none;
    filter: drop-shadow(0 0 2px rgba(26, 115, 232, 0.45));
}

body.lp-editor-active .lp-edge-handle {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

body.lp-editor-active .lp-flow-edge-hover .lp-edge-handle {
    opacity: 0.45;
    pointer-events: none;
}

body.lp-editor-active .lp-flow-edge-selected .lp-edge-handle {
    opacity: 1;
    pointer-events: all;
    cursor: crosshair;
}

body.lp-editor-active .lp-flow-edge-selected.lp-flow-edge-dragging .lp-edge-line {
    stroke: #1557b0;
    stroke-width: 3.5;
}

body.lp-editor-active .lp-edge-hit {
    cursor: pointer;
}

body.lp-editor-active .lp-edge-handle:hover {
    fill: #1557b0;
    r: 8;
}

body.lp-editor-active .category-diagram-container {
    outline: 2px dashed #1a73e8;
    outline-offset: 4px;
}

.lp-editor-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lp-editor-modal-panel {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    width: fit-content;
    min-width: min(18rem, calc(100vw - 2.5rem));
    max-width: min(28rem, calc(100vw - 2.5rem));
    height: fit-content;
    max-height: calc(100vh - 2.5rem);
    overflow: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

.lp-editor-modal-panel h3 {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 500;
    color: #202124;
}

.lp-editor-modal-panel label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #5f6368;
    margin-bottom: 12px;
}

.lp-editor-modal-panel input {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.lp-editor-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

.lp-editor-modal-actions .lp-editor-btn {
    color: #202124;
    border-color: #dadce0;
}

.lp-editor-modal-actions .lp-editor-btn-primary {
    color: #fff;
}
