/**
 * Makale Grok - Frontend CSS
 * Table of Contents (TOC) & Article Enhancements
 *
 * @package MakaleGrok
 */

/* ========================================
   TABLE OF CONTENTS (İçindekiler)
   ======================================== */

/* TOC Container */
.mg-table-of-contents {
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    border-left: 4px solid #4f46e5;
    border-radius: 12px;
    padding: 24px 28px;
    margin: 32px 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.mg-table-of-contents:hover {
    box-shadow: 0 6px 24px rgba(79, 70, 229, 0.15);
    transform: translateY(-2px);
}

/* TOC Heading */
.mg-table-of-contents h2 {
    color: #1e293b;
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #4f46e5;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mg-table-of-contents h2::before {
    content: "📚";
    font-size: 24px;
}

/* TOC List */
.mg-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: toc-counter;
}

.mg-toc-list li {
    counter-increment: toc-counter;
    margin-bottom: 12px;
    position: relative;
    padding-left: 32px;
}

.mg-toc-list li::before {
    content: counter(toc-counter);
    position: absolute;
    left: 0;
    top: 2px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

/* TOC Links */
.mg-toc-list a {
    color: #334155;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.6;
    transition: all 0.3s ease;
    display: inline-block;
    position: relative;
}

.mg-toc-list a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    transition: width 0.3s ease;
}

.mg-toc-list a:hover {
    color: #4f46e5;
    transform: translateX(4px);
}

.mg-toc-list a:hover::after {
    width: 100%;
}

/* ========================================
   HEADING ANCHORS (Başlık Linkler)
   ======================================== */

.mg-heading-anchor {
    position: relative;
    scroll-margin-top: 32px; /* Space for fixed headers */
}

/* Anchor link indicator */
.mg-heading-anchor::before {
    content: "🔗";
    position: absolute;
    left: -32px;
    opacity: 0;
    font-size: 20px;
    transition: opacity 0.3s ease;
}

.mg-heading-anchor:hover::before {
    opacity: 0.6;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablet */
@media screen and (max-width: 768px) {
    .mg-table-of-contents {
        padding: 20px 24px;
        margin: 24px 0;
    }

    .mg-table-of-contents h2 {
        font-size: 20px;
    }

    .mg-toc-list a {
        font-size: 15px;
    }

    .mg-heading-anchor::before {
        left: -28px;
        font-size: 18px;
    }
}

/* Mobile */
@media screen and (max-width: 480px) {
    .mg-table-of-contents {
        padding: 16px 20px;
        margin: 20px -10px; /* Slightly wider on mobile */
        border-radius: 8px;
    }

    .mg-table-of-contents h2 {
        font-size: 18px;
    }

    .mg-toc-list li {
        padding-left: 28px;
        margin-bottom: 10px;
    }

    .mg-toc-list li::before {
        width: 20px;
        height: 20px;
        font-size: 11px;
    }

    .mg-toc-list a {
        font-size: 14px;
    }

    .mg-heading-anchor::before {
        display: none; /* Hide on mobile to save space */
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .mg-table-of-contents {
        background: #fff;
        border: 1px solid #333;
        box-shadow: none;
    }

    .mg-toc-list a {
        color: #000;
    }

    .mg-heading-anchor::before {
        display: none;
    }
}

/* ========================================
   DARK MODE SUPPORT (Optional)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .mg-table-of-contents {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
        border-left-color: #818cf8;
    }

    .mg-table-of-contents h2 {
        color: #f1f5f9;
        border-bottom-color: #818cf8;
    }

    .mg-toc-list a {
        color: #cbd5e1;
    }

    .mg-toc-list a:hover {
        color: #818cf8;
    }

    .mg-toc-list li::before {
        background: linear-gradient(135deg, #6366f1, #8b5cf6);
    }
}
