/* ========================================================
   TAKIN BUILDER: ADVANCED GRAPHICAL UI COMPONENTS (Phase 2 V3)
   ======================================================== */

/* General Typography & Utility */
.tk-block {
    font-family: inherit;
    line-height: 2;
    margin: 40px 0;
    color: #f8fafc;
}
.tk-block bdi, .tk-block [dir="rtl"] {
    font-family: 'Tajawal', Tahoma, sans-serif;
}

/* 1. Pros and Cons Block (Matches Image 2 exactly) */
.tk-pros-cons-container {
    background: #1e2128; /* Dark grey-blue */
    border-radius: 16px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    /* Force LTR for structural layout to match mockup */
    direction: ltr; 
}
.tk-pc-header {
    display: flex;
    justify-content: space-between;
    color: #d946ef;
    font-weight: 900;
    font-size: 0.9em;
    margin-bottom: 20px;
    letter-spacing: 1px;
}
.tk-pc-title {
    text-shadow: 0 0 10px rgba(217, 70, 239, 0.5);
}
.tk-pc-score-title {
    text-align: center;
    width: 150px; /* Match badge width */
    text-shadow: 0 0 10px rgba(217, 70, 239, 0.5);
}
.tk-pc-body {
    display: flex;
    gap: 25px;
    align-items: stretch;
}
@media (max-width: 768px) {
    .tk-pc-body { flex-direction: column; }
    .tk-pc-score-title { display: none; }
}
.tk-pc-lists {
    display: flex;
    gap: 20px;
    flex: 1;
}
@media (max-width: 600px) {
    .tk-pc-lists { flex-direction: column; }
}
.tk-pros-box, .tk-cons-box {
    flex: 1;
    border-radius: 12px;
    padding: 20px;
}
.tk-pros-box {
    border: 2px solid #22c55e;
    background: rgba(34, 197, 94, 0.05);
    box-shadow: inset 0 0 20px rgba(34, 197, 94, 0.1);
}
.tk-cons-box {
    border: 2px solid #ef4444;
    background: rgba(239, 68, 68, 0.05);
    box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.1);
}
.tk-pros-title { color: #4ade80; font-size: 1.5em; font-weight: 800; margin-bottom: 15px; text-transform: uppercase; }
.tk-cons-title { color: #f87171; font-size: 1.5em; font-weight: 800; margin-bottom: 15px; text-transform: uppercase; }

.tk-pros-list, .tk-cons-list {
    list-style: none; padding: 0; margin: 0;
}
.tk-pros-list li, .tk-cons-list li {
    margin-bottom: 12px;
    position: relative;
    padding: 0 30px;
    color: #e2e8f0;
}
[dir="rtl"] .tk-pros-list li, [dir="rtl"] .tk-cons-list li { text-align: right; }
[dir="ltr"] .tk-pros-list li, [dir="ltr"] .tk-cons-list li { text-align: left; }

[dir="rtl"] .tk-pros-list li::before { content: '✓'; position: absolute; right: 0; top: 0; color: #4ade80; font-weight: bold; }
[dir="ltr"] .tk-pros-list li::before { content: '✓'; position: absolute; left: 0; top: 0; color: #4ade80; font-weight: bold; }

[dir="rtl"] .tk-cons-list li::before { content: '✕'; position: absolute; right: 0; top: 0; color: #f87171; font-weight: bold; }
[dir="ltr"] .tk-cons-list li::before { content: '✕'; position: absolute; left: 0; top: 0; color: #f87171; font-weight: bold; }

.tk-score-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 150px;
}
.tk-score-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid #d946ef;
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 20px rgba(217, 70, 239, 0.4), inset 0 0 20px rgba(217, 70, 239, 0.2);
    text-align: center;
}
.tk-score-badge .score-num {
    font-size: 4em;
    font-weight: 900;
    color: #f0abfc;
    line-height: 1;
    text-shadow: 0 0 15px #d946ef;
}
.tk-score-badge .score-label {
    font-size: 0.8em;
    color: #e879f9;
    font-weight: bold;
    margin-top: 5px;
    text-transform: uppercase;
}
.tk-score-badge .score-sub {
    font-size: 0.7em;
    color: #a1a1aa;
}

/* 2. Editor Note (Image 3 Top) */
.tk-editor-note {
    background: #1e2128;
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 25px;
    display: flex;
    gap: 20px;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.15), inset 0 0 20px rgba(245, 158, 11, 0.05);
    /* Force LTR structural layout */
    direction: ltr;
}
.tk-en-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #0f172a;
    border: 2px solid #f59e0b;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8em;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}
.tk-en-content {
    flex: 1;
}
.tk-en-meta {
    color: #94a3b8;
    font-size: 0.9em;
    margin-bottom: 8px;
}
.tk-en-title {
    color: #f59e0b;
    font-weight: 900;
    font-size: 1.1em;
    margin-bottom: 12px;
    text-transform: uppercase;
}
.tk-en-text {
    color: #e2e8f0;
    line-height: 1.8;
}
.tk-en-text[dir="rtl"] { text-align: right; }
.tk-en-text[dir="ltr"] { text-align: left; }

/* 3. Quote Block (Image 3 Bottom) */
.tk-quote-block {
    background: #1e2128;
    border-radius: 12px;
    padding: 40px;
    position: relative;
    overflow: hidden;
    text-align: center;
    direction: ltr;
}
.tk-qb-bg-quote {
    position: absolute;
    font-size: 300px;
    font-family: Georgia, serif;
    color: rgba(255, 255, 255, 0.03);
    line-height: 1;
    z-index: 0;
    top: -50px;
    left: 10px;
}
.tk-qb-bg-quote.right {
    left: auto;
    right: 10px;
    top: auto;
    bottom: -150px;
}
.tk-qb-text {
    position: relative;
    z-index: 1;
    font-size: 1.8em;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.6;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
}
.tk-qb-author {
    position: relative;
    z-index: 1;
    color: #94a3b8;
    font-size: 1.1em;
}

/* 4. Welcome Box Grid (Image 4) */
.tk-welcome-container {
    padding: 3px;
    background: linear-gradient(135deg, #06b6d4, #a855f7);
    border-radius: 24px;
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
    direction: ltr; /* Force LTR structure */
}
.tk-welcome-grid {
    background: #0f172a;
    border-radius: 21px;
    padding: 25px;
    display: flex;
    gap: 25px;
}
@media (max-width: 768px) {
    .tk-welcome-grid { flex-direction: column; }
}
.tk-wg-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.tk-wg-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.tk-wg-title {
    font-size: 2em;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 15px;
}
.tk-wg-title[dir="rtl"] { text-align: right; }
.tk-wg-title[dir="ltr"] { text-align: left; }

.tk-wg-desc {
    color: #cbd5e1;
    margin-bottom: 20px;
    flex: 1;
}
.tk-wg-desc[dir="rtl"] { text-align: right; }
.tk-wg-desc[dir="ltr"] { text-align: left; }

.tk-wg-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #06b6d4;
    font-weight: bold;
    font-size: 0.9em;
    text-transform: uppercase;
}
.tk-wg-play { display: flex; align-items: center; gap: 8px; }
.tk-wg-date { color: #94a3b8; }

.tk-wg-empty-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    height: 150px;
    backdrop-filter: blur(10px);
}

.tk-wg-right {
    flex: 1.5;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 25px;
}
.tk-wg-toc-title {
    color: #e2e8f0;
    font-size: 1.2em;
    font-weight: 800;
    margin-bottom: 20px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}
.tk-wg-list {
    list-style: none; padding: 0; margin: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.tk-wg-list li {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.tk-wg-list li:last-child { border-bottom: none; }
.tk-wg-li-icon {
    font-size: 1.5em;
    width: 40px; text-align: center;
}
.tk-wg-li-content {
    flex: 1;
}
.tk-wg-li-content[dir="rtl"] { text-align: right; }
.tk-wg-li-content[dir="ltr"] { text-align: left; }

.tk-wg-li-title {
    color: #f8fafc;
    font-weight: bold;
    margin-bottom: 5px;
}
.tk-wg-li-desc {
    color: #94a3b8;
    font-size: 0.85em;
}
.tk-wg-li-arrow {
    color: #94a3b8;
    font-size: 1.2em;
}

/* 5. Key Points Box / FAQs (Basic Box Fix) */
.tk-faq-container {
    background: #1e293b;
    padding: 30px;
    border-radius: 16px;
    border-left: 4px solid #8b5cf6;
}
.tk-faq-title {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.5em;
    color: #a78bfa;
    margin-bottom: 20px;
}
.tk-faq-title[dir="rtl"] { flex-direction: row-reverse; justify-content: flex-end; }

.tk-key-points-list {
    list-style: none; padding: 0; margin: 0;
}
.tk-key-points-list li {
    position: relative;
    margin-bottom: 15px;
    color: #e2e8f0;
}
[dir="rtl"] .tk-key-points-list li { padding-right: 30px; text-align: right; }
[dir="ltr"] .tk-key-points-list li { padding-left: 30px; text-align: left; }

[dir="rtl"] .tk-key-points-list li::before { content: '✦'; position: absolute; right: 0; top: 2px; color: #22d3ee; font-size: 1.2em; }
[dir="ltr"] .tk-key-points-list li::before { content: '✦'; position: absolute; left: 0; top: 2px; color: #22d3ee; font-size: 1.2em; }

.tk-faq-details {
    background: rgba(255,255,255,0.05);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
}
.tk-faq-details summary {
    color: #60a5fa;
    font-weight: bold;
    cursor: pointer;
    font-size: 1.1em;
}
.tk-faq-details p {
    margin-top: 15px;
    color: #cbd5e1;
    line-height: 1.8;
}
[dir="rtl"] .tk-faq-details { text-align: right; }
[dir="ltr"] .tk-faq-details { text-align: left; }

.tk-content-paragraph {
    line-height: 2.2;
    color: #e2e8f0;
    font-size: 1.1em;
}
.tk-content-paragraph[dir="rtl"] { text-align: right; }
.tk-content-paragraph[dir="ltr"] { text-align: left; }

/* Contact Footer preserved */
.tk-contact-container {
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.9) 0%, rgba(49, 16, 66, 0.9) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 35px;
    border-radius: 24px;
    margin: 50px 0;
    border: 1px solid rgba(168, 85, 247, 0.4);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5), inset 0 0 30px rgba(168, 85, 247, 0.15), 0 0 20px rgba(168, 85, 247, 0.2);
    position: relative;
    overflow: hidden;
}
.tk-contact-container::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, #c084fc, #e879f9, #d946ef);
    box-shadow: 0 0 15px #d946ef;
}
.tk-contact-header { color: #f3e8ff; margin: 0 0 20px 0; font-size: 1.8em; font-weight: 900; display: flex; align-items: center; gap: 15px; border-bottom: 2px solid rgba(216, 180, 254, 0.2); padding-bottom: 15px; text-shadow: 0 0 10px rgba(216, 180, 254, 0.5); }
.tk-contact-text { color: #e2e8f0; line-height: 1.8; margin: 0 0 25px 0; font-size: 1.1em; font-weight: 500; }
.tk-contact-links { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
@media (max-width: 768px) { .tk-contact-links { grid-template-columns: 1fr; } }
.tk-contact-link { display: flex; align-items: center; justify-content: center; gap: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(216, 180, 254, 0.15); padding: 16px 20px; border-radius: 16px; text-decoration: none; color: #f8fafc; font-weight: 700; font-size: 1.05em; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.tk-contact-link:hover { background: rgba(168, 85, 247, 0.2); border-color: rgba(216, 180, 254, 0.6); transform: translateY(-4px) scale(1.02); box-shadow: 0 10px 20px rgba(168, 85, 247, 0.2), 0 0 15px rgba(216, 180, 254, 0.3); color: #ffffff; }

/* ========================================================
   6. Custom Interactive Timeline Component (Inside Info-Boxes)
   ======================================================== */
.timeline-container {
    position: relative;
    margin: 25px 0;
    padding: 10px 0;
    width: 100%;
}

.timeline-grid {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Connecting Line */
.timeline-grid::before {
    content: '';
    position: absolute;
    top: 5px;
    bottom: 5px;
    width: 3px;
    background: linear-gradient(to bottom, #a855f7 0%, #06b6d4 100%);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

[dir="rtl"] .timeline-grid::before {
    right: 20px;
    left: auto;
}
[dir="ltr"] .timeline-grid::before {
    left: 20px;
    right: auto;
}

/* Timeline Cards */
.timeline-item {
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[dir="rtl"] .timeline-item {
    margin-right: 50px;
    margin-left: 0;
}
[dir="ltr"] .timeline-item {
    margin-left: 50px;
    margin-right: 0;
}

/* Circular Node Indicator */
.timeline-item::before {
    content: '';
    position: absolute;
    top: 24px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0f172a;
    border: 3px solid #06b6d4;
    box-shadow: 0 0 8px #06b6d4;
    z-index: 2;
    transition: all 0.3s ease;
}

[dir="rtl"] .timeline-item::before {
    right: -39px;
}
[dir="ltr"] .timeline-item::before {
    left: -39px;
}

/* Hover Zoom & Light Effects */
.timeline-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(6, 182, 212, 0.4);
    box-shadow: 0 10px 25px rgba(6, 182, 212, 0.15);
}

.timeline-item:hover::before {
    background: #06b6d4;
    transform: scale(1.2);
}

/* Custom state for delayed event */
.timeline-item.timeline-delay {
    border-color: rgba(249, 115, 22, 0.3);
    background: linear-gradient(180deg, rgba(249, 115, 22, 0.03) 0%, transparent 100%);
}

.timeline-item.timeline-delay::before {
    border-color: #f97316;
    box-shadow: 0 0 8px #f97316;
}

.timeline-item.timeline-delay:hover {
    border-color: rgba(249, 115, 22, 0.6);
    box-shadow: 0 10px 25px rgba(249, 115, 22, 0.15);
}

.timeline-item.timeline-delay:hover::before {
    background: #f97316;
}

.timeline-item h4 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 10px 0;
}

.timeline-item.timeline-delay h4 {
    color: #f97316;
}

.timeline-item p {
    font-size: 0.95rem;
    color: #cbd5e1;
    margin: 0;
    line-height: 1.7;
}

/* ========================================================
   7. Mobile Responsive Protections for Article Cards & Grids
   ======================================================== */
@media (max-width: 640px) {
    /* Auto-collapse 3-column inline grids in briefing cards & info boxes to prevent narrow text squishing */
    article div[style*="grid-template-columns:repeat(3"],
    article div[style*="grid-template-columns: repeat(3"],
    .tkParagraph div[style*="grid-template-columns:repeat(3"],
    .tkParagraph div[style*="grid-template-columns: repeat(3"],
    .proseContent div[style*="grid-template-columns:repeat(3"],
    .proseContent div[style*="grid-template-columns: repeat(3"],
    div[style*="grid-template-columns:repeat(3,1fr)"],
    div[style*="grid-template-columns: repeat(3, 1fr)"],
    div[style*="grid-template-columns:repeat(3, 1fr)"] {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
        gap: 8px !important;
    }

    /* Mobile Timeline Alignment adjustments */
    [dir="rtl"] .timeline-item {
        margin-right: 32px !important;
    }
    [dir="ltr"] .timeline-item {
        margin-left: 32px !important;
    }
    [dir="rtl"] .timeline-grid::before {
        right: 10px !important;
    }
    [dir="ltr"] .timeline-grid::before {
        left: 10px !important;
    }
    [dir="rtl"] .timeline-item::before {
        right: -29px !important;
    }
    [dir="ltr"] .timeline-item::before {
        left: -29px !important;
    }
}

@media (max-width: 420px) {
    /* Narrow mobile screens: stack cleanly to single column for maximum readability */
    article div[style*="grid-template-columns:repeat(3"],
    article div[style*="grid-template-columns: repeat(3"],
    .tkParagraph div[style*="grid-template-columns:repeat(3"],
    .tkParagraph div[style*="grid-template-columns: repeat(3"],
    .proseContent div[style*="grid-template-columns:repeat(3"],
    .proseContent div[style*="grid-template-columns: repeat(3"],
    div[style*="grid-template-columns:repeat(3,1fr)"],
    div[style*="grid-template-columns: repeat(3, 1fr)"],
    div[style*="grid-template-columns:repeat(3, 1fr)"] {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
}
