/* ═══════════════════════════════════════════════════════════════
   stp-tree.css — استایل درخت پیشرفت شجره طیبه
   ═══════════════════════════════════════════════════════════════ */

/* ── Wrapper ──────────────────────────────────────────────────── */
.stp-tree-wrap {
    direction: rtl;
    font-family: inherit;
    max-width: 780px;
    margin: 0 auto;
    padding: 16px 0;
}

/* ── آمار بالا ────────────────────────────────────────────────── */
.stp-stats-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.stp-stat-pill {
    background: #f6f7f7;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 13px;
    color: #444;
    white-space: nowrap;
}

.stp-progress-bar {
    flex: 1;
    min-width: 120px;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.stp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3B6D11, #68A523);
    border-radius: 4px;
    transition: width 0.8s ease;
}

/* ── درخت ─────────────────────────────────────────────────────── */
.stp-tree-svg-wrap {
    width: 100%;
    max-width: 340px;
    margin: 0 auto 16px;
}

.stp-tree-svg {
    width: 100%;
    height: auto;
    display: block;
}

/* ── میوه‌ها ──────────────────────────────────────────────────── */
.stp-fruit {
    cursor: default;
    transition: transform 0.15s ease, opacity 0.2s ease;
    transform-box: fill-box;
    transform-origin: center;
}

.stp-fruit--done,
.stp-fruit--active {
    cursor: pointer;
}

.stp-fruit--done:hover,
.stp-fruit--active:hover {
    transform: scale(1.18);
}

.stp-fruit--done:focus,
.stp-fruit--active:focus {
    outline: none;
}
.stp-fruit--done:focus circle,
.stp-fruit--active:focus circle {
    stroke-width: 3;
    stroke-dasharray: 4;
}

/* انیمیشن باز شدن میوه */
@keyframes stp-fruit-pop {
    0%   { transform: scale(0.4); opacity: 0; }
    60%  { transform: scale(1.25); opacity: 1; }
    100% { transform: scale(1); }
}

.stp-fruit--popping {
    animation: stp-fruit-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* تکان خوردن آرام درخت */
@keyframes stp-tree-sway {
    0%,100% { transform: rotate(-0.6deg); }
    50%      { transform: rotate(0.6deg); }
}

.stp-tree-svg .tree-trunk-group {
    transform-origin: 170px 530px;
    animation: stp-tree-sway 6s ease-in-out infinite;
}

/* ── لیست درس‌ها ──────────────────────────────────────────────── */
.stp-list-title {
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin: 0 0 8px;
}

.stp-lesson-list {
    margin-top: 8px;
}

.stp-lessons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 400px;
    overflow-y: auto;
    padding-left: 4px;
}

.stp-lesson-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: #fff;
    transition: background 0.15s, border-color 0.15s;
}

.stp-lesson-row.stp-lesson--approved {
    background: #f0fdf4;
    border-color: #86efac;
}

.stp-lesson-row.stp-lesson--unlocked {
    background: #fffbeb;
    border-color: #fde68a;
}

.stp-lesson-row.stp-lesson--locked {
    opacity: 0.45;
}

.stp-lesson-row.stp-highlight {
    background: #fef9c3;
    border-color: #facc15;
}

.stp-lesson-num {
    font-size: 12px;
    font-weight: 600;
    color: #2271b1;
    min-width: 22px;
    text-align: center;
}

.stp-lesson-title {
    flex: 1;
    font-size: 13px;
    color: #222;
    text-align: right;
}

/* ── Badge ─────────────────────────────────────────────────────── */
.stp-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    text-decoration: none;
}

.stp-badge--green  { background: #dcfce7; color: #15803d; }
.stp-badge--amber  { background: #fef9c3; color: #92400e; }
.stp-badge--blue   { background: #dbeafe; color: #1e40af; cursor: pointer; }
.stp-badge--gray   { background: #f3f4f6; color: #9ca3af; }

/* ── برترین‌های جلسه ──────────────────────────────────────────── */
.stp-leaders {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.stp-leader-cards {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.stp-leader-card {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
}

.stp-medal { font-size: 18px; }
.stp-leader-name { color: #222; font-weight: 500; }
.stp-badge-rg { font-size: 14px; }
.stp-badge-sp { font-size: 14px; }

/* ── Toast ────────────────────────────────────────────────────── */
.stp-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1b5e20;
    color: #fff;
    padding: 11px 20px;
    border-radius: 10px;
    font-size: 13px;
    direction: rtl;
    z-index: 99999;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    max-width: 320px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
}

.stp-toast--visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Notice ────────────────────────────────────────────────────── */
.stp-login-notice,
.stp-notice {
    background: #fff8e1;
    border-right: 4px solid #ffb300;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 14px;
    color: #633806;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (min-width: 640px) {
    .stp-tree-wrap {
        display: grid;
        grid-template-columns: 340px 1fr;
        grid-template-rows: auto auto auto;
        gap: 16px;
        align-items: start;
    }
    .stp-stats-row      { grid-column: 1 / -1; }
    .stp-tree-svg-wrap  { grid-column: 1; grid-row: 2 / 4; }
    .stp-lesson-list    { grid-column: 2; grid-row: 2; }
    .stp-leaders        { grid-column: 2; grid-row: 3; margin-top: 0; }
}

@media (max-width: 480px) {
    .stp-toast {
        right: 12px;
        left: 12px;
        max-width: none;
    }
}
