/**
 * Blog Post - Enhanced Design with UI/UX Improvements
 * Features: Breadcrumbs, TOC, Related Posts, Prev/Next Navigation
 * Portfolio Website by Amr Farag
 */

/* ==================== CSS VARIABLES ==================== */
:root {
    /* Colors */
    --dark: #0A0E1A;
    --dark-secondary: #1A2332;
    --dark-tertiary: #252F3F;
    --primary: #FF9500;
    --primary-hover: #FFB340;
    --text: #FFFFFF;
    --text-light: #E5E5E5;
    --text-gray: #94A3B8;
    --border: rgba(255, 255, 255, 0.1);
    --border-primary: rgba(255, 149, 0, 0.4);
    
    /* Spacing Scale (8px Grid System) */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    --space-4xl: 80px;
    --space-5xl: 120px;
    
    /* Container Widths */
    --container-hero: 1400px;
    --container-content: 1200px;
    --container-reading: 900px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-full: 50px;
    
    /* Typography Scale (1.25 - Major Third) */
    --text-base: 17px;
    --text-lg: 18px;
    --text-xl: 22px;
    --text-2xl: 26px;
    --text-3xl: 32px;
    --text-4xl: 42px;
    --text-5xl: 56px;
    
    /* Line Heights */
    --leading-tight: 1.2;
    --leading-snug: 1.3;
    --leading-normal: 1.5;
    --leading-relaxed: 1.7;
    --leading-loose: 1.8;
    
    /* Shadows */
    --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 25px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(255, 149, 0, 0.15);
}

/* ==================== GLOBAL RESETS ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #1A2332;
    color: var(--text-light);
    line-height: 1.7;
    overflow-x: hidden;
}

/* ==================== BACK TO BLOG BUTTON (Floating Minimal) ==================== */
.back-to-blog-wrapper {
    padding: 20px 0;
    position: sticky;
    top: 70px;
    z-index: 50;
    background: #111623;
}

.back-to-blog-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    margin-left: var(--space-2xl);
    background: transparent;
    border: none;
    color: var(--text-gray);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.back-to-blog-btn:hover {
    color: var(--primary);
    transform: translateX(-5px);
}

.back-to-blog-btn i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.back-to-blog-btn:hover i {
    transform: translateX(-3px);
}

.back-to-blog-btn::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.back-to-blog-btn:hover::after {
    width: 100%;
}

/* ==================== HERO SECTION ==================== */
.blog-post-hero {
    position: relative;
    background: linear-gradient(180deg, #0F1624 0%, #1A2332 100%);
    padding: 49px 0 0 0px;
    overflow: hidden;
}

.hero-container {
    max-width: var(--container-hero);
    margin: 0 auto;
    padding: 0 var(--space-2xl);
    text-align: center;
    position: relative;
    z-index: 10;
}

/* Featured Image in Hero */
.hero-featured-image {
    position: relative;
    width: 100%;
    max-width: var(--container-hero);
    height: 700px;
    margin: 0 auto var(--space-2xl);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border: 2px solid var(--border-primary);
}

.hero-featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(26, 35, 50, 0.3) 50%,
        rgba(26, 35, 50, 0.7) 100%
    );
    pointer-events: none;
}

/* Hero Content */
.hero-content {
    position: relative;
}

.hero-title {
    font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl));
    font-weight: 800;
    line-height: var(--leading-tight);
    color: var(--text);
    margin-bottom: var(--space-lg);
    letter-spacing: -0.5px;
}

/* Meta Information */
.hero-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
    margin-top: var(--space-lg);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 14px;
    color: var(--text-gray);
    font-weight: 500;
}

.meta-item i {
    color: var(--primary);
    font-size: var(--space-md);
}

.meta-item.category {
    background: rgba(255, 149, 0, 0.1);
    border: 1px solid var(--border-primary);
    padding: 6px var(--space-md);
    border-radius: var(--radius-lg);
    color: var(--primary);
    font-weight: 600;
}

/* ==================== CONTENT SECTION ==================== */
.blog-post-content-section {
    background: #1A2332;
    padding: var(--space-4xl) 0;
    position: relative;
}

.blog-post-content-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(255, 149, 0, 0.03) 0%, transparent 70%);
    pointer-events: none;
}

.content-wrapper {
    position: relative;
    max-width: var(--container-hero);
    margin: 0 auto;
    display: flex;
    gap: var(--space-4xl);
}

.content-container {
    max-width: var(--container-content);
    margin: 0 auto;
    padding: 0 var(--space-2xl);
    position: relative;
    z-index: 10;
    flex: 1;
}

/* ==================== TABLE OF CONTENTS (REDESIGNED) ==================== */
.table-of-contents {
    background: transparent;
    border: none;
    border-left: 3px solid rgba(255, 149, 0, 0.4);
    padding: 0 0 0 var(--space-xl);
    margin-bottom: var(--space-3xl);
}

.toc-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: var(--space-lg);
}

.toc-header i {
    color: var(--primary);
    font-size: 18px;
}

.toc-header h3 {
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    margin-bottom: 8px;
}

.toc-item-sub {
    margin-left: var(--space-lg);
}

.toc-link {
    color: var(--text-gray);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.6;
    display: inline-block;
    transition: all 0.3s ease;
    position: relative;
}

.toc-link::before {
    content: '→';
    margin-right: 8px;
    color: var(--primary);
    opacity: 0;
    transition: all 0.3s ease;
}

.toc-link:hover::before,
.toc-link.active::before {
    opacity: 1;
}

.toc-link:hover {
    color: var(--text);
}

.toc-link.active {
    color: var(--primary);
    font-weight: 600;
}

/* ==================== FLOATING SOCIAL SHARE (Desktop) ==================== */
.floating-social-share {
    position: sticky;
    top: 150px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    padding: var(--space-lg);
    background: rgba(30, 38, 55, 0.6);
    border: 2px solid rgba(255, 149, 0, 0.3);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(15px);
    box-shadow: var(--shadow-sm);
    margin-left: var(--space-2xl);
    height: fit-content;
}

.floating-share-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 1px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

.floating-share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: rgba(30, 38, 55, 0.8);
    border: 2px solid var(--border);
    border-radius: 50%;
    color: var(--text-light);
    font-size: 18px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.floating-share-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.floating-share-btn.twitter:hover {
    background: rgba(29, 161, 242, 0.15);
    border-color: #1DA1F2;
    color: #1DA1F2;
}

.floating-share-btn.linkedin:hover {
    background: rgba(0, 119, 181, 0.15);
    border-color: #0077B5;
    color: #0077B5;
}

.floating-share-btn.facebook:hover {
    background: rgba(66, 103, 178, 0.15);
    border-color: #4267B2;
    color: #4267B2;
}

/* Excerpt/Intro */
.post-excerpt-intro {
    font-size: var(--text-lg);
    line-height: var(--leading-loose);
    color: var(--text-gray);
    margin-bottom: var(--space-2xl);
    padding: var(--space-xl);
    background: rgba(30, 38, 55, 0.4);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
}

/* Main Content Typography */
.post-main-content {
    color: var(--text-light);
    font-size: var(--text-base);
    line-height: var(--leading-loose);
}

.post-main-content h2 {
    font-size: var(--text-3xl);
    font-weight: 800;
    color: var(--text);
    margin: 50px 0 var(--space-lg);
    line-height: var(--leading-snug);
    scroll-margin-top: 120px;
}

.post-main-content h3 {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text);
    margin: var(--space-2xl) 0 var(--space-md);
    line-height: var(--leading-snug);
    scroll-margin-top: 120px;
}

.post-main-content h4 {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--primary);
    margin: var(--space-xl) 0 14px;
    line-height: var(--leading-snug);
}

.post-main-content p {
    margin-bottom: var(--space-lg);
    color: var(--text-light);
}

.post-main-content strong {
    color: var(--text);
    font-weight: 700;
}

.post-main-content em {
    color: var(--primary-hover);
    font-style: italic;
}

.post-main-content a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 149, 0, 0.4);
    transition: all 0.3s ease;
}

.post-main-content a:hover {
    color: var(--primary-hover);
    border-bottom-color: var(--primary-hover);
}

/* Lists */
.post-main-content ul,
.post-main-content ol {
    margin: var(--space-lg) 0;
    padding-left: var(--space-xl);
}

.post-main-content li {
    margin-bottom: 12px;
    line-height: var(--leading-loose);
}

.post-main-content ul li::marker {
    color: var(--primary);
}

.post-main-content ol li::marker {
    color: var(--primary);
    font-weight: 700;
}

/* Blockquotes */
.post-main-content blockquote {
    margin: var(--space-xl) 0;
    padding: var(--space-lg) var(--space-xl);
    background: rgba(30, 38, 55, 0.5);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    font-size: var(--text-lg);
    font-style: italic;
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.post-main-content blockquote p {
    margin: 0;
}

/* Code Blocks */
.post-main-content pre {
    background: rgba(15, 22, 36, 0.8);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-lg);
    overflow-x: auto;
    margin: var(--space-lg) 0;
}

.post-main-content code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 14px;
    color: var(--primary-hover);
}

.post-main-content pre code {
    color: var(--text-light);
}

.post-main-content :not(pre) > code {
    background: rgba(255, 149, 0, 0.1);
    padding: 2px var(--space-sm);
    border-radius: 4px;
    font-size: 15px;
}

/* Images in Content */
.post-main-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: var(--space-xl) 0;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

/* ==================== TAGS SECTION ==================== */
.post-tags-section {
    margin-top: var(--space-3xl);
    padding-top: var(--space-xl);
    border-top: 2px solid rgba(255, 149, 0, 0.2);
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.tags-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.tags-title i {
    color: var(--primary);
    font-size: 18px;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tag-item {
    padding: 8px 18px;
    background: rgba(255, 149, 0, 0.1);
    border: 1px solid rgba(255, 149, 0, 0.35);
    border-radius: var(--radius-full);
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.tag-item:hover {
    background: rgba(255, 149, 0, 0.2);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* ==================== SHARE SECTION ==================== */
.blog-share-section {
    background: #1A2332;
    padding: 60px 0 var(--space-4xl);
    border-top: 1px solid rgba(255, 149, 0, 0.15);
}

.share-container {
    max-width: var(--container-content);
    margin: 0 auto;
    padding: 0 var(--space-2xl);
    text-align: center;
}

.share-heading {
    font-size: var(--space-lg);
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--space-xl);
}

.share-buttons-row {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.share-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: rgba(30, 38, 55, 0.6);
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.share-button i {
    font-size: var(--text-lg);
}

.share-button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.twitter-btn:hover {
    background: rgba(29, 161, 242, 0.15);
    border-color: #1DA1F2;
    color: #1DA1F2;
}

.linkedin-btn:hover {
    background: rgba(0, 119, 181, 0.15);
    border-color: #0077B5;
    color: #0077B5;
}

.facebook-btn:hover {
    background: rgba(66, 103, 178, 0.15);
    border-color: #4267B2;
    color: #4267B2;
}

/* ==================== RELATED POSTS SECTION ==================== */
.related-posts-section {
    background: linear-gradient(180deg, 
        rgba(15, 22, 36, 0.95) 0%, 
        rgba(25, 32, 48, 0.98) 100%
    );
    padding: var(--space-5xl) 0;
    position: relative;
    overflow: hidden;
}

.related-posts-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(255, 149, 0, 0.06) 0%, transparent 70%);
    z-index: 1;
}

.related-container {
    max-width: var(--container-hero);
    margin: 0 auto;
    padding: 0 var(--space-2xl);
    position: relative;
    z-index: 10;
}

.related-header {
    text-align: center;
    margin-bottom: var(--space-4xl);
}

.related-title {
    font-size: 48px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 15px;
    letter-spacing: -1px;
}

.related-subtitle {
    font-size: 18px;
    color: var(--text-gray);
    font-weight: 500;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

.related-post-card {
    background: linear-gradient(
        135deg,
        rgba(255, 149, 0, 0.05) 0%,
        rgba(30, 38, 55, 0.7) 50%,
        rgba(255, 149, 0, 0.05) 100%
    );
    border: 2px solid rgba(255, 149, 0, 0.3);
    border-radius: 25px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    backdrop-filter: blur(15px);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    box-shadow: 
        0 10px 35px rgba(0, 0, 0, 0.4),
        0 0 25px rgba(255, 149, 0, 0.06);
}

.related-post-card:hover {
    border-color: var(--primary);
    transform: translateY(-8px);
    box-shadow: 
        0 20px 45px rgba(0, 0, 0, 0.5),
        0 0 45px rgba(255, 149, 0, 0.35);
}

.related-post-image {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 149, 0, 0.1), rgba(30, 38, 55, 0.9));
}

.related-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.related-post-card:hover .related-post-image img {
    transform: scale(1.08);
}

.related-post-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(10, 14, 26, 0.4) 100%);
}

.related-post-content {
    padding: 30px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.related-post-category {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(255, 149, 0, 0.15);
    border: 1px solid rgba(255, 149, 0, 0.35);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 50px;
    margin-bottom: 15px;
    width: fit-content;
}

.related-post-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 12px;
    line-height: 1.3;
}

.related-post-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.related-post-card:hover .related-post-title a {
    color: var(--primary);
}

.related-post-excerpt {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-gray);
    margin-bottom: 20px;
}

.related-post-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-top: auto;
}

.related-post-card:hover .related-post-link {
    gap: 14px;
}

/* ==================== RESPONSIVE DESIGN ==================== */

@media (max-width: 1024px) {
    .floating-social-share {
        display: none;
    }
    
    .content-wrapper {
        display: block;
    }
    
    .related-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .back-to-blog-btn {
        margin-left: var(--space-lg);
        font-size: 14px;
    }
    
    .blog-post-hero {
        padding: 10px 0 0px;
    }
    
    .hero-container {
        padding: 0 var(--space-lg);
    }
    
    .hero-featured-image {
        height: 280px;
        margin-bottom: var(--space-xl);
    }
    
    .hero-title {
        font-size: 28px;
    }
    
    .hero-meta {
        gap: var(--space-md);
    }
    
    .meta-item {
        font-size: 13px;
    }
    
    .blog-post-content-section {
        padding: 30px 0;
    }
    
    .content-container,
    .share-container {
        padding: 0 var(--space-lg);
    }
    
    .table-of-contents {
        padding-left: var(--space-lg);
        margin-bottom: var(--space-xl);
    }
    
    .toc-header h3 {
        font-size: 16px;
    }
    
    .toc-link {
        font-size: 13px;
    }
    
    .post-excerpt-intro {
        font-size: var(--space-md);
        padding: var(--space-lg);
    }
    
    .post-main-content {
        font-size: var(--space-md);
    }
    
    .post-main-content h2 {
        font-size: var(--text-2xl);
        margin: var(--space-2xl) 0 var(--space-md);
    }
    
    .post-main-content h3 {
        font-size: var(--text-xl);
        margin: var(--space-xl) 0 14px;
    }
    
    .post-main-content h4 {
        font-size: var(--space-lg);
    }
    
    .share-buttons-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .share-button {
        justify-content: center;
        width: 100%;
    }
    
    .related-posts-grid {
        grid-template-columns: 1fr;
    }
    
    .related-title {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .hero-featured-image {
        height: 220px;
        border-radius: 12px;
    }
    
    .hero-title {
        font-size: var(--space-lg);
    }
    
    .hero-meta {
        gap: 12px;
    }
    
    .post-main-content h2 {
        font-size: var(--space-lg);
    }
    
    .post-main-content blockquote {
        padding: 18px var(--space-lg);
        font-size: var(--space-md);
    }
    
    .table-of-contents {
        padding-left: 12px;
    }
    
    .related-title {
        font-size: 28px;
    }
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .back-to-blog-wrapper,
    .floating-social-share,
    .table-of-contents,
    .blog-share-section,
    .related-posts-section,
    .share-buttons-row {
        display: none;
    }
    
    .blog-post-hero,
    .blog-post-content-section {
        background: white !important;
        color: black !important;
    }
    
    .hero-title,
    .post-main-content h2,
    .post-main-content h3 {
        color: black !important;
    }
}

/* ==================== END OF FILE ==================== */