/* CloseTag Sub-Topic Dedicated Page Styles */

.ct-topic-page-wrap {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 16px 48px;
}

/* Breadcrumbs spacing */
.ct-topic-page-wrap .ct-breadcrumbs--lesson {
    margin-bottom: 20px;
}

/* Topic Hero */
.ct-topic-hero {
    background: #f1ecf8;
    border: 1px solid #ddd1e9;
    border-radius: 20px;
    padding: 32px 36px;
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
    transition: background 0.3s ease, border-color 0.3s ease;
}

[data-ct-lesson-theme="dark"] .ct-topic-hero {
    background: #1e1a2f;
    border-color: #373053;
}

.ct-topic-hero-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.ct-topic-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.ct-topic-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.18s ease, background 0.18s ease;
}

.ct-topic-badge-primary {
    background: #7750b2;
    color: #fff;
}

.ct-topic-badge-primary:hover {
    background: #5b378d;
    color: #fff;
    transform: translateY(-1px);
}

.ct-topic-badge-secondary {
    background: #e4daef;
    color: #5b378d;
    border: 1px solid #d2c0e4;
}

[data-ct-lesson-theme="dark"] .ct-topic-badge-secondary {
    background: #2b2444;
    color: #cbaff0;
    border-color: #473c6a;
}

.ct-topic-hero-titles {
    margin-bottom: 20px;
}

.ct-topic-hero-title-en {
    display: block;
    font-family: "Inter", sans-serif;
    font-size: clamp(22px, 3.5vw, 34px);
    font-weight: 800;
    line-height: 1.25;
    color: #5b378d;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

[data-ct-lesson-theme="dark"] .ct-topic-hero-title-en {
    color: #cbaff0;
}

.ct-topic-hero-title-ar {
    display: block;
    font-family: "Cairo", sans-serif;
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 800;
    line-height: 1.4;
    color: var(--ct-ink);
}

.ct-topic-hero-description {
    font-size: 15px;
    line-height: 1.75;
    color: var(--ct-muted);
    max-width: 900px;
    margin-top: 12px;
}

[data-ct-lesson-theme="dark"] .ct-topic-hero-description {
    color: #b3acc7;
}

/* Topic Meta Stats */
.ct-topic-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #dfd3eb;
}

[data-ct-lesson-theme="dark"] .ct-topic-stats {
    border-color: #373053;
}

.ct-topic-stat-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ct-muted);
    font-weight: 600;
}

.ct-topic-stat-item svg {
    color: #7750b2;
}

[data-ct-lesson-theme="dark"] .ct-topic-stat-item svg {
    color: #cbaff0;
}

/* Explanation and Rows Section */
.ct-topic-content-section {
    margin-bottom: 48px;
}

.ct-topic-rows-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--ct-line);
}

.ct-topic-rows-heading h2 {
    font-size: 20px;
    font-weight: 800;
    margin: 0;
    color: var(--ct-ink);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Individual Row Card / Band */
.ct-topic-row-card {
    background: var(--ct-white);
    border: 1px solid var(--ct-line);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

[data-ct-lesson-theme="dark"] .ct-topic-row-card {
    background: #181427;
    border-color: #2e2847;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.ct-topic-row-card:hover {
    border-color: #c9aedf;
}

[data-ct-lesson-theme="dark"] .ct-topic-row-card:hover {
    border-color: #4b3e70;
}

.ct-topic-row-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px dashed var(--ct-line);
}

.ct-topic-row-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.ct-topic-row-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #7750b2;
    color: #fff;
    font-weight: 800;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 6px;
}

.ct-topic-type-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    background: #f1ecf8;
    color: #5b378d;
    border: 1px solid #ddd1e9;
}

[data-ct-lesson-theme="dark"] .ct-topic-type-tag {
    background: #25203b;
    color: #cbaff0;
    border-color: #3e3560;
}

.ct-topic-row-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ct-ink);
}

/* Topic Bottom Navigation */
.ct-topic-nav-container {
    background: #f1ecf8;
    border: 1px solid #ddd1e9;
    border-radius: 16px;
    padding: 24px;
    margin-top: 40px;
}

[data-ct-lesson-theme="dark"] .ct-topic-nav-container {
    background: #1e1a2f;
    border-color: #373053;
}

.ct-topic-nav-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
}

@media (max-width: 768px) {
    .ct-topic-nav-grid {
        grid-template-columns: 1fr;
    }
}

.ct-topic-nav-card {
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
    background: var(--ct-white);
    border: 1px solid var(--ct-line);
    border-radius: 12px;
    text-decoration: none;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

[data-ct-lesson-theme="dark"] .ct-topic-nav-card {
    background: #181427;
    border-color: #2e2847;
}

.ct-topic-nav-card:hover {
    transform: translateY(-2px);
    border-color: #7750b2;
    box-shadow: 0 6px 16px rgba(119, 80, 178, 0.12);
}

.ct-topic-nav-card.ct-nav-prev {
    text-align: right;
}

.ct-topic-nav-card.ct-nav-next {
    text-align: left;
}

[dir="rtl"] .ct-topic-nav-card.ct-nav-prev {
    text-align: right;
}

[dir="rtl"] .ct-topic-nav-card.ct-nav-next {
    text-align: left;
}

.ct-topic-nav-direction {
    font-size: 12px;
    font-weight: 700;
    color: #7750b2;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

[data-ct-lesson-theme="dark"] .ct-topic-nav-direction {
    color: #cbaff0;
}

.ct-topic-nav-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ct-ink);
    line-height: 1.4;
}

.ct-topic-nav-center {
    display: flex;
    justify-content: center;
}

.ct-topic-btn-parent {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #7750b2;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 24px;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.18s ease, transform 0.18s ease;
}

.ct-topic-btn-parent:hover {
    background: #5b378d;
    color: #fff;
    transform: translateY(-1px);
}

/* Other Topics List in Lesson */
.ct-topic-siblings-card {
    background: var(--ct-white);
    border: 1px solid var(--ct-line);
    border-radius: 16px;
    padding: 24px;
    margin-top: 32px;
}

[data-ct-lesson-theme="dark"] .ct-topic-siblings-card {
    background: #181427;
    border-color: #2e2847;
}

.ct-topic-siblings-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--ct-ink);
}

.ct-topic-siblings-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.ct-topic-sibling-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--ct-line);
    background: var(--ct-page);
    font-size: 13px;
    font-weight: 600;
    color: var(--ct-ink);
    text-decoration: none;
    transition: all 0.18s ease;
}

[data-ct-lesson-theme="dark"] .ct-topic-sibling-item a {
    background: #201b33;
    border-color: #342d4f;
    color: #d8d3e9;
}

.ct-topic-sibling-item a:hover {
    border-color: #7750b2;
    background: #f1ecf8;
    color: #5b378d;
}

[data-ct-lesson-theme="dark"] .ct-topic-sibling-item a:hover {
    background: #2c2547;
    color: #cbaff0;
    border-color: #584a7e;
}

.ct-topic-sibling-item.ct-is-current a {
    border-color: #7750b2;
    background: #7750b2;
    color: #fff;
    font-weight: 800;
}

.ct-topic-sibling-item.ct-is-current a:hover {
    background: #5b378d;
    color: #fff;
}

/* RTL Action button physical left alignment rule */
[dir="rtl"] .ct-topic-actions {
    display: flex;
    justify-content: flex-start;
}
