/*
 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
*/

/* ======== CSS RESET & BASE ======== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2ecc71;
    --primary-dark: #27ae60;
    --secondary-color: #3498db;
    --secondary-dark: #2980b9;
    --accent-color: #ff5722;
    --text-color: #333;
    --text-light: #777;
    --bg-color: #f8f9fa;
    --white: #fff;
    --border-color: #ddd;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --border-radius: 10px;
    --transition: all 0.3s ease;
}

/* ======== GENERAL STYLES ======== */ 
body {
    font-family: "Poppins", "Noto Sans Bengali", "Noto Sans Devanagari", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-display: swap;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Language Direction */
:lang(en) body { direction: ltr; }
:lang(bn) body { 
    direction: ltr;
    font-family: "Poppins", "Noto Sans Bengali", sans-serif;
}
:lang(hi) body { 
    direction: ltr;
    font-family: "Poppins", "Noto Sans Devanagari", sans-serif;
}
:lang(ar) body { 
    direction: rtl;
    text-align: right;
}

/* ======== LAYOUT COMPONENTS ======== */

/* Page Header */
.page-header {
    padding: 20px 0;
    text-align: center;
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.page-title {
    font-size: clamp(24px, 5vw, 32px);
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    line-height: 1.3;
}

/* Posts Grid */
.latest-posts-wrapper,
.posts-grid,
.modern-post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin: 20px 0;
    padding: 10px;
}

@media (max-width: 768px) {
    .latest-posts-wrapper,
    .posts-grid,
    .modern-post-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .latest-posts-wrapper,
    .posts-grid,
    .modern-post-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Post Item */
.post-item,
.modern-post-card {
    background-color: var(--white);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px var(--shadow-light);
    transition: var(--transition);
    overflow: hidden;
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.post-item:hover,
.modern-post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px var(--shadow-medium);
    border-color: var(--primary-color);
}

/* Thumbnail */
.post-thumbnail img,
.modern-thumb img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
    display: block;
    border-bottom: 3px solid var(--primary-color);
    transition: var(--transition);
}

.post-item:hover .post-thumbnail img,
.modern-post-card:hover .modern-thumb img {
    transform: scale(1.05);
}

/* Post Content */
.post-content,
.modern-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.post-title,
.modern-content h2 {
    font-size: clamp(1.1em, 2vw, 1.3em);
    margin-bottom: 10px;
    font-weight: 700;
    color: #0073e6;
    line-height: 1.4;
    flex-grow: 1;
}

.post-title a,
.modern-content h2 a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-title a:hover,
.modern-content h2 a:hover {
    color: var(--accent-color);
}

/* Post Meta */
.post-meta,
.qa-meta,
.news-meta,
.tools-meta,
.modern-date {
    font-size: 0.85em;
    color: var(--text-light);
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.post-meta .author {
    font-weight: 600;
    color: var(--text-color);
}

/* Excerpt */
.post-excerpt {
    font-size: 0.95em;
    line-height: 1.6;
    color: #444;
    margin-top: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ======== SPECIAL COMPONENTS ======== */

/* Author Box */
.author-box {
    display: flex;
    align-items: flex-start;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    margin: 30px 0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

@media (max-width: 768px) {
    .author-box {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .author-avatar {
        margin-right: 0;
        margin-bottom: 20px;
    }
}

.author-box:hover {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.author-avatar {
    margin-right: 25px;
    flex-shrink: 0;
}

.author-avatar-img {
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
    width: 100px;
    height: 100px;
    object-fit: cover;
}

.author-details {
    flex: 1;
}

.author-name {
    font-size: 1.4em;
    font-weight: 700;
    margin: 0 0 10px;
    color: #2c3e50;
}

.author-name a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.author-name a:hover {
    color: var(--primary-color);
}

.author-bio {
    font-size: 0.95em;
    color: #555;
    margin: 0 0 15px;
    line-height: 1.6;
}

.author-link {
    display: inline-block;
    font-size: 0.95em;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    padding: 8px 16px;
    border: 2px solid var(--primary-color);
    border-radius: 50px;
    transition: var(--transition);
}

.author-link:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

/* Language Switcher */
.menu-item-language a {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-dark));
    color: var(--white);
    padding: 8px 16px;
    border-radius: 50px;
    margin: 0 5px;
    text-transform: capitalize;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    transition: var(--transition);
    display: inline-block;
}

.menu-item-language a:hover {
    background: linear-gradient(135deg, var(--secondary-dark), #2c3e50);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

/* Related Posts */
.related-title-item a {
    display: block;
    background: var(--white);
    padding: 15px 20px;
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: 0 3px 10px var(--shadow-light);
    transition: var(--transition);
    line-height: 1.5;
    margin-bottom: 10px;
}

.related-title-item a:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    border-left-color: var(--primary-dark);
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
}

/* Search Filter */
.search-filter-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 40px;
    padding: 0 15px;
}

.sf-input-select {
    border: 2px solid var(--secondary-color);
    border-radius: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #f0faff, #e3f2fd);
    font-weight: 600;
    color: #2d3436;
    font-size: 1em;
    cursor: pointer;
    transition: var(--transition);
    min-width: 250px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%233498db' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    padding-right: 45px;
}

.sf-input-select:hover,
.sf-input-select:focus {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-color: var(--secondary-dark);
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* Archive Pages */
body.archive .generate-columns-container .inside-article,
body.blog .generate-columns-container .inside-article,
body.search .generate-columns-container .inside-article {
    border: 2px solid #a29bfe;
    border-radius: var(--border-radius);
    padding: 25px;
    background-color: var(--white);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    margin-bottom: 30px;
}

body.archive .generate-columns-container .inside-article:hover,
body.blog .generate-columns-container .inside-article:hover,
body.search .generate-columns-container .inside-article:hover {
    box-shadow: 0 15px 35px rgba(162, 155, 254, 0.15);
    transform: translateY(-5px);
    border-color: #6c5ce7;
}

/* Comment Form */
.comment-form #url {
    display: none !important;
}

/* Links */
.single article a {
    color: #6e09ef;
    border-bottom: 2px dotted #40e0d0;
    text-decoration: none;
    transition: var(--transition);
}

.single article a:hover {
    color: #ff5722;
    border-bottom-style: solid;
}

a.read-more.button {
    display: inline-block;
    background-color: var(--white);
    font-size: 1em;
    padding: 10px 25px;
    text-align: center;
    transition: var(--transition);
    color: var(--text-color);
    box-shadow: 0 5px 20px var(--shadow-light);
    border-radius: 50px;
    border: 2px solid var(--text-color);
    font-weight: 600;
    text-decoration: none;
    margin-top: 15px;
}

a.read-more.button:hover {
    background-color: var(--text-color);
    color: var(--white);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

/* ======== AUTHOR PAGE ======== */
.author-modern-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 15px;
}

.author-header {
    text-align: center;
    margin-bottom: 40px;
}

.author-header h1 {
    font-size: clamp(1.8em, 4vw, 2.5em);
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.author-header p {
    font-size: clamp(0.95em, 2vw, 1.1em);
    color: var(--text-light);
    max-width: 700px;
    margin: 0 auto;
}

.modern-tab-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.tab-item {
    padding: 10px 20px;
    background: #e9ecef;
    border-radius: 50px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.95em;
    transition: var(--transition);
    border: 2px solid transparent;
}

.tab-item.active,
.tab-item:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
}

.modern-no-post {
    text-align: center;
    font-size: 1.1em;
    color: var(--text-light);
    padding: 40px 20px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px var(--shadow-light);
}

/* ======== TABLES ======== */
.wp-block-table {
    width: 100%;
    overflow-x: auto;
    margin: 2em 0;
    border-radius: 8px;
    background: var(--white);
    box-shadow: 0 5px 15px var(--shadow-light);
    -webkit-overflow-scrolling: touch;
}

.wp-block-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(14px, 1vw, 16px);
    min-width: 600px;
}

/* Small tables (3 columns or less) */
.wp-block-table:has(table tr:first-child :nth-child(3):last-child),
.wp-block-table:has(table tr:first-child :nth-child(2):last-child),
.wp-block-table:has(table tr:first-child :nth-child(1):last-child) {
    overflow-x: visible;
}

.wp-block-table:has(table tr:first-child :nth-child(3):last-child) table,
.wp-block-table:has(table tr:first-child :nth-child(2):last-child) table,
.wp-block-table:has(table tr:first-child :nth-child(1):last-child) table {
    min-width: unset;
}

/* Table Headers */
.wp-block-table th,
.wp-block-table thead td {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    font-weight: 600;
    padding: 16px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
    border: 1px solid var(--primary-dark);
    white-space: nowrap;
}

/* Table Cells */
.wp-block-table td {
    padding: 14px 16px;
    border: 1px solid #e9ecef;
    text-align: center;
    transition: var(--transition);
}

.wp-block-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.wp-block-table tbody tr:hover {
    background-color: #e8f5e9;
}

.wp-block-table tbody tr:hover td {
    transform: scale(1.01);
}

/* Responsive Tables */
@media (max-width: 768px) {
    .wp-block-table {
        border: 1px solid #e9ecef;
    }
    
    .wp-block-table table {
        min-width: 500px;
    }
    
    .wp-block-table th,
    .wp-block-table thead td,
    .wp-block-table td {
        padding: 12px;
        font-size: 0.95em;
    }
}

@media (max-width: 480px) {
    .wp-block-table table {
        min-width: 400px;
    }
    
    .wp-block-table th,
    .wp-block-table thead td,
    .wp-block-table td {
        padding: 10px 8px;
        font-size: 0.9em;
    }
    
    /* Allow text wrapping in small screens for small tables */
    .wp-block-table:has(table tr:first-child :nth-child(3):last-child) th,
    .wp-block-table:has(table tr:first-child :nth-child(2):last-child) th,
    .wp-block-table:has(table tr:first-child :nth-child(1):last-child) th,
    .wp-block-table:has(table tr:first-child :nth-child(3):last-child) td,
    .wp-block-table:has(table tr:first-child :nth-child(2):last-child) td,
    .wp-block-table:has(table tr:first-child :nth-child(1):last-child) td {
        white-space: normal;
        word-break: break-word;
    }
}

/* Desktop optimization */
@media (min-width: 1025px) {
    .wp-block-table {
        overflow-x: visible;
    }
    
    .wp-block-table table {
        table-layout: auto;
    }
    
    /* Large tables */
    .wp-block-table:has(table tr:first-child :nth-child(n+8)) table {
        table-layout: fixed;
    }
}

/* Print styles */
@media print {
    .wp-block-table {
        overflow-x: visible !important;
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
    
    .wp-block-table th {
        background-color: #f0f0f0 !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
    }
}

/* ======== ANIMATIONS ======== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ======== PERFORMANCE OPTIMIZATIONS ======== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for accessibility */
:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Loading optimization */
img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
    font-style: italic;
    background-repeat: no-repeat;
    background-size: cover;
    shape-margin: 1rem;
}

/* Selection color */
::selection {
    background-color: rgba(46, 204, 113, 0.3);
    color: var(--text-color);
}