/* Title Styling */
.blog-area .medical-blog-title {
    color: var(--tg-quaternary-color);
    font-weight: 700;
    font-family: 'Merriweather', serif;
}

/* Category Toggle Styling */
.category-toggle {
    background-color: var(--tg-secondary-color);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    box-shadow: none;
    text-transform: none;
    font-weight: 500;
    letter-spacing: normal;
    line-height: 1.5;
    margin-bottom: 5px;
    opacity: 0.5;
    /* Layout */
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    transition: all 0.3s ease;
    text-decoration: none;
    /* For the anchor tag version */
    cursor: pointer;
}

.category-toggle:hover,
.category-toggle:focus,
.category-toggle.active {
    background-color: var(--tg-primary-color);
    opacity: 1;
    color: #fff;
    transform: translateY(-2px);
    text-decoration: none;
}

/* Dropdown specific */
.custom-category-dropdown summary {
    list-style: none;
    /* Hide default triangle */
}

/* Rotate arrow when open */
.custom-category-dropdown summary .fa-chevron-down {
    transition: transform 0.3s ease;
}

.custom-category-dropdown[open] summary .fa-chevron-down {
    transform: rotate(180deg);
}

.custom-category-dropdown summary::-webkit-details-marker {
    display: none;
}

/* Sub-category links */
.category-dropdown-list ul li a {
    display: block;
    padding: 8px 15px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 2px solid transparent;
}

.category-dropdown-list ul li a:hover {
    color: var(--tg-secondary-color);
    border-left-color: var(--tg-secondary-color);
    padding-left: 20px;
    background-color: #f8f9fa;
}

.category-dropdown-list ul li a.active {
    color: var(--tg-primary-color) !important;
    border-left: 3px solid var(--tg-primary-color) !important;
    padding-left: 20px !important;
    background-color: rgba(26, 115, 232, 0.1) !important;
    /* using primary color with opacity */
    font-weight: 700 !important;
}

/* Read More Button Styling */
.tg-blog-post-bottom .btn {
    opacity: 0.5;
    transition: all 0.3s ease;
}

.tg-blog-post-bottom .btn:hover {
    opacity: 1;
}

/* Custom Blog Layout Classes */
@media (min-width: 992px) {
    .custom-sidebar-col {
        flex: 0 0 20%;
        max-width: 20%;
    }

    .custom-content-col {
        flex: 0 0 80%;
        max-width: 80%;
    }

    /* Alignment Fixes */
    .custom-sidebar-header {
        height: 60px;
        /* Match Search Bar Height */
        margin-bottom: 20px !important;
        display: flex;
        align-items: center;
        /* Vertical Center is handled by flex + align-items: center */
    }

    .blog-search-panel {
        height: 60px;
        margin-bottom: 20px !important;
    }

    /* Reset category list margin/top check */
    .category-dropdown-list {
        margin-top: 40px !important;
    }
}

/* Global Search Bar Styles (Desktop & Mobile) */
.blog-search-panel .sidebar-search-form input,
.blog-search-panel input[type="text"],
.blog-search-panel input[type="search"],
.mobile-search-wrapper .sidebar-search-form input,
.mobile-search-wrapper input[type="text"],
.mobile-search-wrapper input[type="search"] {
    width: 100%;
    height: 60px !important;
    border-radius: 8px;
    border: 2px solid var(--tg-primary-color) !important;
    /* Hardcoded primary blue */
    padding: 0 15px;
    box-sizing: border-box;
    line-height: normal;
    background: #fff !important;
}

.blog-search-panel .sidebar-search-form input::placeholder,
.blog-search-panel input[type="text"]::placeholder,
.blog-search-panel input[type="search"]::placeholder,
.mobile-search-wrapper .sidebar-search-form input::placeholder,
.mobile-search-wrapper input[type="text"]::placeholder,
.mobile-search-wrapper input[type="search"]::placeholder {
    text-transform: none !important;
    opacity: 0.6;
    /* Optional: standard placeholder opacity */
}

/* Mobile Responsive Styles (< 992px) */
@media (max-width: 991px) {
    .sidebar-header {
        background: #f8f9fa;
        padding: 10px 15px;
        border-radius: 5px;
        margin-bottom: 0 !important;
    }

    #category-sidebar-list {
        display: none;
        /* Hidden by default on mobile */
        margin-top: 10px;
    }

    /* Show when toggled */
    #category-sidebar-list.active {
        display: block;
        animation: slideDown 0.3s ease-out forwards;
    }

    .mobile-menu-trigger {
        background: none;
        border: none;
        font-size: 24px;
        color: var(--tg-secondary-color);
        cursor: pointer;
        padding: 0;
    }

    /* Mobile Filter Styles */
    .mobile-search-filter-row {
        gap: 10px;
    }

    .mobile-search-wrapper form {
        margin-bottom: 0;
        width: 100%;
        display: flex;
    }

    .mobile-filter-trigger {
        background-color: var(--tg-secondary-color);
        color: #fff;
        border: none;
        width: 60px;
        min-width: 60px;
        height: 60px !important;
        border-radius: 5px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.3s;
        padding: 0;
        margin: 0;
        cursor: pointer;
        outline: none !important;
        box-sizing: border-box;
    }

    .mobile-filter-trigger:hover,
    .mobile-filter-trigger.active {
        background-color: var(--tg-primary-color);
    }

    .mobile-filter-panel {
        background: #f8f9fa;
        padding: 15px;
        border-radius: 5px;
        border: 1px solid #eee;
    }

    /* Custom Dropdown Styles */
    .mobile-filter-panel .form-group {
        position: relative;
    }

    .custom-dropdown {
        position: relative;
        width: 100%;
        margin-bottom: 15px;
    }

    .custom-dropdown-trigger {
        height: 60px;
        width: 100%;
        border: 1px solid #0d6efd;
        /* Primary Blue */
        border-radius: 5px;
        background-color: #fff;
        display: flex;
        align-items: center;
        padding: 0 40px 0 15px;
        /* Space for arrow */
        font-size: 16px;
        color: #333;
        cursor: pointer;
        position: relative;
        box-sizing: border-box;
        user-select: none;
    }

    /* Custom Arrow */
    .custom-dropdown-trigger::after {
        content: '';
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        width: 16px;
        height: 16px;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230d6efd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
        transition: transform 0.2s;
    }

    .custom-dropdown.open .custom-dropdown-trigger::after {
        transform: translateY(-50%) rotate(180deg);
    }

    .custom-dropdown-options {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 5px;
        margin-top: 5px;
        padding: 0;
        list-style: none;
        z-index: 1000;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        display: none;
        max-height: 200px;
        overflow-y: auto;
    }

    .custom-dropdown.open .custom-dropdown-options {
        display: block;
    }

    .custom-option {
        padding: 12px 15px;
        cursor: pointer;
        transition: background 0.2s;
        border-bottom: 1px solid #f0f0f0;
    }

    .custom-option:last-child {
        border-bottom: none;
    }

    .custom-option:hover {
        background-color: #f8f9fa;
        color: #0d6efd;
    }

    .custom-option.selected {
        background-color: #e9ecef;
        font-weight: 500;
    }

    .custom-dropdown.disabled {
        opacity: 0.6;
        pointer-events: none;
    }

    /* Remove margin from last child if needed, or rely on panel padding */
    .mobile-filter-panel select:last-child {
        margin-bottom: 0;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- New Post Card Layout --- */
.custom-post-card {
    padding: 0;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid #eee;
    /* Light border + shadow */
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    /* Subtle shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.custom-post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.custom-post-card:last-child {
    /* No special rule needed if treating as separate cards */
    margin-bottom: 20px;
}

.custom-post-card .blog-post-content {
    padding: 20px !important;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.custom-post-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.custom-post-title a {
    color: var(--tg-primary-color);
    transition: color 0.3s;
    text-decoration: none;
}

.custom-post-title a:hover {
    color: var(--tg-tertiary-color);
}

.post-views {
    font-size: 14px;
    color: #777;
    display: flex;
    align-items: center;
    gap: 5px;
}

.custom-post-card .post-text {
    font-size: 15px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-meta-date {
    font-size: 13px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 5px;
}

.custom-post-thumb {
    overflow: hidden;
    border-radius: 10px;
    position: relative;
    /* Context for absolute tag */
}

.custom-post-cat {
    position: absolute;
    top: 12px;
    right: 9px;
    margin-left: 20px;
    background-color: #FF5722;
    color: #fff;
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 50px;
    font-weight: 600;
    line-height: 1;
    z-index: 2;
    text-align: right;
}

.custom-post-thumb img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 10px;
    min-height: 225px;
    max-height: 225px;
    /* Limit height if needed */
    transition: transform 0.3s ease;
}

.custom-post-thumb:hover img {
    transform: scale(1.05);
}

/* Single Post Content Width (PC) */
@media (min-width: 992px) {
    .blog-post-content.blog-details-content {
        max-width: 700px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Single Post Title Styling */
.blog-details-content .title {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 15px;
}

@media (max-width: 991px) {
    .blog-details-content .title {
        font-size: 24px;
    }
}