:root {
    --primary-color: #4a6da7;
    --secondary-color: #f5f7fa;
    --accent-color: #3b5998;
    --text-color: #333;
    --light-gray: #e9ecef;
    --border-color: #ddd;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--secondary-color);
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.upload-section {
    background-color: #f8f9fa;
    padding: 35px;
    border-radius: 8px;
    margin-bottom: 30px;
    text-align: center;
    border: 2px dashed #ccc;
    transition: all 0.3s ease;
}

.upload-section.highlight {
    border-color: var(--primary-color);
    background-color: rgba(74, 109, 167, 0.1);
}

.file-input {
    display: none;
}

.upload-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.upload-btn:hover {
    background-color: var(--accent-color);
}

.file-info {
    margin-top: 15px;
    font-size: 14px;
}

.progress-container {
    margin-top: 20px;
    display: none;
}

.progress-bar {
    height: 8px;
    background-color: var(--light-gray);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress {
    height: 100%;
    background-color: var(--primary-color);
    width: 0;
    transition: width 0.3s;
}

.progress-text {
    font-size: 14px;
    color: var(--primary-color);
}

.search-section {
    margin-bottom: 30px;
    display: none;
}

.search-container {
    display: flex;
    margin-bottom: 20px;
}

.search-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px 0 0 4px;
    font-size: 16px;
}

.search-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 16px;
}

.filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-select {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
}

.fuzzy-search-container {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.fuzzy-search-label {
    margin-right: 10px;
}

.results-section {
    display: none;
}

.results-info {
    margin-bottom: 15px;
    font-weight: bold;
}

.table-container {
    max-height: 800px;
    overflow-y: auto;
    overflow-x: auto; /* 横スクロールを有効化 */
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    width: 100%;
}

.results-table {
    width: auto; /* テーブルの幅を内容に合わせる */
    min-width: 100%; /* 最低でもコンテナの幅いっぱいに広がる */
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

.results-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 10px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 3px rgba(0,0,0,0.1);
    
    /* テキスト省略を無効化 */
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    
    /* 高さと配置の調整 */
    min-height: 60px;
    vertical-align: top;
    line-height: 1.4;
    
    /* 横表示を確保 */
    writing-mode: horizontal-tb !important;
}

.results-table td {
    border-bottom: 1px solid var(--border-color);
    padding: 10px;
    vertical-align: top;
    max-width: none; /* 最大幅の制限を削除 */
    white-space: normal; /* 改行を許可 */
    overflow: visible; /* オーバーフローを表示 */
    text-overflow: clip; /* 省略記号を表示しない */
    word-break: break-word; /* 長い単語を折り返す */
}

.results-table td:hover {
    background-color: #f8f9fa;
    position: relative;
    z-index: 5;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.results-table tr:nth-child(even) {
    background-color: var(--light-gray);
}

.results-table tr:hover {
    background-color: rgba(74, 109, 167, 0.1);
}

.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.pagination button {
    background-color: white;
    border: 1px solid var(--border-color);
    padding: 8px 15px;
    margin: 0 3px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.pagination button:hover {
    background-color: #f0f0f0;
}

.pagination button.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

.no-results {
    text-align: center;
    padding: 20px;
    color: #666;
}

.download-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 20px;
}

.download-btn:hover {
    background-color: var(--accent-color);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--light-gray);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.highlighted {
    background-color: #ffff00;
    font-weight: bold;
    padding: 2px 0;
    border-radius: 2px;
}

.fuzzy-match {
    background-color: #ffeeba;
    font-weight: bold;
    padding: 2px 0;
    border-radius: 2px;
}

.advanced-options {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--light-gray);
}

.advanced-options-title {
    margin-bottom: 10px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.advanced-options-title::after {
    content: '▼';
    margin-left: 5px;
    font-size: 12px;
}

.advanced-options-title.open::after {
    content: '▲';
}

.advanced-options-content {
    display: none;
}

.settings-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.settings-label {
    width: 200px;
    font-size: 14px;
}

.footer {
    text-align: center;
    margin-top: 30px;
    font-size: 14px;
    color: #666;
}

