/**
 * Blog Enhancements Styles - Unancor
 * Table of Contents, Reading Progress, Copy Buttons, Image Modal
 */

/* ==========================================================================
   Reading Progress Bar
   ========================================================================== */

.reading-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(229, 231, 235, 0.5);
    z-index: 9999;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4E8AFF 0%, #7C3AED 100%);
    width: 0%;
    transition: width 0.1s ease;
}

/* ==========================================================================
   Table of Contents (TOC)
   ========================================================================== */

.toc-container {
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 3rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.03);
}

.toc-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

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

.toc-item {
    margin: 0.75rem 0;
}

.toc-sublist {
    list-style: none;
    padding-left: 1.25rem;
    margin: 0.5rem 0;
}

.toc-subitem {
    margin: 0.5rem 0;
}

.toc-link {
    color: #4B5563;
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.6;
    display: block;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    position: relative;
    padding-left: 1.5rem;
}

.toc-link::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: #CBD5E1;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toc-link:hover {
    background: #F3F4F6;
    color: #4E8AFF;
    padding-left: 2rem;
}

.toc-link:hover::before {
    background: #4E8AFF;
    transform: translateY(-50%) scale(1.3);
}

.toc-link.active {
    background: linear-gradient(to right, #EFF6FF, transparent);
    color: #4E8AFF;
    font-weight: 600;
    border-left: 3px solid #4E8AFF;
    padding-left: 1.75rem;
}

.toc-link.active::before {
    background: #4E8AFF;
    width: 8px;
    height: 8px;
}

.toc-subitem .toc-link {
    font-size: 0.875rem;
    color: #6B7280;
}

/* TOC is no longer sticky - it stays inline with content */
.toc-container {
    position: relative;
    width: 100%;
    max-width: 100%;
}

/* Ensure TOC doesn't float or overlay */
.blog-content .toc-container {
    clear: both;
    float: none;
    position: static;
}

/* ==========================================================================
   Copy Code Button
   ========================================================================== */

.copy-code-button {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #E5E7EB;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    z-index: 10;
}

.copy-code-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.copy-code-button:active {
    transform: translateY(0);
}

.copy-code-button.copied {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.4);
    color: #6EE7B7;
}

.copy-code-button .copy-icon {
    width: 16px;
    height: 16px;
}

.copy-code-button .copy-text {
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

/* ==========================================================================
   Image Modal (Zoom)
   ========================================================================== */

.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.image-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.image-modal-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
    cursor: default;
}

.image-modal-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.image-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}

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

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==========================================================================
   Reading Time Badge
   ========================================================================== */

.reading-time {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #F5F9FF 0%, #EFF6FF 100%);
    border: 1px solid #DBEAFE;
    border-radius: 2rem;
    font-size: 0.875rem;
    color: #1E40AF;
    font-weight: 500;
}

.reading-time svg {
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   Social Share Buttons
   ========================================================================== */

.social-share {
    display: flex;
    gap: 0.75rem;
    margin: 2rem 0;
}

.social-share-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid #E5E7EB;
    background: white;
    color: #6B7280;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}

.social-share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.social-share-button.twitter:hover {
    background: #1DA1F2;
    border-color: #1DA1F2;
    color: white;
}

.social-share-button.linkedin:hover {
    background: #0A66C2;
    border-color: #0A66C2;
    color: white;
}

.social-share-button.facebook:hover {
    background: #1877F2;
    border-color: #1877F2;
    color: white;
}

.social-share-button.whatsapp:hover {
    background: #25D366;
    border-color: #25D366;
    color: white;
}

.social-share-button.email:hover {
    background: #EA4335;
    border-color: #EA4335;
    color: white;
}

/* ==========================================================================
   Back to Top Button
   ========================================================================== */

.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #4E8AFF 0%, #7C3AED 100%);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(78, 138, 255, 0.4);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(78, 138, 255, 0.5);
}

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

/* ==========================================================================
   Dark Mode for Enhancements
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .toc-container {
        background: #1F2937;
        border-color: #374151;
    }

    .toc-title {
        color: #F9FAFB;
    }

    .toc-link {
        color: #D1D5DB;
    }

    .toc-link:hover {
        background: #374151;
        color: #93C5FD;
    }

    .toc-link.active {
        background: linear-gradient(to right, rgba(30, 58, 138, 0.3), transparent);
        color: #93C5FD;
        border-left-color: #60A5FA;
    }

    .toc-subitem .toc-link {
        color: #9CA3AF;
    }

    .reading-time {
        background: linear-gradient(135deg, #1E3A8A 0%, #1E40AF 100%);
        border-color: #1E40AF;
        color: #BFDBFE;
    }

    .social-share-button {
        background: #1F2937;
        border-color: #374151;
        color: #D1D5DB;
    }

    .reading-progress-container {
        background: rgba(55, 65, 81, 0.5);
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .toc-container {
        padding: 1.25rem;
        margin-bottom: 2rem;
    }

    .image-modal-overlay {
        padding: 1rem;
    }

    .image-modal-close {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }

    .back-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 44px;
        height: 44px;
    }

    .social-share {
        gap: 0.5rem;
    }

    .social-share-button {
        width: 40px;
        height: 40px;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .reading-progress-container,
    .copy-code-button,
    .social-share,
    .back-to-top,
    .image-modal {
        display: none !important;
    }

    .toc-container {
        border: 1pt solid #ccc;
        page-break-inside: avoid;
    }
}
