#wt-app {
    --primary: #6d5ef8;
    --primary-dark: #5b3ff0;
    --accent: #a855f7;
    --success: #10b981;
    --success-dark: #059669;
    --danger: #ef4444;
    --ink: #2c2f4a;
    --ink-soft: #6b6f8b;
    --bg: #f3f2fb;
    --card: #ffffff;
    --border: #e7e6f4;
}

#wt-app *,
#wt-app *::before,
#wt-app *::after {
    box-sizing: border-box;
}

#wt-app {
    font-family: 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 15% 0%, rgba(109, 94, 248, 0.08), transparent 40%),
        radial-gradient(circle at 85% 15%, rgba(168, 85, 247, 0.08), transparent 40%);
    color: var(--ink);
    /* جهت متن از ویژگی dir روی خود #wt-app (که در index.php بر اساس $_SESSION['lang'] تنظیم
       می‌شود) به ارث می‌رسد؛ text-align: start هم خودش را با آن هماهنگ می‌کند. */
    text-align: start;
    line-height: 1.7;
}

#wt-app ::selection {
    background-color: #ddd6fe;
    color: var(--primary-dark);
}

/* اسکرول‌بار */
#wt-app ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

#wt-app ::-webkit-scrollbar-track {
    background: transparent;
}

#wt-app ::-webkit-scrollbar-thumb {
    background-color: #cfceee;
    border-radius: 20px;
}

#wt-app ::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary);
}

/* هدر */
#wt-app header {
    position: relative;
    background: linear-gradient(135deg, #6d5ef8 0%, #a855f7 100%);
    color: white;
    padding: 40px 20px 30px;
    text-align: center;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(109, 94, 248, 0.3);
}

#wt-app header::before,
#wt-app header::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

#wt-app header::before {
    width: 260px;
    height: 260px;
    top: -140px;
    right: -60px;
}

#wt-app header::after {
    width: 180px;
    height: 180px;
    bottom: -110px;
    left: 5%;
}

#wt-app header .hero-title {
    position: relative;
    margin: 0 0 8px;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.3px;
}

#wt-app .header-subtitle {
    position: relative;
    margin: 0 0 22px;
    opacity: 0.92;
    font-size: 15px;
}

#wt-app .progress-wrap {
    position: relative;
    max-width: 460px;
    margin: 0 auto;
}

#wt-app .progress-bar {
    background-color: rgba(255, 255, 255, 0.22);
    border-radius: 20px;
    height: 12px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

#wt-app .progress-fill {
    background: linear-gradient(90deg, #34d399, #10b981);
    height: 100%;
    width: 0%;
    border-radius: 20px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

#wt-app .progress-label {
    display: block;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 600;
    opacity: 0.95;
}

/* چیدمان اصلی */
#wt-app .container {
    display: flex;
    max-width: 1200px;
    margin: -18px auto 30px;
    position: relative;
    background-color: var(--card);
    box-shadow: 0 10px 40px rgba(45, 40, 90, 0.1);
    border-radius: 18px;
    overflow: hidden;
    align-items: stretch;
}

/* نوار کناری */
#wt-app .sidebar {
    width: 300px;
    flex-shrink: 0;
    padding: 26px 16px;
    background-color: #f8f8fd;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

#wt-app .sidebar h2 {
    margin: 0 0 16px;
    padding: 0 4px;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#wt-app .sidebar nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#wt-app .sidebar li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    cursor: pointer;
    background-color: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
    font-size: 13.5px;
}

#wt-app .step-icon {
    font-size: 16px;
    flex-shrink: 0;
}

#wt-app .step-title {
    flex: 1;
}

#wt-app .sidebar li:hover:not(.locked):not(.active) {
    border-color: var(--primary);
    background-color: #faf9ff;
    transform: translateX(-3px);
}

#wt-app .sidebar li.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-weight: 700;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(109, 94, 248, 0.4);
    transform: translateX(-3px);
}

#wt-app .sidebar li.completed:not(.active) {
    background-color: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

#wt-app .sidebar li.locked {
    background-color: #f9f9fb;
    color: #b3b5c6;
    cursor: not-allowed;
    opacity: 0.75;
}

#wt-app .reset-btn {
    margin-top: 18px;
    background-color: transparent;
    color: var(--primary);
    border: 1.5px solid #ded9fb;
    padding: 10px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: none;
}

#wt-app .reset-btn:hover {
    background-color: #f3effd;
    box-shadow: none;
    transform: none;
}

/* محتوای اصلی */
#wt-app .content {
    flex-grow: 1;
    padding: 42px 44px;
    min-width: 0;
}

#wt-app .step-section {
    min-height: 460px;
}

#wt-app .step-section h2 {
    color: var(--ink);
    font-size: 23px;
    border-bottom: 3px solid #ede9fe;
    padding-bottom: 12px;
    margin-top: 0;
    margin-bottom: 18px;
}

#wt-app .step-section h3 {
    color: var(--ink);
    font-size: 17px;
}

#wt-app .step-section p {
    line-height: 1.95;
    color: #454869;
}

#wt-app .step-section ul {
    padding-right: 22px;
    line-height: 1.95;
    color: #454869;
}

#wt-app .fade-in {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#wt-app .info-box {
    background: linear-gradient(135deg, #f3f0ff, #eef2ff);
    border-right: 4px solid var(--primary);
    padding: 14px 18px;
    border-radius: 8px;
    margin: 18px 0;
    color: #423d78;
}

/* چک‌پوینت پروژه‌ی نهایی */
#wt-app .project-box {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1.5px dashed #d97706;
    border-radius: 10px;
    padding: 16px 18px;
    margin: 22px 0;
    color: #78350f;
}

#wt-app .project-box .project-box-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    color: #92400e;
    margin-bottom: 6px;
    font-size: 14.5px;
}

#wt-app .project-box p {
    color: #78350f;
    margin: 6px 0 0;
}

#wt-app .project-box code {
    background-color: #fef3c7;
    color: #92400e;
}

#wt-app .project-box a {
    color: #92400e;
    font-weight: 700;
    text-decoration: underline;
}

#wt-app #project-save-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 4px 12px rgba(109, 94, 248, 0.3);
}

#wt-app #project-save-btn:hover {
    box-shadow: 0 8px 18px rgba(109, 94, 248, 0.4);
}

/* باکس جمع‌شو/بازشوی توضیح آپشن‌ها */
#wt-app .options-box {
    background-color: #fbfaff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2px 18px;
    margin: 18px 0;
}

#wt-app .options-box summary {
    cursor: pointer;
    padding: 13px 0;
    font-weight: 700;
    font-size: 14.5px;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    list-style: none;
}

#wt-app .options-box summary::-webkit-details-marker {
    display: none;
}

#wt-app .options-box summary::after {
    content: '▾';
    color: var(--ink-soft);
    font-size: 13px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

#wt-app .options-box[open] summary::after {
    transform: rotate(180deg);
}

#wt-app .options-box summary:hover {
    color: var(--accent);
}

#wt-app .options-list {
    margin: 0 0 16px;
    padding-right: 20px;
    line-height: 1.95;
    color: #454869;
    animation: fadeIn 0.25s ease;
}

#wt-app .options-list li {
    margin-bottom: 8px;
}

#wt-app pre {
    background-color: #1e2430;
    color: #ecf0f1;
    padding: 34px 18px 18px;
    border-radius: 10px;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
    font-family: 'Consolas', 'Courier New', monospace;
    position: relative;
    box-shadow: 0 6px 18px rgba(20, 20, 40, 0.18);
}

#wt-app pre::before {
    content: '\25CF \25CF \25CF';
    position: absolute;
    top: 10px;
    left: 14px;
    letter-spacing: 5px;
    color: #ff5f57;
    font-size: 10px;
    text-shadow: 16px 0 #febc2e, 32px 0 #28c840;
}

#wt-app code {
    font-family: 'Consolas', 'Courier New', monospace;
}

#wt-app p code, #wt-app li code {
    background-color: #f1eefe;
    color: #6d28d9;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 0.92em;
}

/* استایل های دکمه ها */
#wt-app button {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: white;
    border: none;
    padding: 13px 28px;
    margin-top: 22px;
    cursor: pointer;
    border-radius: 10px;
    font-size: 15.5px;
    font-weight: 700;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

#wt-app button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(16, 185, 129, 0.35);
    filter: brightness(1.04);
}

#wt-app button:active {
    transform: translateY(0);
}

#wt-app button:disabled {
    background: #b7b9c9;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

#wt-app .feedback {
    padding: 13px 16px;
    margin-top: 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    animation: fadeIn 0.25s ease;
}

#wt-app .feedback:empty {
    display: none;
}

#wt-app .feedback.success {
    background-color: #e2fbf0;
    color: #08794f;
    border: 1px solid #a7f3d0;
}

#wt-app .feedback.error {
    background-color: #fdeeee;
    color: #b91c1c;
    border: 1px solid #f6c6c6;
}

/* استایل های کوئیز */
#wt-app .quiz-item {
    background-color: #fbfaff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 14px;
    transition: border-color 0.15s ease;
}

#wt-app .quiz-item:hover {
    border-color: #d9d3fb;
}

#wt-app .quiz-item p {
    margin-top: 0;
}

#wt-app .quiz-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

#wt-app .quiz-options label:hover {
    background-color: #f1eefe;
}

#wt-app .quiz-options input[type="radio"] {
    appearance: none;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border: 2px solid #c9c5ee;
    border-radius: 50%;
    display: inline-grid;
    place-content: center;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

#wt-app .quiz-options input[type="radio"]::before {
    content: '';
    width: 9px;
    height: 9px;
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.12s ease;
    background: linear-gradient(135deg, var(--primary), var(--accent));
}

#wt-app .quiz-options input[type="radio"]:checked {
    border-color: var(--primary);
}

#wt-app .quiz-options input[type="radio"]:checked::before {
    transform: scale(1);
}

/* ویرایشگر کد */
#wt-app .code-editor {
    direction: ltr;
    text-align: left;
    width: 100%;
    min-height: 250px;
    padding: 16px;
    border: 1px solid #1e2430;
    box-sizing: border-box;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14.5px;
    resize: vertical;
    background-color: #1e2430;
    color: #ecf0f1;
    line-height: 1.65;
    caret-color: #f1c40f;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(20, 20, 40, 0.18);
}

#wt-app .code-editor:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(109, 94, 248, 0.35), 0 6px 18px rgba(20, 20, 40, 0.18);
}

/* بلوک «امتحان کنید» در متن درس‌ها */
#wt-app .try-it-block {
    margin: 22px 0;
}

#wt-app .try-it-toggle {
    background: linear-gradient(135deg, #f3f0ff, #eef2ff);
    color: var(--primary-dark);
    border: 1.5px solid #ded9fb;
    box-shadow: none;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 22px;
    margin-top: 0;
}

#wt-app .try-it-toggle:hover {
    background: #ede9fe;
    box-shadow: none;
    transform: none;
    filter: none;
}

#wt-app .try-it-panel {
    margin-top: 14px;
    animation: fadeIn 0.3s ease;
}

#wt-app .try-it-panel[hidden] {
    display: none;
}

#wt-app .try-it-editor {
    min-height: 160px;
}

#wt-app .try-it-preview {
    min-height: 160px;
}

/* شبکه‌ی ویرایشگر + پیش‌نمایش زنده */
#wt-app .editor-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 16px;
}

#wt-app .editor-col h3,
#wt-app .preview-col h3 {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--ink-soft);
    font-weight: 700;
}

#wt-app .activity-preview {
    width: 100%;
    min-height: 250px;
    height: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    background-color: #fff;
    box-shadow: 0 6px 18px rgba(45, 40, 90, 0.08);
}

@media (max-width: 800px) {
    #wt-app .editor-preview-grid {
        grid-template-columns: 1fr;
    }
}

/* صفحه پایان دوره */
#wt-app .completion-section {
    text-align: center;
    padding: 50px 20px;
}

#wt-app .completion-badge {
    font-size: 72px;
    margin-bottom: 18px;
    animation: pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop {
    from { transform: scale(0.4); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

#wt-app .completion-section h2 {
    border-bottom: none;
    font-size: 26px;
    color: var(--primary-dark);
}

/* واکنش‌گرا */
@media (max-width: 800px) {
    #wt-app .container {
        flex-direction: column;
        margin: -12px 12px 20px;
    }

    #wt-app .sidebar {
        width: auto;
        border-left: none;
        border-bottom: 1px solid var(--border);
    }

    #wt-app .content {
        padding: 26px 20px;
    }

    #wt-app header .hero-title {
        font-size: 24px;
    }
}
