/* ---------- MAIN LAYOUT ---------- */
.category-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.category-content {
    padding: 30px 0;
}

/* ---------- CATEGORY HERO ---------- */
.category-hero {
    background: linear-gradient(135deg, #001070 0%, #0018a0 100%);
    border-radius: 16px;
    padding: 40px 30px;
    margin-bottom: 40px;
    box-shadow: 0 8px 24px rgba(0, 16, 112, 0.2);
}

.hero-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.hero-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.hero-text h1 {
    margin: 0 0 8px;
    font-size: 36px;
    font-weight: 700;
    color: white;
}

.post-count {
    margin: 0;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

/* ---------- FILTERS SECTION (FIXED) ---------- */
.filters-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 40px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.filters-form {
    display: flex;
    align-items: flex-end; /* Aligns inputs/buttons to the bottom */
    gap: 16px;
    flex-wrap: wrap;
    width: 100%;
}

/* Filter Group (Dropdowns) */
.filter-group {
    flex: 0 0 220px; /* Fixed width */
    display: flex;
    flex-direction: column;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.filter-group label i {
    margin-right: 6px;
    color: #001070;
}

/* Search Group (Input) */
.search-group {
    flex: 1; /* Takes remaining space */
    min-width: 250px;
    display: flex;
    flex-direction: column;
}

/* UNIFIED INPUT & BUTTON STYLES FOR ALIGNMENT */
.filter-group select,
.filter-group input[type="text"],
.btn-apply,
.btn-reset {
    height: 50px; /* STRICT UNIFORM HEIGHT */
    width: 100%;
    padding: 0 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: 'Poppins', sans-serif;
    box-sizing: border-box; /* Crucial for alignment */
    transition: all 0.3s ease;
}

/* Focus States */
.filter-group select:focus,
.filter-group input[type="text"]:focus {
    outline: none;
    border-color: #001070;
    box-shadow: 0 0 0 3px rgba(0, 16, 112, 0.1);
}

/* Filter Actions (Buttons Wrapper) */
.filter-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Button Specifics */
.btn-apply,
.btn-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    width: auto; /* Reset width for buttons */
    min-width: 100px;
}

.btn-apply {
    background: linear-gradient(135deg, #001070 0%, #0018a0 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 16, 112, 0.3);
}

.btn-apply:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 16, 112, 0.4);
}

.btn-reset {
    background: #f5f5f5;
    color: #666;
    border: 2px solid #e0e0e0; /* Match input border */
}

.btn-reset:hover {
    background: #e0e0e0;
    color: #333;
    border-color: #d0d0d0;
}


/* ---------- POSTS GRID ---------- */
.posts-section {
    margin-bottom: 50px;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.post-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.post-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.post-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.post-image {
    position: relative;
    overflow: hidden;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background: #f0f0f0;
}

.post-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.post-card:hover .post-image img {
    transform: scale(1.08);
}

.post-date {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 16, 112, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(4px);
}

.post-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-content h3 {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.4;
    transition: color 0.3s ease;
    /* Limit to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card:hover .post-content h3 {
    color: #001070;
}

.post-excerpt {
    margin: 0 0 15px;
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    /* Limit to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
    margin-top: auto;
}

.post-author,
.post-views {
    font-size: 13px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.post-author i,
.post-views i {
    color: #001070;
}

/* ---------- NO RESULTS ---------- */
.no-results {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.no-results i {
    font-size: 64px;
    color: #e0e0e0;
    margin-bottom: 20px;
}

.no-results h3 {
    margin: 0 0 10px;
    font-size: 24px;
    color: #333;
}

.no-results p {
    margin: 0 0 25px;
    font-size: 16px;
    color: #666;
}

.btn-back {
    display: inline-block;
    padding: 12px 28px;
    background: linear-gradient(135deg, #001070 0%, #0018a0 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 16, 112, 0.3);
}

.btn-back:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 16, 112, 0.4);
}

/* ---------- BACK TO TOP BUTTON ---------- */
#backToTop {
    position: fixed;
    bottom: 30px;
    right: 20px;
    z-index: 1000;
    font-size: 24px;
    background-color: white;
    color: #001070;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

#backToTop:hover {
    background-color: #001070;
    color: white;
    transform: translateY(-3px);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 992px) {
    .filters-form {
        flex-wrap: wrap;
    }
    .filter-group {
        flex: 1 1 200px; /* Allow shrinking/growing */
    }
    .search-group {
        flex: 1 1 100%; /* Force search to full width on medium screens */
        order: -1; /* Move search to top */
    }
}

@media (max-width: 768px) {
    .category-hero {
        padding: 30px 20px;
    }

    .hero-content {
        flex-direction: column;
        text-align: center;
    }

    .hero-icon {
        width: 56px;
        height: 56px;
    }

    .hero-text h1 {
        font-size: 28px;
    }

    .filters-form {
        flex-direction: column;
        align-items: stretch; /* Stretch inputs to full width */
        gap: 15px;
    }

    .filter-group,
    .search-group,
    .filter-actions {
        width: 100%;
        flex: none; /* Disable flex sizing */
    }

    .filter-actions {
        display: flex;
        gap: 10px;
    }
    
    .btn-apply, .btn-reset {
        flex: 1; /* Equal width buttons on mobile */
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .hero-text h1 {
        font-size: 24px;
    }

    .post-content h3 {
        font-size: 17px;
    }

    .filter-actions {
        flex-direction: column;
    }
}