/*
 Theme Name:   GeneratePress Child
 Theme URI:    https://generatepress.com
 Description:  Default GeneratePress child theme
 Author:       Tom Usborne
 Author URI:   https://tomusborne.com
 Template:     generatepress
 Version:      0.1
*/

/* ============================================================
   GENERAL STYLES
   ============================================================ */
body {
    font-family: "Poppins", sans-serif;
    background-color: #f8f9fa;
    color: #2C3E50;
    margin: 0;
    padding: 0;
    font-display: swap;
}

/* ============================================================
   POLYLANG LANGUAGE SPECIFIC STYLES
   ============================================================ */
:lang(en) body {
    direction: ltr;
}
:lang(ar) body {
    direction: rtl;
    text-align: right;
}

/* ============================================================
   LATEST POSTS AND GRID STYLES
   ============================================================ */
.latest-posts-wrapper,
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 24px 0;
    padding: 12px;
}

/* ============================================================
   POST ITEM STYLING
   ============================================================ */
.post-item {
    background: #ffffff;
    border: 1px solid #e8ecf0;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(44, 62, 80, 0.06);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease;
    overflow: hidden;
    opacity: 0;
    animation: fadeIn 0.8s forwards;
    padding: 20px;
}
.post-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(44, 62, 80, 0.12);
}

/* ============================================================
   THUMBNAIL IMAGE
   ============================================================ */
.post-thumbnail img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-bottom: 3px solid #2ECC71;
}

/* ============================================================
   POST CONTENT
   ============================================================ */
.post-content {
    padding: 16px;
    text-align: center;
}

.post-title {
    font-size: 1.3em;
    margin-bottom: 10px;
    font-weight: 700;
    color: #2C3E50;
    transition: color 0.3s ease;
}
.post-title a {
    text-decoration: none;
    color: inherit;
}
.post-title a:hover {
    color: #E74C3C;
}

/* ============================================================
   POST META (Author & Time)
   ============================================================ */
.post-meta {
    font-size: 0.9em;
    color: #7F8C8D;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
}
.post-meta .author {
    font-weight: 600;
    color: #2C3E50;
}
.post-meta .time {
    color: #95A5A6;
}

/* ============================================================
   POST EXCERPT
   ============================================================ */
.post-excerpt {
    font-size: 1em;
    line-height: 1.6;
    color: #5D6D7E;
    display: none;
    transition: all 0.3s ease;
}
.post-excerpt.show {
    display: block;
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */
@media (max-width: 1024px) {
    .latest-posts-wrapper,
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .latest-posts-wrapper,
    .posts-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 480px) {
    .post-title {
        font-size: 1.1em;
    }
    .post-excerpt {
        font-size: 0.95em;
    }
}

/* ============================================================
   FADE-IN ANIMATION
   ============================================================ */
@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   COMMENT FORM – HIDE URL FIELD
   ============================================================ */
.comment-form #url {
    display: none;
}

/* ============================================================
   LINK STYLING
   ============================================================ */
.single article a {
    color: #8E44AD;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s ease;
}
.single article a:hover {
    border-bottom-color: #8E44AD;
}

a.read-more.button {
    background: #ffffff;
    font-size: 18px;
    padding: 8px 20px;
    text-align: center;
    transition: all 0.3s ease;
    color: #E74C3C;
    box-shadow: 0 4px 16px rgba(44, 62, 80, 0.08);
    border-radius: 50px;
    border: 2px solid #E74C3C;
    font-weight: 700;
}
a.read-more.button:hover {
    background: #E74C3C;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(231, 76, 60, 0.25);
}

/* ============================================================
   RELATED POSTS
   ============================================================ */
.related-title-item a {
    display: block;
    background: #ffffff;
    padding: 12px 16px;
    border-left: 4px solid #2ECC71;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    color: #2C3E50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    line-height: 1.5;
}
.related-title-item a:hover {
    background: linear-gradient(135deg, #2ECC71, #27AE60);
    color: #ffffff;
    border-left-color: #1ABC9C;
    transform: scale(1.02);
}

/* ============================================================
   LANGUAGE SWITCHER
   ============================================================ */
.menu-item-language a {
    background: linear-gradient(135deg, #E74C3C, #F39C12);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 50px;
    margin-right: 6px;
    text-transform: capitalize;
    font-weight: 600;
    transition: all 0.3s ease;
}
.menu-item-language a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(231, 76, 60, 0.3);
}

/* ============================================================
   AUTHOR BOX
   ============================================================ */
.author-box {
    display: flex;
    align-items: flex-start;
    background: #ffffff;
    border: 1px solid #e8ecf0;
    border-radius: 16px;
    padding: 24px;
    margin-top: 30px;
    box-shadow: 0 4px 16px rgba(44, 62, 80, 0.06);
    transition: all 0.3s ease;
}
.author-box:hover {
    box-shadow: 0 8px 32px rgba(44, 62, 80, 0.1);
}
.author-avatar {
    margin-right: 20px;
}
.author-avatar-img {
    border-radius: 50%;
    border: 3px solid #2ECC71;
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.2);
    width: 96px;
    height: 96px;
    object-fit: cover;
}
.author-details {
    flex: 1;
}
.author-name {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 10px;
    color: #2C3E50;
}
.author-name a {
    text-decoration: none;
    color: inherit;
}
.author-bio {
    font-size: 15px;
    color: #5D6D7E;
    margin: 0 0 15px;
    line-height: 1.6;
}
.author-link {
    font-size: 15px;
    text-decoration: none;
    color: #2ECC71;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}
.author-link:hover {
    border-color: #2ECC71;
    color: #27AE60;
}

/* ============================================================
   META INFO BLOCK SPACING
   ============================================================ */
.qa-meta,
.news-meta,
.tools-meta {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 14px;
    color: #5D6D7E;
}
@media (max-width: 480px) {
    .qa-meta,
    .news-meta,
    .tools-meta {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================================
   SEARCH FILTER DROPDOWN
   ============================================================ */
.search-filter-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 40px auto;
}
.sf-input-select {
    border: 2px solid #3498DB;
    border-radius: 50px;
    padding: 12px 20px;
    background: #f0faff;
    font-weight: 600;
    color: #2C3E50;
    transition: all 0.3s ease;
    cursor: pointer;
}
.sf-input-select:hover {
    background: #eaf6ff;
    border-color: #2980B9;
    box-shadow: 0 4px 16px rgba(52, 152, 219, 0.15);
}

/* ============================================================
   ARCHIVE / BLOG / SEARCH GRID BORDERS
   ============================================================ */
body.archive .generate-columns-container .inside-article,
body.blog .generate-columns-container .inside-article,
body.search .generate-columns-container .inside-article {
    border: 2px solid #D5D8DC;
    border-radius: 12px;
    padding: 16px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
}
body.archive .generate-columns-container .inside-article:hover,
body.blog .generate-columns-container .inside-article:hover,
body.search .generate-columns-container .inside-article:hover {
    border-color: #8E44AD;
    box-shadow: 0 8px 32px rgba(142, 68, 173, 0.15);
    transform: translateY(-4px);
}

/* ============================================================
   AUTHOR MODERN CONTAINER
   ============================================================ */
.author-modern-container {
    max-width: 1300px;
    margin: auto;
    padding: 30px 15px;
    font-family: 'Segoe UI', sans-serif;
    color: #2C3E50;
    background: #f9f9f9;
}
.author-header {
    text-align: center;
    margin-bottom: 40px;
}
.author-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #27ae60;
}
.author-header p {
    font-size: 1.1rem;
    color: #666;
    max-width: 700px;
    margin: 10px auto 0;
}
.modern-tab-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
}
.tab-item {
    padding: 10px 25px;
    background: #e0e0e0;
    border-radius: 50px;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    transition: all 0.3s ease;
}
.tab-item.active,
.tab-item:hover {
    background: linear-gradient(135deg, #E74C3C, #F39C12);
    color: #fff;
    box-shadow: 0 4px 16px rgba(231, 76, 60, 0.2);
}
.modern-post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}
.modern-post-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(44, 62, 80, 0.06);
    transition: transform 0.3s ease;
}
.modern-post-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(44, 62, 80, 0.12);
}
.modern-thumb img {
    width: 100%;
    height: auto;
    display: block;
}
.modern-content {
    padding: 15px 20px;
}
.modern-content h2 {
    font-size: 1.3rem;
    margin: 0 0 10px;
    color: #2C3E50;
}
.modern-content h2 a {
    text-decoration: none;
    color: inherit;
}
.modern-content h2 a:hover {
    color: #E74C3C;
}
.modern-date {
    font-size: 0.85rem;
    color: #888;
}
.modern-no-post {
    text-align: center;
    font-size: 1.1rem;
    color: #999;
    padding: 50px 0;
}
@media screen and (max-width: 768px) {
    .tab-item {
        padding: 10px 15px;
        font-size: 0.95rem;
    }
    .author-header h1 {
        font-size: 2rem;
    }
    .modern-content h2 {
        font-size: 1.1rem;
    }
}

/* ============================================================
   PAGE HEADER – Unified
   ============================================================ */
.page-header {
    padding: 24px 0;
    text-align: center;
    border-bottom: 3px solid #2ECC71;
    margin-bottom: 32px;
}
.page-title {
    font-size: 28px;
    font-weight: 700;
    color: #2C3E50;
    margin: 0;
}
:lang(bn) .page-title {
    font-family: 'Noto Sans Bengali', sans-serif;
}
:lang(hi) .page-title {
    font-family: 'Noto Sans Devanagari', sans-serif;
}

/* ============================================================
   BACK TO TOP BUTTON – FIXED (No Hang Issue)
   ============================================================ */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #E74C3C, #F39C12);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.3);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}
#back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
#back-to-top:hover {
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 8px 32px rgba(231, 76, 60, 0.4);
}
#back-to-top:active {
    transform: scale(0.95);
}

/* ============================================================
   WORDPRESS TABLE BLOCK
   ============================================================ */
.wp-block-table {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1rem 0;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    background: #ffffff;
}
.wp-block-table table {
    width: 100%;
    border-collapse: collapse;
    font-family: sans-serif;
    font-size: 16px;
    background: #ffffff;
    table-layout: auto;
}
.wp-block-table th,
.wp-block-table thead td {
    background: linear-gradient(135deg, #2ECC71, #27AE60);
    color: #ffffff;
    font-weight: 600;
    padding: 14px 16px;
    border: 1px solid #27ae60;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: sticky;
    top: 0;
    z-index: 10;
}
.wp-block-table td {
    padding: 12px 15px;
    border: 1px solid #e1e1e1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wp-block-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}
.wp-block-table tbody tr:hover {
    background-color: #f0f7f0;
}

/* ৩ বা তার কম কলামের টেবিল - সব ডিভাইসে নরমাল */
.wp-block-table:has(table tr:first-child th:nth-child(3):last-child),
.wp-block-table:has(table tr:first-child td:nth-child(3):last-child),
.wp-block-table:has(table tr:first-child th:nth-child(2):last-child),
.wp-block-table:has(table tr:first-child td:nth-child(2):last-child),
.wp-block-table:has(table tr:first-child th:nth-child(1):last-child),
.wp-block-table:has(table tr:first-child td:nth-child(1):last-child) {
    overflow-x: visible;
}
.wp-block-table:has(table tr:first-child th:nth-child(3):last-child) table,
.wp-block-table:has(table tr:first-child td:nth-child(3):last-child) table,
.wp-block-table:has(table tr:first-child th:nth-child(2):last-child) table,
.wp-block-table:has(table tr:first-child td:nth-child(2):last-child) table,
.wp-block-table:has(table tr:first-child th:nth-child(1):last-child) table,
.wp-block-table:has(table tr:first-child td:nth-child(1):last-child) table {
    width: 100%;
    table-layout: auto;
}

/* ৪ বা তার বেশি কলামের টেবিলের জন্য রেস্পন্সিভ স্টাইল */
@media (max-width: 1024px) {
    .wp-block-table:has(table tr:first-child th:nth-child(4)),
    .wp-block-table:has(table tr:first-child td:nth-child(4)) {
        border: 1px solid #ddd;
    }
    .wp-block-table:has(table tr:first-child th:nth-child(4)) table,
    .wp-block-table:has(table tr:first-child td:nth-child(4)) table {
        min-width: 700px;
    }
    .wp-block-table:has(table tr:first-child th:nth-child(4)) th,
    .wp-block-table:has(table tr:first-child td:nth-child(4)) th,
    .wp-block-table:has(table tr:first-child th:nth-child(4)) thead td,
    .wp-block-table:has(table tr:first-child td:nth-child(4)) thead td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 15px;
        padding: 12px 14px;
    }
    .wp-block-table:has(table tr:first-child th:nth-child(4)) td,
    .wp-block-table:has(table tr:first-child td:nth-child(4)) td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 14px;
        padding: 10px 12px;
    }
}
@media (max-width: 768px) {
    .wp-block-table:has(table tr:first-child th:nth-child(4)) table,
    .wp-block-table:has(table tr:first-child td:nth-child(4)) table {
        min-width: 600px;
    }
    .wp-block-table:has(table tr:first-child th:nth-child(4)) th,
    .wp-block-table:has(table tr:first-child td:nth-child(4)) th,
    .wp-block-table:has(table tr:first-child th:nth-child(4)) thead td,
    .wp-block-table:has(table tr:first-child td:nth-child(4)) thead td {
        font-size: 14px;
        padding: 10px 12px;
    }
    .wp-block-table:has(table tr:first-child th:nth-child(4)) td,
    .wp-block-table:has(table tr:first-child td:nth-child(4)) td {
        font-size: 13px;
        padding: 8px 10px;
    }
}
@media (max-width: 480px) {
    .wp-block-table:has(table tr:first-child th:nth-child(4)) table,
    .wp-block-table:has(table tr:first-child td:nth-child(4)) table {
        min-width: 500px;
    }
    .wp-block-table:has(table tr:first-child th:nth-child(4)) th,
    .wp-block-table:has(table tr:first-child td:nth-child(4)) th {
        font-size: 13px;
        padding: 8px 6px;
    }
    .wp-block-table:has(table tr:first-child th:nth-child(4)) td,
    .wp-block-table:has(table tr:first-child td:nth-child(4)) td {
        font-size: 12px;
        padding: 6px 4px;
    }
    .wp-block-table:has(table tr:first-child th:nth-child(3):last-child) table,
    .wp-block-table:has(table tr:first-child td:nth-child(3):last-child) table,
    .wp-block-table:has(table tr:first-child th:nth-child(2):last-child) table,
    .wp-block-table:has(table tr:first-child td:nth-child(2):last-child) table {
        min-width: unset;
        display: table;
        width: 100%;
    }
    .wp-block-table:has(table tr:first-child th:nth-child(3):last-child) th,
    .wp-block-table:has(table tr:first-child td:nth-child(3):last-child) th,
    .wp-block-table:has(table tr:first-child th:nth-child(2):last-child) th,
    .wp-block-table:has(table tr:first-child td:nth-child(2):last-child) th {
        white-space: nowrap;
        font-size: 14px;
        padding: 10px 8px;
    }
    .wp-block-table:has(table tr:first-child th:nth-child(3):last-child) td,
    .wp-block-table:has(table tr:first-child td:nth-child(3):last-child) td,
    .wp-block-table:has(table tr:first-child th:nth-child(2):last-child) td,
    .wp-block-table:has(table tr:first-child td:nth-child(2):last-child) td {
        white-space: normal;
        font-size: 13px;
        padding: 8px 6px;
    }
}

@media (min-width: 1025px) {
    .wp-block-table {
        overflow-x: visible;
    }
    .wp-block-table table {
        table-layout: auto;
    }
    .wp-block-table:has(table tr:first-child th:nth-child(8)) table,
    .wp-block-table:has(table tr:first-child td:nth-child(8)) table {
        table-layout: fixed;
    }
    .wp-block-table:has(table tr:first-child th:nth-child(8)) th,
    .wp-block-table:has(table tr:first-child td:nth-child(8)) th,
    .wp-block-table:has(table tr:first-child th:nth-child(8)) td,
    .wp-block-table:has(table tr:first-child td:nth-child(8)) td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media print {
    .wp-block-table {
        overflow-x: visible !important;
        border: none !important;
    }
    .wp-block-table table {
        width: 100% !important;
        min-width: unset !important;
    }
    .wp-block-table th {
        background-color: #f0f0f0 !important;
        color: #000 !important;
    }
}

/* ============================================================
   DARK MODE SUPPORT – Premium Dark Theme
   ============================================================ */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #12181F;
        color: #E8EDF2;
    }
    .post-item,
    .related-title-item a,
    .author-box,
    .modern-post-card,
    .wp-block-table,
    .wp-block-table table,
    body.archive .generate-columns-container .inside-article,
    body.blog .generate-columns-container .inside-article,
    body.search .generate-columns-container .inside-article {
        background: #1E2A36;
        border-color: #2F4050;
    }
    .post-title {
        color: #E8EDF2;
    }
    .post-meta .author {
        color: #C0D0E0;
    }
    .post-meta .time {
        color: #8899AA;
    }
    .post-excerpt {
        color: #A0B0C0;
    }
    .author-name {
        color: #E8EDF2;
    }
    .author-bio {
        color: #A0B0C0;
    }
    .modern-content h2 {
        color: #E8EDF2;
    }
    .modern-date {
        color: #8899AA;
    }
    .tab-item {
        background: #1E2A36;
        color: #C0D0E0;
    }
    .tab-item.active,
    .tab-item:hover {
        background: linear-gradient(135deg, #E74C3C, #F39C12);
        color: #ffffff;
    }
    .sf-input-select {
        background: #1E2A36;
        color: #E8EDF2;
        border-color: #2F4050;
    }
    .sf-input-select:hover {
        background: #2A3845;
        border-color: #3498DB;
    }
    .wp-block-table th,
    .wp-block-table thead td {
        background: linear-gradient(135deg, #2ECC71, #27AE60);
        color: #ffffff;
    }
    .wp-block-table td {
        border-color: #2F4050;
        color: #C0D0E0;
    }
    .wp-block-table tbody tr:nth-child(even) {
        background-color: #141E28;
    }
    .wp-block-table tbody tr:hover {
        background-color: #1A2A36;
    }
    .dropdown-select {
        background: #2A3845;
        color: #E8EDF2;
    }
    .page-title {
        color: #E8EDF2;
    }
    .article-badge-dark {
        background: #DEB887 !important;
        color: #FFFFFF !important;
        border-color: #CD853F !important;
    }
    #back-to-top {
        box-shadow: 0 4px 20px rgba(231, 76, 60, 0.4);
    }
    #back-to-top:hover {
        box-shadow: 0 8px 32px rgba(231, 76, 60, 0.5);
    }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .post-item {
        opacity: 1;
        animation: none;
    }
    .post-item:hover {
        transform: none;
    }
    .related-title-item a:hover {
        transform: none;
    }
    .author-box:hover {
        box-shadow: 0 4px 16px rgba(44, 62, 80, 0.06);
    }
    body.archive .generate-columns-container .inside-article:hover,
    body.blog .generate-columns-container .inside-article:hover,
    body.search .generate-columns-container .inside-article:hover {
        transform: none;
    }
    #back-to-top:hover {
        transform: none;
    }
    .tab-item:hover {
        transform: none;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .najibul-ultimate-home {
        background: white;
        padding: 20px;
    }
    .dropdown-filter-wrapper,
    .infinite-sentinel,
    .infinite-loader,
    .end-message,
    #back-to-top {
        display: none !important;
    }
    .article-card {
        break-inside: avoid;
        border: 1px solid #ddd;
        box-shadow: none;
    }
    .wp-block-table {
        overflow-x: visible !important;
        border: none !important;
    }
    .wp-block-table table {
        width: 100% !important;
        min-width: unset !important;
    }
    .wp-block-table th {
        background-color: #f0f0f0 !important;
        color: #000 !important;
    }
}