/* タイポグラフィ（仕様: Helvetica Neue / 基本14px / 見出し36px / #333） */
body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #333333;
}

/* チェックボックスを押しやすいサイズに（申請・研究データ一覧） */
.posts.form.content input[type="checkbox"].agreement-check,
.researchDatas.index .toggle-is-research-data {
    width: 18px;
    height: 18px;
    margin-bottom: 0;
    vertical-align: middle;
    cursor: pointer;
}

.researchDatas.index .toggle-is-research-data:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* 研究データ詳細：ファイル欄 */
.researchDatas.view .data-table td.file-value .file-value-item + .file-value-item {
    margin-top: 8px;
}

.main {
    padding-bottom: 30px;
}

h1,
h2,
h3,
h4,
h5,
h6,
.top-nav-links,
.side-nav {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: #333333;
}

/* ページ見出し */
.content h1,
.content h2,
.content h3,
.posts h3,
.researchDatas h3,
.kaken h3,
.dmps h3 {
    font-size: 36px;
    font-weight: 400;
    color: #333333;
}

/* メニューバー全体 */
.top-nav {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #5683aa;
    border-bottom: 1px solid #ddd;
    padding: 10px 40px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    box-sizing: border-box;
    margin-bottom: 30px;
}

/* タイトル（左） */
.top-nav-title a {
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

/* リンク（右） */
.top-nav-links {
    display: flex;
    gap: 20px;
    collapse: white;
}

.top-nav-links a {
    color: white;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: color 0.2s;
}

/* ホバー時 */
.top-nav-links a:hover {
    color: white;
}

.menu-nav {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    border-bottom: 1px solid #ddd;
    padding: 10px 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    box-sizing: border-box;
    border-radius: 4px;
    margin-bottom: 10px;
}

.menu-nav-links a {
    color: white;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-buttons {
    display: flex;
    gap: 1px;
    justify-content: center;
}

.nav-buttons a {
    background-color: white;
    color: black;
    border: 1px solid #aaa;
    padding: 5px 20px;
    font-size: 14px;
    text-decoration: none;
    transition:
        background-color 0.2s,
        box-shadow 0.2s;
    border-radius: 4px;
    height: 32px;
    margin: 0 5px;
}
.nav-buttons a:hover {
    background-color: #eee;
}

/* 申請追加・編集フォームの部品を共通化 */
.posts.form.content .data-table {
    border-radius: 4px !important;
}

#post-kakendb-ids + .select2-container .select2-selection--multiple {
    border-color: #d1d1d1;
}

#post-kakendb-ids + .select2-container .select2-search__field {
    margin-top: 0 !important;
    transform: translateY(-2px);
}

#post-kakendb-ids + .select2-container .select2-selection__choice {
    display: inline-flex;
    flex-direction: row-reverse;
    align-items: center;
    height: 2.8rem;
    margin: 0.5rem 0.5rem 0 0;
    padding: 0.4rem 0 0.4rem 0.8rem !important;
    box-sizing: border-box;
    background-color: #f8f9fa;
    border-color: #ddd;
    line-height: 1.2;
}

#post-kakendb-ids + .select2-container .select2-selection__rendered {
    align-items: flex-start !important;
}

#post-kakendb-ids + .select2-container .select2-search--inline {
    align-self: flex-start;
}

#post-kakendb-ids + .select2-container .select2-selection__choice__remove {
    position: static;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    margin-left: 0.8rem;
    margin-right: 0;
    padding: 0 0.6rem;
    border-right: 0;
    border-left: 1px solid #ddd;
    border-radius: 0;
}

@media (max-width: 1260px) {
    #post-kakendb-ids + .select2-container .select2-selection__choice {
        height: auto !important;
        min-height: 2.8rem;
        max-width: 100% !important;
        margin: 0.5rem 0.5rem 0 0 !important;
        padding: 0.4rem 0 0.4rem 0.8rem !important;
    }

    #post-kakendb-ids + .select2-container .select2-selection__choice__remove {
        flex: 0 0 auto;
    }
}

/* 申請フォームの項目間余白を入力部品の種類にかかわらず統一 */
.posts.form.content form .input,
.posts.form.content form .select,
.posts.form.content form .textarea,
.posts.form.content form .file {
    margin-bottom: 2.5rem !important;
}

.posts.form.content form .input > input,
.posts.form.content form .input > select,
.posts.form.content form .input > textarea,
.posts.form.content form .select > input,
.posts.form.content form .select > select,
.posts.form.content form .select > textarea,
.posts.form.content form .textarea > textarea,
.posts.form.content form .file > input,
.posts.form.content form .select2-container {
    margin-bottom: 0 !important;
}

/* 研究データ作成・編集も申請と同じ項目間余白 */
.researchDatas.form.content form .input,
.researchDatas.form.content form .select,
.researchDatas.form.content form .textarea,
.researchDatas.form.content form .file {
    margin-bottom: 2.5rem !important;
}

.researchDatas.form.content form .input > input,
.researchDatas.form.content form .input > select,
.researchDatas.form.content form .input > textarea,
.researchDatas.form.content form .select > input,
.researchDatas.form.content form .select > select,
.researchDatas.form.content form .select > textarea,
.researchDatas.form.content form .textarea > textarea,
.researchDatas.form.content form .file > input,
.researchDatas.form.content form .select2-container {
    margin-bottom: 0 !important;
}

.researchDatas.form.content > form > fieldset > .files,
.researchDatas.form.content .files-upload {
    margin-bottom: 2.5rem !important;
}

.researchDatas.form.content .files-current {
    margin-bottom: 1rem !important;
}

/* DMP作成・編集も申請と同じ項目間余白 */
.dmps.form.content form .input,
.dmps.form.content form .select,
.dmps.form.content form .textarea,
.dmps.form.content form .file {
    margin-bottom: 2.5rem !important;
}

.dmps.form.content form .input > input,
.dmps.form.content form .input > select,
.dmps.form.content form .input > textarea,
.dmps.form.content form .select > input,
.dmps.form.content form .select > select,
.dmps.form.content form .select > textarea,
.dmps.form.content form .textarea > textarea,
.dmps.form.content form .file > input,
.dmps.form.content form .select2-container {
    margin-bottom: 0 !important;
}

.dmps.form.content form .dual-listbox-container {
    margin-bottom: 0;
}

.dmps.form.content form .dmp-research-datas {
    margin-bottom: 2.5rem !important;
}

.dmps.form.content form .input:has(#addResearchDataBtn) {
    margin-bottom: 0.5rem !important;
}

.posts.form.content form .volume-number .input {
    margin-bottom: 0 !important;
}

.posts.form.content form .input:has(#addResearchDataBtn) {
    margin-bottom: 0.5rem !important;
}

/* 根拠データ：ラベル〜ボタン〜リストの上下余白を均等に */
.posts.form.content form .research-datas > label {
    display: block;
    margin-bottom: 0.5rem !important;
}

.posts.form.content form .research-datas .research-data-add-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0 0 0.5rem !important;
}

.posts.form.content form .research-datas .research-data-add-btn .button {
    margin: 0 !important;
}

.posts.form.content form .research-datas .research-data-help {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.posts.form.content form .research-datas .dual-listbox-container {
    margin-top: 0 !important;
    margin-bottom: 0;
}

.posts.form.content form .research-datas .listbox-half > h5 {
    margin-top: 0 !important;
}

.posts.form.content h3:has(+ .toggle-input-type) {
    margin: 0;
}

.posts.form.content form .dual-listbox-container {
    margin-bottom: 2.5rem;
}

.posts.form.content > form > fieldset > .files {
    margin-bottom: 2.5rem !important;
}

.posts.form.content form .confirmation-section > label {
    margin-top: 0 !important;
}

/* researchmapモーダルの選択欄を行の上下中央に揃える */
#rmPaperModal .table-body-container td:last-child {
    vertical-align: middle;
}

#rmPaperModal .table-body-container .select-paper {
    margin-top: 0;
    margin-bottom: 0;
}

#rmPaperModal .table-body-container td:last-child > span {
    margin: 0 auto 5px !important;
}

/* 940px以下の幅でのレスポンシブ対応 */
@media (max-width: 940px) {
    /* トップナビゲーションバーのレスポンシブ対応 */
    .top-nav {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 15px;
        gap: 10px;
    }

    .top-nav-title {
        width: 100%;
    }

    .top-nav-title a {
        font-size: 18px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
        max-width: 100%;
    }

    .top-nav-links {
        width: 100%;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .top-nav-links a {
        font-size: 14px;
        padding: 5px 0;
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }

    .top-nav-links a:last-child {
        border-bottom: none;
    }

    /* DMP関連のリンクを非表示 */
    .top-nav-links a.dmp-link {
        display: none;
    }

    /* ページ内ナビゲーションバーのレスポンシブ対応 */
    .menu-nav {
        flex-direction: column;
        align-items: stretch;
        padding: 10px 5px;
        gap: 10px;
    }

    .menu-nav-links {
        width: 100%;
    }

    .nav-buttons {
        flex-direction: column;
        gap: 5px;
        width: 100%;
    }

    .nav-buttons a {
        width: 100%;
        margin: 0;
        padding: 8px 15px;
        text-align: center;
        box-sizing: border-box;
        font-size: 13px;
    }
}

/* 登録ファイル：D&Dエリア */
.posts.form.content .files > label {
    display: block;
    margin-bottom: 0.5rem;
}

#drop-area {
    margin-top: 1rem;
    background-color: #e8f5e9;
    border: 2px dashed #a5d6a7 !important;
    border-radius: 4px;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}

#drop-area:hover,
#drop-area:focus-visible,
#drop-area2:hover,
#drop-area2:focus-visible {
    background-color: #dff1e1;
    border-color: #66bb6a !important;
    outline: none;
}

#drop-area2 {
    width: 100%;
    max-width: 100%;
    padding: 20px;
    box-sizing: border-box;
    background-color: #e8f5e9;
    border: 2px dashed #a5d6a7 !important;
    border-radius: 4px;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease;
}

#drop-area > p {
    margin: 0 0 1rem;
}

#drop-area2 > p {
    margin: 0 0 0.5rem;
}

#drop-area2 > p:last-of-type {
    margin-bottom: 1rem;
}

#drop-area > label {
    display: inline-block;
    margin: 0;
}

#researchDataModal #drop-area2 > .file-select-button {
    margin: 0;
    padding: 0 !important;
    background-color: transparent !important;
    color: inherit !important;
    border-radius: 0;
    font-weight: bold;
}

#researchDataModal #drop-area2 > .file-select-button:hover {
    background-color: transparent !important;
}

@media (max-width: 940px) {
    #drop-area2 {
        padding: 15px !important;
    }
}

#drop-area.highlight,
#drop-area2.highlight {
    background-color: #c8e6c9 !important;
    border-color: #4caf50 !important;
}

/* 登録ファイル：選択済みファイル表示 */
#file-list .file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin: 10px 0;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#file-list .file-item span {
    flex: 1;
    min-width: 0;
    display: block;
    line-height: 1.4;
    word-break: break-word;
}

#file-list .file-item button,
#file-list .file-item .btn-danger {
    position: static;
    transform: none;
    margin: 0;
    height: auto;
    min-height: unset;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: normal;
    letter-spacing: normal;
    line-height: 1.2;
    background-color: #dc3545 !important;
    border: 1px solid #dc3545 !important;
    color: #fff !important;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

#file-list .file-item button:hover,
#file-list .file-item button:focus,
#file-list .file-item .btn-danger:hover,
#file-list .file-item .btn-danger:focus {
    background-color: #c82333 !important;
    border-color: #c82333 !important;
    color: #fff !important;
}

/* 申請フォーム：選択済み項目のカードデザインを統一 */
#file-list .file-item,
.dual-listbox .listbox-item,
#post-kakendb-ids + .select2-container .select2-selection__choice {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 100% !important;
    min-height: 46px;
    height: auto !important;
    margin: 5px 0 !important;
    padding: 8px !important;
    box-sizing: border-box;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    line-height: 1.4;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
}

.dual-listbox .selected-list .listbox-item-text,
#post-kakendb-ids + .select2-container .select2-selection__choice {
    min-width: 0;
}

#post-kakendb-ids + .select2-container .select2-selection__choice__remove {
    flex: 0 0 auto;
}

#post-kakendb-ids + .select2-container .select2-selection__choice {
    padding-right: 0 !important;
    justify-content: space-between;
}

#file-list .file-item button,
#file-list .file-item .btn-danger,
.dual-listbox .research-data-hide-btn {
    position: static;
    align-self: center;
    flex: 0 0 64px;
    width: 64px;
    min-width: 64px;
    height: 28px !important;
    min-height: 28px;
    margin: 0;
    padding: 0 12px !important;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #6c757d !important;
    border: 1px solid #6c757d !important;
    border-radius: 4px;
    color: #fff !important;
    font-size: 12px;
    font-weight: normal;
    letter-spacing: normal;
    line-height: 1;
    white-space: nowrap;
}

#file-list .file-item button,
#file-list .file-item .btn-danger {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
}

.dual-listbox .research-data-hide-btn:hover,
.dual-listbox .research-data-hide-btn:focus {
    background-color: #5a6268 !important;
    border-color: #5a6268 !important;
}

#file-list .file-item button:hover,
#file-list .file-item button:focus,
#file-list .file-item .btn-danger:hover,
#file-list .file-item .btn-danger:focus {
    background-color: #c82333 !important;
    border-color: #c82333 !important;
}
