/* Blog Section Styles */

/* Blog Preview Section on Homepage */
.blog-preview {
    padding: 80px 5%;
    background: #f9fafb;
    position: relative;
}

body.dark-mode .blog-preview {
    background: #111827;
}

.blog-preview .section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #1f2937;
}

body.dark-mode .blog-preview .section-title {
    color: #f3f4f6;
}

.blog-preview .section-subtitle {
    text-align: center;
    color: #6b7280;
    font-size: 1.1rem;
    margin-bottom: 3rem;
}

body.dark-mode .blog-preview .section-subtitle {
    color: #9ca3af;
}

/* Blog Grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Blog Card */
.blog-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.blog-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.15);
}

body.dark-mode .blog-card {
    background: #1f2937;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body.dark-mode .blog-card:hover {
    box-shadow: 0 12px 24px rgba(96, 165, 250, 0.2);
}

.blog-card-header {
    padding: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
}

body.dark-mode .blog-card-header {
    border-bottom-color: #374151;
}

.blog-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #6b7280;
}

body.dark-mode .blog-card-meta {
    color: #9ca3af;
}

.blog-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.blog-read-time {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.blog-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

body.dark-mode .blog-card-title {
    color: #f3f4f6;
}

.blog-card-excerpt {
    font-size: 1rem;
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 1rem;
}

body.dark-mode .blog-card-excerpt {
    color: #d1d5db;
}

.blog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.blog-tag {
    padding: 0.25rem 0.75rem;
    background: #dbeafe;
    color: #2563eb;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

body.dark-mode .blog-tag {
    background: #374151;
    color: #60a5fa;
}

.blog-card-footer {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.read-more-btn {
    color: #2563eb;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: gap 0.3s ease;
}

.read-more-btn:hover {
    gap: 0.75rem;
}

body.dark-mode .read-more-btn {
    color: #60a5fa;
}

.view-all-btn {
    display: inline-block;
    margin: 3rem auto 0;
    padding: 1rem 2.5rem;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.view-all-btn:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.3);
}

body.dark-mode .view-all-btn {
    background: #60a5fa;
    color: #1a1a1a;
}

body.dark-mode .view-all-btn:hover {
    background: #3b82f6;
}

.blog-preview-actions {
    text-align: center;
}

/* Blog Modal */
.blog-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 2rem;
    overflow-y: auto;
    cursor: auto !important;
}

.blog-modal.active {
    display: flex;
}

.blog-modal-content {
    background: #ffffff;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    cursor: auto !important;
}

.blog-modal-content * {
    cursor: auto !important;
}

body.dark-mode .blog-modal-content {
    background: #1f2937;
}

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

.blog-modal-header {
    padding: 2rem 2.5rem;
    border-bottom: 2px solid #e5e7eb;
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 10;
    border-radius: 16px 16px 0 0;
}

body.dark-mode .blog-modal-header {
    background: #1f2937;
    border-bottom-color: #374151;
}

.blog-modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: #f3f4f6;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.5rem;
    color: #4b5563;
}

.blog-modal-close:hover {
    background: #e5e7eb;
    transform: rotate(90deg);
}

body.dark-mode .blog-modal-close {
    background: #374151;
    color: #9ca3af;
}

body.dark-mode .blog-modal-close:hover {
    background: #4b5563;
}

.blog-modal-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
    line-height: 1.3;
    padding-right: 3rem;
}

body.dark-mode .blog-modal-title {
    color: #f3f4f6;
}

.blog-modal-meta {
    display: flex;
    gap: 2rem;
    align-items: center;
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 1rem;
}

body.dark-mode .blog-modal-meta {
    color: #9ca3af;
}

.blog-modal-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.blog-modal-body {
    padding: 2.5rem;
}

.blog-modal-article {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #374151;
}

body.dark-mode .blog-modal-article {
    color: #d1d5db;
}

/* Blog Article Content Styling */
.blog-modal-article h1,
.blog-modal-article h2,
.blog-modal-article h3,
.blog-modal-article h4 {
    color: #1f2937;
    margin-top: 2rem;
    margin-bottom: 1rem;
    line-height: 1.3;
    font-weight: 700;
}

body.dark-mode .blog-modal-article h1,
body.dark-mode .blog-modal-article h2,
body.dark-mode .blog-modal-article h3,
body.dark-mode .blog-modal-article h4 {
    color: #f3f4f6;
}

.blog-modal-article h1 {
    font-size: 2rem;
}

.blog-modal-article h2 {
    font-size: 1.75rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

body.dark-mode .blog-modal-article h2 {
    border-bottom-color: #374151;
}

.blog-modal-article h3 {
    font-size: 1.5rem;
}

.blog-modal-article h4 {
    font-size: 1.25rem;
}

.blog-modal-article p {
    margin-bottom: 1.5rem;
}

.blog-modal-article ul,
.blog-modal-article ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.blog-modal-article li {
    margin-bottom: 0.5rem;
}

.blog-modal-article a {
    color: #2563eb;
    text-decoration: underline;
}

body.dark-mode .blog-modal-article a {
    color: #60a5fa;
}

.blog-modal-article a:hover {
    color: #1d4ed8;
}

body.dark-mode .blog-modal-article a:hover {
    color: #3b82f6;
}

.blog-modal-article blockquote {
    border-left: 4px solid #2563eb;
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #4b5563;
}

body.dark-mode .blog-modal-article blockquote {
    border-left-color: #60a5fa;
    color: #9ca3af;
}

.blog-modal-article code {
    background: #f3f4f6;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #ef4444;
}

body.dark-mode .blog-modal-article code {
    background: #374151;
    color: #fca5a5;
}

.blog-modal-article pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.blog-modal-article pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
}

body.dark-mode .blog-modal-article pre {
    background: #111827;
}

.blog-modal-article img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.blog-modal-article hr {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 2rem 0;
}

body.dark-mode .blog-modal-article hr {
    border-top-color: #374151;
}

.blog-modal-article strong {
    font-weight: 700;
    color: #1f2937;
}

body.dark-mode .blog-modal-article strong {
    color: #f3f4f6;
}

.blog-modal-article em {
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .blog-preview {
        padding: 60px 5%;
    }

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

    .blog-preview .section-title {
        font-size: 2rem;
    }

    .blog-card-title {
        font-size: 1.25rem;
    }

    .blog-modal {
        padding: 1rem;
    }

    .blog-modal-content {
        max-height: 95vh;
        border-radius: 12px;
    }

    .blog-modal-header {
        padding: 1.5rem;
    }

    .blog-modal-title {
        font-size: 1.5rem;
    }

    .blog-modal-body {
        padding: 1.5rem;
    }

    .blog-modal-article {
        font-size: 1rem;
    }

    .blog-modal-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .blog-modal-close {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }
}

/* Loading State */
.blog-loading {
    text-align: center;
    padding: 4rem 0;
    color: #6b7280;
}

body.dark-mode .blog-loading {
    color: #9ca3af;
}

.blog-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #6b7280;
}

body.dark-mode .blog-empty {
    color: #9ca3af;
}

.blog-empty i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Scroll improvements for modal */
.blog-modal-content::-webkit-scrollbar {
    width: 8px;
}

.blog-modal-content::-webkit-scrollbar-track {
    background: #f3f4f6;
}

body.dark-mode .blog-modal-content::-webkit-scrollbar-track {
    background: #374151;
}

.blog-modal-content::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 4px;
}

body.dark-mode .blog-modal-content::-webkit-scrollbar-thumb {
    background: #6b7280;
}

.blog-modal-content::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

body.dark-mode .blog-modal-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Fix: Hide toast notification by default */
.toast {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
