/**
 * Article Enhancements - Modern Styles
 * Futuristic, engaging design for single article pages
 */

/* ==========================================
   FLOATING ACTION MENU
   ========================================== */

.article-floating-menu {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.article-floating-menu.show {
    opacity: 1;
    transform: translateY(0);
}

.floating-menu-trigger {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0052cc 0%, #00c453 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    font-size: 20px;
}

.floating-menu-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

.floating-menu-trigger.active {
    transform: rotate(90deg);
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.floating-menu-content {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.floating-menu-content.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.menu-item {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: white;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    font-size: 18px;
    color: #0052cc;
    position: relative;
}

.menu-item:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    background: linear-gradient(135deg, #0052cc 0%, #00c453 100%);
    color: white;
}

.menu-item span {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 2px;
    letter-spacing: 0.5px;
}

.menu-item i {
    font-size: 18px;
}

/* Animation delays for staggered effect */
.floating-menu-content.active .menu-item:nth-child(1) { transition-delay: 0.05s; }
.floating-menu-content.active .menu-item:nth-child(2) { transition-delay: 0.1s; }
.floating-menu-content.active .menu-item:nth-child(3) { transition-delay: 0.15s; }
.floating-menu-content.active .menu-item:nth-child(4) { transition-delay: 0.2s; }

/* ==========================================
   TABLE OF CONTENTS (Sliding Panel)
   ========================================== */

.article-toc {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 30px rgba(0,0,0,0.1);
    z-index: 2000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.article-toc.active {
    right: 0;
}

.toc-header {
    padding: 30px;
    background: linear-gradient(135deg, #0052cc 0%, #00c453 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.toc-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.toc-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
}

.toc-close:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

.toc-nav {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

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

.toc-item {
    margin-bottom: 10px;
}

.toc-item a {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.toc-item a:hover {
    background: #f8f9fa;
    border-left-color: #0052cc;
    transform: translateX(5px);
    color: #0052cc;
}

.toc-item.active a {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-left-color: #0052cc;
    color: #0052cc;
    font-weight: 600;
}

/* Heading levels */
.toc-level-2 {
    margin-left: 0;
}

.toc-level-3 {
    margin-left: 20px;
}

.toc-level-3 a {
    font-size: 14px;
    padding: 10px 15px;
}

/* Overlay when TOC is open */
.article-toc.active::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 400px;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: -1;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==========================================
   READING TIME INDICATOR
   ========================================== */

.article-reading-time {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 20px;
    color: #0052cc;
    font-weight: 600;
    font-size: 14px;
    margin: 15px 0;
}

.article-reading-time i {
    font-size: 16px;
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */

.article-toast {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: #333;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    font-weight: 500;
}

.article-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================
   RELATED ARTICLES (Enhanced)
   ========================================== */

.article-related {
    margin-top: 60px;
    padding: 50px 0;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
}

.widget.article-related {
    background: transparent;
    border: none;
    box-shadow: none;
}

.widget.article-related .block-header {
    text-align: center;
    margin-bottom: 50px;
    border: none;
    padding: 0;
}

.widget.article-related .block-header .block-title {
    position: relative;
    display: inline-block;
    padding: 0 30px;
}

.widget.article-related .block-header .block-title span {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(135deg, #0052cc 0%, #00c453 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    z-index: 1;
}

.widget.article-related .block-header .block-title span::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #0052cc 0%, #00c453 100%);
    border-radius: 2px;
}

.widget.article-related .block-header .block-title span::after {
    content: '✨';
    position: absolute;
    right: -35px;
    top: -5px;
    font-size: 24px;
}

.widget.article-related .block-content {
    padding: 0;
}

.widget.article-related .row {
    gap: 0;
}

.widget.article-related .block-item {
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

.widget.article-related .block-item-img {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    aspect-ratio: 16 / 9;
}

.widget.article-related .block-item-img::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.7) 100%);
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.widget.article-related .block-item:hover .block-item-img::before {
    opacity: 1;
}

.widget.article-related .block-item:hover .block-item-img {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.25);
}

.widget.article-related .block-item-img a {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.4s ease;
}

.widget.article-related .block-item:hover .block-item-img a {
    transform: scale(1.08);
}

.widget.article-related .block-item-category {
    position: absolute;
    bottom: 15px;
    left: 15px;
    z-index: 3;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
}

.widget.article-related .block-item:hover .block-item-category {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.widget.article-related .block-item-category a {
    color: white;
    text-decoration: none;
}

.widget.article-related .block-item-title {
    margin-top: 20px;
    margin-bottom: 12px;
    line-height: 1.5;
}

.widget.article-related .block-item-title a {
    font-size: 18px;
    font-weight: 700;
    color: #2d3748;
    text-decoration: none;
    transition: all 0.3s ease;
    display: block;
}

.widget.article-related .block-item-title a:hover {
    color: #0052cc;
    transform: translateX(5px);
}

.widget.article-related .block-item-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    color: #718096;
}

.widget.article-related .block-item-meta small {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.widget.article-related .block-item-meta i {
    color: #a0aec0;
    font-size: 14px;
}

/* Engagement indicators */
.article-engagement-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 3;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #0052cc;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.article-engagement-badge i {
    font-size: 14px;
}

/* Related Articles Animation */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.widget.article-related .block-item {
    animation: slideInUp 0.6s ease forwards;
    opacity: 0;
}

.widget.article-related .block-item:nth-child(1) { animation-delay: 0.1s; }
.widget.article-related .block-item:nth-child(2) { animation-delay: 0.2s; }
.widget.article-related .block-item:nth-child(3) { animation-delay: 0.3s; }
.widget.article-related .block-item:nth-child(4) { animation-delay: 0.4s; }
.widget.article-related .block-item:nth-child(5) { animation-delay: 0.5s; }
.widget.article-related .block-item:nth-child(6) { animation-delay: 0.6s; }

/* ==========================================
   MOBILE RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .article-floating-menu {
        right: 15px;
        bottom: 15px;
    }

    .floating-menu-trigger,
    .menu-item {
        width: 48px;
        height: 48px;
    }

    .article-toc {
        width: 100%;
        right: -100%;
    }

    .article-toc.active {
        right: 0;
    }

    .article-toc.active::before {
        right: 0;
    }

    .toc-header {
        padding: 20px;
    }

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

    .toc-nav {
        padding: 20px;
    }

    .related-articles-grid {
        grid-template-columns: 1fr;
    }

    .article-toast {
        left: 20px;
        right: 20px;
    }
}

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

@media print {
    .article-floating-menu,
    .article-toc,
    .article-toast {
        display: none !important;
    }
}

/* ==========================================
   SMOOTH ANIMATIONS
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
