@import url('https://fonts.googleapis.com/css2?family=Fira+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

html {
    font-size: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Fira Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    font-size: 1rem;
}

.data-info {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.panel-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.error-report-banner {
    color: #888;
    font-size: 0.85rem;
}

.error-report-banner a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.error-report-banner a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.search-panel {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 25px;
}

.search-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-group {
    flex: 1;
    min-width: 250px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.search-tip-inline {
    font-size: 0.75em;
    color: #888;
    font-weight: normal;
}

@media (max-width: 768px) {
    .search-tip-inline {
        display: block;
        margin-top: 4px;
        font-size: 0.7em;
    }
}

input[type="text"], input[type="number"], select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

input[type="text"]:focus, input[type="number"]:focus, select:focus {
    outline: none;
    border-color: #3498db;
}

.year-group {
    display: flex;
    gap: 10px;
}

.year-group input {
    flex: 1;
}

.journal-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.journal-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.select-all-btn {
    background: #f8f9fa;
    color: #555;
    border: 1px solid #ddd;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.select-all-btn:hover {
    background: #e9ecef;
    border-color: #bbb;
    color: #333;
}

.journal-select {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #e0e0e0; /* 更柔和的邊框 */
    border-radius: 8px; /* 稍微大一點的圓角 */
    padding: 8px; /* 稍微減少內部填充 */
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08); /* 輕微的陰影 */
}

.journal-option {
    display: flex;
    align-items: center;
    margin-bottom: 6px; /* 稍微減少選項間距 */
    padding: 4px 8px; /* 增加選項的內部填充，使其看起來更寬敞 */
    border-radius: 4px; /* 為懸停效果增加圓角 */
    transition: background-color 0.2s ease; /* 平滑的背景顏色過渡 */
}

.journal-option:hover {
    background-color: #f0f0f0; /* 懸停時的背景顏色 */
}

.journal-option input {
    margin-right: 8px;
    width: auto;
    cursor: pointer; /* 確保滑鼠指標是手型 */
}

.journal-option label {
    cursor: pointer;
    display: block;
    padding: 5px 0;
    width: 100%;
    flex-grow: 1;
}

.results-info {
    background: #e8f4fd;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: 600;
    color: #2980b9;
}

.load-more-hint {
    font-size: 0.85em;
    color: #666;
    font-weight: normal;
    margin-left: 10px;
}

.loading-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.results-container {
    position: relative;
}

.load-more-trigger {
    height: 20px;
    visibility: hidden;
}

.loading-more {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 5px;
    margin: 10px 0;
}

.paper-card {
    background: white;
    margin-bottom: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    transform: translateZ(0); /* Force GPU acceleration */
    will-change: transform; /* Optimize for transforms */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.paper-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.paper-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.paper-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s;
}

.paper-title:hover {
    color: #3498db;
}

.paper-title-link {
    color: inherit;
    text-decoration: none;
    display: inline-block;
    padding: 5px 0;
}

.paper-title-link:hover {
    color: #3498db;
}

.paper-meta {
    display: flex;
    gap: 20px;
    color: #666;
    font-size: 14px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
}

.meta-label {
    font-weight: 600;
    margin-right: 5px;
}

.abstract-section {
    padding: 0 20px 20px;
}

.abstract-toggle {
    background: #f8f9fa;
    border: none;
    padding: 12px 20px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-weight: 600;
    color: #555;
    transition: background-color 0.3s;
}

.abstract-toggle:hover {
    background: #e9ecef;
}

.abstract-content {
    padding: 15px 20px;
    line-height: 1.7;
    color: #444;
    display: none;
}

.abstract-content.show {
    display: block;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #666;
    background: white;
    border-radius: 10px;
}

.doi-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.doi-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

@media (max-width: 768px) {
    html {
        font-size: 15px; /* 稍微縮小基準字體 */
    }

    .container {
        padding: 15px;
    }

    .search-panel {
        padding: 20px;
    }

    .search-row {
        flex-direction: column;
        gap: 15px;
    }

    .year-group {
        flex-direction: column;
        gap: 15px;
    }
    
    .paper-meta {
        flex-direction: column;
        align-items: flex-start; /* 讓項目靠左對齊 */
        gap: 8px;
    }
    
    .meta-item {
        align-items: flex-start;
    }
    
    .meta-label {
        white-space: nowrap;
    }

    .abstract-toggle {
        padding: 12px 20px;
    }
}
