/* ==================================================
   UX ENHANCEMENTS STYLES FOR SEO & USER EXPERIENCE
   ================================================== */

/* 1. READING PROGRESS BAR */
.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
    z-index: 9999;
}

.reading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.1s ease;
}

/* 2. TABLE OF CONTENTS */
.table-of-contents {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 20px;
    margin: 30px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border-left: 5px solid var(--primary-color);
}

.toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.toc-header i {
    color: var(--primary-color);
    font-size: 20px;
    margin-right: 10px;
}

.toc-header h3 {
    flex: 1;
    margin: 0 !important;
    font-size: 20px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
}

.toc-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px 10px;
    color: var(--text-light);
    font-size: 16px;
    transition: color 0.3s ease;
}

.toc-toggle:hover {
    color: var(--primary-color);
}

.toc-nav {
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.3s ease;
}

.table-of-contents.collapsed .toc-nav {
    max-height: 0;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 10px;
}

.toc-list a {
    display: block;
    padding: 10px 15px;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
    padding-left: 25px;
}

.toc-list a::before {
    content: '▸';
    position: absolute;
    left: 10px;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.toc-list a:hover {
    background: rgba(211, 47, 47, 0.1);
    padding-left: 30px;
}

.toc-list a:hover::before {
    transform: translateX(3px);
}

.toc-list a.active {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.toc-list a.active::before {
    color: white;
}

/* 3. BACK TO TOP BUTTON */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--secondary-color);
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.4);
}

.back-to-top:active {
    transform: translateY(-2px);
}

/* 4. BREADCRUMBS */
.breadcrumbs {
    margin: 20px 0;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
}

.breadcrumb-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.breadcrumb-list li {
    display: flex;
    align-items: center;
    color: var(--text-light);
}

.breadcrumb-list li:not(:last-child)::after {
    content: '/';
    margin-left: 10px;
    color: var(--text-light);
}

.breadcrumb-list a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb-list a:hover {
    color: var(--primary-color);
}

.breadcrumb-list .active {
    color: var(--primary-color);
    font-weight: 600;
}

.breadcrumb-list i {
    margin-right: 5px;
}

/* 5. READING TIME */
.reading-time {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border-radius: 8px;
    margin: 20px 0;
    font-size: 14px;
    color: var(--text-dark);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.reading-time i {
    color: var(--primary-color);
    font-size: 16px;
}

.reading-time span {
    font-weight: 500;
}

.reading-time .word-count {
    color: var(--text-light);
    font-weight: 400;
    padding-left: 15px;
    border-left: 2px solid rgba(0, 0, 0, 0.1);
}

/* 6. SOCIAL SHARE BUTTONS */
.social-share {
    margin: 50px 0 30px;
    padding: 30px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    text-align: center;
}

.share-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.share-label i {
    color: var(--primary-color);
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.share-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-size: 20px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.share-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.share-btn.facebook {
    background: #1877f2;
}

.share-btn.twitter {
    background: #1da1f2;
}

.share-btn.linkedin {
    background: #0a66c2;
}

.share-btn.whatsapp {
    background: #25d366;
}

.share-btn.copy-link {
    background: #6c757d;
}

.share-btn.copy-link.copied {
    background: #28a745;
}

/* 7. SMOOTH SCROLL ENHANCEMENT */
html {
    scroll-behavior: smooth;
}

/* 8. RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
        font-size: 18px;
    }

    .table-of-contents {
        padding: 15px;
        margin: 20px 0;
    }

    .toc-header h3 {
        font-size: 18px;
    }

    .toc-list a {
        font-size: 14px;
        padding: 8px 12px;
    }

    .breadcrumbs {
        font-size: 12px;
        padding: 10px 15px;
    }

    .reading-time {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        font-size: 13px;
    }

    .reading-time .word-count {
        padding-left: 0;
        border-left: none;
        padding-top: 8px;
        border-top: 2px solid rgba(0, 0, 0, 0.1);
    }

    .social-share {
        padding: 20px;
    }

    .share-label {
        font-size: 16px;
    }

    .share-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

/* 9. PRINT STYLES */
@media print {
    .reading-progress-bar,
    .back-to-top,
    .social-share,
    .toc-toggle {
        display: none;
    }

    .table-of-contents {
        border: 1px solid #ddd;
        background: white;
    }
}

/* 10. ACCESSIBILITY ENHANCEMENTS */
.back-to-top:focus,
.share-btn:focus,
.toc-toggle:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}
