html {
    scroll-behavior: smooth;
}

body {
    font-family: "Lexend", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

.article-content {
    font-family: "Lexend", sans-serif;
    font-size: 1.05rem;
    line-height: 1.8;
    word-wrap: break-word;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    margin-top: 10px;
    font-family: "Lexend", sans-serif;
    font-weight: 700;
}

.article-content h1 {
    font-size: 2rem;
    line-height: 1.3;
}

.article-content h2 {
    font-size: 1.75rem;
}

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

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

.article-content p {
    font-size: 1.05rem;
    line-height: 1.8;
}

.article-content {
    max-width: 100%;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1.5rem auto;
    display: block;
    margin-bottom: 5px !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.article-content blockquote {
    border-left: 4px solid #4f46e5;
    padding: 1rem 1.5rem;
    font-style: italic;
    background-color: rgba(79, 70, 229, 0.05);
    border-radius: 0.375rem;
    margin: 1.5rem 0;
}

.article-content pre {
    background-color: #1e293b;
    color: #f8fafc;
    padding: 1.25rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    line-height: 1.5;
    font-family: "Fira Code", monospace;
}

figcaption {
    font-style: italic;
    text-align: center !important;
    font-size: 14px;
}

@media (max-width: 768px) {
    .article-content {
        font-size: 1rem;
        line-height: 1.7;
    }

    .article-content h1 {
        font-size: 1.75rem;
    }

    .article-content h2 {
        font-size: 1.5rem;
    }

    .article-content h3 {
        font-size: 1.3rem;
    }
}

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, #4f46e5, #a855f7);
    z-index: 50;
    transition: width 0.1s ease-out;
}

@media (max-width: 640px) {
    article {
        padding: 0.75rem;
    }

    .article-content h1 {
        font-size: 1.5rem;
    }

    .article-content h2 {
        font-size: 1.3rem;
    }

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

    .article-content p {
        font-size: 0.95rem;
    }

    .article-content p {
        text-align: left;
    }

    .share-buttons {
        justify-content: center;
    }

    #modalPreviewImage {
        max-height: 80vh !important;
        max-width: 90vw !important;
    }

    .author-info {
        flex-direction: column;
        text-align: center;
    }

    .author-info .ml-3 {
        margin-left: 0;
    }

    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    section {
        padding-top: 2rem;
    }
}

@media (min-width: 768px) {
    .article-content p {
        text-align: justify;
    }
}

a {
    transition: color 0.2s ease;
}

button {
    transition: all 0.2s ease;
}

.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.dark .card:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.article-content ul {
    list-style-position: inside;
}

#imagePreviewModal {
    overscroll-behavior: none;
}

#imageContainer {
    touch-action: none;
    user-select: none;
}

#imageWrapper {
    transform-origin: center center;
    transition: transform 0.2s ease-out;
}

#modalPreviewImage {
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
}
.pl-8 {
    padding-left: 2rem;
}
.pl-12 {
    padding-left: 3rem;
}
@media (max-width: 640px) {
    #imagePreviewModal {
        padding: 1rem;
    }

    #imageContainer {
        max-height: 90vh;
        max-width: 95vw;
    }

    #modalPreviewImage {
        max-height: 90vh !important;
        max-width: 95vw !important;
    }

    #imagePreviewModal .absolute.top-4.left-4 {
        transform: scale(0.8);
        top: 0.5rem;
        left: 0.5rem;
    }

    #imagePreviewModal .absolute.right-4.top-4 {
        transform: scale(0.8);
        right: 0.5rem;
        top: 0.5rem;
    }
}

.article-content .content a{
    color: blue;
    text-decoration: underline;
}

table {
    width: 100% !important;
    border-collapse: collapse;
    font-size: 13px;              /* Giảm từ 14px xuống 13px */
    border: 1px solid #999;
}

table tbody tr:first-child td {
    background-color: #f0f0f0;
    font-weight: bold;
    color: #222;
    text-align: center;
    vertical-align: middle;
    padding: 10px 8px;            /* Giảm padding nhẹ cho phù hợp */
    border: 1px solid #999;
}

table tbody tr:not(:first-child) td {
    padding: 8px 6px;             /* Cũng giảm padding dòng dưới */
    border: 1px solid #bbb;
    vertical-align: top;
    color: #333;
    font-size: 12.5px;            /* Nhỏ hơn dòng đầu một chút nếu muốn phân cấp */
}

table tbody tr:nth-child(even):not(:first-child) {
    background-color: #f9f9f9;
}

table tbody tr:hover td {
    background-color: #f2f2f2;
}
