/* Publications Page Specific Styles */

/* Hero Section */
.publications-hero {
    padding-top: 180px;
    padding-bottom: 100px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7ff 0%, #e8ecff 100%);
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-top: 40px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 10px;
    display: block;
}

.stat-label {
    font-size: 1rem;
    color: var(--gray-color);
    font-weight: 500;
}

/* Publication Filters */
.publications-filters {
    padding: 50px 0;
    background: white;
    border-bottom: 1px solid var(--light-gray);
}

.filters-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-tab {
    padding: 10px 20px;
    border-radius: 50px;
    background: white;
    border: 2px solid var(--light-gray);
    color: var(--gray-color);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-tab:hover {
    color: var(--primary-color);
    border-color: var(--primary-light);
    background: rgba(108, 99, 255, 0.05);
}

.filter-tab.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
}

.search-sort {
    display: flex;
    gap: 20px;
    align-items: center;
}

.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-color);
}

.search-box input {
    padding: 10px 15px 10px 45px;
    border: 2px solid var(--light-gray);
    border-radius: 50px;
    width: 250px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.sort-select {
    padding: 10px 15px;
    border: 2px solid var(--light-gray);
    border-radius: 8px;
    background: white;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Featured Publications */
.featured-publications {
    padding: 100px 0;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 40px;
    margin-top: 50px;
}

.featured-publication {
    padding: 40px !important;
    position: relative !important; /* Add this */
    overflow: hidden !important;
    border-left: 4px solid var(--primary-color);
    transition: all 0.4s ease;
}

.featured-publication:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.publication-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--gradient-primary);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
    z-index: 2; /* Add this to ensure it stays above other content */
}

.publication-badge.featured {
    background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
    color: var(--dark-color);
}

.publication-header {
    margin-bottom: 20px !important;
    position: relative !important; /* Add this */
    z-index: 1 !important; /* Add this */
    
}

.publication-header h3 {
    margin-bottom: 15px;
    font-size: 1.5rem;
    line-height: 1.3;
    color: var(--dark-color);
}

.authors {
    font-size: 1rem;
    color: var(--gray-color);
    margin-bottom: 15px;
    font-weight: 500;
}

.publication-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.publication-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: var(--gray-color);
    font-weight: 500;
}

.venue {
    color: var(--primary-color);
    font-weight: 600;
}

.year {
    background: rgba(108, 99, 255, 0.1);
    padding: 3px 8px;
    border-radius: 12px;
    color: var(--primary-color);
}

.citations {
    color: var(--accent-color);
}

.publication-abstract {
    color: var(--gray-color);
    line-height: 1.7;
    margin-bottom: 25px;
}

.publication-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.publication-actions .btn {
    padding: 8px 20px;
    font-size: 0.9rem;
    border-radius: 25px;
}

/* All Publications */
.all-publications {
    padding: 100px 0;
    background: white;
}

.publications-list {
    margin-top: 50px;
}

.publication-item {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-md);
    border-left: 4px solid transparent;
    transition: all 0.4s ease;
    cursor: pointer;
}

.publication-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-lg);
    border-left-color: var(--primary-color);
}

.publication-item .publication-badge {
    position: relative;
    top: auto;
    right: auto;
    float: right;
    margin-bottom: 150px !important;
}

.publication-item .publication-badge[data-type="journal"] {
    background: var(--gradient-primary);
}

.publication-item .publication-badge[data-type="conference"] {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #4fd458 100%);
}

.publication-item .publication-badge[data-type="workshop"] {
    background: linear-gradient(135deg, var(--accent-color) 0%, #70d4f0 100%);
}

.publication-item .publication-badge[data-type="preprint"] {
    background: linear-gradient(135deg, var(--warning-color) 0%, #f4c471 100%);
}

.publication-item h3 {
    margin-bottom: 10px;
    font-size: 1.25rem;
    color: var(--dark-color);
    line-height: 1.4;
}

.publication-item .authors {
    margin-bottom: 10px;
}

.publication-item .publication-meta {
    margin-bottom: 15px;
}

.publication-summary {
    color: var(--gray-color);
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.publication-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: rgba(108, 99, 255, 0.1);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 50px;
}

.pagination-btn {
    padding: 10px 20px;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.pagination-info {
    padding: 10px 20px;
    background: rgba(108, 99, 255, 0.1);
    border-radius: 25px;
    color: var(--primary-color);
    font-weight: 500;
}

/* Research Metrics */
.research-metrics {
    padding: 100px 0;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-top: 50px;
}

.metric-card {
    padding: 40px 30px;
    text-align: center;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
    color: white;
}

.metric-card:hover::before {
    opacity: 1;
}

.metric-icon {
    width: 80px;
    height: 80px;
    background: rgba(108, 99, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    color: var(--primary-color);
    font-size: 2rem;
    transition: all 0.3s ease;
}

.metric-card:hover .metric-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: scale(1.1) rotate(15deg);
}

.metric-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.metric-card:hover .metric-value,
.metric-card:hover .metric-label {
    color: white;
}

.metric-label {
    font-size: 1rem;
    color: var(--gray-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

/* Publications CTA */
.publications-cta {
    padding: 120px 0;
    position: relative;
    overflow: hidden;
}

.cta-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0.9;
    z-index: 0;
}

.cta-content {
    padding: 60px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.cta-content h2 {
    color: white;
    margin-bottom: 20px;
}

.cta-content p {
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin: 0 auto 40px;
    font-size: 1.1rem;
}

.cta-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* Publication Detail Modal */
.publication-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.publication-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.modal-container {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 12px;
    padding: 40px;
    color: white;
    animation: modalFadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
    z-index: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.modal-header {
    margin-bottom: 30px;
}

.modal-header .modal-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    float: right;
    margin-bottom: 15px;
}

.modal-title {
    font-size: 2rem;
    color: white;
    margin-bottom: 15px;
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.modal-authors {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    margin-bottom: 20px;
    font-weight: 500;
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 25px;
}

.modal-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.modal-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 25px 0;
}

.modal-section {
    margin-bottom: 30px;
}

.modal-section h3 {
    color: white;
    margin-bottom: 15px;
    font-size: 1.5rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.modal-section p,
.modal-section li {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.7;
}

.modal-section ul {
    list-style: none;
    padding-left: 0;
}

.modal-section ul li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 12px;
}

.modal-section ul li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--primary-light);
    font-weight: bold;
}

.resource-links {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.resource-links .btn {
    padding: 8px 20px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.resource-links .btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.modal-footer {
    margin-top: 40px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.modal-footer .btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.modal-footer .btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Loading States */
.publications-loading {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--light-gray);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Filter Animations */
.publication-item {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.4s ease;
}

.publication-item.filtering-out {
    opacity: 0;
    transform: translateY(-20px);
}

.publication-item.filtering-in {
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Highlight */
.search-highlight {
    background: rgba(255, 255, 0, 0.3);
    padding: 2px 4px;
    border-radius: 3px;
}

/* Responsive Styles */
@media (max-width: 1200px) {
    .filters-container {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
    }
    
    .search-sort {
        justify-content: center;
    }
}

@media (max-width: 992px) {
    .featured-grid {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    
    .hero-stats {
        gap: 40px;
    }
}

@media (max-width: 768px) {
    .publications-hero {
        padding-top: 150px;
        padding-bottom: 80px;
    }
    
    .featured-publications,
    .all-publications,
    .research-metrics,
    .publications-cta {
        padding: 80px 0;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 30px;
    }
    
    .stat-number {
        font-size: 2.5rem;
    }
    
    .filter-tabs {
        justify-content: center;
    }
    
    .search-sort {
        flex-direction: column;
        width: 100%;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .featured-publication {
        padding: 30px 20px;
        position: relative;
        overflow: hidden;
        border-left: 4px solid var(--primary-color);
        transition: all 0.4s ease;
        padding-top: 60px; /* Add this to create space for the badge */
    }
    
    .publication-item {
        padding: 25px 20px;
    }
    
    .modal-container {
        padding: 30px 20px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .cta-content {
        padding: 40px 20px;
    }
}

@media (max-width: 576px) {
    .filter-tabs {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 10px;
    }
    
    .filter-tab {
        flex-shrink: 0;
    }
    
    .publication-actions {
        flex-direction: column;
    }
    
    .publication-actions .btn {
        width: 100%;
    }
    
    .pagination {
        flex-direction: column;
        gap: 15px;
    }
    
    .pagination-btn {
        width: 100%;
        justify-content: center;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .metric-card {
        padding: 30px 20px;
    }
}

/* Print Styles */
@media print {
    .publications-filters,
    .publications-cta,
    .research-metrics {
        display: none;
    }
    
    .featured-publication,
    .publication-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .publication-badge {
        background: #f0f0f0 !important;
        color: #333 !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .filter-tab {
        border-width: 3px;
    }
    
    .publication-item {
        border: 2px solid var(--dark-color);
    }
    
    .modal-container {
        background: rgba(0, 0, 0, 0.95);
        border: 2px solid white;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .publication-item,
    .featured-publication,
    .metric-card,
    .filter-tab {
        transition: none;
    }
    
    .modal-container {
        animation: none;
    }
    
    .loading-spinner {
        animation: none;
    }
}

/* Fix for Featured Publications Badge */
.featured-publication {
    padding: 40px !important;
    position: relative !important;
    overflow: hidden !important;
    border-left: 4px solid var(--primary-color);
    transition: all 0.4s ease;
    padding-top: 80px !important; /* Increased padding to accommodate badge */
}

.publication-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--gradient-primary);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
    z-index: 10; /* Ensure it stays above other content */
    max-width: 150px; /* Limit badge width */
    text-align: center;
}

.publication-badge.featured {
    background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
    color: var(--dark-color);
}

.publication-header {
    margin-bottom: 20px !important;
    position: relative !important;
    z-index: 1 !important;
    padding-right: 120px; /* Create space for the badge */
}

.publication-header h3 {
    margin-bottom: 15px;
    font-size: 1.5rem;
    line-height: 1.3;
    color: var(--dark-color);
    word-wrap: break-word;
    hyphens: auto;
}

/* Fix Modal Text Issues */
.modal-title {
    font-size: 2rem;
    color: white !important; /* Force white color */
    margin-bottom: 15px;
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.modal-authors {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 1.1rem;
    margin-bottom: 20px;
    font-weight: 500;
}

.modal-section p,
.modal-section li {
    color: rgba(255, 255, 255, 0.9) !important;
    line-height: 1.7;
    word-wrap: break-word;
    hyphens: auto;
}

/* Prevent text breaking in modals */
.modal-container {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.modal-content h2,
.modal-content h3 {
    word-wrap: break-word;
    hyphens: auto;
}

/* Dataset Request Modal Styles */
.dataset-modal,
.success-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.dataset-modal.active,
.success-modal.active {
    opacity: 1;
    visibility: visible;
}

.request-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(108, 99, 255, 0.2);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Success Modal Styles */
.success-modal .modal-container {
    max-width: 400px;
    text-align: center;
}

.success-icon {
    font-size: 4rem;
    color: var(--success-color);
    margin-bottom: 20px;
}

.success-modal h2 {
    color: white !important;
    margin-bottom: 15px;
}

.success-modal p {
    color: rgba(255, 255, 255, 0.9) !important;
    margin-bottom: 25px;
}

/* Responsive adjustments for badges */
@media (max-width: 768px) {
    .featured-publication {
        padding: 30px 20px !important;
        padding-top: 70px !important;
    }
    
    .publication-badge {
        top: 15px;
        right: 15px;
        padding: 6px 12px;
        font-size: 0.8rem;
        max-width: 120px;
    }
    
    .publication-header {
        padding-right: 100px;
    }
    
    .publication-header h3 {
        font-size: 1.3rem;
    }
}

@media (max-width: 576px) {
    .featured-publication {
        padding: 25px 15px !important;
        padding-top: 65px !important;
    }
    
    .publication-badge {
        top: 10px;
        right: 10px;
        padding: 5px 10px;
        font-size: 0.75rem;
        max-width: 100px;
    }
    
    .publication-header {
        padding-right: 90px;
    }
    
    .publication-header h3 {
        font-size: 1.2rem;
    }
}

/* Ensure text doesn't break in publication items */
.publication-item h3 {
    word-wrap: break-word;
    hyphens: auto;
    margin-right: 100px; /* Space for badge */
}

.publication-item .publication-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    margin-bottom: 0 !important;
}

/* Fix for publication item layout */
.publication-item {
    position: relative;
    padding: 30px;
    padding-top: 70px; /* Space for badge */
}

.publication-item .publication-header {
    padding-right: 120px;
}



/* Fix for double scrollbar in modal */
.publication-modal.active {
    overflow: hidden; /* Prevent body scrolling when modal is open */
}

.modal-container {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh; /* This is causing the inner scrollbar */
    overflow-y: auto; /* This creates the inner scrollbar */
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 12px;
    padding: 40px;
    color: white;
    animation: modalFadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Remove max-height and let content determine height */
.modal-container {
    max-height: none; /* Remove this line */
    height: auto; /* Change to auto */
    overflow-y: visible; /* Change to visible */
}

/* Instead, control the height at the modal content level */
.modal-content {
    max-height: 80vh; /* Control height here instead */
    overflow-y: auto; /* Move scroll to content level */
    padding-right: 10px; /* Space for scrollbar */
}

/* Custom scrollbar for modal */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Prevent body scroll when modal is open */
body.no-scroll {
    overflow: hidden;
}

/* Ensure modal is properly centered and sized */
.publication-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px; /* Add padding for small screens */
    box-sizing: border-box;
}

.publication-modal.active {
    opacity: 1;
    visibility: visible;
}

/* Improved modal container sizing */
.modal-container {
    width: 90%;
    max-width: 900px;
    height: auto;
    max-height: 90vh; /* Allow modal to grow but not exceed viewport */
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 12px;
    padding: 30px;
    color: white;
    animation: modalFadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    display: flex;
    flex-direction: column;
}

/* Modal content should scroll internally */
.modal-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    margin-right: -5px;
}

/* Modal footer stays at bottom */
.modal-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        padding: 20px;
        max-height: 95vh;
    }
    
    .publication-modal {
        padding: 10px;
    }
}

@media (max-width: 576px) {
    .modal-container {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        padding: 15px;
    }
    
    .modal-content {
        max-height: calc(100vh - 150px);
    }
}

/* Quick fix for double scrollbar */
.modal-container {
    max-height: none !important;
    overflow-y: visible !important;
}

.modal-content {
    max-height: 70vh;
    overflow-y: auto;
}

body.no-scroll {
    overflow: hidden;
}

/* Complete Modal Fix - Replace all existing modal styles with this */
.publication-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.publication-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-container {
    position: relative;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.1) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 0;
    color: white;
    animation: modalFadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Modal Header Fix */
.modal-header {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 10px;
}

.modal-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

#modal-publication-title {
    font-size: 2rem;
    line-height: 1.3;
    margin-bottom: 15px;
    color: white !important;
    font-weight: 700;
    text-align: center;
    word-wrap: break-word;
    hyphens: auto;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.modal-authors {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9) !important;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
    line-height: 1.5;
}

.modal-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 25px;
    margin-top: 15px;
}

.modal-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 0.95rem;
}

#modal-publication-venue {
    color: var(--primary-light);
    font-weight: 600;
    background: rgba(108, 99, 255, 0.2);
    padding: 6px 12px;
    border-radius: 8px;
}

#modal-publication-year {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 8px;
    color: white;
}

#modal-publication-citations {
    color: #4cbce8;
}

/* Modal Body Fix */
.modal-body {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.modal-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-section h3 {
    font-size: 1.4rem;
    color: white !important;
    margin-bottom: 15px;
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#modal-publication-abstract {
    font-size: 1.05rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.9) !important;
    text-align: justify;
    word-wrap: break-word;
    hyphens: auto;
    margin: 0;
}

/* Contributions List Fix */
#modal-publication-contributions {
    list-style: none;
    padding: 0;
    margin: 0;
}

#modal-publication-contributions li {
    position: relative;
    padding: 12px 0 12px 35px;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.9) !important;
    line-height: 1.5;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#modal-publication-contributions li:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

#modal-publication-contributions li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 25px;
    height: 25px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Resources Section Fix */
.resource-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
}

.resource-links .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.resource-links .btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Modal Footer Fix */
.modal-footer {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding-top: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 10px;
}

.modal-footer .btn {
    padding: 12px 30px;
    font-size: 1rem;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.modal-footer .btn-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
}

.modal-footer .btn-outline {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.modal-footer .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Scrollbar Styling */
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-content {
        padding: 25px;
        gap: 20px;
    }
    
    #modal-publication-title {
        font-size: 1.6rem;
    }
    
    .modal-authors {
        font-size: 1rem;
    }
    
    .modal-meta {
        gap: 15px;
        flex-direction: column;
        align-items: center;
    }
    
    .modal-section {
        padding: 20px;
    }
    
    .modal-section h3 {
        font-size: 1.2rem;
    }
    
    .resource-links {
        justify-content: center;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .modal-container {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .modal-content {
        padding: 20px;
        gap: 15px;
    }
    
    #modal-publication-title {
        font-size: 1.4rem;
    }
    
    .modal-authors {
        font-size: 0.95rem;
    }
    
    .modal-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 1.3rem;
    }
}

/* Text Alignment and Readability Improvements */
.modal-content * {
    box-sizing: border-box;
}

.modal-content p, 
.modal-content li, 
.modal-content span {
    line-height: 1.6;
    word-spacing: 0.5px;
    letter-spacing: 0.2px;
}

/* Force white color for all text elements in modal */
.modal-container,
.modal-container *:not(.modal-close) {
    color: white !important;
}

.modal-container h1,
.modal-container h2,
.modal-container h3,
.modal-container h4,
.modal-container h5,
.modal-container h6 {
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Prevent text breaking issues */
.modal-container {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ensure proper text wrapping */
#modal-publication-title,
.modal-authors,
#modal-publication-abstract {
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}


/* Quick essential fixes */
#modal-publication-title {
    color: white !important;
    text-align: center;
    word-wrap: break-word;
}

.modal-container * {
    color: white !important;
}

.modal-content {
    text-align: left;
    line-height: 1.6;
}

.modal-meta {
    justify-content: center;
    text-align: center;
}

/* Add this to better manage space on tablets/smaller desktops */
@media (max-width: 992px) {
    .navbar .container {
        /* Ensure the container uses all available space, but adds padding */
        padding: 0 15px;
    }

    .nav-links {
        /* This is the key change to ensure all links/buttons align */
        display: flex;
        align-items: center;
        gap: 15px; /* Reduce gap between elements to save horizontal space */
    }

    /* Reduce the button's padding to make it smaller on mobile/tablet */
    .nav-links .btn {
        padding: 8px 15px; 
        font-size: 0.85rem; /* Make the text smaller */
    }
    
    /* Hide the text/icon in the button for even smaller phones if needed */
    @media (max-width: 768px) {
        .nav-links .btn span {
            display: none; /* Hide the "Collaborate With Us" text */
        }
        .nav-links .btn i {
            margin: 0; /* Remove margin if only the icon is left */
        }
        .nav-links .btn {
            padding: 8px 12px; /* Small icon-only button */
        }
    }
}



/* ============================================= */
/* ==  Modal Header and Title Layout Fix      == */
/* ============================================= */

/* 1. Force the header to stack content vertically */
.publication-modal .modal-header {
    display: block; /* This is the main fix */
    width: 100%;
    text-align: center;
    border-bottom: none; /* Remove the old border */
    margin-bottom: 0;
}

/* 2. Style the title to be at the top and full-width */
#modal-publication-title {
    width: 100%;
    font-size: 2.1rem; /* Adjust size as needed */
    line-height: 1.3;
    text-align: center;
    padding-bottom: 20px;
    margin-bottom: 20px;
    /* Add a border below the title to separate it */
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* 3. Style the authors list to appear cleanly below the title */
.publication-modal .modal-authors {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.1rem;
    line-height: 1.5;
}

/* 4. Center the meta information (type, venue, year, citations) */
.publication-modal .modal-meta {
    justify-content: center;
}

/* 5. Hide the old, misplaced badge */
.publication-modal .modal-header > .modal-badge {
    display: none;
}

/* ======================================================= */
/* ==  Responsive Fix for Publication Modal (Mobile)  == */
/* ======================================================= */

/* For tablets and larger phones (screens <= 768px) */
@media (max-width: 768px) {
    #modal-publication-title {
        font-size: 1.7rem; /* Reduce title font size */
        line-height: 1.3;
        padding-bottom: 15px;
        margin-bottom: 15px;
    }

    .publication-modal .modal-authors {
        font-size: 1rem; /* Reduce authors font size */
        margin-bottom: 15px;
    }

    .publication-modal .modal-meta {
        gap: 15px; /* Reduce the gap between meta items */
        padding: 0; /* Remove horizontal padding for more space */
    }

    .publication-modal .modal-meta span {
        font-size: 0.9rem; /* Make meta text slightly smaller */
    }
}

/* For smaller mobile phones (screens <= 576px) */
@media (max-width: 576px) {
    #modal-publication-title {
        font-size: 1.5rem; /* Further reduce title size for small screens */
    }

    /* Stack the meta items vertically for the best readability */
    .publication-modal .modal-meta {
        flex-direction: column; /* This is the key change: stack items vertically */
        align-items: center;    /* Center-align the stacked items */
        gap: 12px;              /* Adjust gap for vertical layout */
    }
}




/* DOI Link Styles */
#modal-publication-doi-display {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
}

.doi-link {
    color: #4cbce8 !important;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    background: rgba(76, 188, 232, 0.1);
    padding: 4px 10px;
    border-radius: 15px;
    border: 1px solid rgba(76, 188, 232, 0.3);
}

.doi-link:hover {
    color: white !important;
    background: rgba(76, 188, 232, 0.3);
    transform: translateY(-1px);
    text-decoration: none;
}

/* Ensure DOI link is properly styled in modal */
.modal-meta #modal-publication-doi-display {
    display: inline-flex !important;
}


/* ======================================= */
/* Mobile and Tablet Responsiveness (Fixes)*/
/* ======================================= */

@media (max-width: 768px) {

    /* 1. Hero Section: Reduce padding */
    .publications-hero {
        padding-top: 130px;
        padding-bottom: 60px;
    }
    
    .hero-stats {
        flex-wrap: wrap; /* Allow stats to wrap if screen is very small */
        gap: 30px 15px;
    }
    
    .stat-number {
        font-size: 2.5rem; /* Slightly smaller for mobile */
    }


    /* 2. Publication Filters: Stack Elements */
    .filters-container {
        /* Force the filter tabs and search box to stack vertically */
        flex-direction: column;
        align-items: stretch; /* Make children take full width */
        gap: 25px;
    }

    .search-sort {
        /* Stack the search box and sort dropdown vertically */
        width: 100%;
        flex-direction: column;
        gap: 15px;
    }

    .search-box,
    .search-box input,
    .sort-select {
        /* Force search input and dropdown to use full available width */
        width: 100%;
        /* Remove fixed width from search input */
    }

    /* 3. Featured Grid: Force Single Column */
    .featured-grid {
        /* Override the minmax(450px) rule for small screens */
        grid-template-columns: 1fr;
        gap: 30px;
        margin-top: 30px;
    }

    /* 4. Reduce Section Padding */
    .featured-publications,
    .all-publications,
    .research-metrics {
        padding: 60px 0;
    }

    /* 5. Metrics Grid: Ensure proper wrap */
    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 20px;
    }
    
    /* 6. Publication Item Details */
    .publication-item {
        padding: 20px; /* Smaller padding on mobile cards */
    }
    
    .publication-item h3 {
        font-size: 1.15rem; /* Smaller title size */
    }
}


/* ======================================= */
/* Mobile and Tablet Responsiveness FIX    */
/* ======================================= */

@media (max-width: 992px) {
    /* 1. General Section Padding */
    .publications-hero,
    .featured-publications,
    .all-publications,
    .research-metrics {
        padding: 50px 0; /* Reduce all vertical padding on sections */
    }

    /* 2. Publication Filters: Critical Fix */
    .filters-container {
        /* Forces the filter tabs and the search/sort box to stack */
        flex-direction: column;
        align-items: stretch; /* Ensures they both take full width */
        gap: 20px;
    }

    /* 3. Search and Sort Box Layout */
    .search-sort {
        /* Forces the search input and the sort dropdown to stack */
        flex-direction: column; 
        width: 100%; /* Ensure it uses the full width of the container */
        gap: 15px;
    }

    .search-box,
    .search-box input,
    .sort-select {
        /* Ensures both elements use 100% of the available width */
        width: 100%;
        min-width: unset; /* Remove any desktop fixed min-width constraints */
    }
    
    /* 4. Featured Grid Layout */
    .featured-grid {
        /* Override the desktop minmax(450px) rule, forcing a single column */
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    /* 5. Hero Stats Wrap */
    .hero-stats {
        flex-wrap: wrap; /* Allow stats boxes to wrap into multiple rows */
        gap: 20px;
        justify-content: space-around; /* Better spacing when wrapped */
    }

    .stat-number {
        font-size: 2.2rem;
    }
}

.publication-item .publication-badge {
    position: relative;
    top: auto;
    right: auto;
    float: right;
    /* FIX: Remove the fixed, excessive margin */
    margin-bottom: 5px; 
}






