/* Custom Styles for RichLifePath */

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Reading Progress Bar - Only visible on mobile */
.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, #2563eb 0%, #1d4ed8 100%);
    z-index: 9999;
    transition: width 0.1s ease;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
    display: none;
}

/* Next Article Suggestion - Only visible on mobile */
.next-article-suggestion {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    padding: 1.5rem;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    transition: transform 0.4s ease;
    z-index: 9998;
    display: none;
}

.next-article-suggestion.show {
    transform: translateY(0);
}

.next-article-suggestion-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.next-article-suggestion-text {
    flex: 1;
    min-width: 250px;
}

.next-article-suggestion-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: flex;
    align-items: center;
}

.next-article-suggestion-text p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.next-article-suggestion-link {
    display: inline-flex;
    align-items: center;
    background: white;
    color: #2563eb;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    margin-right: 0.5rem;
}

.next-article-suggestion-link:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.next-article-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.next-article-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Show only on mobile devices */
@media (max-width: 640px) {
    .reading-progress-bar {
        display: block;
    }
    
    .next-article-suggestion {
        display: block;
    }
    
    .next-article-suggestion {
        padding: 1rem;
    }
    
    .next-article-suggestion-content {
        flex-direction: column;
        text-align: left;
        align-items: flex-start;
    }
    
    .next-article-suggestion-link {
        width: 100%;
        justify-content: center;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .next-article-suggestion-title {
        font-size: 1.125rem;
    }
    
    .next-article-close {
        align-self: flex-end;
    }
}

/* Article Content Styling - Override Tailwind Typography */
.article-content,
.prose.article-content,
article.article-content {
    line-height: 1.8 !important;
}

.article-content h2,
.prose.article-content h2,
article.article-content h2 {
    font-size: 1.75rem !important;
    font-weight: 700 !important;
    margin-top: 2rem !important;
    margin-bottom: 1rem !important;
    color: #1e293b !important;
}

/* Remove any before/after pseudo-elements from headings */
.article-content h2::before,
.article-content h2::after,
.prose.article-content h2::before,
.prose.article-content h2::after,
article.article-content h2::before,
article.article-content h2::after,
.prose h2::before,
.prose h2::after,
.article-content h3::before,
.article-content h3::after,
.prose.article-content h3::before,
.prose.article-content h3::after,
article.article-content h3::before,
article.article-content h3::after,
.prose h3::before,
.prose h3::after,
.prose h2::before,
.prose h2::after,
.prose h3::before,
.prose h3::after {
    content: none !important;
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0 !important;
}

.article-content h3,
.prose.article-content h3,
article.article-content h3 {
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    margin-top: 1.5rem !important;
    margin-bottom: 0.75rem !important;
    color: #334155 !important;
}

.article-content p,
.prose.article-content p,
article.article-content p {
    margin-bottom: 1.25rem !important;
    color: #475569 !important;
}

.article-content ul,
.article-content ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.article-content ul,
.prose.article-content ul,
article.article-content ul,
.article-content ul[class],
.article-content > ul,
.prose ul {
    list-style: none !important;
    list-style-type: none !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
    margin-bottom: 1.25rem !important;
}

.article-content ul li,
.prose.article-content ul li,
article.article-content ul li,
.article-content > ul > li,
.prose ul li,
.article-content li {
    margin-bottom: 0.75rem !important;
    color: #475569 !important;
    padding-left: 1.75rem !important;
    position: relative !important;
    line-height: 1.8 !important;
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
}

.article-content ul li::before,
.prose.article-content ul li::before,
article.article-content ul li::before,
.article-content > ul > li::before,
.prose ul li::before {
    content: "■" !important;
    position: absolute !important;
    left: 0 !important;
    top: 0.45rem !important;
    color: #2563eb !important;
    font-weight: 900 !important;
    font-size: 0.875rem !important;
    line-height: 1 !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

.article-content ol {
    list-style: none;
    counter-reset: custom-counter;
    padding-left: 0;
}

.article-content ol li {
    counter-increment: custom-counter;
    margin-bottom: 0.75rem;
    color: #475569;
    padding-left: 2.25rem;
    position: relative;
}

.article-content ol li::before {
    content: counter(custom-counter);
    position: absolute;
    left: 0;
    top: 0.15rem;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
    z-index: 1;
    line-height: 1.5rem;
}

.article-content a {
    color: #2563eb;
    text-decoration: underline;
}

.article-content a:hover {
    color: #1d4ed8;
}

/* Table styles for articles - Maximum specificity to override Tailwind */
.article-content table,
.prose.article-content table,
article.article-content table,
section .article-content table,
.article-content > table,
.prose table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    margin: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    border: 2px solid #cbd5e1 !important;
    background-color: #ffffff !important;
    display: table !important;
    table-layout: auto !important;
    min-width: 600px !important;
    font-size: 0.875rem !important;
}

.article-content table thead,
.prose.article-content table thead,
article.article-content table thead,
.prose table thead {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    color: white !important;
    display: table-header-group !important;
}

.article-content table thead tr,
.prose.article-content table thead tr,
article.article-content table thead tr,
.prose table thead tr {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    display: table-row !important;
}

.article-content table th,
.prose.article-content table th,
article.article-content table th,
.article-content table thead th,
.prose table th {
    padding: 0.875rem 0.625rem !important;
    text-align: left !important;
    font-weight: 600 !important;
    font-size: 0.8125rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    border-right: 2px solid rgba(255, 255, 255, 0.5) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.5) !important;
    background-color: transparent !important;
    background: transparent !important;
    color: white !important;
    display: table-cell !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
}

.article-content table th:last-child,
.prose.article-content table th:last-child {
    border-right: none !important;
}

.article-content table tbody,
.prose.article-content table tbody,
article.article-content table tbody,
.prose table tbody {
    background-color: #ffffff !important;
    display: table-row-group !important;
}

.article-content table tbody tr,
.prose.article-content table tbody tr,
article.article-content table tbody tr,
.prose table tbody tr {
    display: table-row !important;
}

.article-content table td,
.prose.article-content table td,
article.article-content table td,
.article-content table tbody td,
.prose table td {
    padding: 0.75rem 0.625rem !important;
    border-bottom: 1px solid #cbd5e1 !important;
    border-right: 1px solid #cbd5e1 !important;
    color: #475569 !important;
    background-color: #ffffff !important;
    vertical-align: top !important;
    display: table-cell !important;
    word-wrap: break-word !important;
    white-space: normal !important;
    line-height: 1.6 !important;
}

.article-content table td:last-child,
.prose.article-content table td:last-child {
    border-right: none !important;
}

.article-content table tbody tr {
    transition: background-color 0.2s ease;
}

.article-content table tbody tr:hover {
    background-color: #f1f5f9;
}

.article-content table tbody tr:hover td {
    background-color: #f1f5f9 !important;
}

.article-content table tbody tr:last-child td {
    border-bottom: none !important;
}

.article-content table tbody tr:nth-child(even) td {
    background-color: #f8fafc !important;
}

.article-content table tbody tr:nth-child(even):hover td {
    background-color: #f1f5f9 !important;
}

/* Table Wrapper for Mobile Responsiveness */
.table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
}

.table-wrapper table {
    margin: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Table of Contents Toggle Styles */
.table-of-contents button {
    border: none !important;
    background: none !important;
    cursor: pointer !important;
}

.table-of-contents h3 {
    margin-bottom: 0 !important;
}

.table-of-contents #toc-list {
    display: block !important;
    max-height: 2000px !important;
    overflow: hidden !important;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease !important;
    opacity: 1 !important;
    margin-top: 1rem !important;
}

.table-of-contents.collapsed #toc-list {
    max-height: 0 !important;
    opacity: 0 !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.table-of-contents.collapsed #toc-chevron {
    transform: rotate(-90deg) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .article-content table,
    .prose.article-content table,
    article.article-content table,
    .prose table {
        font-size: 0.8125rem !important;
        min-width: 550px !important;
    }
    
    .article-content table th,
    .prose.article-content table th,
    article.article-content table th,
    .prose table th {
        padding: 0.75rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
    
    .article-content table td,
    .prose.article-content table td,
    article.article-content table td,
    .prose table td {
        padding: 0.625rem 0.5rem !important;
    }
}

@media (max-width: 640px) {
    .article-content table,
    .prose.article-content table,
    article.article-content table,
    .prose table {
        font-size: 0.75rem !important;
        min-width: 480px !important;
    }
    
    .article-content table th,
    .prose.article-content table th,
    article.article-content table th,
    .prose table th {
        padding: 0.625rem 0.375rem !important;
        font-size: 0.6875rem !important;
    }
    
    .article-content table td,
    .prose.article-content table td,
    article.article-content table td,
    .prose table td {
        padding: 0.5rem 0.375rem !important;
    }
}


.article-content blockquote {
    border-left: 4px solid #2563eb;
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #64748b;
}

/* Card Hover Effects */
.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Category Badge */
.category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Read Time Estimate */
.read-time {
    color: #64748b;
    font-size: 0.875rem;
}

/* Social Share Buttons - Only visible on mobile */
.share-buttons {
    display: none !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 0.75rem !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

.share-buttons > a,
.share-buttons > button,
.share-buttons a,
.share-buttons button {
    width: 3rem !important;
    height: 3rem !important;
    min-width: 3rem !important;
    min-height: 3rem !important;
    padding: 0 !important;
    transition: all 0.3s ease !important;
    margin: 0 !important;
    border: none !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 0.5rem !important;
    flex-shrink: 0 !important;
}

.share-buttons > a i,
.share-buttons > button i,
.share-buttons a i,
.share-buttons button i {
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.25rem !important;
    width: auto !important;
    height: auto !important;
}

/* Show buttons only on mobile devices */
@media (max-width: 640px) {
    .share-buttons {
        display: flex !important;
        gap: 0.5rem !important;
    }
    
    .share-buttons > a,
    .share-buttons > button,
    .share-buttons a,
    .share-buttons button {
        width: 2.5rem !important;
        height: 2.5rem !important;
        min-width: 2.5rem !important;
        min-height: 2.5rem !important;
    }
    
    .share-buttons > a i,
    .share-buttons > button i,
    .share-buttons a i,
    .share-buttons button i {
        font-size: 1.125rem !important;
    }
}

/* Difficulty Badge */
.difficulty-badge {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Table of Contents - Remove ONLY arrow characters, keep styling */
.table-of-contents ul,
#toc-list {
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
}

.table-of-contents ul li,
#toc-list li {
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
}

/* Remove ONLY ::before and ::after pseudo-elements that contain arrows/bullets */
.table-of-contents ul li::before,
.table-of-contents ul li::after,
.table-of-contents li::before,
.table-of-contents li::after,
#toc-list li::before,
#toc-list li::after,
.table-of-contents ul li::marker,
.table-of-contents li::marker,
#toc-list li::marker {
    content: none !important;
    display: none !important;
}

.table-of-contents a {
    color: #2563eb;
    text-decoration: none;
    transition: color 0.2s ease;
}

.table-of-contents a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Smooth scroll for TOC links */
html {
    scroll-behavior: smooth;
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    nav, footer, .share-buttons, .card-hover, 
    #featuredCarousel, button, form,
    .category-filter, .breadcrumbs {
        display: none !important;
    }
    
    .article-content {
        max-width: 100%;
    }
    
    .article-content img {
        max-width: 100%;
        page-break-inside: avoid;
    }
    
    .article-content h1,
    .article-content h2,
    .article-content h3 {
        page-break-after: avoid;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    @page {
        margin: 2cm;
    }
}

