/* Together Academy - Student Progress View */

:root {
    --ta-primary: #2563eb;
    --ta-primary-dark: #1d4ed8;
    --ta-success: #16a34a;
    --ta-warning: #d97706;
    --ta-bg: #f8fafc;
    --ta-card-bg: #ffffff;
    --ta-border: #e2e8f0;
    --ta-text: #1e293b;
    --ta-text-muted: #64748b;
    --ta-radius: 12px;
    --ta-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --ta-shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

/* ── Wrapper ── */
.ta-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--ta-text);
}

.ta-header { margin-bottom: 28px; }
.ta-header h2 { font-size: 1.8rem; font-weight: 700; margin: 0 0 6px; }
.ta-welcome { color: var(--ta-text-muted); margin: 0; }

/* ── Program block ── */
.ta-program {
    background: var(--ta-card-bg);
    border: 1px solid var(--ta-border);
    border-radius: var(--ta-radius);
    margin-bottom: 24px;
    box-shadow: var(--ta-shadow);
    overflow: hidden;
}

.ta-program-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 22px;
    cursor: pointer;
    background: var(--ta-bg);
    border-bottom: 1px solid var(--ta-border);
    user-select: none;
    transition: background .15s;
}
.ta-program-header:hover { background: #eef2ff; }
.ta-program-header h3 { flex: 1; margin: 0; font-size: 1.15rem; font-weight: 600; }
.ta-program-icon { font-size: 1.4rem; }
.ta-toggle-arrow { color: var(--ta-text-muted); transition: transform .2s; font-size: .85rem; }
.ta-program-header.is-open .ta-toggle-arrow { transform: rotate(180deg); }

.ta-program-body { padding: 22px; }

/* ── Levels ── */
.ta-levels { margin-bottom: 28px; }
.ta-levels h4 { margin: 0 0 14px; font-size: 1rem; font-weight: 600; color: var(--ta-text-muted); text-transform: uppercase; letter-spacing: .05em; }

.ta-levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.ta-level {
    border: 1px solid var(--ta-border);
    border-radius: 10px;
    padding: 14px 16px;
    background: #f8fafc;
    transition: box-shadow .15s, border-color .15s;
}
.ta-level:hover { box-shadow: var(--ta-shadow-md); }
.ta-level--achieved {
    border-color: #86efac;
    background: #f0fdf4;
}
.ta-level--postgrad {
    border-style: dashed;
    border-color: #c4b5fd;
    background: #faf5ff;
}

.ta-level-header {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.ta-level-header strong { font-size: .88rem; line-height: 1.35; flex: 1; min-width: 0; }
.ta-level-badge { font-size: 1.1rem; flex-shrink: 0; }

.ta-tag-postgrad {
    font-size: .7rem;
    background: #ede9fe;
    color: #7c3aed;
    border-radius: 4px;
    padding: 2px 6px;
    font-weight: 600;
    flex-shrink: 0;
}

.ta-level-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 6px;
}
.ta-level-bar-fill {
    height: 100%;
    background: var(--ta-primary);
    border-radius: 99px;
    transition: width .5s ease;
}
.ta-bar--done { background: var(--ta-success); }

.ta-level-stats {
    display: flex;
    justify-content: space-between;
    font-size: .78rem;
    color: var(--ta-text-muted);
}

.ta-level-tesis {
    font-size: .78rem;
    color: var(--ta-text-muted);
    margin-top: 4px;
}

.ta-section--thesis {
    border-left: 3px solid #7c3aed;
    padding-left: 4px;
}

.ta-subsection-title {
    font-size: .9rem;
    font-weight: 600;
    color: var(--ta-text-muted);
    margin: 16px 0 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.ta-level-note {
    font-size: .76rem;
    color: var(--ta-text-muted);
    margin: 8px 0 0;
    line-height: 1.4;
    border-top: 1px dashed var(--ta-border);
    padding-top: 6px;
}

/* ── Sections ── */
.ta-section { margin-bottom: 24px; }
.ta-section h4 {
    margin: 0 0 12px;
    font-size: .95rem;
    font-weight: 600;
}

/* ── Course grid ── */
.ta-course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.ta-course-card {
    border: 1px solid var(--ta-border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--ta-card-bg);
    box-shadow: var(--ta-shadow);
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s, transform .15s;
}
.ta-course-card:hover { box-shadow: var(--ta-shadow-md); transform: translateY(-2px); }

.ta-course-thumb {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
}
.ta-course-thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    font-size: 2rem;
}

.ta-course-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.ta-course-title {
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.35;
    flex: 1;
}

.ta-badge-done {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--ta-success);
    color: white;
    border-radius: 50%;
    font-size: .7rem;
    font-weight: 700;
    align-self: flex-start;
}

.ta-course-price {
    font-weight: 700;
    color: var(--ta-primary);
    font-size: .9rem;
}

.ta-course-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}
.ta-course-bar-fill {
    height: 100%;
    background: var(--ta-primary);
    border-radius: 99px;
    transition: width .4s;
}
.ta-course-pct { font-size: .75rem; color: var(--ta-text-muted); }

/* ── Buttons ── */
.ta-btn {
    display: block;
    text-align: center;
    padding: 7px 12px;
    border-radius: 7px;
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: background .15s, opacity .15s;
    margin-top: auto;
}
.ta-btn--continue  { background: var(--ta-primary); color: #fff !important; }
.ta-btn--continue:hover { background: var(--ta-primary-dark); }
.ta-btn--buy       { background: #16a34a; color: #fff !important; }
.ta-btn--buy:hover { background: #15803d; }
.ta-btn--review    { background: #e2e8f0; color: var(--ta-text) !important; }
.ta-btn--review:hover { background: #cbd5e1; }

/* ── Login notice ── */
.ta-login-notice {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--ta-radius);
    padding: 20px 24px;
    text-align: center;
    color: var(--ta-text);
}
.ta-login-notice a { color: var(--ta-primary); font-weight: 600; }

.ta-empty {
    color: var(--ta-text-muted);
    font-style: italic;
    padding: 12px 0;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .ta-levels-grid,
    .ta-course-grid {
        grid-template-columns: 1fr;
    }
    .ta-program-header h3 { font-size: 1rem; }
}

/* ── v1.1.0 — Sidebar layout ── */

.ta-layout {
    display: flex;
    gap: 0;
    min-height: 500px;
    background: var(--ta-card-bg);
    border: 1px solid var(--ta-border);
    border-radius: var(--ta-radius);
    box-shadow: var(--ta-shadow);
    overflow: hidden;
}

/* Sidebar nav */
.ta-sidebar-nav {
    width: 240px;
    flex-shrink: 0;
    background: #f8fafc;
    border-right: 1px solid var(--ta-border);
    padding: 0;
    overflow-y: auto;
}

.ta-sidebar-title {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--ta-text-muted);
    font-weight: 700;
    padding: 16px 18px 10px;
    margin: 0;
}

.ta-sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ta-sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background .15s, border-color .15s;
    user-select: none;
}

.ta-sidebar-item:hover {
    background: #eef2ff;
}

.ta-sidebar-item.is-active {
    background: #eff6ff;
    border-left-color: var(--ta-primary);
}

.ta-sidebar-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.ta-sidebar-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ta-sidebar-label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--ta-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ta-sidebar-meta {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.ta-sidebar-badge {
    font-size: .68rem;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 600;
}

.ta-sidebar-badge--gold  { background: #fef9c3; color: #92400e; }
.ta-sidebar-badge--green { background: #dcfce7; color: #166534; }
.ta-sidebar-badge--blue  { background: #dbeafe; color: #1e40af; }

.ta-sidebar-arrow {
    color: var(--ta-text-muted);
    font-size: 1.1rem;
    transition: transform .15s;
    flex-shrink: 0;
}

.ta-sidebar-item.is-active .ta-sidebar-arrow {
    transform: rotate(90deg);
    color: var(--ta-primary);
}

/* Right panel */
.ta-panel {
    flex: 1;
    min-width: 0;
    padding: 24px;
    overflow-y: auto;
}

.ta-program-panel {
    display: none;
}

.ta-program-panel.is-active {
    display: block;
    animation: ta-fade-in .2s ease;
}

@keyframes ta-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Solo program (no sidebar) */
.ta-program-solo {
    background: var(--ta-card-bg);
    border: 1px solid var(--ta-border);
    border-radius: var(--ta-radius);
    padding: 24px;
    box-shadow: var(--ta-shadow);
    margin-bottom: 24px;
}

/* Achieved certs banner */
.ta-certs-achieved {
    background: linear-gradient(135deg, #fef9c3, #fef3c7);
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 16px 20px;
    margin-top: 24px;
}

.ta-certs-achieved h4 {
    margin: 0 0 12px;
    font-size: .95rem;
    font-weight: 600;
    color: #78350f;
}

.ta-certs-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ta-cert-achieved {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: .85rem;
    font-weight: 600;
    color: #78350f;
}

/* ── Responsive sidebar ── */
@media (max-width: 720px) {
    .ta-layout {
        flex-direction: column;
    }

    .ta-sidebar-nav {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--ta-border);
    }

    .ta-sidebar-list {
        display: flex;
        overflow-x: auto;
        gap: 0;
    }

    .ta-sidebar-item {
        flex-shrink: 0;
        border-left: none;
        border-bottom: 3px solid transparent;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 12px 14px;
        gap: 4px;
    }

    .ta-sidebar-item.is-active {
        border-bottom-color: var(--ta-primary);
        border-left-color: transparent;
    }

    .ta-sidebar-arrow { display: none; }

    .ta-sidebar-info { align-items: center; }

    .ta-panel { padding: 16px; }
}

/* ── Maestría CTA (nivel con aprobación) ─────── */
.ta-level--maestria-cta {
    border-style: dashed;
    border-color: #a78bfa;
    background: #faf5ff;
}
.ta-btn--maestria-cta {
    width: 100%;
    margin-top: 12px;
    padding: 12px 20px;
    background: #7c3aed;
    color: #fff !important;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.ta-btn--maestria-cta:hover {
    background: #6d28d9;
    color: #fff !important;
}
.ta-modal-maestria {
    max-width: 400px;
}

/* ── Cert buy button ─────────────────────────── */
.ta-btn--cert-buy {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 18px;
    background: #1565c0;
    color: #fff !important;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    transition: background 0.2s;
}
.ta-btn--cert-buy:hover {
    background: #0d47a1;
    color: #fff !important;
}
.ta-cert-purchased {
    margin-top: 10px;
    padding: 8px 12px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

/* ── Cert requirement notice on WC product page ── */
.ta-cert-req {
    display: block;
    font-size: 13px;
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: 500;
}
.ta-cert-req--locked {
    background: #fff3f3;
    color: #c62828;
    border: 1px solid #ffcdd2;
}
.ta-cert-req--unlocked {
    background: #f1f8e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

/* ── Flow tree panel (student view) ─────────────── */
.ta-flow-panel {
    border: 1px solid var(--ta-border);
    border-radius: var(--ta-radius);
    overflow: hidden;
    margin-bottom: 24px;
}

.ta-flow-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 18px;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    font-size: .88rem;
    font-weight: 600;
    color: var(--ta-text);
    text-align: left;
    transition: background .15s;
}
.ta-flow-toggle:hover { background: #e2e8f0; }
.ta-flow-toggle.is-open {
    background: #eff6ff;
    color: var(--ta-primary);
    border-bottom: 1px solid var(--ta-border);
}

.ta-flow-toggle-icon { font-size: 1rem; flex-shrink: 0; }
.ta-flow-toggle-text { flex: 1; }
.ta-flow-toggle-arrow {
    font-size: .65rem;
    color: var(--ta-text-muted);
    transition: transform .2s;
}
.ta-flow-toggle.is-open .ta-flow-toggle-arrow { transform: rotate(180deg); }

.ta-flow-content { padding: 16px 20px 20px; background: var(--ta-card-bg); }

/* Legend */
.ta-ftree-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid var(--ta-border);
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: .78rem;
    color: var(--ta-text-muted);
}
.ta-ftree-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Tree lists */
.ta-ftree-root {
    list-style: none;
    margin: 0;
    padding: 0;
}
.ta-ftree-list {
    list-style: none;
    margin: 4px 0 0;
    padding-left: 22px;
    border-left: 2px solid #e2e8f0;
}
.ta-ftree-item { margin: 3px 0; }

.ta-ftree-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 7px;
    transition: background .1s;
}
.ta-ftree-row:hover { background: #f1f5f9; }

/* Status row backgrounds */
.ta-ftree-item--achieved > .ta-ftree-row { background: #f0fdf4; }
.ta-ftree-item--achieved > .ta-ftree-row:hover { background: #dcfce7; }
.ta-ftree-item--progress > .ta-ftree-row { background: #eff6ff; }
.ta-ftree-item--progress > .ta-ftree-row:hover { background: #dbeafe; }
.ta-ftree-item--available > .ta-ftree-row { background: #fefce8; }
.ta-ftree-item--available > .ta-ftree-row:hover { background: #fef9c3; }
.ta-ftree-item--locked > .ta-ftree-row { opacity: .55; }

.ta-ftree-toggle {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: .62rem;
    padding: 2px 3px;
    color: var(--ta-text-muted);
    transition: transform .15s;
    line-height: 1;
}
.ta-ftree-leaf {
    flex-shrink: 0;
    font-size: .65rem;
    color: #94a3b8;
    padding: 0 3px;
    line-height: 1;
}
.ta-ftree-icon {
    flex-shrink: 0;
    font-size: .9rem;
    line-height: 1;
}
.ta-ftree-label {
    flex: 1;
    font-size: .84rem;
    font-weight: 500;
    line-height: 1.35;
}
.ta-ftree-item--locked .ta-ftree-label { color: var(--ta-text-muted); }

.ta-ftree-badge {
    flex-shrink: 0;
    font-size: .68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
}
.ta-ftree-badge--done      { background: #dcfce7; color: #166534; }
.ta-ftree-badge--progress  { background: #dbeafe; color: #1e40af; }
.ta-ftree-badge--available { background: #fef9c3; color: #92400e; }

.ta-ftree-children-wrap { /* no extra padding — handled by ul */ }

@media (max-width: 600px) {
    .ta-ftree-list { padding-left: 14px; }
    .ta-flow-content { padding: 12px 14px 16px; }
}
