/* 全体のスタイル */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 25px 0;
    border-bottom: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 60%);
    opacity: 0.6;
    z-index: 0;
}

header h1,
header p {
    position: relative;
    z-index: 1;
}

.subtitle {
    font-size: 1.1rem;
    margin-top: 8px;
    opacity: 0.9;
    letter-spacing: 0.5px;
    font-weight: 300;
}

header h1 {
    font-size: 2.2rem;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

h1,
h2,
h3 {
    color: #2c3e50;
}

header h1 {
    color: white;
}

h1 i,
h2 i,
h3 i {
    margin-right: 10px;
}

header h1 i {
    font-size: 1.1em;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    animation: glow 2s infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    }

    to {
        text-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 20px rgba(255, 255, 255, 0.3);
    }
}

section {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 25px;
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

section:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* ファイルアップロードセクション */
.upload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    margin: 20px 0;
    transition: all 0.3s ease;
    background-color: #f9f9f9;
}

.upload-container:hover {
    border-color: #007bff;
    background-color: #f0f7ff;
}

input[type="file"] {
    display: none;
}

.file-list {
    width: 100%;
    max-width: 600px;
    margin-top: 20px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin: 5px 0;
    background-color: #f0f7ff;
    border-radius: 4px;
    border-left: 3px solid #007bff;
}

.file-item .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 10px;
}

.file-item .remove-file {
    color: #dc3545;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.file-item .remove-file:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

.file-label {
    background-color: #007bff;
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0, 123, 255, 0.3);
}

.file-label:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.4);
}

#file-name {
    margin-top: 15px;
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

.upload-hint {
    margin-top: 15px;
    font-size: 0.85em;
    color: #888;
    font-style: italic;
}

/* コントロールセクション */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.data-type-selector,
.threshold-controls {
    flex: 1;
    min-width: 250px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.data-type-selector:hover,
.threshold-controls:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #ccc;
}

.select-group {
    margin-top: 10px;
}

select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
    font-size: 1em;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 1em;
}

select:hover {
    border-color: #aaa;
}

select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.threshold-inputs {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    margin-bottom: 15px;
}

.threshold-input {
    display: flex;
    flex-direction: column;
    flex: 1;
}

input[type="number"] {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-top: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    width: 100%;
}

input[type="number"]:hover {
    border-color: #aaa;
}

input[type="number"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(40, 167, 69, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    background-color: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.4);
}

button i {
    margin-right: 6px;
}

/* 合計カウント表示 */
.total-summary {
    margin-top: 15px;
    padding: 10px;
    background-color: #e3f2fd;
    border-radius: 6px;
    border-left: 4px solid #1e88e5;
    font-weight: bold;
    color: #1565c0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.total-count {
    display: flex;
    align-items: center;
}

.total-count i {
    margin-right: 8px;
    font-size: 1.1em;
}

.total-count span {
    margin: 0 5px;
    color: #0d47a1;
    font-size: 1.1em;
}

/* 結果サマリー */
.results-summary {
    background-color: #e9ecef;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #4a6fa5;
}

#matching-wells-count {
    display: flex;
    align-items: center;
    color: #2c3e50;
}

#matching-wells-count i {
    color: #28a745;
    margin-right: 8px;
    font-size: 1.1em;
}

/* データ詳細表示 */
#data-details {
    margin-top: 15px;
    font-weight: normal;
}

#data-details summary {
    cursor: pointer;
    color: #007bff;
    padding: 8px 0;
    display: flex;
    align-items: center;
    font-weight: 500;
    transition: all 0.2s ease;
}

#data-details summary:hover {
    color: #0056b3;
}

#data-details summary i {
    margin-right: 8px;
    font-size: 1.1em;
}

.data-table-container {
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#data-table {
    width: 100%;
    border-collapse: collapse;
}

#data-table th,
#data-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#data-table th {
    background-color: #4a6fa5;
    color: white;
    position: sticky;
    top: 0;
    padding: 12px;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 0.5px;
}

#data-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

#data-table tr:hover {
    background-color: #f1f1f1;
}

/* タブインターフェース */
.tabs-container {
    margin-top: 20px;
    width: 100%;
}

.tabs-header {
    display: flex;
    overflow-x: auto;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
    padding-bottom: 5px;
}

.tab {
    padding: 10px 20px;
    margin-right: 5px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    position: relative;
    top: 1px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.tab:hover::after {
    content: attr(title);
    position: absolute;
    top: -30px;
    left: 0;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9em;
    white-space: nowrap;
    z-index: 100;
}

.tab.active {
    background-color: #fff;
    border-bottom: 1px solid #fff;
    font-weight: bold;
    color: #4a6fa5;
}

.tab:hover {
    background-color: #e9ecef;
}

.tabs-content {
    position: relative;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* プレート表示 */
.plate-container {
    margin-top: 30px;
    overflow-x: auto;
    background-color: #f8f9fa;
    padding: 20px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.plate-header {
    display: flex;
    align-items: center;
}

.plate-corner {
    width: 30px;
    height: 30px;
}

.plate-column-labels {
    display: flex;
    flex: 1;
    padding: 0 2px;
    margin-left: -5px;
    /* グリッドと同じオフセット */
}

.plate-column-labels div {
    flex: 1;
    text-align: center;
    font-weight: bold;
    padding: 5px 0;
    color: #4a6fa5;
    font-size: 0.9em;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    max-width: 30px;
}

.plate-body {
    display: flex;
}

.plate-row-labels {
    display: flex;
    flex-direction: column;
    width: 30px;
}

.plate-row-labels div {
    height: 31px;
    /* ウェルの高さに合わせる */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #4a6fa5;
    font-size: 0.9em;
    padding-right: 5px;
    /* 右側に少しパディングを追加 */
}

.plate-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(28px, 1fr));
    grid-template-rows: repeat(8, 31px);
    /* 行の高さを固定 */
    gap: 2px;
    flex: 1;
    padding: 5px 2px;
    align-items: center;
    justify-items: center;
    margin-left: -5px;
    /* 左側に少しオフセットを追加してABCDとアライン */
}

.well {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background-color: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #ddd;
    font-weight: 500;
    margin: 0 auto;
}

.well:hover {
    transform: scale(1.05);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.well.highlighted {
    border: 2px solid #1e5799;
    box-shadow: 0 0 8px rgba(30, 87, 153, 0.7);
    z-index: 5;
    background-color: #1e5799 !important;
    color: white;
}

.well-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border-left: 3px solid #4a6fa5;
}

/* ローディングオーバーレイ */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(74, 111, 165, 0.2);
    border-top: 5px solid #4a6fa5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

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

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 20px;
    font-size: 1.2em;
    color: #2c3e50;
    font-weight: 500;
}

/* ユーティリティクラス */
.hidden {
    display: none !important;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
    }

    .plate-grid {
        grid-template-columns: repeat(12, minmax(30px, 1fr));
    }

    .well {
        font-size: 0.7em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    section {
        padding: 15px;
    }

    .plate-container {
        font-size: 0.9em;
    }
}

/* フッター */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid #ddd;
    color: #666;
    font-size: 0.9em;
    background: linear-gradient(to right, #f8f9fa, #e9ecef, #f8f9fa);
    border-radius: 8px;
}

footer i {
    color: #4a6fa5;
    margin: 0 3px;
}

footer i.fa-heart {
    color: #dc3545;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}