/* 全体のスタイル */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Hiragino Sans', 'Meiryo', sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

header, footer {
    background-color: #1c4587;
    color: white;
    padding: 1rem;
    text-align: center;
}

header h1 {
    margin-bottom: 0.5rem;
}

.user-settings {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.user-role, .terminology-selector, .institution-selector {
    display: flex;
    align-items: center;
}

.user-role label, .terminology-selector label {
    margin-right: 0.5rem;
    color: white;
}

.institution-btn {
    background-color: #2c5aa0;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    margin-right: 0.5rem;
}

.selected-institution {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

select {
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid #ddd;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

section {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    padding: 1.5rem;
}

h2 {
    border-bottom: 2px solid #1c4587;
    color: #1c4587;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

h3 {
    color: #1c4587;
    margin: 1rem 0;
}

button {
    background-color: #1c4587;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-weight: bold;
    margin-right: 0.5rem;
    padding: 0.5rem 1rem;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #2c5aa0;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

input[type="file"] {
    border: 1px dashed #ccc;
    border-radius: 4px;
    display: block;
    margin: 1rem 0;
    padding: 1rem;
    width: 100%;
}

/* 入力セクション */
.input-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.node-edge-editor {
    position: relative;
}

.editor-controls {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.node-form, .edge-form {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 1rem;
}

.node-form label, .edge-form label {
    display: block;
    margin-bottom: 0.8rem;
}

.node-form input, .edge-form input, .node-form select, .edge-form select {
    display: block;
    margin-top: 0.3rem;
    width: 100%;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.form-actions {
    margin-top: 1rem;
}

/* ビジュアライゼーションセクション */
#graphContainer {
    background-color: #fafafa;
    border: 1px solid #eee;
    border-radius: 4px;
    height: 500px;
    overflow: hidden;
    position: relative;
}

/* フィードバックセクション */
.feedback-content {
    background-color: #f0f4f8;
    border-left: 4px solid #1c4587;
    font-style: italic;
    padding: 1rem;
}

.empty-feedback {
    color: #888;
}

/* 用語標準化セクション */
.terminology-section {
    margin-top: 1.5rem;
    background-color: #f8f4ff;
    border: 1px solid #d8c6ff;
    border-radius: 8px;
}

.terminology-content {
    padding: 1rem;
}

.terminology-filter {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.terminology-filter-btn {
    background-color: #f1f1f1;
    color: #444;
    font-size: 0.9rem;
    border: 1px solid #ddd;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
}

.terminology-filter-btn:hover {
    background-color: #e5e5e5;
}

.terminology-filter-btn.active {
    background-color: #1c4587;
    color: white;
    border-color: #1c4587;
}

.suggestions-container {
    margin: 1rem 0;
    max-height: 300px;
    overflow-y: auto;
}

.term-suggestion {
    background-color: white;
    border-left: 4px solid #9b59b6;
    margin-bottom: 0.8rem;
    padding: 0.8rem;
    border-radius: 0 4px 4px 0;
}

.term-original {
    color: #e74c3c;
    text-decoration: line-through;
    font-weight: normal;
    display: inline-block;
    margin-right: 0.5rem;
}

.term-suggestion-arrow {
    color: #555;
    font-size: 1.2rem;
    margin: 0 0.5rem;
}

.term-suggested {
    color: #2ecc71;
    font-weight: bold;
}

.term-source {
    color: #7f8c8d;
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 0.3rem;
}

.dictionary-info {
    background-color: #f0f8ff;
    border-radius: 4px;
    padding: 0.7rem;
    margin-bottom: 1rem;
    border-left: 4px solid #3498db;
}

.dictionary-name {
    margin: 0;
}

.no-suggestions {
    background-color: #e8f8f5;
    padding: 1rem;
    border-radius: 4px;
    color: #27ae60;
    text-align: center;
}

.terminology-actions {
    display: flex;
    justify-content: flex-end;
}

.terminology-actions button {
    margin-left: 0.5rem;
}

/* モーダル関連 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.wide-modal {
    max-width: 800px;
}

.close-modal {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #777;
}

.close-modal:hover {
    color: black;
}

.search-type-tabs {
    display: flex;
    margin-bottom: 1rem;
    border-bottom: 1px solid #ddd;
}

.tab-btn {
    background-color: #f1f1f1;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    padding: 0.5rem 1rem;
    margin-right: 0.3rem;
    cursor: pointer;
}

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

.search-area {
    display: flex;
    margin-bottom: 1rem;
}

.search-input {
    flex: 1;
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
}

.search-btn {
    background-color: #1c4587;
    color: white;
    border: none;
    padding: 0.7rem 1.2rem;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

.search-results {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 4px;
}

.result-item {
    padding: 0.7rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.result-item:hover {
    background-color: #f5f7fa;
}

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

.result-name {
    font-weight: bold;
}

.result-address {
    font-size: 0.8rem;
    color: #777;
}

/* 比較チャート */
.chart-container {
    height: 400px;
    margin-top: 1rem;
    border: 1px solid #eee;
    padding: 1rem;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
}

.comparison-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

#compareBaseSelect {
    flex: 1;
    padding: 0.5rem;
}

#compareBtn {
    background-color: #1c4587;
    color: white;
    padding: 0.5rem 1rem;
}

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

#preview {
    margin: 1rem 0;
    max-width: 100%;
}

#preview img {
    max-width: 100%;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.action-button {
    background-color: #2ecc71;
    color: white;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    cursor: pointer;
    transition: background-color 0.2s;
}

.action-button:hover {
    background-color: #27ae60;
}

@media (max-width: 768px) {
    .input-section {
        grid-template-columns: 1fr;
    }
}