:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --light-bg: #f8f9fa;
    --border-color: #e9ecef;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-muted: #95a5a6;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
}

* {
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e7f1 100%);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 2rem;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, rgba(44, 62, 80, 0.95) 0%, rgba(52, 73, 94, 0.9) 100%);
    color: white;
    border-radius: 0 0 20px 20px;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
}

header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.1) 0%, transparent 20%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.08) 0%, transparent 25%);
}

.header-content {
    position: relative;
    z-index: 2;
}

.header-content h1 {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.header-divider {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color), #2980b9);
    margin: 1rem auto;
    border-radius: 2px;
}

/* Card Styles */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 12px 12px 0 0 !important;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 12px 12px !important;
}

/* Search Section */
.search-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 249, 250, 0.95) 100%);
}

.search-input-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    z-index: 2;
}

.search-input {
    padding-left: 2.5rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
    background: white;
}

.search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-button {
    background: linear-gradient(135deg, var(--accent-color) 0%, #2980b9 100%);
    border: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    height: 100%;
}

.search-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

/* Facets Section */
.facets-section {
    background: rgba(248, 249, 250, 0.7);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.facet-title {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-select {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background-color: white;
}

.form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

/* Results Section */
.results-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 249, 250, 0.95) 100%);
}

.stats {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Result Items */
.result-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 1.5rem;
    background: white;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.result-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--accent-color), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.result-item:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.result-item:hover::before {
    opacity: 1;
}

.result-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.result-authors {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.result-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.result-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.result-description {
    margin: 0.75rem 0;
    line-height: 1.5;
    color: var(--text-primary);
    font-size: 0.95rem;
    border-left: 3px solid var(--border-color);
    padding-left: 1rem;
}

.result-description-placeholder {
    margin: 0.75rem 0;
    line-height: 1.5;
    color: var(--text-muted);
    font-size: 0.95rem;
    background: rgba(248, 249, 250, 0.6);
    padding: 0.5rem;
    border-radius: 3px;
    border: 1px dashed var(--border-color);
    font-style: italic;
}

.result-doi {
    font-size: 0.8rem;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.result-doi a {
    color: inherit;
    text-decoration: none;
}

.result-doi a:hover {
    text-decoration: underline;
}

/* Citation Section */
.citation-section {
    margin: 1rem 0;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 5px;
    border-left: 3px solid #667eea;
}

.citation-section h4 {
    margin-bottom: 0.75rem;
    color: #555;
    font-size: 1rem;
}

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

.citation-style {
    font-size: 0.85rem;
    line-height: 1.4;
}

.citation-label {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.citation-text {
    font-family: monospace;
    background: white;
    padding: 0.5rem;
    border-radius: 3px;
    border: 1px solid #ddd;
    word-break: break-word;
    margin-bottom: 0.25rem;
    min-height: 2.5em;
}

.copy-button {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-button:hover {
    background: #5a6268;
}

.copy-button.copied {
    background: #28a745;
}

.view-full-text {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 3px;
    font-size: 0.8rem;
}

.view-full-text:hover {
    background: #5a6fd8;
    color: white;
    text-decoration: none;
}

/* Group Headers */
.group-header {
    background: #e9ecef;
    padding: 0.75rem 1rem;
    margin: 1rem 0 0.5rem 0;
    border-radius: 5px;
    font-weight: bold;
}

/* Loading States */
.loading, .info-message {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 5px;
    margin: 1rem 0;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.pagination-buttons {
    display: flex;
    gap: 0.25rem;
}

.pagination-button {
    padding: 0.375rem 0.75rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
}

.pagination-button:hover:not(:disabled) {
    background: #e9ecef;
}

.pagination-button:disabled {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

.pagination-button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* ORCID Icon */
.orcid-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    vertical-align: middle;
    background-color: #a6ce39;
    border-radius: 2px;
    position: relative;
}

.orcid-icon::before {
    content: "ORCID";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8px;
    font-weight: bold;
    color: white;
    font-family: Arial, sans-serif;
}

.orcid-link {
    text-decoration: none;
    margin-left: 2px;
}

.orcid-link:hover .orcid-icon {
    opacity: 0.8;
}

/* Demo Badge */
.demo-badge {
    background: #ffc107;
    color: #212529;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Responsive Design */
@media (max-width: 768px) {
    .search-controls, .results-header, .pagination {
        flex-direction: column;
    }

    input, select, button {
        width: 100%;
    }

    .result-meta {
        flex-direction: column;
        gap: 0.25rem;
    }

    .grouping-controls, .pagination-controls {
        width: 100%;
        justify-content: center;
    }

    .facets {
        grid-template-columns: 1fr;
    }

    .citation-styles {
        grid-template-columns: 1fr;
    }

    .facets-section {
        padding: 1rem;
    }

    header {
        border-radius: 0 0 15px 15px;
    }
}

/* Loading spinner styles */
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 1rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Copy icon using CSS */
.copy-icon::before {
    content: "📋";
}

.copied-icon::before {
    content: "✓";
}
