/* ============================================================
   COMPLETE BLOG.CSS - FULLY FIXED
   ============================================================ */

/* ============================================================
   ROOT VARIABLES
   ============================================================ */
:root {
    --primary: #1F6E5C;
    --primary-dark: #155243;
    --primary-light: #E9F3EF;
    --secondary: #3b82f6;
    --accent: #A67C2E;
    --text: #1a202c;
    --text-light: #4a5568;
    --text-muted: #718096;
    --bg: #f8fafc;
    --bg-white: #ffffff;
    --bg-dark: #1a202c;
    --border: #e2e8f0;
    --border-light: #f0f2f5;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-hover: 0 8px 30px rgba(0,0,0,0.10);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: var(--primary);
}

a:hover {
    color: var(--primary-dark);
}

/* ============================================================
   LAYOUT
   ============================================================ */
.wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

.layouts {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
    padding: 32px 0 48px;
}

/* ============================================================
   BLOG LISTING
   ============================================================ */
.listing-header {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border);
}

.listing-header h1 {
    font-size: 38px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.listing-subtitle {
    font-size: 18px;
    color: var(--text-muted);
    font-weight: 400;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
    margin-bottom: 48px;
}

.blog-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all var(--transition);
    border: 1px solid var(--border-light);
}

.blog-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
    border-color: var(--border);
}

.blog-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.blog-card-image {
    position: relative;
    padding-top: 56.25%;
    background: var(--border);
    overflow: hidden;
}

.blog-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition);
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.05);
}

.blog-card-content {
    padding: 20px 24px 24px;
}

.blog-card-content h2 {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text);
}

.blog-card-content h2:hover {
    color: var(--primary);
}

.blog-card-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.blog-card-read {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--primary);
    transition: all var(--transition);
    font-size: 14px;
}

.blog-card:hover .blog-card-read {
    gap: 10px;
}

.blog-card-read::after {
    content: '→';
    transition: transform var(--transition);
    display: inline-block;
}

.blog-card:hover .blog-card-read::after {
    transform: translateX(4px);
}

/* ============================================================
   SINGLE BLOG ARTICLE
   ============================================================ */
.blog-article {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 48px 56px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}

.article-header {
    margin-bottom: 32px;
}

.article-title {
    font-size: 36px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.article-featured-image {
    margin: 0 -56px 32px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.article-featured-image img {
    width: 100%;
    height: auto;
    max-height: 480px;
    object-fit: cover;
}

.article-content {
    font-size: 17px;
    line-height: 1.8;
    color: var(--text);
}

.article-content h2 {
    font-size: 26px;
    font-weight: 700;
    margin: 40px 0 16px;
    color: var(--text);
}

.article-content h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 28px 0 12px;
    color: var(--text);
}

.article-content p {
    margin-bottom: 18px;
}

.article-content a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-content a:hover {
    color: var(--primary-dark);
}

.article-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 16px 24px;
    margin: 24px 0;
    background: var(--primary-light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
}

.article-content blockquote p:last-child {
    margin-bottom: 0;
}

/* ============================================================
   RESUME DOWNLOADS
   ============================================================ */
.resume-downloads {
    margin: 48px 0;
    padding: 32px;
    background: var(--bg);
    border-radius: var(--radius);
}

.resume-downloads h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
}

.resume-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
}

.resume-card {
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    overflow: hidden;
    padding: 12px;
    box-shadow: var(--shadow);
    transition: all var(--transition);
}

.resume-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.resume-card img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.resume-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    flex: 1;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    color: white;
    box-shadow: 0 4px 12px rgba(31, 110, 92, 0.3);
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: #d0d5dd;
    transform: translateY(-1px);
}

/* ============================================================
   FAQ SECTION
   ============================================================ */
.faq-section {
    margin: 48px 0;
    padding: 32px;
    background: var(--bg);
    border-radius: var(--radius);
}

.faq-section h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    overflow: hidden;
    background: var(--bg-white);
    transition: all var(--transition);
}

.faq-item:hover {
    border-color: var(--primary);
}

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 16px 20px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: background var(--transition);
    font-family: var(--font-family);
}

.faq-question:hover {
    background: var(--bg);
    color: var(--primary);
}

.faq-icon {
    font-size: 20px;
    font-weight: 300;
    color: var(--primary);
    transition: transform var(--transition);
    flex-shrink: 0;
    margin-left: 12px;
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 20px 20px;
    color: var(--text-light);
    line-height: 1.7;
}

.faq-answer p:last-child {
    margin-bottom: 0;
}

/* ============================================================
   RELATED ARTICLES
   ============================================================ */
.related-articles {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 2px solid var(--border);
}

.related-articles h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.related-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: all var(--transition);
    border: 1px solid var(--border-light);
}

.related-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--border);
}

.related-card img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    background: var(--border);
}

.related-card h3 {
    padding: 12px 16px 4px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
}

.read-more {
    display: inline-block;
    padding: 0 16px 14px;
    color: var(--primary);
    font-weight: 600;
    font-size: 13px;
}

/* ============================================================
   ✅ SEARCH BAR - YOUR CODE
   ============================================================ */
.search-container {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    background: var(--bg-white);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: border-color var(--transition);
    background: var(--bg);
    color: var(--text);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-btn {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(31, 110, 92, 0.3);
}

.search-btn-clear {
    padding: 12px 24px;
    background: var(--border);
    color: var(--text);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.search-btn-clear:hover {
    background: #d0d5dd;
}

/* Popular Badge */
.popular-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #f59e0b;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* Blog Card Excerpt */
.blog-card-excerpt {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.5;
    margin: 8px 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Views Badge */
.views-badge {
    font-size: 12px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Search Highlight */
mark {
    background: #fef3c7;
    padding: 0 4px;
    border-radius: 3px;
    color: var(--text);
}

/* ============================================================
   ✅ ADVANCED PAGINATION - YOUR CODE
   ============================================================ */
.pagination {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 2px solid var(--border);
}

.pagination-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all var(--transition);
}

.page-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
}

.page-numbers {
    display: flex;
    gap: 4px;
    align-items: center;
}

.page-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all var(--transition);
}

.page-number:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.page-number.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.page-ellipsis {
    padding: 0 8px;
    color: var(--text-muted);
}

.pagination-info {
    text-align: center;
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-muted);
    width: 100%;
}

/* ============================================================
   NO POSTS STATE
   ============================================================ */
.no-posts {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.no-posts-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.no-posts h2 {
    font-size: 24px;
    color: var(--text);
    margin-bottom: 8px;
}

.no-posts p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ============================================================
   VIEWS COUNT
   ============================================================ */
.views-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--text-muted);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   ✅ RESPONSIVE - YOUR CODE (Fixed)
   ============================================================ */

/* Tablets */
@media (max-width: 1024px) {
    .layouts {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .blog-article {
        padding: 32px 28px;
    }
    
    .article-featured-image {
        margin: 0 -28px 28px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .wrapper {
        padding: 0 16px;
    }
    
    .layouts {
        padding: 16px 0;
        gap: 24px;
    }
    
    .listing-header h1 {
        font-size: 28px;
    }
    
    .listing-subtitle {
        font-size: 16px;
    }
    
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .blog-article {
        padding: 20px 16px;
        border-radius: var(--radius);
    }
    
    .article-title {
        font-size: 24px;
    }
    
    .article-featured-image {
        margin: 0 -16px 20px;
    }
    
    .article-featured-image img {
        max-height: 280px;
    }
    
    .article-content {
        font-size: 16px;
    }
    
    .article-content h2 {
        font-size: 22px;
    }
    
    /* ✅ Search - Your code */
    .search-container {
        flex-direction: column;
        padding: 16px;
    }
    
    .search-input {
        min-width: auto;
        width: 100%;
    }
    
    .search-btn,
    .search-btn-clear {
        width: 100%;
        justify-content: center;
    }
    
    /* ✅ Pagination - Your code */
    .pagination-wrap {
        gap: 4px;
    }
    
    .page-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .page-number {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    .page-ellipsis {
        display: none;
    }
    
    .resume-grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    
    .related-grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    
    .faq-section {
        padding: 20px 16px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .article-title {
        font-size: 20px;
    }
    
    .resume-grid {
        grid-template-columns: 1fr;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
    }
    
    .blog-article {
        padding: 16px 12px;
    }
    
    .article-featured-image {
        margin: 0 -12px 16px;
    }
    
    .article-featured-image img {
        max-height: 200px;
    }
    
    .resume-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* ✅ Your code */
    .page-btn:not(.page-number) {
        display: none;
    }
    
    .page-numbers {
        gap: 2px;
    }
    
    .pagination {
        flex-direction: column;
        gap: 8px;
    }
}

/* ============================================================
   DARK MODE SUPPORT
   ============================================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d1117;
        --bg-white: #161b22;
        --bg-dark: #0d1117;
        --text: #e6edf3;
        --text-light: #c9d1d9;
        --text-muted: #8b949e;
        --border: #30363d;
        --border-light: #21262d;
        --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.4);
        --primary-light: #1a3a32;
        --primary-dark: #1F6E5C;
    }
    
    .blog-card {
        border-color: var(--border);
    }
    
    .blog-card:hover {
        border-color: var(--primary);
    }
    
    .faq-item {
        background: var(--bg);
    }
    
    .resume-card {
        background: var(--bg);
    }
    
    .related-card {
        background: var(--bg);
        border-color: var(--border);
    }
    
    .search-container {
        background: var(--bg-white);
    }
    
    .search-input {
        background: var(--bg);
        color: var(--text);
        border-color: var(--border);
    }
    
    mark {
        background: #2d1f00;
        color: #fbbf24;
    }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .navbar,
    .sidebar,
    .ad-box,
    .mobile-sticky-ad,
    .footer-fixed {
        display: none !important;
    }
    
    .wrapper {
        max-width: 100%;
        padding: 0;
    }
    
    .layouts {
        display: block;
    }
    
    .blog-article {
        box-shadow: none;
        border: none;
        padding: 20px;
    }
    
    .article-featured-image {
        margin: 0 0 20px;
    }
    
    .article-content {
        font-size: 14px;
    }
}