/* 
 * MT Academy - Article Formatting Styles 
 * Modern Premium Table of Contents & Tables
 */

:root {
    /* TOC Variables */
    --mta-toc-bg: #ffffff;
    --mta-toc-border: #e2e8f0;
    --mta-toc-line: #cbd5e1;
    --mta-toc-accent: #3b82f6;
    --mta-toc-accent-dark: #2563eb;
    --mta-toc-accent-light: #eff6ff;
    --mta-toc-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
    
    /* Table Variables */
    --mta-tbl-head-bg: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --mta-tbl-head-text: #ffffff;
    --mta-tbl-border: #e2e8f0;
    --mta-tbl-row-even: #f8fafc;
    --mta-tbl-hover: #f1f5f9;
}

/* ==========================================
   1. Premium Table of Contents (TOC) UI
   ========================================== */

.mta-toc-wrapper {
    background: var(--mta-toc-bg);
    border: 1px solid var(--mta-toc-border);
    border-radius: 16px;
    box-shadow: var(--mta-toc-shadow);
    margin: 40px 0;
    overflow: hidden;
    font-family: inherit;
    direction: rtl;
    transition: all 0.3s ease;
}

.mta-toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #f8fafc;
    border-bottom: 1px solid var(--mta-toc-border);
    cursor: pointer;
    user-select: none;
    transition: background 0.3s ease;
}

.mta-toc-header:hover {
    background: #f1f5f9;
}

.mta-toc-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.mta-toc-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--mta-toc-accent), var(--mta-toc-accent-dark));
    color: #ffffff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.mta-toc-icon svg {
    width: 20px;
    height: 20px;
}

.mta-toc-title {
    font-size: 17px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    margin: 0 !important;
}

.mta-toc-toggle {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #64748b;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    outline: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.mta-toc-toggle:hover {
    color: var(--mta-toc-accent);
    border-color: var(--mta-toc-accent);
}

.mta-toc-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mta-toc-wrapper.is-collapsed .mta-toc-toggle svg {
    transform: rotate(180deg);
}

.mta-toc-body {
    padding: 24px 30px 24px 24px;
    transition: max-height 0.4s ease, opacity 0.4s ease, padding 0.4s ease;
    max-height: 2000px;
    opacity: 1;
    overflow: hidden;
}

.mta-toc-wrapper.is-collapsed .mta-toc-body {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* 
 * Tree View Logic (The Magic for Beautiful Sub-items) 
 */
.mta-toc-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
}

/* Main Vertical Line */
.mta-toc-list::before {
    content: '';
    position: absolute;
    top: 15px;
    bottom: 20px;
    right: 5px; /* RTL alignment */
    width: 2px;
    background: var(--mta-toc-line);
    border-radius: 2px;
    z-index: 1;
}

.mta-toc-item {
    position: relative;
    margin-bottom: 6px;
    padding-right: 25px; /* Base padding for dots */
    list-style-type: none !important;
}

.mta-toc-item::before,
.mta-toc-item::after {
    content: '';
    position: absolute;
    z-index: 2;
    transition: all 0.3s ease;
}

/* 
 * Global Links (Forcing !important to override WoodMart/Elementor)
 */
.mta-toc-link {
    display: block !important;
    padding: 8px 14px !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    line-height: 1.8 !important; /* Increased line-height for better typography */
    text-align: right !important; /* Forced Right Alignment */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

.mta-toc-item:hover .mta-toc-link {
    background: #f8fafc !important;
    color: var(--mta-toc-accent) !important;
    transform: translateX(-6px) !important; /* Slide left in RTL */
}

.mta-toc-item.is-active .mta-toc-link {
    background: var(--mta-toc-accent-light) !important;
    color: var(--mta-toc-accent-dark) !important;
}

/* 
 * H2 (Main Topics)
 */
.mta-toc-item-h2 {
    margin-top: 16px;
}
.mta-toc-item-h2:first-child {
    margin-top: 0;
}
.mta-toc-item-h2 .mta-toc-link {
    font-weight: 800 !important;
    font-size: 16px !important; /* Increased Font Size */
    color: #1e293b !important;
}
.mta-toc-item-h2.is-active .mta-toc-link {
    font-weight: 900 !important;
}
/* Large Dot for H2 */
.mta-toc-item-h2::after {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: #ffffff;
    border: 3px solid var(--mta-toc-accent);
    border-radius: 50%;
    box-shadow: 0 0 0 4px #ffffff; /* Cut out effect */
}
.mta-toc-item-h2:hover::after, 
.mta-toc-item-h2.is-active::after {
    background: var(--mta-toc-accent);
    box-shadow: 0 0 0 4px var(--mta-toc-accent-light);
}

/* 
 * H3 (Sub Topics)
 */
.mta-toc-item-h3 {
    padding-right: 50px;
}
.mta-toc-item-h3 .mta-toc-link {
    font-size: 15px !important; /* Increased Font Size */
    color: #475569 !important;
    font-weight: 500 !important;
}
/* Horizontal Branch Line */
.mta-toc-item-h3::before {
    right: 5px; /* Attach to main vertical line */
    top: 50%;
    width: 22px;
    height: 2px;
    background: var(--mta-toc-line);
}
/* Small Dot for H3 */
.mta-toc-item-h3::after {
    right: 27px; /* End of branch */
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--mta-toc-line);
    border: 2px solid #ffffff;
    border-radius: 50%;
}
.mta-toc-item-h3:hover::after, 
.mta-toc-item-h3.is-active::after {
    background: var(--mta-toc-accent);
    transform: translateY(-50%) scale(1.3);
}
.mta-toc-item-h3:hover::before, 
.mta-toc-item-h3.is-active::before {
    background: var(--mta-toc-accent);
}

/* 
 * H4 (Deep Topics)
 */
.mta-toc-item-h4 {
    padding-right: 75px;
}
.mta-toc-item-h4 .mta-toc-link {
    font-size: 14px !important; /* Increased Font Size */
    color: #64748b !important;
    font-weight: 400 !important;
}
.mta-toc-item-h4::before {
    right: 5px;
    top: 50%;
    width: 47px;
    height: 2px;
    background: var(--mta-toc-line);
    opacity: 0.6;
}
.mta-toc-item-h4::after {
    right: 52px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--mta-toc-line);
    border-radius: 50%;
}
.mta-toc-item-h4:hover::after, 
.mta-toc-item-h4.is-active::after {
    background: var(--mta-toc-accent);
}

/* Responsive TOC */
@media (max-width: 768px) {
    .mta-toc-wrapper { margin: 30px 0; border-radius: 12px; }
    .mta-toc-header { padding: 14px 18px; }
    .mta-toc-title { font-size: 16px !important; }
    .mta-toc-icon { width: 36px; height: 36px; border-radius: 10px; }
    .mta-toc-icon svg { width: 18px; height: 18px; }
    .mta-toc-body { padding: 20px 15px; }
}


/* ==========================================
   2. Modern Premium Tables UI
   ========================================== */

.mta-table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 40px 0;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--mta-tbl-border);
    background: #fff;
    direction: rtl; /* Enforce RTL */
}

.mta-modern-table {
    width: 100% !important;
    min-width: 600px;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    font-family: inherit !important;
    direction: rtl !important;
}

/* Headers */
.mta-modern-table th {
    background: var(--mta-tbl-head-bg) !important;
    color: var(--mta-tbl-head-text) !important;
    font-weight: 800 !important;
    font-size: 16px !important; /* Increased Font Size */
    padding: 22px 24px !important; /* Increased Height/Padding */
    text-align: right !important; /* Forced Right Alignment */
    white-space: nowrap !important;
    border: none !important;
}

.mta-modern-table th:first-child {
    border-top-right-radius: 16px !important;
}
.mta-modern-table th:last-child {
    border-top-left-radius: 16px !important;
}

/* Cells */
.mta-modern-table td {
    padding: 20px 24px !important; /* Increased Height/Padding */
    color: #334155 !important;
    font-size: 15px !important; /* Increased Font Size */
    line-height: 2 !important; /* Premium Line Height */
    text-align: right !important; /* Forced Right Alignment */
    border-bottom: 1px solid var(--mta-tbl-border) !important;
    border-left: 1px solid var(--mta-tbl-border) !important;
    vertical-align: middle !important;
}

.mta-modern-table td:last-child {
    border-left: none !important;
}

/* Striped Rows & Hover */
.mta-modern-table tbody tr:nth-child(even) td {
    background-color: var(--mta-tbl-row-even) !important;
}

.mta-modern-table tbody tr td {
    transition: background-color 0.2s ease !important;
}

.mta-modern-table tbody tr:hover td {
    background-color: var(--mta-tbl-hover) !important;
}

.mta-modern-table tbody tr:last-child td {
    border-bottom: none !important;
}

/* Smooth anchor scrolling for the whole document */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 120px; /* Leave space for fixed headers */
}