/* Blog Picker Improvements */
.blog-listing-container {
    margin-top: 15px;
}

.blogs_section {
    row-gap: 2rem !important;
}

/* Tab Menu Improvements */
.tab-menu.blogs-tabs {
    background: #ffffff;
    padding: 10px 15px;
    border-radius: 12px;
    align-items: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 4rem;
}

.tab-menu .subtitle-2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 8px;
}

/* ==============================================
   CATEGORY DROPDOWN STYLING
   ============================================== */

.category-dropdown-container {
    margin-right: 20px;
}

.dropdown {
    position: relative;
    display: inline-block;
    min-width: 200px;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 16px;
    background: #f8fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.dropdown-toggle:hover,
.dropdown-toggle.active {
    background: #415d9b;
    color: #ffffff;
    border-color: #415d9b;
}

.dropdown-arrow {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.dropdown-toggle.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    margin: 0;
    padding: 0;
}

.dropdown-item .nav-link {
    display: block;
    padding: 10px 16px;
    color: #4a5568;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    background: transparent;
    cursor: pointer;
}

.dropdown-item .nav-link:hover {
    background: #f8fafc;
    color: #415d9b;
}

.dropdown-item.active .nav-link {
    background: #415d9b;
    color: #ffffff;
}

.dropdown-item:first-child .nav-link {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.dropdown-item:last-child .nav-link {
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* Tabs and Search Container */
.tabs-search-container {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.tabs-container {
    flex: 1;
}

.search-container {
    flex: 0 0 auto;
    min-width: 300px;
}

.mobile-dropdown {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 0;
    padding: 0;
    list-style: none;
}

    .mobile-dropdown .nav-item {
        margin-bottom: 0;
    }

    .mobile-dropdown .nav-link {
        display: inline-block;
        padding: 8px 16px;
        background: #f8fafc;
        color: #4a5568;
        text-decoration: none;
        border-radius: 6px;
        font-size: 0.85rem;
        font-weight: 500;
        transition: all 0.3s ease;
        border: 1px solid #e2e8f0;
        cursor: pointer;
    }

        .mobile-dropdown .nav-item.active .nav-link,
        .mobile-dropdown .nav-link:hover,
        .mobile-dropdown .nav-link.active {
            background: #415d9b;
            color: #ffffff;
            border-color: #415d9b;
        }

/* Search Form Improvements */
#searchForm {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.form-floating.form-group {
    flex: 1;
    margin-bottom: 0;
    position: relative;
}

.form-floating .form-control {
    height: 42px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    padding: 12px 16px;
    font-size: 0.9rem;
}

.form-floating label {
    font-size: 0.85rem;
    color: #6b7280;
    padding: 0 16px;
}

.form-floating .form-control:focus {
    border-color: #415d9b;
    box-shadow: 0 0 0 3px rgba(65, 93, 155, 0.1);
}

.btn-hover-black {
    height: 42px;
    padding: 0 20px;
    background: #415d9b;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

    .btn-hover-black:hover {
        transform: translateY(-1px);
        color: #415d9b;
        background: #f8fafc;
    }

/* ==============================================
   PAGINATION STYLING
   ============================================== */

.pagination {
    margin: 3rem 0 2rem 0;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.pagination .page-item {
    margin: 0;
}

.pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    padding: 0;
    margin: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    box-shadow: none;
}

.pagination .page-link:hover {
    background: #415d9b;
    border-color: #415d9b;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: none;
}

.pagination .page-item.active .page-link {
    background: #415d9b;
    border-color: #415d9b;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: none;
}

.pagination .page-item.disabled .page-link {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pagination .page-item.disabled .page-link:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #d1d5db;
    transform: none;
    box-shadow: none;
}

/* Previous/Next arrows styling */
.pagination .page-link[aria-label="Previous"],
.pagination .page-link[aria-label="Next"] {
    width: 50px;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Ellipsis styling for large pagination */
.pagination .page-item.dots .page-link {
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: default;
    font-weight: 600;
    box-shadow: none;
}

.pagination .page-item.dots .page-link:hover {
    background: transparent;
    border: none;
    color: #6b7280;
    transform: none;
    box-shadow: none;
}

/* Responsive pagination */
@media (max-width: 768px) {
    .pagination {
        margin: 2rem 0 1.5rem 0;
        gap: 6px;
    }

    .pagination .page-link {
        width: 40px;
        height: 40px;
        font-size: 0.85rem;
    }

    .pagination .page-link[aria-label="Previous"],
    .pagination .page-link[aria-label="Next"] {
        width: 45px;
        font-size: 1rem;
    }

    /* Hide some page numbers on mobile to keep it clean */
    .pagination .page-item:not(.active):not(:first-child):not(:last-child):not(:nth-child(2)):not(:nth-last-child(2)) {
        display: none;
    }
}

@media (max-width: 480px) {
    .pagination {
        margin: 1.5rem 0 1rem 0;
        gap: 4px;
    }

    .pagination .page-link {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
        border-radius: 6px;
    }

    .pagination .page-link[aria-label="Previous"],
    .pagination .page-link[aria-label="Next"] {
        width: 40px;
        font-size: 0.9rem;
    }

    /* Show only active page, previous, next, and first/last on small screens */
    .pagination .page-item:not(.active):not(:first-child):not(:last-child) {
        display: none;
    }
}

/* Blog Cards - More Compact Horizontal Version */
.blog-card {
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 0;
    max-width: 95%;
    margin-left: auto;
    margin-right: auto;
}

    .blog-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    }

.blog-image-container {
    position: relative;
    width: 100%;
    height: 240px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .blog-image-container img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center center;
        transition: transform 0.3s ease;
    }

.blog-card:hover .blog-image-container img {
    transform: scale(1.03);
}

.blog-content {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 150px;
}

.blog-category {
    font-size: 0.65rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    margin-bottom: 6px;
    display: inline-block;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.blog-title {
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: #1a202c !important;
    line-height: 1.3;
    margin-bottom: 6px !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-shrink: 0;
    height: 2.6rem;
}

.blog-description {
    font-size: 0.8rem !important;
    color: #4a5568 !important;
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    height: 2.2rem;
    min-height: 2.2rem;
}

.blog-read-more {
    font-size: 0.7rem;
    color: #ffffff;
    background-color: #415d9b;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    padding: 5px 12px;
    border-radius: 5px;
    margin-top: auto;
    transition: all 0.3s ease;
    text-align: center;
    align-self: flex-start;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

    .blog-read-more:hover {
        background-color: #364a82;
        color: #ffffff;
        text-decoration: none;
        transform: translateY(-1px);
    }

/* Adjust grid layout for narrower cards */
@media (min-width: 1200px) {
    .blogs_section .col-lg-4 {
        flex: 0 0 auto;
        width: 31.33%; /* Slightly narrower than default 33.33% */
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .blogs_section .col-lg-4 {
        flex: 0 0 auto;
        width: 48%; /* Two cards per row on medium-large screens */
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .blogs_section .col-md-6 {
        flex: 0 0 auto;
        width: 48%; /* Two cards per row */
    }
    
    .blog-card {
        max-width: 280px;
    }
}

/* Responsive Design */
@media (max-width: 992px) {
    .tab-menu.blogs-tabs {
        padding: 12px 18px;
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .category-dropdown-container {
        margin-right: 0;
        margin-bottom: 15px;
    }

    .dropdown {
        min-width: 100%;
    }

    .tabs-search-container {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .search-container {
        min-width: auto;
    }

    #searchForm {
        gap: 10px;
    }

    .form-floating.form-group {
        width: 100%;
    }

    .blog-image-container {
        height: 160px;
    }

    .blog-content {
        padding: 12px;
        min-height: 130px;
    }
}

@media (max-width: 768px) {
    .blog-listing-container {
        margin-top: 12px;
    }

    .blogs_section {
        row-gap: 1.5rem !important;
    }

    .tab-menu.blogs-tabs {
        padding: 12px 15px;
        margin-bottom: 4rem;
    }

    .tab-menu .subtitle-2 {
        font-size: 1rem;
        margin-bottom: 6px;
    }

    .form-floating .form-control,
    .btn-hover-black {
        height: 38px;
        font-size: 0.85rem;
    }

    .btn-hover-black {
        padding: 0 16px;
    }

    .blog-card {
        max-width: 100%;
    }

    .blog-image-container {
        height: 140px;
    }

    .blog-content {
        padding: 10px;
        min-height: 120px;
    }

    .blog-category {
        font-size: 0.6rem;
        margin-bottom: 4px;
        max-width: 100%;
        white-space: nowrap;
    }

    .blog-title {
        font-size: 0.95rem !important;
        height: 2.4rem;
    }

    .blog-description {
        font-size: 0.75rem !important;
        height: 2rem;
    }

    .blog-read-more {
        font-size: 0.65rem;
        padding: 4px 10px;
        max-width: 100%;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .blog-listing-container {
        margin-top: 10px;
    }

    .blogs_section {
        row-gap: 1.2rem !important;
    }

    .tab-menu.blogs-tabs {
        padding: 10px 12px;
        margin-bottom: 3rem;
    }

    .form-floating .form-control,
    .btn-hover-black {
        height: 36px;
        font-size: 0.8rem;
    }

    .blog-image-container {
        height: 120px;
    }

    .blog-content {
        padding: 8px;
        min-height: 110px;
    }

    .blog-category {
        font-size: 0.55rem;
        margin-bottom: 3px;
        max-width: 100%;
        white-space: nowrap;
    }

    .blog-title {
        height: 2.2rem;
        font-size: 0.9rem !important;
    }

    .blog-description {
        height: 1.8rem;
        font-size: 0.7rem !important;
    }

    .blog-read-more {
        font-size: 0.6rem;
        padding: 3px 8px;
        max-width: 100%;
        white-space: nowrap;
    }

    .dropdown-menu {
        max-height: 200px;
    }
}
