/* -------------------------------- ベース定義 -------------------------------- */
html {
    color: #243053;
    font-size: 16px;
    font-family: "メイリオ", "ヒラギノ角ゴ Pro W3", sans-serif;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

select {
    padding: 8px;
    width: 160px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}

@media (max-width: 768px) {
    select {
        width: 100%;
        max-width: 300px;
    }
}

div {
    margin: 2px 0px;
}

input[type="text"], 
input[type="email"], 
input[type="number"], 
textarea {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    width: 100%;
    max-width: 300px;
}

@media (max-width: 768px) {
    input[type="text"], 
    input[type="email"], 
    input[type="number"], 
    textarea {
        width: 100%;
        max-width: none;
    }
}

h1 {
    font-size: 32px;
    color: #483d8b;
    text-align: center;
    font-weight: normal;
    margin: 20px 0;
    padding: 0 20px;
}

@media (max-width: 768px) {
    h1 {
        font-size: 24px;
        margin: 15px 0;
        padding: 0 10px;
    }
}

h2 {
    font-size: 15px;
    background-color: #0033cc;
    color: #ffffff;
    width: 100%;
    text-align: center;
    padding: 7px;
    margin: 0;
}

span.required {
    color: #ff5959;
}

/* ボタンスタイル */
button {
    background-color: #0033cc;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
    display: block;
}

button:hover {
    background-color: #0022aa;
}

@media (max-width: 768px) {
    button {
        width: 100%;
        max-width: none;
        padding: 16px;
        font-size: 18px;
    }
}

/* ラジオボタンとチェックボックス */
input[type="radio"], 
input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

@media (max-width: 768px) {
    input[type="radio"], 
    input[type="checkbox"] {
        transform: scale(1.5);
        margin-right: 12px;
    }
}

/* ラベル */
label {
    display: inline-block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 16px;
}

/* キャプション */
.caption {
    font-size: 16px;
    font-weight: bold;
}

@media (max-width: 768px) {
    label {
        font-size: 16px;
    }
    
    .caption {
        font-size: 16px;
    }
}

/* ---------------------------- レイアウト定義 ---------------------------- */

/* 全体のコンテナ */
div.main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}


/* 支援対象の施設名を表示する帯 */
span.facility-text {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    display: block;
    margin: 20px 0;
    padding: 0 20px;
}

@media (max-width: 768px) {
    span.facility-text {
        font-size: 20px;
        margin: 15px 0;
        padding: 0 10px;
    }
}

/* 個人法人共通の申込内容、個人用・法人用お客様情報のコンテナ */
div.customer-info, div.contents-container {
    display: grid;
    grid-template-columns: 200px 1fr;
    width: 100%;
    gap: 10px;
    padding: 10px;
}

@media (max-width: 768px) {
    div.customer-info, div.contents-container {
        grid-template-columns: 1fr;
        gap: 5px;
        padding: 5px;
    }
}

/* 園内やホームページでのお名前の公表希望、メールでの動物園情報の提供のコンテナ */
div#display-info {
    display: grid;
    grid-template-columns: 300px 1fr;
    width: 100%;
    gap: 10px;
    padding: 10px;
}

@media (max-width: 768px) {
    div#display-info {
        grid-template-columns: 1fr;
        gap: 5px;
        padding: 5px;
    }
}

/* ----------------------- 各項目個別定義 ----------------------- */

/* 支援金額の表示 */
div.total-amount-info {
    font-size: 24px;
    font-weight: bold;
}

/* 特典希望の表示 */
div.gift-info {
    margin-left: 0px;
    width: 100%;
    font-size: small;
}

/* 匿名の場合の注記 */
p.comment-paragraph {
    margin: 0px;
    width: 100%;
    font-size: small;
}

/* 特典希望の選択肢制御 */
select#gift option[disabled] {
    display: none;
}

/* セレクトボックスのoptionがdisabledの場合はスマホでも確実に非表示にする
   結局効かなかったため、JSでDOMの追加削除で対応した */
@media (max-width: 768px) {
    select#gift option[disabled] {
        display: none !important;
    }
}

/* -- 電話番号はスピンを非表示 -- */
/* CHrome, Safari */
input[type="number"].not-spin::-webkit-outer-spin-button, 
input[type="number"].not-spin::-webkit-inner-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
} 

/* Firefox, IE */
input[type="number"].not-spin { 
    -moz-appearance:textfield; 
} 

div#kasai-explain {
    color: red;
    font-size: small;
}
input#corporationName, input#corporationKana {
    width: 100%;
    max-width: none;
}

input#postalCode1, input#corporationPostalCode1 {
    width: 60px;
}

input#postalCode2, input#corporationPostalCode2 {
    width: 80px;
}

input#address, input#corporationAddress {
    width: 100%;
    max-width: none;
}

select#prefCode, select#corporationPrefCode {
    width: 100px;
}

input#email, input#corporationEmail {
    width: 100%;
    max-width: none;
}

select#birth-year {
    width: 90px;
}
select#birth-month, select#birth-day {
    width: 60px;
}

/* 生年月日選択フィールドのレイアウト */
.birthday-container {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
}

.birthday-container select {
    width: 90px;
    max-width: 90px;
}

.birthday-container select#birth-month,
.birthday-container select#birth-day {
    width: 60px;
    max-width: 60px;
}

@media (max-width: 768px) {
    .birthday-container {
        flex-wrap: nowrap;
        gap: 5px;
    }
    
    .birthday-container select {
        width: 80px;
        max-width: 80px;
    }
    
    .birthday-container select#birth-month,
    .birthday-container select#birth-day {
        width: 60px;
        max-width: 60px;
    }
}
textarea#note {
    width: 100%;
    max-width: none;
    min-height: 80px;
    resize: vertical;
}

input.pn-input {
    width: 50px;
}

@media (max-width: 768px) {
    input.pn-input {
        width: 60px;
        font-size: 16px;
    }
}

span.prefix-area {
    margin: 0px 5px;
}

input#supporterId {
    width: 70px;
}

/* 支援口数入力フィールド */
select#ammount {
    width: 60px;
    max-width: 60px;
}

/* 申込区分セレクトボックス */
select#supporterType {
    width: 200px;
    max-width: 200px;
}

/* 支援対象セレクトボックス */
select#supportTarget {
    width: auto;
    min-width: 200px;
    max-width: 100%;
}

button.add-support-target-button {
    margin: 0px 5px 5px 0px; 
    padding: 10px 10px;
    width: auto;
    font-size: small;
    display: inline-block;
}

button.add-support-target-button:disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
}

/* ----------------------- 重要事項モーダル ----------------------- */
/* 重要事項を表示するエリア */
div.note-area {
    margin: 20px;
}

/* 重要事項を表示するボタン */
button.note-toggle {
    width: 100%;
    padding: 10px;
    background-color: gray;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
}

button.note-toggle:hover {
    background-color: gray;
}

.note-toggle-icon {
    margin-left: 10px;
    transition: transform 0.2s;
}

/* 重要事項の内容 */
.note-content {
    margin-top: 10px;
    padding: 10px;
    background-color: #fafafa;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 重要事項の内容のテキスト */
div.note-area > .note-content > p {
    margin: 0px;
    padding: 5px 0px;
    font-size: small;
}

div.note-area {
    margin: 0px 20px;
}
.note-content {
    display: none;
    margin-top: 5px;
}

.note-toggle {
    display: flex;
    margin: 0;
}

/* ---------------------------- 項目個別 ---------------------------- */


/* 氏名入力フィールドのレイアウト */
.name-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.name-input-container input {
    width: 150px;
    max-width: 150px;
}

@media (max-width: 768px) {
    .name-input-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        flex-wrap: wrap;
    }
    
    .name-input-container input {
        width: 100%;
        max-width: 250px;
    }
}

/* 郵便番号入力フィールドのレイアウト */
.postal-code-container {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
}

.postal-code-container input {
    width: 100px;
    max-width: 100px;
}

@media (max-width: 768px) {
    .postal-code-container {
        flex-wrap: nowrap;
        gap: 5px;
    }
    
    .postal-code-container input {
        width: 90px;
        max-width: 90px;
    }
}

/* 電話番号入力フィールドのレイアウト */
.pn-container {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
}

.pn-container input {
    width: 80px;
    max-width: 80px;
}

@media (max-width: 768px) {
    .pn-container {
        flex-wrap: nowrap;
        gap: 5px;
    }
    
    .pn-container input {
        width: 70px;
        max-width: 70px;
        font-size: 16px;
    }
}

/* ---------------------------- 確認画面モーダル ---------------------------- */

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

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 600px;  /* 幅を少し広げる */
    width: 90%;
    max-height: 85vh;  /* 画面の85%まで */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 20px;      /* 上下に余白を確保 */
    display: flex;
    flex-direction: column;
}


.modal-header h3 {
    margin: 0 0 15px 0;
    color: #333;
}

.modal-body p {
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-cancel, .btn-confirm {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.btn-cancel {
    background-color: #f0f0f0;
    color: #333;
}

.btn-confirm {
    background-color: #0033cc;
    color: white;
}

.btn-cancel:hover {
    background-color: #e0e0e0;
}

.btn-confirm:hover {
    background-color: #0011bb;
}


/* 確認内容エリア */
.confirm-content {
    margin: 20px 0;
    line-height: 1.8;
    max-height: 85vh;  /* ヘッダーとボタンを除いた高さ */
    overflow-y: auto;                 /* このエリアもスクロール可能に */
    padding-right: 10px;              /* スクロールバーとの余白 */
}

/* 確認項目 */
.confirm-item {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.confirm-label {
    font-weight: bold;
    color: #333;
    display: block;
    margin-bottom: 5px;
}

.confirm-value {
    color: #666;
    word-break: break-all;  /* ★追加：長い文字列を折り返す */
}

/* モーダルボタンエリアは固定 */
.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    border-top: 1px solid #eee;  /* ★追加：区切り線 */
    position: sticky;             /* ★追加：スクロール時も下部に固定 */
    bottom: 0;
    background: white;            /* ★追加：背景色を設定 */
}

.modal-buttons button {
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.cancel-button {
    background-color: #ccc;
    color: #333;
}

.cancel-button:hover {
    background-color: #bbb;
}

.confirm-button {
    background-color: #007bff;
    color: white;
}

.confirm-button:hover {
    background-color: #0056b3;
}

/* スクロールバーのカスタマイズ（Webkit系ブラウザ） */
.confirm-content::-webkit-scrollbar {
    width: 8px;
}

.confirm-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.confirm-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.confirm-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* デスクトップでは常に表示 */
@media (hover: hover) and (pointer: fine) {
    #noteModalToggle {
        display: none;
    }
    
    #noteToggle {
        display: block;
    }

    /* PCでウィンドウの縦幅が短い場合の重要事項エリアの制御 */
    #confirmModal .note-area {
        margin-top: 20px;
        padding-top: 20px;
        border-top: 1px solid #eee;
    }
    
    #confirmModal .note-content {
        max-height: 200px;  /* 重要事項エリアの最大高さ */
        overflow-y: auto;   /* スクロール可能にする */
        padding-right: 10px;
    }
    
    /* モーダル全体のレイアウトを調整 */
    #confirmModal .modal-content {
        overflow: hidden;  /* モーダル自体のオーバーフローを防ぐ */
    }
}

/* スマホ：画面全体を使う */
@media (hover: none) and (pointer: coarse) {
    .modal {
        background-color: rgba(0, 0, 0, 0.9);  /* 背景を濃く */
        align-items: stretch;  /* 伸ばす */
    }
    
    .modal-content {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        padding: 15px 10px;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }
    
    .modal-content h2 {
        font-size: 18px;
        margin: 0 0 10px 0;
        padding-bottom: 10px;
        border-bottom: 1px solid #eee;
    }
    
    .confirm-content {
        flex: 1;
        overflow-y: auto;
        padding-right: 5px;
        min-height: 0;
        margin: 0px;
    }
    
    .modal-buttons {
        padding: 0 0 0 0;
        gap: 10px;
    }
    
    .modal-buttons button {
        width: 100%;
        margin: 10px 0px;
        padding: 16px;
        font-size: 16px;
    }

    #noteModalToggle {
        display: none;
    }
    
    #noteToggle {
        display: block;
    }

}

/* 重要事項モーダル（横向きの時のみ使用） */
#noteModal .modal-content {
    max-width: 700px;
    max-height: 90vh;
}

#noteModal .note-content {
    max-height: calc(90vh - 150px);
    overflow-y: auto;
    margin: 20px 0;
    padding: 15px;
}

#noteModal .note-content p {
    margin: 0px;
    padding: 5px 0px;
    font-size: 14px;
    line-height: 1.6;
}

/* スマホ横向きでの重要事項モーダル調整 */
@media (hover: none) and (pointer: coarse) and (max-height: 500px) {

    #noteModalToggle {
        display: block !important;
    }

    #noteToggle {
        display: none !important;
    }

    #noteModal .modal-content {
        width: 95%;
        max-width: 95%;
        max-height: 95vh;
        padding: 10px;
    }
    
    #noteModal .note-content {
        max-height: calc(95vh - 100px);
        padding: 10px;
        margin: 0px;
    }
    
    #noteModal .note-content p {
        font-size: 12px;
        padding: 3px 0px;
    }

    #noteContent {
        display: none !important;
    }

    .modal-buttons button {
        padding: 5px;
        margin: 3px;
    }


}
