/* 
 * Blog Page Styles - Responsive Update
 * Modern, visually appealing design with enhanced mobile responsiveness
 * Complements index.css for consistent branding
 */

/* ===== VARIABLES ===== */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --purple-color: #6f42c1;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --transition: all 0.3s ease;
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --gradient-primary: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ===== BLOG HERO SECTION ===== */
.blog-hero {
    padding-top: 76px;
    min-height: 60vh;
    display: flex;
    align-items: center;
    background: var(--gradient-hero);
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.blog-hero .hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://images.unsplash.com/photo-1486312338219-ce68d2c6f44d?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80') no-repeat center center;
    background-size: cover;
    opacity: 0.1;
    animation: backgroundZoom 20s ease-in-out infinite alternate;
}

.blog-hero .hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
}

.blog-hero h1,
.blog-hero .lead {
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* ===== SEARCH BAR STYLES - FIXED ===== */
.search-container {
    max-width: 500px;
    margin: 0 auto;
}

.search-container .input-group {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 50px;
    overflow: hidden;
    background: white;
}

.search-container .form-control {
    border: none;
    padding: 15px 20px;
    font-size: 1rem;
    border-radius: 0;
}

.search-container .form-control:focus {
    box-shadow: none;
    outline: none;
}

.search-container .btn {
    border: none;
    padding: 15px 25px;
    background: var(--primary-color);
    color: white;
    transition: var(--transition);
}

.search-container .btn:hover {
    background: #0b5ed7;
    transform: none;
}

.search-container .btn:focus {
    box-shadow: none;
}

/* Ensure proper rounded corners for search bar */
.rounded-pill-start {
    border-top-left-radius: 50px !important;
    border-bottom-left-radius: 50px !important;
}

.rounded-pill-end {
    border-top-right-radius: 50px !important;
    border-bottom-right-radius: 50px !important;
}

/* ===== BLOG CATEGORIES - RESPONSIVE UPDATE ===== */
.blog-categories {
    border-bottom: 1px solid #dee2e6;
    position: relative;
}

/* Mobile Dropdown Filter */
.blog-categories .form-select {
    border: 2px solid var(--primary-color);
    border-radius: 50px;
    padding: 12px 20px;
    font-weight: 500;
    background-color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.blog-categories .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Desktop Button Filters */
.blog-categories .btn {
    transition: var(--transition);
    padding: 10px 20px;
    font-weight: 500;
    border: 2px solid var(--primary-color);
    white-space: nowrap;
    flex-shrink: 0;
}

.blog-categories .btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.blog-categories .btn:not(.active):hover {
    background-color: rgba(13, 110, 253, 0.1);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Desktop filter buttons container */
.blog-categories .d-md-flex {
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ===== FEATURED ARTICLE ===== */
.featured-article {
    position: relative;
    overflow: hidden;
}

.featured-image {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.featured-image img {
    transition: var(--transition);
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.featured-image:hover img {
    transform: scale(1.05);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(13, 110, 253, 0.1), transparent);
    opacity: 0;
    transition: var(--transition);
}

.featured-image:hover .image-overlay {
    opacity: 1;
}

/* ===== BLOG CARDS ===== */
.blog-card {
    transition: var(--transition);
    border-radius: 12px;
    overflow: hidden;
    background: white;
    opacity: 1;
    transform: translateY(0);
}

.blog-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.card-img-wrapper {
    position: relative;
    overflow: hidden;
    height: 200px;
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.blog-card:hover .card-img-wrapper img {
    transform: scale(1.1);
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.3));
    opacity: 0;
    transition: var(--transition);
}

.blog-card:hover .card-overlay {
    opacity: 1;
}

.category-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 2;
}

.blog-card .card-body {
    padding: 1.5rem;
}

.article-meta {
    font-size: 0.875rem;
}

.article-actions .btn {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.bookmark-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Newsletter Card */
.newsletter-card {
    transition: var(--transition);
    border-radius: 12px;
}

.newsletter-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2) !important;
}

.newsletter-form .form-control {
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
}

.newsletter-form .btn {
    padding: 12px 24px;
}

/* ===== STAT COUNTERS ===== */
.stat-counter {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--warning-color);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    display: inline-block;
    min-width: 60px;
}

/* ===== ANIMATIONS ===== */
@keyframes backgroundZoom {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.1);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes countUp {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.animate-count-up {
    animation: countUp 0.5s ease-out;
}

/* Staggered animation for blog cards */
.blog-card:nth-child(1) { animation-delay: 0.1s; }
.blog-card:nth-child(2) { animation-delay: 0.2s; }
.blog-card:nth-child(3) { animation-delay: 0.3s; }
.blog-card:nth-child(4) { animation-delay: 0.4s; }
.blog-card:nth-child(5) { animation-delay: 0.5s; }
.blog-card:nth-child(6) { animation-delay: 0.6s; }
.blog-card:nth-child(7) { animation-delay: 0.7s; }
.blog-card:nth-child(8) { animation-delay: 0.8s; }

/* ===== FILTERING ANIMATIONS ===== */
.blog-item {
    transition: all 0.4s ease;
    display: block;
}

.blog-item.hidden {
    opacity: 0;
    transform: scale(0.8);
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    display: none;
}

.blog-item.visible {
    opacity: 1;
    transform: scale(1);
    height: auto;
    display: block;
}

/* Filter active state enhancements */
.blog-categories .btn.active {
    position: relative;
}

.blog-categories .btn.active::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background-color: var(--primary-color);
    border-radius: 50%;
}

/* ===== LOAD MORE BUTTON ===== */
#loadMore {
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

#loadMore:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

#loadMore.loading {
    pointer-events: none;
    opacity: 0.7;
}

#loadMore.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== TOAST NOTIFICATIONS ===== */
.custom-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: none;
    border-radius: 8px;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== RESPONSIVE DESIGN - ENHANCED ===== */
@media (max-width: 767.98px) {
    /* Mobile-specific styles */
    .blog-hero {
        min-height: 50vh;
        text-align: center;
        padding-top: 80px;
    }
    
    .blog-hero h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .blog-hero .lead {
        font-size: 1.1rem;
    }
    
    .stat-counter {
        font-size: 1.8rem;
        min-width: 50px;
    }
    
    /* FIXED: Search Bar Mobile Styles */
    .search-container {
        max-width: 100%;
        padding: 0 15px;
    }
    
    .search-container .input-group {
        flex-direction: row; /* Keep as row, don't change to column */
        border-radius: 50px;
        overflow: hidden;
    }
    
    .search-container .form-control {
        border-radius: 0;
        border-top-left-radius: 50px;
        border-bottom-left-radius: 50px;
        padding: 12px 20px;
        margin-bottom: 0;
        flex: 1;
    }
    
    .search-container .btn {
        border-radius: 0;
        border-top-right-radius: 50px;
        border-bottom-right-radius: 50px;
        padding: 12px 20px;
        width: auto;
        max-width: none;
        margin: 0;
        flex-shrink: 0;
    }
    
    .featured-article .display-5 {
        font-size: 1.8rem;
        line-height: 1.3;
    }
    
    .featured-image img {
        height: 250px;
    }
    
    .card-img-wrapper {
        height: 180px;
    }
    
    .blog-card .card-body {
        padding: 1.25rem;
    }
    
    .custom-toast {
        min-width: 280px;
        right: 10px;
        left: 10px;
        margin: 0 auto;
    }
    
    /* Mobile dropdown filter styling */
    .blog-categories {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    .blog-categories .form-select {
        font-size: 1rem;
        max-width: 100%;
        margin: 0 auto;
    }
    
    .blog-categories .btn.active::after {
        bottom: -8px;
    }
}

@media (max-width: 575.98px) {
    /* Extra small devices */
    .blog-hero h1 {
        font-size: 1.75rem;
    }
    
    .stat-counter {
        font-size: 1.5rem;
    }
    
    .featured-article .display-5 {
        font-size: 1.5rem;
    }
    
    /* FIXED: Search bar for extra small screens */
    .search-container .form-control {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .search-container .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .blog-grid .row {
        margin-left: -8px;
        margin-right: -8px;
    }
    
    .blog-grid .col-md-6 {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .card-img-wrapper {
        height: 160px;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    /* Tablet devices */
    .blog-hero h1 {
        font-size: 2.5rem;
    }
    
    .featured-image img {
        height: 350px;
    }
    
    .card-img-wrapper {
        height: 180px;
    }
    
    /* Ensure filter buttons wrap properly on tablets */
    .blog-categories .d-md-flex {
        gap: 8px;
    }
    
    .blog-categories .btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .blog-card:hover {
        transform: none;
    }
    
    .featured-image:hover img {
        transform: none;
    }
}

/* Focus styles for better accessibility */
.blog-card:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .blog-card {
        border: 2px solid var(--dark-color);
    }
    
    .blog-card:hover {
        border-width: 3px;
    }
    
    .blog-categories .btn {
        border-width: 2px;
    }
}

/* ===== CUSTOM UTILITIES ===== */
.min-vh-60 {
    min-height: 60vh;
}

.text-shadow {
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.bg-gradient-primary {
    background: var(--gradient-primary);
}

.bg-gradient-hero {
    background: var(--gradient-hero);
}

/* Smooth transitions for all interactive elements */
a, button, .blog-card, .newsletter-card, .featured-image {
    transition: var(--transition);
}

/* Loading state for images */
.card-img-wrapper img:not([src]) {
    background: linear-gradient(90deg, #f0f0f0 25%, transparent 37%, #f0f0f0 63%);
    background-size: 400% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0 50%;
    }
}

.card-img-wrapper img {
    animation: none;
    background: none;
}

/* Filter results counter */
.filter-results {
    text-align: center;
    padding: 1rem 0;
    font-style: italic;
    color: var(--secondary-color);
}

/* Mobile-first responsive improvements */
.container {
    padding-left: 15px;
    padding-right: 15px;
}

.row {
    margin-left: -8px;
    margin-right: -8px;
}

.col, .col-1, .col-10, .col-11, .col-12, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-auto, .col-lg, .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-auto, .col-md, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-auto, .col-sm, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-auto, .col-xl, .col-xl-1, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-auto {
    padding-left: 8px;
    padding-right: 8px;
}