/* Blog Modal Styles - Consistent with Care4Me Design */
.blog-modal {
    backdrop-filter: blur(5px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 99999 !important;
}

/* Blog Share URL Styles */
.blog-share-url {
    padding: 15px 20px;
    background: linear-gradient(135deg, #f0fbf9 0%, #e8f5f2 100%);
    border-radius: 10px;
    margin: 20px;
    position: relative;
}

.share-url-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.share-url-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    color: #666;
    font-size: 14px;
    transition: all 0.3s ease;
}

.share-url-input:focus {
    outline: none;
    border-color: #2db094;
    box-shadow: 0 0 0 3px rgba(45, 176, 148, 0.1);
}

.share-url-copy-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #2db094, #37c8a9);
    color: white;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
}

.share-url-copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(45, 176, 148, 0.3);
}

.share-url-copy-btn:active {
    transform: translateY(0);
}

.share-url-copy-btn i {
    font-size: 16px;
}

.share-url-success {
    position: absolute;
    top: -35px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.share-url-success.show {
    opacity: 1;
    transform: translateY(0);
}

.share-url-success::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #28a745;
}

@media (max-width: 768px) {
    .blog-share-url {
        margin: 0 15px 15px 15px;
        padding: 12px 15px;
    }

    .share-url-container {
        flex-direction: column;
        gap: 10px;
    }

    .share-url-input {
        width: 100%;
        font-size: 12px;
    }

    .share-url-copy-btn {
        width: 100%;
        justify-content: center;
    }

    .share-url-success {
        right: 50%;
        transform: translateX(50%) translateY(10px);
    }

    .share-url-success.show {
        transform: translateX(50%) translateY(0);
    }
}

.blog-modal-dialog {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: translateY(-50px);
    opacity: 0;
    max-width: 900px;
}

.blog-modal.show .blog-modal-dialog {
    transform: translateY(0);
    opacity: 1;
}

.blog-modal-content {
    border-radius: 20px;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.blog-modal-header {
    background: linear-gradient(135deg, #2db094, #37c8a9);
    color: white;
    border: none;
    padding: 25px 30px;
    position: relative;
    flex-shrink: 0;
}

.blog-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.blog-modal-header .blog-meta {
    position: relative;
    z-index: 1;
    padding-right: 70px; /* Space for close button */
}

.blog-modal-title {
    margin: 0 0 10px 0;
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: 1.8rem;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: left;
}

.blog-modal-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.95rem;
    opacity: 0.9;
    flex-wrap: wrap;
}

.blog-modal-meta i {
    margin-right: 5px;
}

/* Remove default close button from blog modal */
.blog-modal .btn-close {
    display: none;
}

.blog-modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

.blog-hero-image {
    width: 100%;
    height: 300px;
    object-fit: contain;
    object-position: center;
    display: block;
    border-radius: 8px;
    margin-top: 20px;
}

.blog-content {
    padding: 25px;
    /* Normalize whitespace - collapse multiple spaces */
    white-space: normal;
    word-spacing: normal;
    letter-spacing: normal;
}

/* Fix whitespace issues in all blog content elements */
.blog-content * {
    white-space: normal !important;
    word-spacing: normal !important;
    letter-spacing: normal !important;
}

/* Specifically target common problematic elements */
.blog-content span,
.blog-content div,
.blog-content p,
.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4,
.blog-content h5,
.blog-content h6 {
    white-space: normal !important;
    word-spacing: normal !important;
    letter-spacing: normal !important;
}

.blog-content h1, .blog-content h2, .blog-content h3 {
    font-family: 'Lora', serif;
    color: #222222;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}

.blog-content h1 {
    font-size: 2rem;
    border-bottom: 3px solid #2db094;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.blog-content h2 {
    font-size: 1.5rem;
    color: #2db094;
}

.blog-content h3 {
    font-size: 1.2rem;
}

.blog-content p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #444;
    margin-bottom: 1.2rem;
    text-align: justify;
    /* Fix multiple whitespace issues */
    white-space: normal;
    word-spacing: normal;
    letter-spacing: normal;
}

.blog-content ul, .blog-content ol {
    margin-left: 2rem;
    margin-bottom: 1.2rem;
}

.blog-content li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

.blog-content blockquote {
    border-left: 4px solid #2db094;
    padding-left: 2rem;
    margin: 2rem 0;
    font-style: italic;
    color: #666;
    background: #f0fbf9;
    padding: 1.5rem 2rem;
    border-radius: 0 10px 10px 0;
}

.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 1.5rem 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.blog-author-info {
    background: linear-gradient(135deg, #f0fbf9 0%, #ffffff 100%);
    padding: 25px 30px;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
}

.blog-author-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2db094, #37c8a9);
}

.blog-author-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    border: 3px solid rgba(45, 176, 148, 0.3);
    box-shadow: 0 4px 15px rgba(45, 176, 148, 0.2);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.blog-author-avatar.placeholder {
    background: linear-gradient(135deg, #2db094, #37c8a9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.5rem;
}

.blog-author-avatar:hover {
    transform: scale(1.05);
}

.blog-author-details {
    flex: 1;
}

.blog-author-details h4 {
    margin: 0 0 5px 0;
    color: #222222;
    font-size: 1.2rem;
    font-family: 'Lora', serif;
    font-weight: 600;
}

.blog-author-details p {
    margin: 0;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.4;
}

.blog-author-role {
    color: #2db094;
    font-weight: 500;
    margin-bottom: 5px;
}

.blog-author-bio {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

/* Blog Modal Navigation Buttons */
.blog-modal-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    gap: 15px;
}

.blog-nav-btn {
    background: linear-gradient(135deg, #2db094 0%, #37c8a9 100%);
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    flex: 1;
    justify-content: center;
    max-width: 150px;
    position: relative;
    overflow: hidden;
}

.blog-nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #37c8a9 0%, #2db094 100%);
    transition: left 0.3s ease;
    z-index: -1;
}

.blog-nav-btn:hover::before {
    left: 0;
}

.blog-nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(45, 176, 148, 0.3);
    color: white;
    text-decoration: none;
}

.blog-nav-btn i {
    transition: transform 0.3s ease;
}

.blog-nav-btn:hover i {
    transform: translateX(3px);
}

.blog-nav-btn:active {
    transform: translateY(0);
}

.blog-nav-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.blog-nav-btn:disabled:hover {
    background: #ccc;
    transform: none;
    box-shadow: none;
}

.blog-nav-btn.secondary {
    background: #6c757d;
    color: white;
}

.blog-nav-btn.secondary:hover {
    background: #5a6268;
    color: white;
}

/* Navigation button positioning */
.blog-nav-btn:first-child {
    justify-self: flex-start;
}

.blog-nav-btn:nth-child(2) {
    justify-self: center;
}

.blog-nav-btn:last-child {
    justify-self: flex-end;
}

/* Responsive navigation buttons */
@media (max-width: 768px) {
    .blog-modal-navigation {
        padding: 15px 20px;
        flex-direction: row;
        justify-content: space-between;
        gap: 8px;
    }
    
    .blog-nav-btn {
        flex: 1;
        max-width: none;
        font-size: 12px;
        padding: 10px 12px;
    }
    
    .blog-nav-btn i {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .blog-modal-navigation {
        padding: 10px 15px;
        flex-direction: row;
        justify-content: space-between;
        gap: 5px;
    }
    
    .blog-nav-btn {
        flex: 1;
        max-width: none;
        font-size: 11px;
        padding: 8px 8px;
    }
    
    .blog-nav-btn i {
        font-size: 12px;
    }
}

/* Related Posts Section */
.related-posts {
    background: #f8f9fa;
    padding: 30px;
    border-top: 1px solid #e9ecef;
}

.related-posts h3 {
    font-family: 'Lora', serif;
    color: #222222;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5rem;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.related-post-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.related-post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.related-post-image {
    width: 100%;
    height: 150px;
    object-fit: contain;
    object-position: center;
    margin-top: 20px;
}

.related-post-placeholder {
    width: 100%;
    height: 150px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 2rem;
}

.no-related-posts {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 2rem;
    margin: 0;
}

.related-post-content {
    padding: 15px;
}

.related-post-title {
    font-family: 'Lora', serif;
    font-size: 1rem;
    color: #222222;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.related-post-meta {
    font-size: 0.8rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 10px;
}

.related-post-excerpt {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
    margin-top: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Blog Modal Footer */
.blog-modal-footer {
    background: #f8f9fa;
    border: none;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.blog-modal-footer .blog-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.blog-tag {
    background: #2db094;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.blog-tag:hover {
    background: #259d7f;
    color: white;
}

.blog-modal-footer .share-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.blog-modal-footer .share-text {
    font-size: 1rem;
    font-weight: 600;
    color: #222222;
    margin-bottom: 0;
}

.blog-modal-footer .share-buttons {
    display: flex;
    gap: 10px;
}

.share-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
    cursor: pointer;
}

.share-btn:hover {
    transform: translateY(-2px);
}

.share-btn.copy-link {
    background: linear-gradient(135deg, #2db094, #37c8a9);
    color: white;
}
.share-btn.copy-link:hover {
    background: linear-gradient(135deg, #259d7f, #2fb396);
}
.share-btn.facebook { background: #3b5998; }
.share-btn.twitter { background: #1da1f2; }
.share-btn.linkedin { background: #0077b5; }
.share-btn.instagram { background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%); }
.share-btn.whatsapp { background: #25d366; }

/* Loading State */
.blog-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #666;
}

.blog-loading .spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2db094;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .blog-modal-dialog {
        margin: 10px;
        max-width: calc(100vw - 20px);
    }
    
    .blog-modal-title {
        font-size: 1.4rem;
    }
    
    .blog-modal-meta {
        font-size: 0.85rem;
        gap: 15px;
    }
    
    .blog-hero-image {
        height: 200px;
    }
    
    .blog-content {
        padding: 12px;
        /* Enhanced whitespace normalization for mobile */
        white-space: normal !important;
        word-spacing: normal !important;
        letter-spacing: normal !important;
    }

    /* Stronger whitespace rules for mobile content */
    .blog-content *,
    .blog-content span,
    .blog-content div,
    .blog-content p,
    .blog-content h1,
    .blog-content h2,
    .blog-content h3,
    .blog-content h4,
    .blog-content h5,
    .blog-content h6 {
        white-space: normal !important;
        word-spacing: normal !important;
        letter-spacing: normal !important;
        text-spacing: normal !important;
    }

    .blog-content h1 {
        font-size: 1.6rem;
        margin-top: 1.2rem;
        margin-bottom: 0.8rem;
    }

    .blog-content h2 {
        font-size: 1.3rem;
        margin-top: 1rem;
        margin-bottom: 0.6rem;
    }

    .blog-content h3 {
        margin-top: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .blog-content p {
        font-size: 1rem;
        margin-bottom: 1rem;
        /* Extra whitespace normalization for paragraphs on mobile */
        white-space: normal !important;
        word-spacing: normal !important;
        letter-spacing: normal !important;
    }
    
    .related-posts {
        padding: 20px;
    }
    
    .related-posts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .blog-modal-footer {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
    }

    .blog-modal-footer .share-section {
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .blog-modal-footer .share-text {
        font-size: 0.9rem;
        text-align: center;
        margin-bottom: 5px;
    }
    
    .blog-author-info {
        padding: 15px 20px;
    }
    
    .blog-modal-header .blog-meta {
        padding-right: 60px; /* Adjust space for smaller close button on mobile */
    }
    
    .cookie-close-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
        top: 15px;
        right: 15px;
    }
}

@media (max-width: 480px) {
    .blog-modal-dialog {
        margin: 5px;
        max-width: calc(100vw - 10px);
        max-height: calc(100vh - 10px);
    }
    
    .blog-modal-header {
        padding: 20px 15px;
    }
    
    .blog-modal-header .blog-meta {
        padding-right: 50px; /* Less space needed for smaller button */
    }
    
    .blog-modal-title {
        font-size: 1.2rem;
        line-height: 1.2;
    }
    
    .blog-modal-meta {
        font-size: 0.8rem;
        gap: 10px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .blog-modal-meta span {
        display: flex;
        align-items: center;
    }
    
    .cookie-close-btn {
        width: 30px;
        height: 30px;
        font-size: 14px;
        top: 10px;
        right: 10px;
    }
    
    .blog-content {
        padding: 10px;
        /* Enhanced whitespace normalization for small screens */
        white-space: normal !important;
        word-spacing: normal !important;
        letter-spacing: normal !important;
    }

    /* Extra strong whitespace rules for small screens */
    .blog-content *,
    .blog-content span,
    .blog-content div,
    .blog-content p,
    .blog-content h1,
    .blog-content h2,
    .blog-content h3,
    .blog-content h4,
    .blog-content h5,
    .blog-content h6 {
        white-space: normal !important;
        word-spacing: normal !important;
        letter-spacing: normal !important;
        text-spacing: normal !important;
        word-break: break-word !important;
    }

    .blog-content h1 {
        font-size: 1.4rem;
        margin-top: 1rem;
        margin-bottom: 0.8rem;
    }

    .blog-content h2 {
        font-size: 1.2rem;
        margin-top: 1rem;
        margin-bottom: 0.6rem;
    }

    .blog-content h3 {
        font-size: 1.1rem;
        margin-top: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .blog-content p {
        font-size: 0.95rem;
        line-height: 1.6;
        margin-bottom: 0.8rem;
        /* Extra whitespace normalization for small screen paragraphs */
        white-space: normal !important;
        word-spacing: normal !important;
        letter-spacing: normal !important;
        word-break: break-word !important;
    }
    
    .blog-hero-image {
        height: 180px;
    }
    
    .related-posts {
        padding: 15px;
    }
    
    .blog-modal-footer {
        padding: 10px 15px;
    }

    .blog-modal-footer .share-section {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .blog-modal-footer .share-text {
        font-size: 0.85rem;
        margin-bottom: 5px;
    }
    
    .blog-author-info {
        padding: 15px;
    }
}

/* Animation for modal entrance */
@keyframes blogModalSlideIn {
    0% {
        transform: translateY(-100px) scale(0.9);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.blog-modal.show .blog-modal-dialog {
    animation: blogModalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Custom scrollbar for modal body */
.blog-modal-body::-webkit-scrollbar {
    width: 8px;
}

.blog-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.blog-modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #2db094, #37c8a9);
    border-radius: 10px;
}

.blog-modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #259d7f, #2fb396);
}