/* css/blog.css */

:root {
    --primary-color: #4CAF50; /* A nice green for primary actions */
    --accent-color: #FFC107; /* A vibrant yellow for highlights */
    --bg-color: #f8f9fa; /* Light background */
    --card-bg: #ffffff; /* White card background */
    --text-color: #333;
    --light-text-color: #666;
    --border-color: #e0e0e0;
}


.blog-hero {
    background: linear-gradient(135deg, #fdfaf5, #fff4e6);
    /* Warm, light background */
    padding: 80px 20px;
    text-align: center;
    border-bottom: 2px solid var(--primary-color);
    overflow: hidden;
    position: relative; /* For potential overlay effects */
}

.blog-hero .section-title {
    font-size: 3em;
    color: var(--primary-color);
    margin-bottom: 15px;
    font-weight: 700;
    opacity: 0;
    transform: translateY(-30px); /* Adjusted for smoother animation */
    animation: fadeInSlideDown 1.2s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.blog-hero p {
    font-size: 1.2em;
    color: var(--light-text-color);
    max-width: 800px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(30px); /* Adjusted for smoother animation */
    animation: fadeInSlideUp 1.2s cubic-bezier(0.23, 1, 0.32, 1) forwards 0.3s;
}

.blog-posts-section {
    padding: 60px 20px;
    background-color: var(--bg-color);
    position: relative;
    overflow: hidden;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    padding-top: 20px;
}

.blog-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    border: 1px solid var(--border-color);
    opacity: 0;
    transform: translateY(30px);
    animation: cardFadeInUp 0.6s ease-out forwards;
    position: relative; /* For pseudo-elements and overlays */
    cursor: pointer; /* Indicate interactivity */
}

/* Subtle lighting effect on hover */
.blog-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Use CSS variables for mouse position */
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none; /* Allows clicks to pass through */
    z-index: 1; /* Above image, below content for visual layering */
}

.blog-card:hover::before {
    opacity: 1;
}

.blog-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18), 0 0 0 4px var(--accent-color); /* Added outline on hover */
    border-color: var(--accent-color); /* Highlight border */
}

.blog-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid #eee;
    transition: transform 0.5s ease;
}

.blog-card:hover img {
    transform: scale(1.05);
}

.blog-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    position: relative;
}

.blog-content h3 {
    font-size: 1.8em;
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 10px;
    text-align: left;
    line-height: 1.3;
    min-height: 2.6em; /* Ensure consistent height for titles */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blog-content p {
    font-size: 1em;
    color: var(--light-text-color);
    line-height: 1.7;
    margin-bottom: 15px;
    text-align: left;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blog-meta {
    font-size: 0.9em;
    color: #888;
    margin-top: auto;
    text-align: left;
    border-top: 1px dashed #f0f0f0;
    padding-top: 10px;
    display: flex; /* To align date and views */
    justify-content: space-between;
    align-items: center;
    gap: 10px; /* Space between date and views */
}

.blog-views {
    font-size: 0.95em;
    color: var(--primary-color);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: #e6ffe6; /* Light background for views */
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid var(--primary-color);
}

.blog-views i {
    color: var(--accent-color);
}


.blog-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.read-more-btn {
    display: inline-block;
    background-color: var(--accent-color);
    color: white;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 2; /* Ensure button is above lighting effect */
}

.read-more-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    z-index: 1;
}

.read-more-btn:hover::before {
    left: 0;
}

.read-more-btn:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.share-card-btn {
    background: none;
    border: none;
    font-size: 1.3em;
    color: var(--primary-color);
    cursor: pointer;
    transition: transform 0.2s ease, color 0.3s ease;
    padding: 5px;
    border-radius: 50%;
    position: relative; /* For ripple effect */
    overflow: hidden;
    z-index: 2;
}

.share-card-btn:hover {
    color: var(--accent-color);
    transform: scale(1.2);
    background-color: rgba(0, 0, 0, 0.05);
}

/* Ripple effect for share button */
.share-card-btn::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.1);
    width: 100%;
    height: 100%;
    transform: scale(0);
    opacity: 1;
    transition: transform 0.6s ease-out, opacity 0.6s ease-out;
    left: 0;
    top: 0;
}

.share-card-btn:active::after {
    transform: scale(2);
    opacity: 0;
    transition: 0s; /* Reset transition for instant effect on click */
}


/* Modal for single blog post */
.blog-post-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.4s ease-out; /* Faster fade in for modal background */
    overflow-y: auto;
}

.blog-post-modal.hidden {
    display: none;
}

.blog-post-modal .modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: expandIn 0.6s cubic-bezier(0.23, 1, 0.32, 1); /* Smoother, more dynamic */
}

/* Typing effect for modal body */
.blog-post-modal .modal-body.typing-effect p {
    overflow: hidden;
    border-right: .15em solid var(--accent-color); /* The typewriter cursor */
    white-space: pre-wrap;
    margin: 0 auto;
    letter-spacing: .05em;
    animation:
        typing 3s steps(40, end),
        blink-caret .75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0
    }

    to {
        width: 100%
    }
}

@keyframes blink-caret {

    from,
    to {
        border-color: transparent
    }

    50% {
        border-color: var(--accent-color);
    }
}


.blog-post-modal .close-button {
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 2.5em;
    color: #333;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
    z-index: 10;
}

.blog-post-modal .close-button:hover {
    color: #e74c3c;
    transform: rotate(90deg);
}

.modal-share-buttons-top {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.modal-share-buttons-top .share-button {
    padding: 8px 10px;
    font-size: 1em;
    border-radius: 5px;
}

.blog-post-modal h2 {
    font-size: 2.2em;
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
    padding-top: 40px;
}

.blog-post-modal .modal-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.blog-post-modal .modal-body {
    font-size: 1.1em;
    line-height: 1.8;
    color: #444;
    margin-bottom: 20px;
    white-space: pre-wrap;
    text-align: justify;
}

.blog-post-modal .modal-meta {
    font-size: 0.9em;
    color: #777;
    text-align: right;
    border-top: 1px dashed #eee;
    padding-top: 10px;
    display: flex; /* For aligning date and views in modal */
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

/* Social Share Buttons (bottom of modal) */
.social-share-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #eee;
}

.share-button {
    background-color: #f0f0f0;
    color: #333;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
    position: relative;
    overflow: hidden; /* For the new hover effect */
    isolation: isolate; /* To ensure ::before works correctly with z-index */
}

.share-button i {
    font-size: 1.1em;
    position: relative;
    z-index: 2; /* Make icon appear above ::before */
}

.share-button span { /* For text like "WhatsApp" */
    position: relative;
    z-index: 2;
}

/* New subtle pulsing effect on hover */
.share-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    z-index: 1;
}

.share-button:hover::before {
    width: 150%;
    height: 150%;
    opacity: 1;
}

.share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.share-button.whatsapp-share {
    background-color: #25D366;
    color: white;
}

.share-button.whatsapp-share:hover {
    background-color: #1DA851;
}

.share-button.twitter-share {
    background-color: #1DA1F2;
    color: white;
}

.share-button.twitter-share:hover {
    background-color: #0c85d0;
}

.share-button.facebook-share {
    background-color: #1877F2;
    color: white;
}

.share-button.facebook-share:hover {
    background-color: #145CB3;
}

.share-button.copy-link {
    background-color: #6c757d;
    color: white;
}

.share-button.copy-link:hover {
    background-color: #5a6268;
}

/* Loading spinner */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid var(--accent-color);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}


/* Keyframe Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInSlideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cardFadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


@keyframes expandIn {
    0% {
        transform: scale(0.7);
        opacity: 0;
    }

    60% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

/* Particle background (ensure this is in style.css or general.css) */
.particle-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Ensures it stays behind content */
    background-color: #fdfaf5; /* Fallback color */
}


/* Responsive adjustments for blog page */
@media (max-width: 767px) {
    .blog-hero {
        padding: 60px 15px;
    }

    .blog-hero .section-title {
        font-size: 2.5em;
    }

    .blog-hero p {
        font-size: 1.1em;
    }

    .blog-posts-section {
        padding: 40px 15px;
    }

    .blog-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .blog-card img {
        height: 180px;
    }

    .blog-content {
        padding: 20px;
    }

    .blog-content h3 {
        font-size: 1.6em;
    }

    .blog-content p {
        font-size: 0.95em;
    }

    .logo h1 {
        font-size: 1rem;
    }

    .blog-post-modal .modal-content {
        padding: 20px;
        width: 95%;
        max-height: 95vh;
    }

    .blog-post-modal .close-button {
        top: 10px;
        right: 15px;
        font-size: 2em;
    }

    .blog-post-modal h2 {
        font-size: 1.8em;
        padding-top: 30px;
    }

    .modal-share-buttons-top {
        top: 15px;
        left: 15px;
    }

    .blog-post-modal .modal-image {
        max-height: 200px;
    }

    .blog-post-modal .modal-body {
        font-size: 1em;
    }

    .social-share-buttons {
        flex-direction: column;
    }

    .share-button {
        width: 100%;
        justify-content: center;
    }

    .blog-meta {
        flex-direction: column; /* Stack date and views on small screens */
        align-items: flex-start;
    }
    .blog-views {
        width: fit-content; /* Ensure it doesn't stretch */
    }
}