/* ============================================================================
   ENHANCED CSS FOR RESPRO CROSSREF LIBRARY
   ============================================================================ */

.respro-crossref-wrapper {
    --primary: #1abc9c;
    --primary-dark: #16a085;
    --primary-light: #48c9b0;
    --primary-gradient: linear-gradient(135deg, #1abc9c 0%, #3498db 100%);
    --secondary: #3498db;
    --secondary-dark: #2980b9;
    --accent: #e74c3c;
    --accent-light: #ec7063;
    --warning: #f39c12;
    --success: #27ae60;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --bg-dark: #1a1a2e;
    --text-dark: #1a2a3a;
    --text-gray: #5a6e85;
    --text-light: #94a3b8;
    --border: #eef2f5;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --shadow-hover: 0 12px 40px rgba(26,188,156,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* Main Container */
.respro-crossref-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 30px;
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-white) 100%);
    border-radius: var(--radius-xl);
}

/* Header Section */
.respro-header {
    text-align: center;
    margin-bottom: 40px;
}

.respro-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.header-icon {
    font-size: 2rem;
    background: none;
    -webkit-text-fill-color: initial;
}

.header-subtitle {
    color: var(--text-gray);
    font-size: 1rem;
}

/* Statistics Dashboard */
.respro-stats-dashboard {
    margin-bottom: 40px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(26,188,156,0.1);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-trend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.75rem;
}

.trend-up {
    color: var(--success);
    font-weight: 600;
    background: rgba(39,174,96,0.1);
    padding: 2px 8px;
    border-radius: 20px;
}

.trend-down {
    color: var(--accent);
    font-weight: 600;
    background: rgba(231,76,60,0.1);
    padding: 2px 8px;
    border-radius: 20px;
}

/* Stat Card Variations */
.stat-card.stat-total .stat-icon { color: var(--primary); }
.stat-card.stat-citations .stat-icon { color: var(--secondary); }
.stat-card.stat-journals .stat-icon { color: var(--warning); }
.stat-card.stat-impact .stat-icon { color: var(--accent); }

/* Quick Insights */
.quick-insights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.insight-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, rgba(26,188,156,0.05) 0%, rgba(52,152,219,0.05) 100%);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(26,188,156,0.15);
    transition: all 0.3s ease;
}

.insight-card:hover {
    transform: translateX(5px);
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(26,188,156,0.08) 0%, rgba(52,152,219,0.08) 100%);
}

.insight-icon {
    font-size: 2rem;
}

.insight-content {
    flex: 1;
}

.insight-content strong {
    display: block;
    font-size: 0.75rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.insight-content span {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.insight-content small {
    font-size: 0.7rem;
    color: var(--primary);
    font-weight: 600;
}

/* Charts Section */
.charts-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.chart-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.chart-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.chart-badge {
    font-size: 0.7rem;
    background: var(--primary-gradient);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
}

/* Search & Filters */
.respro-search-filters {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.search-icon {
    position: absolute;
    left: 16px;
    font-size: 1rem;
    color: var(--text-light);
}

.respro-search-input {
    flex: 1;
    padding: 14px 16px 14px 44px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: var(--bg-white);
}

.respro-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,188,156,0.1);
}

.search-btn {
    margin-left: 12px;
    padding: 14px 28px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Active Filters */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.filter-label {
    font-size: 0.75rem;
    color: var(--text-gray);
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(26,188,156,0.1);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--primary-dark);
}

.remove-filter {
    text-decoration: none;
    color: var(--text-gray);
    font-weight: bold;
    margin-left: 4px;
}

.remove-filter:hover {
    color: var(--accent);
}

.clear-all-btn {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.75rem;
    padding: 5px 12px;
    border-radius: 20px;
    background: rgba(231,76,60,0.1);
}

.clear-all-btn:hover {
    background: rgba(231,76,60,0.2);
}

/* Filters Bar */
.respro-filters-bar {
    margin-top: 16px;
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.filter-select {
    flex: 1;
    min-width: 140px;
}

.filter-select label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.filter-select select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-select select:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-apply {
    padding: 10px 24px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-apply:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.layout-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-light);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.layout-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.layout-btn.active {
    background: var(--primary);
    color: white;
}

/* Results Info */
.respro-results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 12px 0;
    border-bottom: 2px solid var(--border);
}

.results-count {
    font-size: 0.85rem;
    color: var(--text-gray);
}

.results-count strong {
    color: var(--primary);
    font-size: 1rem;
}

.export-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.8rem;
}

.export-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Articles Grid */
.respro-articles-list.layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.respro-articles-list.layout-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Article Cards */
.article-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
    position: relative;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.article-card-inner {
    padding: 20px;
}

/* Badges */
.article-badge {
    position: absolute;
    top: 12px;
    right: 12px;
}

.badge-hot {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-popular {
    background: linear-gradient(135deg, var(--warning) 0%, #f5b041 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Article Title */
.article-title {
    margin: 0 0 12px 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.article-title a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.2s;
}

.article-title a:hover {
    color: var(--primary);
}

/* Article Meta */
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.7rem;
    color: var(--text-gray);
}

.article-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.meta-citations {
    color: var(--primary);
    font-weight: 500;
}

/* Article Authors */
.article-authors {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-gray);
    margin-bottom: 12px;
    padding: 8px 0;
    border-top: 1px dashed var(--border);
    border-bottom: 1px dashed var(--border);
}

.more-authors {
    color: var(--primary);
    font-size: 0.7rem;
}

/* Article Footer */
.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.read-more {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: gap 0.2s;
}

.read-more:hover {
    gap: 8px;
    color: var(--primary-dark);
}

.save-article {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s;
}

.save-article:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Pagination */
.respro-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 40px;
    padding: 20px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.pagination-info {
    font-size: 0.8rem;
    color: var(--text-gray);
}

.pagination-links {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.page-link {
    padding: 8px 14px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-dark);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.page-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.page-link.current {
    background: var(--primary-gradient);
    border-color: var(--primary);
    color: white;
}

.page-dots {
    padding: 8px 4px;
    color: var(--text-gray);
}

.pagination-jump {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-jump label {
    font-size: 0.75rem;
    color: var(--text-gray);
}

#jump-to-page {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
}

.jump-button {
    padding: 6px 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.7rem;
}

/* No Results */
.respro-no-results {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.respro-no-results h3 {
    font-size: 1.2rem;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.respro-no-results p {
    color: var(--text-gray);
    margin-bottom: 20px;
}

.reset-filters-btn {
    display: inline-block;
    padding: 10px 24px;
    background: var(--primary-gradient);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.2s;
}

.reset-filters-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Journal Section */
.respro-journal-section {
    margin-bottom: 40px;
}

.journal-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
}

.journal-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.article-count-badge {
    font-size: 0.7rem;
    background: var(--bg-light);
    padding: 4px 10px;
    border-radius: 20px;
    color: var(--text-gray);
}

/* Responsive */
@media (max-width: 768px) {
    .respro-crossref-container {
        padding: 20px 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .quick-insights {
        grid-template-columns: 1fr;
    }
    
    .charts-wrapper {
        grid-template-columns: 1fr;
    }
    
    .filters-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-select {
        min-width: auto;
    }
    
    .filter-actions {
        flex-direction: column;
    }
    
    .layout-toggle {
        width: 100%;
        justify-content: center;
    }
    
    .respro-pagination {
        flex-direction: column;
        text-align: center;
    }
    
    .pagination-links {
        justify-content: center;
    }
    
    .respro-articles-list.layout-grid {
        grid-template-columns: 1fr;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .respro-crossref-container {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }
    
    .stat-card,
    .chart-card,
    .respro-search-filters,
    .article-card,
    .respro-pagination,
    .respro-no-results {
        background: #1a1a2e;
        border-color: #2d2d4a;
    }
    
    .stat-number,
    .article-title a {
        color: #e2e8f0;
    }
    
    .stat-label,
    .insight-content strong,
    .filter-select label,
    .results-count {
        color: #94a3b8;
    }
    
    .respro-search-input,
    .filter-select select {
        background: #1a1a2e;
        border-color: #2d2d4a;
        color: #e2e8f0;
    }
    
    .page-link {
        background: #1a1a2e;
        border-color: #2d2d4a;
        color: #e2e8f0;
    }
    
    .journal-title {
        color: #e2e8f0;
    }
}

/* Print Styles */
@media print {
    .respro-search-filters,
    .respro-filters-bar,
    .export-btn,
    .layout-toggle,
    .save-article,
    .respro-pagination {
        display: none;
    }
    
    .article-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}