/* Publications Section Styling - Based on Members CSS */
.publications-section {
    background-color: #f8f9fa;
    padding: 40px 0;
    min-height: 100vh;
}

/* Page Header */
.publications-header {
    text-align: center;
    margin-bottom: 3rem;
}

.publications-title {
    color: #C3020D;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.publications-subtitle {
    color: #6c757d;
    font-size: 1.2rem;
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto;
}

/* Search and Sort Controls */
.publication-tile.search-hidden {
    display: none !important;
}

.publications-controls {
    position: relative;
    z-index: 1000;
    margin-bottom: 2rem;
}

/* Search container with integrated clear button */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box {
    position: relative;
    flex-grow: 1;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    z-index: 5;
}

.search-box input {
    padding-left: 2.5rem;
    padding-right: 3rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.3s ease;
    width: 100%;
}

.search-box input:focus {
    border-color: #698EE9;
    box-shadow: 0 0 0 0.2rem rgba(105, 142, 233, 0.25);
}

/* Clear button - fixed visibility and positioning */
.clear-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    color: #6c757d;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.clear-search-btn.show {
    display: flex !important;
}

.clear-search-btn i:hover {
    color: #C3020D;
    transform: scale(1.5);
}

.clear-search-btn i {
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

/* Filter Button Styling */
.filter-icon-container {
    position: relative;
    display: flex;
    justify-content: flex-end;
    z-index: 1002;
    isolation: isolate;
    margin-right: 0.5rem;
}

.filter-icon {
    background: none;
    color: #6c757d;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 4px rgba(153, 153, 153, 0.25);
}

.filter-icon:hover {
    background: #999999;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(153, 153, 153, 0.25);
}

.filter-icon.has-active-filters {
    background: #8CC63E;
    color: white;
    box-shadow: 0 2px 8px rgba(43, 116, 1, 0.3);
}

.filter-icon.has-active-filters:hover {
    background: #6f9e32;
}

.filter-icon i {
    font-size: 1.1rem;
}

/* Filter Section Styling */
.filters-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 2px solid #e9ecef;
    
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    visibility: hidden;
    transition: all 0.3s ease;
    
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
}

.filters-section.show {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
    margin-bottom: 2rem;
    max-height: 900px;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.filters-content {
    max-height: none;
    overflow: visible;
    padding-top: 0;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: white;
    color: #495057;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: #698EE9;
    box-shadow: 0 0 0 0.2rem rgba(105, 142, 233, 0.25);
}

.filter-select:hover {
    border-color: #698EE9;
}

/* Clear Filters Button */
.clear-filters-container {
    margin-top: 1rem;
    text-align: right;
}

.clear-filters-btn {
    background: #ffeff0;
    border: 1px solid #C3020D;
    color: #C3020D;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: none;
}

.clear-filters-btn.show {
    display: inline-block;
}

.clear-filters-btn:hover {
    background: #ffd7da;
    color: #C3020D;
}

/* Active Filter Indicator */
.filter-select.has-filter {
    border-color: #698EE9;
    background: #f0f4ff;
}

/* Sort Icon and Popup Styling */
.sort-icon-container {
    position: relative;
    display: flex;
    justify-content: flex-end;
    z-index: 1001;
    isolation: isolate;
}

.sort-icon {
    background: none;
    color: #6c757d;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 4px rgba(153, 153, 153, 0.25);
}

.sort-icon:hover {
    background: #999999;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(153, 153, 153, 0.25);
}
.sort-icon i {
    font-size: 1.1rem;
}

.sort-icon.has-active-sort {
    background: #8CC63E;
    color: white;
    box-shadow: 0 2px 8px rgba(43, 116, 1, 0.3);
}

.sort-icon.has-active-sort:hover {
    background: #6f9e32;
}

/* Sort popup styling */
.sort-popup {
    position: absolute !important;
    top: 55px;
    right: auto;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 9999 !important;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.sort-popup.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Sort Popup Header with Direction Toggle */
.sort-popup-header {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sort-popup-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.direction-arrow {
    color: #6c757d;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    min-width: 20px;
    text-align: center;
}

.direction-arrow:hover {
    color: #495057;
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

.direction-arrow:active {
    transform: scale(0.95);
}

.direction-arrow.disabled {
    color: #dee2e6;
    cursor: not-allowed;
}

.direction-arrow.disabled:hover {
    color: #dee2e6;
    background: none;
    transform: none;
}

.sort-option-divider {
    border-top: 1px solid #e9ecef;
    margin: 0.5rem 0;
}

.sort-option.reset-option {
    color: #6c757d;
    font-style: italic;
    padding: 0.5rem 1rem;
}

.sort-options {
    padding: 0.5rem 0;
}

.sort-option {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sort-option:hover {
    background-color: #f8f9fa;
}

.sort-option.active {
    background-color: #f0f4ff;
    color: #698EE9;
}

.sort-option i {
    margin-right: 0.75rem;
    width: 16px;
    color: #6c757d;
}

.sort-option.active i {
    color: #698EE9;
}

.sort-option-text {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Backdrop for closing popup */
.sort-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    display: none;
}

.sort-backdrop.show {
    display: block;
}

/* Publication Tiles */
.publication-tiles {
    margin-bottom: 1rem;
    margin-top: 1rem;
}

.publication-tile {
    background: white;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    overflow: hidden;
    border: 2px solid #999999;
    opacity: 0.85;
    background-color: rgb(247 247 247);
}

.publication-tile.featured {
    /* No special border - just the star will indicate featured status */
}

.publication-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.publication-header {
    padding: 1.25rem 1rem;
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s ease;
}

.publication-header:hover {
    background-color: rgba(105, 142, 233, 0.03);
}

.expand-arrow {
    color: #6c757d;
    margin-right: 0.75rem;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    width: 15px;
    text-align: center;
}

.publication-tile.expanded .expand-arrow {
    transform: rotate(90deg);
}

/* Publication Title Section - Container for title and authors */
.publication-title-section {
    flex-grow: 1;
    text-align: left;
}

.publication-title {
    font-weight: 700;
    color: #212529;
    font-size: 1.1rem;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between; 
    gap: 0.75rem;
    flex-grow: 1;
}

.publication-title-text {
    flex-grow: 1;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.featured-star {
    color: #FFD700;
    font-size: 0.9rem;
    text-shadow: 0 0 3px rgba(255, 215, 0, 0.5);
    margin-left: 0.5rem;
    flex-shrink: 0;
}

/* Publication Authors - Light gray text under title */
.publication-authors {
    color: #6c757d;
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 0.25rem;
    line-height: 1.3;
}

.publication-authors em {
    font-style: italic;
    color: #868e96;
}

.publication-type {
    color: #6c757d;
    font-style: italic;
    font-size: 0.95rem;
    margin-left: auto;
    white-space: nowrap;
}

.publication-details {
    border-top: 1px solid #e9ecef;
    padding: 0 1.25rem;
    background: #f8f9fa;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease;
}

.publication-tile.expanded .publication-details {
    max-height: 1000px;
    padding: 1.25rem;
}

/* Abstract Section */
.publication-abstract {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.publication-abstract .detail-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    display: block;
}

.abstract-text {
    color: #333;
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: justify;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem 2rem;
    margin-bottom: 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    color: #212529;
    font-size: 0.95rem;
    line-height: 1.4;
}

.detail-value a {
    color: #698EE9;
    text-decoration: none;
}

.detail-value a:hover {
    text-decoration: underline;
}

/* Keywords Section */
.publication-keywords {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

.publication-keywords .detail-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    display: block;
}

.keywords-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.keyword-bubble {
    background-color: #f8f9fa;
    color: #6c757d;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid #e9ecef;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.keyword-bubble:hover {
    background-color: #e9ecef;
    color: #495057;
}

.action-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.publication-link {
    color: #698EE9;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.publication-link:hover {
    text-decoration: underline;
}

/* Open Access and restricted Badges */
.open-access-badge,
.restricted-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.open-access-badge {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.restricted-badge {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.open-access-badge i,
.restricted-badge i {
    font-size: 0.7rem;
}

.featured-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    background: #FFF9E6;
    color: #B8820A;
    border: 1px solid #EDAA03;
}

/* Stats Cards */
.publications-stats {
    margin-top: 3rem;
}

.publications-stats .row {
    display: flex;
    align-items: stretch; /* Make all columns same height */
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    height: 100%; /* Take full height of parent */
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 120px; /* Minimum height to accommodate wrapping text */
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #C3020D;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

/* Filter Animations */
.publication-tile.filtered-out {
    opacity: 0;
    transform: scale(0.95);
    max-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.publication-tile.filtered-in {
    opacity: 1;
    transform: scale(1);
    transition: all 0.3s ease;
}

/* No Results Message */
.no-results {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.no-results p {
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .publications-title {
        font-size: 2.5rem;
    }
    
    .publications-subtitle {
        font-size: 1.1rem;
    }
    
    .filters-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 992px) {
    .publications-section {
        padding: 60px 0;
    }
    
    .publications-title {
        font-size: 2.25rem;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .action-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .filter-icon {
        width: 40px;
        height: 40px;
    }
    
    .filter-icon i {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .publications-section {
        padding: 40px 0;
    }
    
    .publications-title {
        font-size: 2rem;
    }
    
    .publications-subtitle {
        font-size: 1rem;
    }
    
    .publication-header {
        padding: 0.5rem 0.75rem;
        flex-wrap: wrap;
    }
    
    .publication-title {
        font-size: 1rem;
    }
    
    .publication-type {
        font-size: 0.85rem;
        order: 2;
        flex-basis: 100%;
        margin-top: 0.5rem;
        margin-left: calc(15px + 0.75rem);
        text-align: right;
    }
    
    .publication-authors {
        font-size: 0.8rem;
        margin-top: 0.5rem;
        margin-left: calc(15px + 0.75rem); /* Align with title text */
        order: 3; /* Place after title in mobile layout */
        flex-basis: 100%; /* Take full width */
    }
    
    .publication-title-section {
        order: 2;
        flex-basis: calc(100% - 120px); /* Account for publication type width */
    }
    
    .abstract-text {
        font-size: 0.9rem;
        text-align: left; /* Left align on mobile for better readability */
    }
    
    .keywords-container {
        gap: 0.4rem;
    }
    
    .keyword-bubble {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }
    
    .featured-star {
        font-size: 0.8rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .sort-icon {
        width: 40px;
        height: 40px;
    }
    
    .sort-icon i {
        font-size: 1rem;
    }
    
    .clear-search-btn {
        width: 28px;
        height: 28px;
    }
    
    .clear-search-btn i {
        font-size: 0.7rem;
    }
    
    .sort-popup {
        min-width: 180px;
    }
    
    .sort-popup-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .stat-card {
        width: 60%;
        justify-self: center;
    }
}

@media (max-width: 576px) {
    .publications-controls .row {
        --bs-gutter-x: 0.75rem;
    }
    
    .publications-controls .col-lg-4,
    .publications-controls .col-lg-2 {
        margin-bottom: 0.5rem;
    }

    .detail-value {
        font-size: 0.85rem;
    }
    
    .featured-star {
        font-size: 0.7rem;
    }
    
    .publication-authors {
        font-size: 0.75rem;
        margin-left: calc(15px + 0.75rem);
    }
    
    .open-access-badge,
    .restricted-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }
    
    .open-access-badge i,
    .restricted-badge i {
        font-size: 0.6rem;
    }
    
    .abstract-text {
        font-size: 0.85rem;
    }
    
    .keyword-bubble {
        font-size: 0.7rem;
        padding: 0.15rem 0.5rem;
    }
    
    .sort-popup {
        min-width: 160px;
    }
    
    .sort-option {
        padding: 0.5rem 0.75rem;
    }
    
    .sort-option-text {
        font-size: 0.85rem;
    }
    
    .filters-content {
        max-height: 400px;
    }
    
    .filters-section.show .filters-content {
        max-height: 400px;
    }
}