/* =========================================
   Blog Layout Styles
   ========================================= */
body.page-blog,
body.page-blog-article {
    background: #f5f7ff;
    color: #1e255a;
}

body.page-blog *,
body.page-blog-article *,
body.page-blog *::before,
body.page-blog *::after,
body.page-blog-article *::before,
body.page-blog-article *::after {
    box-sizing: border-box;
}

.blog-main,
.article-main {
    max-width: 1160px;
    margin: 0 auto;
    padding: 40px 20px 80px;
    width: 100%;
    box-sizing: border-box;
}

.blog-hero {
    background: linear-gradient(130deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.9) 100%);
    color: #ffffff;
    padding: 48px clamp(24px, 5vw, 56px);
    border-radius: 24px;
    box-shadow: 0 25px 50px -20px rgba(102, 126, 234, 0.6);
    position: relative;
    overflow: hidden;
}

.blog-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.25), transparent 55%),
                radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.15), transparent 60%);
    pointer-events: none;
}

.blog-hero h1 {
    font-size: clamp(32px, 4vw, 46px);
    margin-bottom: 16px;
    font-weight: 700;
}

.blog-hero p {
    max-width: 640px;
    font-size: clamp(17px, 2vw, 20px);
    line-height: 1.65;
    margin: 0;
    position: relative;
}

.blog-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-weight: 600;
    border-radius: 999px;
    padding: 6px 16px;
    margin-bottom: 18px;
    position: relative;
}

.blog-hero-actions {
    margin-top: 26px;
    position: relative;
    z-index: 1;
}

.blog-hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    color: #4b55c4;
    font-weight: 600;
    padding: 12px 22px;
    border-radius: 999px;
    text-decoration: none;
    box-shadow: 0 14px 30px -14px rgba(255, 255, 255, 0.7);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.blog-hero-btn span {
    font-size: 18px;
}

.blog-hero-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px -12px rgba(255, 255, 255, 0.8);
}

.blog-controls {
    margin-top: 40px;
    background: #ffffff;
    border-radius: 18px;
    padding: 24px clamp(16px, 4vw, 32px);
    box-shadow: 0 18px 40px -24px rgba(26, 43, 99, 0.4);
    display: grid;
    gap: 20px;
}

.blog-search-label {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 10px;
    display: inline-block;
    color: #4b55c4;
}

.blog-search-field {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f6f7ff;
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 12px;
    padding: 0 16px;
    min-height: 50px;
}

.blog-search-field input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    color: #1e255a;
    outline: none;
}

.blog-search-field input::placeholder {
    color: rgba(30, 37, 90, 0.45);
}

.blog-search-icon {
    font-size: 18px;
}

#blogClearSearch {
    border: none;
    background: rgba(102, 126, 234, 0.12);
    color: #4b55c4;
    font-size: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

#blogClearSearch[hidden] {
    display: none;
}

#blogClearSearch:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: scale(1.05);
}

.blog-search-hint {
    font-size: 13px;
    color: rgba(30, 37, 90, 0.55);
    margin-top: 8px;
}

.blog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.blog-tag-btn {
    background: #f0f2ff;
    color: #4b55c4;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.blog-tag-btn:hover {
    background: #e4e8ff;
}

.blog-tag-btn.is-active {
    background: #4b55c4;
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 10px 20px -14px rgba(75, 85, 196, 0.8);
}

.blog-tags-empty {
    color: rgba(30, 37, 90, 0.6);
    font-size: 14px;
    margin: 0;
}

.blog-articles {
    margin-top: 40px;
}

.blog-loading,
.blog-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 60px 20px;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 18px 40px -24px rgba(26, 43, 99, 0.4);
    color: #1e255a;
}

.blog-loading p,
.blog-empty p {
    margin: 0;
    font-size: 16px;
}

.blog-loading-spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid rgba(102, 126, 234, 0.15);
    border-top-color: #667eea;
    animation: blog-spin 1s linear infinite;
}

@keyframes blog-spin {
    to {
        transform: rotate(360deg);
    }
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 28px;
}

.blog-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 20px 45px -30px rgba(26, 43, 99, 0.6);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.blog-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 24px 60px -28px rgba(26, 43, 99, 0.65);
}

.blog-card-hero {
    position: relative;
    overflow: hidden;
}

.blog-card-hero img {
    display: block;
    width: 100%;
    height: 190px;
    object-fit: cover;
}

.blog-card-body {
    padding: 22px 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.blog-card-meta {
    font-size: 13px;
    color: rgba(30, 37, 90, 0.6);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.blog-card h2 {
    font-size: 20px;
    line-height: 1.4;
    margin: 0;
    color: #1e255a;
}

.blog-card p {
    margin: 0;
    color: rgba(30, 37, 90, 0.75);
    font-size: 15px;
    line-height: 1.6;
}

.blog-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.blog-card-tag {
    background: rgba(102, 126, 234, 0.15);
    color: #4b55c4;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 13px;
}

.blog-empty-btn,
.blog-empty button {
    background: #667eea;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 10px 22px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.blog-empty-btn:hover,
.blog-empty button:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.article-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
    gap: clamp(32px, 6vw, 48px);
}

.article-breadcrumbs {
    grid-column: 1 / -1;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 14px;
    color: rgba(30, 37, 90, 0.6);
    margin-bottom: 12px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.article-breadcrumb-link {
    color: #4b55c4;
    text-decoration: none;
    font-weight: 600;
}

.article-breadcrumb-link:hover {
    text-decoration: underline;
}

.blog-article {
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 25px 45px -30px rgba(26, 43, 99, 0.5);
    padding: clamp(22px, 4vw, 40px);
}

.blog-article-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 28px;
}

.blog-article-header h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.2;
    color: #1e255a;
    word-break: break-word;
    overflow-wrap: break-word;
}

.blog-article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.blog-article-meta {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    font-size: 14px;
    color: rgba(30, 37, 90, 0.6);
}

.blog-article-hero {
    margin: 0 auto 32px;
    border-radius: 20px;
    overflow: hidden;
    background: #eef1ff;
    max-width: 720px;
}

.blog-article-hero img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.blog-article-content {
    font-size: 17px;
    line-height: 1.75;
    color: rgba(30, 37, 90, 0.88);
    display: grid;
    gap: 18px;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.blog-article-content h2,
.blog-article-content h3 {
    color: #1e255a;
    margin: 28px 0 12px;
    line-height: 1.35;
}

.blog-article-content h2 {
    font-size: clamp(24px, 3vw, 32px);
}

.blog-article-content h3 {
    font-size: clamp(20px, 2.5vw, 26px);
}

.blog-article-content p {
    margin: 0;
}

.blog-article-content ul,
.blog-article-content ol {
    margin: 0 0 12px 0;
    padding-left: 24px;
}

.blog-article-content li {
    margin-bottom: 8px;
}

.blog-article-content table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 15px;
    box-shadow: 0 12px 30px -24px rgba(26, 43, 99, 0.5);
    table-layout: auto;
}

.blog-article-content th,
.blog-article-content td {
    border: 1px solid rgba(102, 126, 234, 0.25);
    padding: 14px 16px;
    text-align: left;
}

.blog-article-content thead {
    background: rgba(102, 126, 234, 0.12);
}

.blog-article-content tbody tr:nth-child(odd) {
    background: rgba(102, 126, 234, 0.06);
}

.blog-article-sources {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid rgba(102, 126, 234, 0.2);
}

.blog-article-sources h2 {
    margin-top: 0;
    font-size: 20px;
    color: #4b55c4;
}

.blog-article-sources ul {
    margin: 0;
    padding-left: 20px;
}

.blog-article-sources a {
    color: #4b55c4;
    font-weight: 600;
    text-decoration: none;
}

.blog-article-sources a:hover {
    text-decoration: underline;
}

.article-sidebar {
    position: sticky;
    top: 120px;
    align-self: flex-start;
    display: grid;
    gap: 24px;
}

.sidebar-ad {
    background: #ffffff;
    padding: 12px;
    border-radius: 20px;
    box-shadow: 0 18px 40px -30px rgba(26, 43, 99, 0.35);
}

.sidebar-ad ins {
    border-radius: 12px;
}

.sidebar-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 26px;
    box-shadow: 0 20px 40px -30px rgba(26, 43, 99, 0.45);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sidebar-card h2 {
    margin: 0;
    font-size: 20px;
    color: #1e255a;
}

.sidebar-articles {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 16px;
}

.sidebar-articles a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(102, 126, 234, 0.08);
    transition: background 0.2s ease, transform 0.2s ease;
}

.sidebar-articles a:hover {
    background: rgba(102, 126, 234, 0.18);
    transform: translateY(-1px);
}

.sidebar-article-title {
    font-weight: 600;
    color: #1e255a;
    font-size: 15px;
}

.sidebar-article-meta {
    font-size: 13px;
    color: rgba(30, 37, 90, 0.6);
}

.article-empty {
    grid-column: 1 / -1;
    text-align: center;
    background: #ffffff;
    padding: 60px 24px;
    border-radius: 24px;
    box-shadow: 0 20px 45px -30px rgba(26, 43, 99, 0.5);
    display: grid;
    gap: 18px;
}

.article-empty h2 {
    margin: 0;
    font-size: 26px;
    color: #1e255a;
}

.article-empty p {
    margin: 0;
    color: rgba(30, 37, 90, 0.65);
}

.article-empty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: #667eea;
    color: #ffffff;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.2s ease;
}

.article-empty-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.share-btn.is-success,
.share-btn.is-success:hover {
    background: #4caf50;
    box-shadow: 0 10px 20px -12px rgba(76, 175, 80, 0.7);
}

/* Responsive Layout */
@media (max-width: 1024px) {
    .article-main {
        grid-template-columns: minmax(0, 1fr);
    }

    .article-sidebar {
        position: static;
        order: 3;
    }

    .sidebar-ad {
        display: none;
    }
}

@media (max-width: 880px) {
    .blog-controls {
        padding: 22px 18px;
    }

    .blog-grid {
        gap: 20px;
    }
}

@media (max-width: 720px) {
    .blog-main,
    .article-main {
        padding: 32px 18px 70px;
    }

    .blog-hero {
        padding: 36px 24px;
    }

    .blog-hero-actions {
        display: flex;
        justify-content: flex-start;
    }

    .blog-controls {
        margin-top: 28px;
    }

    .blog-card-hero img {
        height: 200px;
    }

    .blog-card h2 {
        font-size: 19px;
    }
}

@media (max-width: 560px) {
    .blog-hero {
        text-align: left;
    }

    .blog-hero-btn {
        width: 100%;
        justify-content: center;
    }

    .blog-tag-btn {
        font-size: 13px;
        padding: 7px 14px;
    }

    .blog-card {
        border-radius: 16px;
    }

    .blog-card-hero img {
        height: 180px;
    }

    .blog-card-body {
        padding: 20px 18px 22px;
    }

    .blog-article {
        padding: 20px;
    }

    .blog-article-hero {
        margin: 0 -4px 26px;
    }

    .blog-article-content {
        font-size: 16px;
    }
}

/* iPhone 13 mini and smaller devices (375px and below) */
@media (max-width: 375px) {
    .blog-main,
    .article-main {
        padding: 24px 12px 60px;
    }

    .blog-hero {
        padding: 28px 16px;
        border-radius: 16px;
    }

    .blog-hero h1 {
        font-size: 26px;
        line-height: 1.3;
    }

    .blog-hero p {
        font-size: 15px;
    }

    .blog-controls {
        padding: 18px 14px;
        margin-top: 24px;
    }

    .blog-article {
        padding: 18px 14px;
        border-radius: 16px;
    }

    .blog-article-header h1 {
        font-size: 24px;
        line-height: 1.3;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .blog-article-hero {
        margin: 0 -2px 24px;
        border-radius: 12px;
    }

    .blog-article-content {
        font-size: 15px;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .blog-article-content h2 {
        font-size: 22px;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .blog-article-content h3 {
        font-size: 19px;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .blog-article-content p,
    .blog-article-content li {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .blog-article-content table {
        min-width: 100%;
        font-size: 13px;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .blog-article-content table thead,
    .blog-article-content table tbody,
    .blog-article-content table tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }

    .blog-article-content th,
    .blog-article-content td {
        padding: 10px 12px;
        word-break: break-word;
    }

    .blog-article-content a {
        word-break: break-all;
        overflow-wrap: break-word;
    }

    .article-breadcrumbs {
        font-size: 13px;
        flex-wrap: wrap;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .blog-card-body {
        padding: 18px 14px 20px;
    }

    .blog-card h2 {
        font-size: 17px;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .blog-card p {
        font-size: 14px;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .sidebar-card {
        padding: 20px 16px;
    }

    .sidebar-article-title {
        font-size: 14px;
        word-break: break-word;
        overflow-wrap: break-word;
    }
}

