
:root {
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #8b5cf6;
    --text: #1e293b;
    --text-light: #64748b;
    --border-radius: 0.75rem;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.05);
    --shadow-md: 0 0.25rem 0.375rem -0.0625rem rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 0.625rem 0.9375rem -0.1875rem rgba(124, 58, 237, 0.15);
}

/* Main content */
.main-container {
    padding: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 2rem;
}

.back-button:hover {
    background: linear-gradient(-45deg, #0ea5e9, #8b5cf6);
    color: white;
    border-color: transparent;
    transform: translateX(-5px);
    box-shadow: var(--shadow-md);
}

.back-button i {
    transition: transform 0.3s ease;
}

.back-button:hover i {
    transform: translateX(-3px);
}

.blog-header-card {
    color: white;
    padding: 3rem 2.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.blog-header-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.blog-header-card::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
}

.blog-header-card > * {
    position: relative;
    z-index: 1;
}

.blog-category-badge {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: rgba(255,255,255,0.25);
    border-radius: 25px;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.blog-header-card h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.blog-header-meta {
    font-size: 1rem;
    opacity: 0.95;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.blog-header-meta i {
    margin-right: 0.5rem;
}

.blog-header-meta span {
    display: inline-flex;
    align-items: center;
}

.blog-content-card {
    background: white;
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.blog-featured-image {
    width: 100%;
    object-fit: cover;
    border-radius: var(--border-radius);
    margin-bottom: 2.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.blog-featured-image:hover {
    transform: scale(1.02);
}

/* Blog Body Content Styles */
.blog-body {
    position: relative;
    z-index: 1;
    /* Using clearfix ::after instead of overflow:hidden to contain floats */
    /* This prevents borders from being cut off */
}

.blog-body::after {
    content: "";
    display: table;
    clear: both;
}

.blog-body * {
    pointer-events: auto;
}

.blog-body h1 {
    color: var(--text);
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    font-size: 1.75rem;
    line-height: 1.3;
    clear: both;
}

.blog-body h2 {
    color: var(--text);
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    clear: both;
}

.blog-body h3 {
    color: var(--text);
    font-weight: 600;
    margin-top: 1.75rem;
    margin-bottom: 0.875rem;
    font-size: 1.25rem;
    clear: both;
}

.blog-body p {
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
    line-height: 1.8;
    color: #495057;
}

.blog-body strong,
.blog-body b {
    font-weight: 700;
    color: var(--text);
}

/* Handle inline font-weight styles from pasted content */
.blog-body span[style*="font-weight: bold"],
.blog-body span[style*="font-weight:bold"],
.blog-body span[style*="font-weight: 700"],
.blog-body span[style*="font-weight:700"],
.blog-body span[style*="font-weight: 800"],
.blog-body span[style*="font-weight:800"],
.blog-body span[style*="font-weight: 900"],
.blog-body span[style*="font-weight:900"] {
    font-weight: 700 !important;
    color: var(--text);
}

.blog-body a {
    color: var(--primary) !important;
    text-decoration: underline !important;
    text-underline-offset: 2px;
    transition: all 0.2s ease;
    cursor: pointer !important;
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
    display: inline;
}

/* Links inside strong tags should inherit primary color */
.blog-body strong a,
.blog-body a strong,
.blog-body b a,
.blog-body a b {
    color: var(--primary) !important;
    font-weight: 600;
}

/* Fix for links with span or inline styles */
.blog-body a span,
.blog-body a * {
    color: inherit !important;
}

.blog-body a[style],
.blog-body a span[style] {
    color: var(--primary) !important;
}

.blog-body strong a:hover,
.blog-body a strong:hover,
.blog-body b a:hover,
.blog-body a b:hover {
    color: var(--primary-dark) !important;
}

.blog-body a:hover {
    color: var(--primary-dark) !important;
    text-decoration-thickness: 2px;
}

.blog-body a:visited {
    color: #5b21b6 !important;
}

.blog-body strong a:visited,
.blog-body b a:visited {
    color: #5b21b6 !important;
}

/* List Styles */
.blog-body ul {
    margin-bottom: 1.25rem;
    padding-left: 2rem;
    list-style-type: disc !important;
    list-style-position: outside;
}

.blog-body ol {
    margin-bottom: 1.25rem;
    padding-left: 2rem;
    list-style-type: decimal !important;
    list-style-position: outside;
}

.blog-body ul ul {
    list-style-type: circle !important;
}

.blog-body ul ul ul {
    list-style-type: square !important;
}

.blog-body li {
    margin-bottom: 0.625rem;
    line-height: 1.7;
    display: list-item !important;
}

.blog-body .ql-indent-1 {
    padding-left: 3rem;
}

.blog-body .ql-indent-2 {
    padding-left: 6rem;
}

.blog-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1.25rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--text-light);
    clear: both;
}

.blog-body table {
    width: 100%;
    margin: 2rem 0;
    border-collapse: collapse;
    clear: both;
}

.blog-body table th,
.blog-body table td {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
}

.blog-body table th {
    background: #f8f9fa;
    font-weight: 600;
}

/* =====================================================
    CKEditor 4 Image Styles - IMPORTANT
    CKEditor 4 outputs images with align, hspace, vspace, 
    border attributes that need CSS handling
    ===================================================== */

/* Base image styles for all images in blog body */
.blog-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    display: inline-block;
    vertical-align: middle;
    box-sizing: border-box; /* Include border in width calculation */
}

/* Remove default styling when border attribute is set */
.blog-body img[border] {
    border-radius: 0;
    box-shadow: none;
    box-sizing: border-box; /* Ensure border is included in max-width */
}

/* CKEditor 4 align="left" attribute */
.blog-body img[align="left"] {
    float: left;
    margin: 0.5rem 1.5rem 1rem 0;
    clear: left;
}

/* CKEditor 4 align="right" attribute */
.blog-body img[align="right"] {
    float: right;
    margin: 0.5rem 0 1rem 1.5rem;
    clear: right;
}

/* CKEditor 4 align="middle" or "center" - for inline centering */
.blog-body img[align="middle"],
.blog-body img[align="center"] {
    display: block;
    margin: 1.5rem auto;
    float: none;
}

/* CKEditor 4 align="top", "bottom", "baseline" - text alignment */
.blog-body img[align="top"] {
    vertical-align: top;
}

.blog-body img[align="bottom"] {
    vertical-align: bottom;
}

.blog-body img[align="baseline"] {
    vertical-align: baseline;
}

/* Images wrapped in paragraph (common CKEditor 4 output) */
.blog-body p > img {
    margin: 1rem 0;
}

/* Centered paragraph with image */
.blog-body p[style*="text-align: center"] > img,
.blog-body p[style*="text-align:center"] > img,
.blog-body .text-center > img,
.blog-body [align="center"] > img {
    display: block;
    margin: 1.5rem auto;
}

/* Figure elements (if CKEditor outputs them) */
.blog-body figure {
    margin: 2rem 0;
    text-align: center;
}

.blog-body figure.image {
    margin: 2rem 0;
    text-align: center;
}

.blog-body figure.image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.blog-body figure img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.blog-body figcaption {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 0.75rem;
    font-style: italic;
}

/* CKEditor 5 compatibility (image style classes) */
.blog-body .image-style-side {
    float: right;
    margin-left: 1.25rem;
    max-width: 50%;
}

.blog-body .image-style-align-left {
    float: left;
    margin-right: 1.25rem;
}

.blog-body .image-style-align-right {
    float: right;
    margin-left: 1.25rem;
}

.blog-body .image-style-align-center,
.blog-body .image-align-center {
    text-align: center;
    margin: 2rem auto;
    display: block;
}

.blog-body .image-align-left {
    float: left;
    margin-right: 1.25rem;
}

.blog-body .image-align-right {
    float: right;
    margin-left: 1.25rem;
}

/* Clear floats after sections */
.blog-body h1::before,
.blog-body h2::before,
.blog-body h3::before,
.blog-body h4::before,
.blog-body h5::before,
.blog-body h6::before {
    content: "";
    display: table;
    clear: both;
}

/* Ensure proper spacing when images have width/height attributes */
.blog-body img[width],
.blog-body img[height] {
    max-width: 100%;
    height: auto;
}

/* Handle images with style attribute containing width */
.blog-body img[style*="width"] {
    max-width: 100%;
    height: auto !important;
}

/* Share Section */
.share-card {
    background: linear-gradient(135deg, rgba(39, 56, 121, 0.05) 0%, rgba(15, 116, 178, 0.05) 100%);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2.5rem;
    text-align: center;
    border: 1px solid rgba(39, 56, 121, 0.1);
}

.share-card h5 {
    margin-bottom: 1.25rem;
    color: var(--text);
    font-weight: 600;
}

.share-btn {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white !important;
    border-radius: 50%;
    margin: 0 0.5rem;
    font-size: 1.25rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none !important;
    box-shadow: var(--shadow-sm);
}

.share-btn:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: var(--shadow-md);
}

.share-facebook {
    background: linear-gradient(135deg, #1877f2, #0d65d9);
}

.share-twitter {
    background: linear-gradient(135deg, #1da1f2, #0c8de4);
}

.share-linkedin {
    background: linear-gradient(135deg, #0077b5, #005a8c);
}

.share-whatsapp {
    background: linear-gradient(135deg, #25d366, #128c7e);
}

/* FAQ Section */
.faq-section {
    background: white;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 2.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.faq-section h3 {
    color: var(--text);
    font-weight: 700;
    margin-bottom: 2rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
}

.faq-section h3 i {
    color: var(--primary);
}

.faq-item {
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item:hover {
    border-color: var(--primary-light);
}

.faq-question {
    padding: 1.25rem 1.5rem;
    background: #f8fafc;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--text);
    transition: all 0.3s ease;
}

.faq-question:hover {
    background: #f1f5f9;
}

.faq-question i {
    color: var(--primary);
    transition: transform 0.3s ease;
}

.faq-item.active .faq-question {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(14, 165, 233, 0.1));
    color: var(--primary);
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: white;
}

.faq-item.active .faq-answer {
    max-height: 500px;
    transition: max-height 0.5s ease-in;
}

.faq-answer p {
    padding: 1.5rem;
    margin: 0;
    line-height: 1.7;
    color: var(--text-light);
}

/* Related Posts */
.related-posts {
    margin-top: 3rem;
}

.related-posts h3 {
    color: var(--text);
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
    font-size: 1.75rem;
}

.related-posts h3::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: linear-gradient(-45deg, #0ea5e9, #8b5cf6);
    margin: 0.75rem auto 0;
    border-radius: 2px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.related-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
}

.related-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(-45deg, #0ea5e9, #8b5cf6);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.related-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.related-card:hover::before {
    transform: scaleX(1);
}

.related-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(-45deg, #0ea5e9, #8b5cf6);
    transition: transform 0.4s ease;
}

.related-card:hover .related-image {
    transform: scale(1.05);
}

.related-card-body {
    padding: 1.5rem;
}

.related-title {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.related-title a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.3s;
    font-weight: 600;
}

.related-title a:hover {
    color: var(--primary);
}

.related-date {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0;
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.blog-header-card {
    animation: fadeIn 0.8s ease;
}

.blog-content-card {
    animation: fadeInUp 0.8s ease 0.2s backwards;
}

.share-card {
    animation: fadeInUp 0.8s ease 0.3s backwards;
}

.faq-section {
    animation: fadeInUp 0.8s ease 0.25s backwards;
}

.related-card {
    animation: fadeInUp 0.6s ease backwards;
}

.related-card:nth-child(1) { animation-delay: 0.1s; }
.related-card:nth-child(2) { animation-delay: 0.2s; }
.related-card:nth-child(3) { animation-delay: 0.3s; }

/* Mobile Responsive */
@media (max-width: 768px) {
    .main-container {
        padding: 0.75rem;
    }

    .back-button {
        padding: 0.6rem 1.25rem;
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .blog-header-card {
        padding: 1.75rem 1.25rem;
        border-radius: 0.5rem;
    }

    .blog-header-card h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .blog-category-badge {
        font-size: 0.75rem;
        padding: 0.4rem 1rem;
        margin-bottom: 1rem;
    }

    .blog-header-meta {
        font-size: 0.8rem;
        gap: 0.75rem;
        flex-direction: column;
    }

    .blog-content-card {
        padding: 1.25rem;
        border-radius: 0.5rem;
    }

    .blog-featured-image {
        border-radius: 0.5rem;
        margin-bottom: 1.5rem;
    }

    .blog-body h1 {
        font-size: 1.35rem;
    }

    .blog-body h2 {
        font-size: 1.2rem;
    }

    .blog-body h3 {
        font-size: 1.1rem;
    }

    .blog-body p {
        font-size: 0.95rem;
        line-height: 1.7;
    }

    .blog-body ul,
    .blog-body ol {
        padding-left: 1.5rem;
    }

    /* Make floated images full width on mobile */
    .blog-body img[align="left"],
    .blog-body img[align="right"],
    .blog-body .image-style-side,
    .blog-body .image-style-align-left,
    .blog-body .image-style-align-right,
    .blog-body .image-align-left,
    .blog-body .image-align-right {
        float: none !important;
        max-width: 100% !important;
        margin: 1.25rem 0 !important;
        display: block;
    }

    .blog-body figure.image img {
        margin: 1.25rem 0;
    }

    .share-card {
        padding: 1.5rem;
        border-radius: 0.5rem;
    }

    .share-card h5 {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .share-btn {
        width: 44px;
        height: 44px;
        font-size: 1rem;
        margin: 0 0.2rem;
    }

    .faq-section {
        padding: 1.5rem;
        border-radius: 0.5rem;
    }

    .faq-section h3 {
        font-size: 1.25rem;
        margin-bottom: 1.25rem;
    }

    .faq-question {
        padding: 1rem;
        font-size: 0.9rem;
    }

    .faq-answer p {
        padding: 1rem;
        font-size: 0.9rem;
    }

    .related-posts {
        margin-top: 2rem;
    }

    .related-posts h3 {
        font-size: 1.35rem;
        margin-bottom: 1.5rem;
    }

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

    .related-image {
        height: 160px;
    }

    .related-card-body {
        padding: 1rem;
    }

    .related-title {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 0.5rem;
    }

    .back-button {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }

    .blog-header-card {
        padding: 1.5rem 1rem;
    }

    .blog-header-card h1 {
        font-size: 1.3rem;
    }

    .blog-category-badge {
        font-size: 0.7rem;
        padding: 0.35rem 0.75rem;
    }

    .blog-header-meta {
        font-size: 0.75rem;
    }

    .blog-content-card {
        padding: 1rem;
    }

    .blog-body p {
        font-size: 0.9rem;
    }

    .share-card {
        padding: 1.25rem;
    }

    .share-btn {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }

    .faq-section {
        padding: 1.25rem;
    }

    .faq-section h3 {
        font-size: 1.1rem;
    }

    .faq-question {
        padding: 0.875rem;
        font-size: 0.85rem;
    }

    .faq-answer p {
        padding: 0.875rem;
        font-size: 0.85rem;
    }

    .related-posts h3 {
        font-size: 1.2rem;
    }

    .related-image {
        height: 140px;
    }

    .related-card-body {
        padding: 0.875rem;
    }

    .related-title {
        font-size: 0.95rem;
    }

    .related-date {
        font-size: 0.75rem;
    }
}
