/* ============================================
   大菌輪 論文検索 - スタイルシート
   ============================================ */

/* CSS変数 */
:root {
    /* ベースカラー */
    --bg-color: #f0f4f0;
    --text-color: #2c2c2c;
    --primary-green: #2e7d32;
    --light-green: #4caf50;
    --dark-green: #1b5e20;
    --dark-brown: #3e2723;
    --light-brown: #795548;

    /* グレースケール */
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;

    /* レイアウト */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition: all 0.3s ease;

    /* ヘッダー・フッター */
    --header-bg-color: #1f1f1f;
    --footer-bg-color: #1f1f1f;

    /* シャドウ */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* リセット */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ベース */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* タイポグラフィ */
.font-serif {
    font-family: 'Noto Serif JP', serif;
}

.species-name {
    font-style: italic;
}

/* ============================================
   ヘッダー
   ============================================ */
.header {
    background: var(--header-bg-color);
    color: white;
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    font-family: 'Noto Serif JP', serif !important;
    font-size: 2.2rem;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
}

.site-logo,
.site-logo:link,
.site-logo:visited,
.site-logo:hover,
.site-logo:active {
    color: #fff;
}

.site-logo:hover {
    opacity: 0.8;
}

.nav {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: white;
}

/* ============================================
   メイン
   ============================================ */
.main {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

/* ============================================
   検索ヘッダー
   ============================================ */
.search-header {
    text-align: center;
    margin-bottom: 2rem;
}

.search-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-green);
    margin-bottom: 0.5rem;
}

.search-subtitle {
    color: var(--gray-600);
    margin-bottom: 1.5rem;
}

/* 検索フォーム */
.search-form {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
}

.search-input-wrapper {
    display: flex;
    gap: 0.5rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 0.5rem;
}

.search-input {
    flex: 1;
    border: none;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    outline: none;
    background: transparent;
}

.search-input::placeholder {
    color: var(--gray-400);
}

.search-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.search-btn:hover {
    background: var(--dark-green);
}

/* 検索ヘルプボタン */
.search-help {
    margin-top: 0.75rem;
    text-align: center;
}

.help-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    background: transparent;
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--gray-600);
    cursor: pointer;
    transition: var(--transition);
}

.help-btn:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
    color: var(--gray-700);
}

.help-btn svg {
    color: var(--primary-green);
}

/* モーダル */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-green);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--gray-700);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--dark-green);
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
}

.modal-body h4:first-child {
    margin-top: 0;
}

.modal-body p {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.modal-body ul {
    font-size: 0.9rem;
    color: var(--gray-700);
    padding-left: 1.5rem;
}

.modal-body li {
    margin-bottom: 0.5rem;
}

.modal-body code {
    background: var(--gray-100);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: monospace;
}

/* 記号テーブル */
.symbol-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.symbol-table tr {
    border-bottom: 1px solid var(--gray-100);
}

.symbol-table td {
    padding: 0.6rem 0.5rem;
    vertical-align: middle;
}

.symbol-table td:first-child {
    width: 40px;
    text-align: center;
}

.symbol-table td:nth-child(2) {
    width: 60px;
}

.symbol-table td.example {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.symbol {
    font-size: 1.2rem;
    font-weight: bold;
}

.symbol-new { color: #ff6b6b; }
.symbol-record { color: #42a5f5; }
.symbol-comb { color: #ffa726; }
.symbol-name { color: #ab47bc; }
.symbol-rank { color: #26a69a; }

/* サジェスト */
.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    z-index: 50;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}

.suggestion-item:hover {
    background: var(--gray-50);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-value {
    font-weight: 500;
}

.suggestion-value.species-name {
    font-style: italic;
}

.suggestion-meta {
    font-size: 0.8rem;
    color: var(--gray-500);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ============================================
   検索レイアウト
   ============================================ */
.search-layout {
    display: flex;
    gap: 2rem;
}

/* フィルターサイドバー */
.filter-sidebar {
    width: 280px;
    flex-shrink: 0;
}

.filter-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.filter-title {
    margin: 0;
}

.filter-toggle {
    width: 100%;
    padding: 1rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-content {
    padding: 0 1rem 1rem;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 年範囲 */
.year-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.year-input {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    text-align: center;
}

.year-separator {
    color: var(--gray-500);
}

/* チェックボックス */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-300);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--primary-green);
    border-color: var(--primary-green);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

/* バッジ */
.badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-new-species {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
}

.badge-new-record {
    background: linear-gradient(135deg, #42a5f5, #1e88e5);
    color: white;
}

.badge-new-combination {
    background: linear-gradient(135deg, #ffa726, #fb8c00);
    color: white;
}

.badge-new-name {
    background: linear-gradient(135deg, #ab47bc, #8e24aa);
    color: white;
}

.badge-new-rank {
    background: linear-gradient(135deg, #26a69a, #00897b);
    color: white;
}

.badge-year {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* ボタン */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    border: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-green);
    color: var(--primary-green);
}

.btn-outline:hover {
    background: var(--primary-green);
    color: white;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* ============================================
   検索結果
   ============================================ */
.search-results {
    flex: 1;
    min-width: 0;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.results-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.results-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.results-count {
    font-size: 0.95rem;
}

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

.sort-label {
    font-size: 0.85rem;
    color: var(--gray-600);
    white-space: nowrap;
}

.sort-select {
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    font-size: 0.85rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.5rem center;
    background-size: 12px;
    appearance: none;
    cursor: pointer;
    transition: var(--transition);
}

.sort-select:hover {
    border-color: var(--primary-green);
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

/* ============================================
   サイドバー統計パネル（PubMed風）
   ============================================ */
.sidebar-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
    margin-bottom: 1rem;
}

.sidebar-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-title svg {
    color: var(--primary-green);
}

.btn-block {
    width: 100%;
    text-align: center;
}

/* クイック年代フィルター */
.quick-filter-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.quick-filter-btn {
    padding: 0.4rem 0.75rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--gray-700);
}

.quick-filter-btn:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

.quick-filter-btn.active {
    background: var(--primary-green);
    color: white;
    border-color: var(--primary-green);
}

/* タイプ別ファセット */
.type-facet-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.type-facet-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
}

.type-facet-item:hover {
    background: var(--gray-50);
}

.type-facet-item.active {
    background: rgba(46, 125, 50, 0.1);
}

.type-facet-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.type-facet-count {
    font-size: 0.75rem;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
}

/* 年代タイムライン */
.timeline-chart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 60px;
    padding-top: 0.5rem;
}

.timeline-bar {
    flex: 1;
    min-width: 4px;
    max-width: 20px;
    background: linear-gradient(180deg, var(--primary-green), var(--light-green));
    border-radius: 2px 2px 0 0;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.timeline-bar:hover {
    background: linear-gradient(180deg, var(--dark-green), var(--primary-green));
    transform: scaleY(1.05);
}

.timeline-bar.active {
    background: linear-gradient(180deg, #ff6b6b, #ee5a5a);
}

.timeline-bar::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--header-bg-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.timeline-bar:hover::after {
    opacity: 1;
}

.timeline-legend {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
    padding: 0 2px;
}

/* 年範囲スライダー（PubMed風） */
.year-range-slider {
    padding: 0.75rem 8px 0.25rem;
    user-select: none;
}

.slider-track {
    position: relative;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    cursor: pointer;
}

.slider-range {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-green), var(--light-green));
    border-radius: 3px;
    pointer-events: none;
}

.slider-handle {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    background: white;
    border: 2px solid var(--primary-green);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    z-index: 2;
    transition: box-shadow 0.2s, transform 0.1s;
}

.slider-handle:hover {
    box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.2);
}

.slider-handle:active,
.slider-handle.dragging {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 0 0 6px rgba(46, 125, 50, 0.25);
}

.slider-handle:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.3);
}

.year-range-display {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary-green);
    margin-top: 0.5rem;
    min-height: 1.2em;
}

.year-range-display:empty {
    display: none;
}

/* ローディング */
.loading {
    text-align: center;
    padding: 3rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 結果リスト */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 論文カード */
.paper-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: var(--transition);
}

.paper-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.paper-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.paper-id {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-family: monospace;
}

.paper-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.paper-title {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.paper-original-title {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.paper-meta {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.paper-journal {
    font-weight: 500;
}

.paper-summary {
    font-size: 0.9rem;
    color: var(--gray-700);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.paper-species {
    margin-bottom: 1rem;
}

.species-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-right: 0.5rem;
}

.species-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.species-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    background: var(--gray-100);
    border-radius: 4px;
    font-size: 0.8rem;
    font-style: italic;
    color: var(--gray-700);
}

.species-tag .badge {
    font-size: 0.55rem;
    padding: 0.1rem 0.25rem;
}

.species-tag a {
    color: inherit;
    text-decoration: none;
}

.species-tag a:hover {
    color: var(--primary-green);
    text-decoration: underline;
}

/* 種ページへのリンク */
.species-link {
    color: var(--primary-green);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.species-link:hover {
    color: var(--dark-green);
    text-decoration: underline;
}

/* リンクがある種名タグ */
.species-tag:has(.species-link) {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border: 1px solid var(--light-green);
}

.paper-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.paper-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.8rem;
    border-radius: 16px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: var(--transition);
    background: var(--gray-100);
    color: var(--gray-700);
}

.paper-link:hover {
    background: var(--gray-200);
}

.paper-link.primary {
    background: var(--primary-green);
    color: white;
}

.paper-link.primary:hover {
    background: var(--dark-green);
}

/* 空の状態 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: var(--border-radius);
}

.empty-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-green), var(--light-green));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
    margin: 0 auto 1.5rem;
}

.empty-state h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--dark-green);
}

.empty-state p {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

.search-examples {
    margin-top: 1.5rem;
}

.search-examples p {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.example-btn {
    margin: 0.25rem;
    padding: 0.5rem 1rem;
    background: var(--gray-100);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.example-btn:hover {
    background: var(--primary-green);
    color: white;
}

/* ページネーション */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-200);
}

.pagination-btn {
    padding: 0.5rem 1.25rem;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-green);
    color: white;
    border-color: var(--primary-green);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.9rem;
    color: var(--gray-600);
}

/* ============================================
   フッター
   ============================================ */
.footer {
    background: var(--footer-bg-color);
    color: rgba(255, 255, 255, 0.8);
    padding: 1.5rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
    font-size: 0.85rem;
}

.footer-links {
    margin-top: 0.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    margin: 0 0.75rem;
}

.footer-links a:hover {
    color: white;
}

/* ============================================
   レスポンシブ
   ============================================ */
@media (max-width: 900px) {
    .search-layout {
        flex-direction: column;
    }

    .filter-sidebar {
        width: 100%;
        order: 2;
    }

    .search-results {
        order: 1;
    }

    .filter-content {
        display: none;
    }

    .filter-content.open {
        display: block;
    }
}

/* ============================================
   タグ検索モーダル
   ============================================ */
.tag-modal-content {
    max-width: 800px;
    width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.tag-modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.5rem;
}

/* 検索・フィルターコントロール */
.tag-search-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.tag-search-input-wrapper {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.75rem;
    transition: var(--transition);
}

.tag-search-input-wrapper:focus-within {
    border-color: var(--primary-green);
    background: white;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.tag-search-input-wrapper svg {
    color: var(--gray-500);
    flex-shrink: 0;
}

.tag-search-input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    outline: none;
}

.tag-category-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tag-category-filter label {
    font-size: 0.85rem;
    color: var(--gray-600);
    white-space: nowrap;
}

.tag-category-filter select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.85rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.5rem center;
    background-size: 12px;
    appearance: none;
    cursor: pointer;
    min-width: 150px;
}

/* 選択中のタグエリア */
.tag-selected-area {
    background: #e8f5e9;
    border: 1px solid var(--light-green);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.tag-selected-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--dark-green);
    margin-bottom: 0.5rem;
}

.tag-selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-selected-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    background: white;
    border: 1px solid var(--primary-green);
    border-radius: 16px;
    font-size: 0.8rem;
    color: var(--dark-green);
}

.tag-selected-item .tag-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--gray-200);
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.7rem;
    color: var(--gray-600);
    transition: var(--transition);
}

.tag-selected-item .tag-remove:hover {
    background: #ff6b6b;
    color: white;
}

/* タグ一覧 */
.tag-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.tag-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
    padding: 0 0.25rem;
}

.tag-list-hint {
    font-style: italic;
}

.tag-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    background: white;
    min-height: 300px;
    max-height: 400px;
}

.tag-loading {
    padding: 2rem;
    text-align: center;
    color: var(--gray-500);
}

.tag-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: var(--transition);
}

.tag-item:last-child {
    border-bottom: none;
}

.tag-item:hover {
    background: var(--gray-50);
}

.tag-item.selected {
    background: #e8f5e9;
    border-left: 3px solid var(--primary-green);
}

.tag-item-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
    min-width: 0;
}

.tag-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
}

.tag-item-name-en {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.tag-item-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.tag-item-category {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: var(--gray-100);
    border-radius: 10px;
    color: var(--gray-600);
    white-space: nowrap;
}

.tag-item-count {
    font-size: 0.75rem;
    color: var(--gray-500);
    min-width: 50px;
    text-align: right;
}

/* モーダルフッター */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.btn-primary {
    background: var(--primary-green);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--dark-green);
}

.btn-primary:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
}

/* タグがない場合 */
.tag-empty {
    padding: 2rem;
    text-align: center;
    color: var(--gray-500);
}

@media (max-width: 600px) {
    .header-content {
        flex-direction: column;
        gap: 0.75rem;
    }

    .search-input-wrapper {
        flex-direction: column;
    }

    .search-btn {
        justify-content: center;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .paper-header {
        flex-direction: column;
    }

    .paper-badges {
        order: -1;
    }
}
