
/* =====================================================
   共通モーダル
   modal.css

   ・文字を読みやすくする
   ・ボタンを押しやすくする
   ・モーダル本体と余白を調整する
   ・スマホ表示に対応する
===================================================== */


/* =====================================================
   🔢 数値入力モーダル
===================================================== */

.number-input-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 16px;
    box-sizing: border-box;

    background: rgba(0, 0, 0, 0.45);
}


/* =====================================================
   ポップアップ本体
===================================================== */

.number-input-dialog {
    width: min(100%, 420px);
    max-height: calc(100% - 32px);
    overflow-y: auto;
    box-sizing: border-box;

    padding: 26px 22px;

    border-radius: 20px;
    background: var(--card-bg, #ffffff);

    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);
}


/* =====================================================
   タイトル
===================================================== */

.number-input-title {
    margin: 0 0 18px;

    text-align: center;

    font-size: 23px;
    font-weight: bold;
    line-height: 1.5;
}


/* =====================================================
   入力値表示
===================================================== */

.number-input-display {
    min-height: 62px;
    margin-bottom: 18px;
    padding: 10px 16px;

    display: flex;
    align-items: center;
    justify-content: flex-end;

    box-sizing: border-box;

    border-radius: 12px;
    background: rgba(0, 0, 0, 0.06);

    font-size: 32px;
    font-weight: bold;
    line-height: 1.3;

    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-all;
}


/* =====================================================
   数字キー配置
===================================================== */

.number-keypad {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}


/* =====================================================
   数字ボタン
===================================================== */

.number-keypad button {
    min-width: 0;
    min-height: 62px;

    margin: 0;
    padding: 8px 4px;

    border: none;
    border-radius: 12px;

    background: rgba(0, 0, 0, 0.07);
    color: var(--text);

    font-size: 25px;
    font-weight: bold;
    line-height: 1.3;

    cursor: pointer;
    box-shadow: none;
    touch-action: manipulation;
}


/* =====================================================
   小数点・戻るボタン
===================================================== */

.number-keypad .decimal-button,
.number-keypad .backspace-button {
    font-size: 26px;
}


/* =====================================================
   下部操作ボタン
===================================================== */

.number-input-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;

    margin-top: 16px;
}


.number-input-actions button {
    min-width: 0;
    min-height: 54px;

    margin: 0;
    padding: 8px 5px;

    box-sizing: border-box;

    border: none;
    border-radius: 12px;

    font-size: 16px;
    font-weight: bold;
    line-height: 1.4;

    cursor: pointer;
    touch-action: manipulation;
}


/* =====================================================
   👶 こどもカレンダー 数値・時刻入力モーダル
===================================================== */

.number-input-modal.children-number-boy
.number-keypad button {
    background: var(--children-boy-color) !important;
    border: 1px solid var(--children-boy-border) !important;
    color: #fff !important;
}


.number-input-modal.children-number-girl
.number-keypad button {
    background: var(--children-girl-color) !important;
    border: 1px solid var(--children-girl-border) !important;
    color: #fff !important;
}


.number-input-modal.children-number-boy
.number-input-actions button {
    background: var(--children-boy-color) !important;
    border: 1px solid var(--children-boy-border) !important;
    color: #fff !important;
}


.number-input-modal.children-number-girl
.number-input-actions button {
    background: var(--children-girl-color) !important;
    border: 1px solid var(--children-girl-border) !important;
    color: #fff !important;
}


/* =====================================================
   ✅ 共通確認モーダル
===================================================== */

.common-confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 16px;
    box-sizing: border-box;

    background: rgba(0, 0, 0, 0.45);
}


/* =====================================================
   ポップアップ本体
===================================================== */

.common-confirm-dialog {
    width: min(100%, 420px);
    max-height: calc(100% - 32px);
    overflow-y: auto;
    box-sizing: border-box;

    padding: 26px 22px;

    border-radius: 20px;
    background: var(--card-bg, #ffffff);

    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);
}


/* =====================================================
   確認メッセージ
===================================================== */

.common-confirm-message {
    margin: 0 0 24px;

    text-align: center;

    font-size: 19px;
    font-weight: 700;
    line-height: 1.7;

    color: var(--text, #333);

    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}


/* =====================================================
   操作ボタン配置
===================================================== */

.common-confirm-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}


/* =====================================================
   操作ボタン
===================================================== */

.common-confirm-actions button {
    min-width: 0;
    min-height: 54px;

    margin: 0;
    padding: 10px 8px;

    box-sizing: border-box;

    border-radius: 12px;

    font-size: 16px;
    font-weight: 800;
    line-height: 1.4;

    cursor: pointer;
    touch-action: manipulation;
}


/* =====================================================
   キャンセルボタン
===================================================== */

.common-confirm-cancel {
    border: 1px solid var(--child-border, #ccc);

    background: var(--card-bg, #fff);
    color: var(--text, #333);
}


/* =====================================================
   確定ボタン
===================================================== */

.common-confirm-ok {
    border: 1px solid var(--child-accent, #6495ED);

    background: var(--child-accent, #6495ED);
    color: #fff;
}


/* =====================================================
   🔁 繰り返し予定の削除専用モーダル
===================================================== */

.recurring-delete-modal {
    position: fixed;
    inset: 0;
    z-index: 10001;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 16px;
    box-sizing: border-box;

    background: rgba(0, 0, 0, 0.58);
}


/* =====================================================
   ポップアップ本体
===================================================== */

.recurring-delete-dialog {
    width: min(100%, 420px);
    max-height: calc(100% - 32px);

    overflow-y: auto;
    box-sizing: border-box;

    padding: 26px 22px;

    border-radius: 20px;

    background: var(--card-bg, #fff);
    color: var(--text-color, #333);

    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}


/* =====================================================
   タイトル
===================================================== */

.recurring-delete-dialog h3 {
    margin: 0 0 20px;

    text-align: center;

    font-size: 22px;
    line-height: 1.5;
}


/* =====================================================
   説明メッセージ
===================================================== */

.recurring-delete-message {
    margin-bottom: 22px;

    font-size: 18px;
    line-height: 1.8;

    overflow-wrap: anywhere;
    white-space: pre-line;
}


/* =====================================================
   操作ボタン配置
===================================================== */

.recurring-delete-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}


/* =====================================================
   操作ボタン
===================================================== */

.recurring-delete-actions button {
    width: 100%;
    min-height: 56px;

    padding: 12px 14px;
    box-sizing: border-box;

    border: none;
    border-radius: 12px;

    font-size: 17px;
    font-weight: 700;
    line-height: 1.5;

    cursor: pointer;
    touch-action: manipulation;
}


/* =====================================================
   1回分だけ削除
===================================================== */

#recurringDeleteOneButton {
    background: #fce4ec;
    color: #880e4f;
}


/* =====================================================
   すべて削除
===================================================== */

#recurringDeleteAllButton {
    background: #d32f2f;
    color: #fff;
}


/* =====================================================
   キャンセル
===================================================== */

#recurringDeleteCancelButton {
    background: #e8e8e8;
    color: #333;
}


/* =====================================================
   📱 スマホ表示
===================================================== */

@media (max-width: 480px) {

    /* 数値入力モーダル */

    .number-input-dialog {
        width: 100%;
        max-width: 420px;
        padding: 22px 18px;
    }

    .number-input-title {
        font-size: 22px;
    }

    .number-input-display {
        min-height: 60px;
        font-size: 30px;
    }

    .number-keypad {
        gap: 9px;
    }

    .number-keypad button {
        min-height: 58px;
        font-size: 24px;
    }

    .number-keypad .decimal-button,
    .number-keypad .backspace-button {
        font-size: 25px;
    }

    .number-input-actions {
        gap: 8px;
    }

    .number-input-actions button {
        min-height: 52px;
        padding: 8px 3px;
        font-size: 15px;
    }


    /* 共通確認モーダル */

    .common-confirm-dialog {
        width: 100%;
        max-width: 420px;
        padding: 22px 18px;
    }

    .common-confirm-message {
        font-size: 18px;
    }

    .common-confirm-actions {
        gap: 8px;
    }

    .common-confirm-actions button {
        min-height: 52px;
        padding: 9px 6px;
        font-size: 15px;
    }


    /* 繰り返し予定の削除モーダル */

    .recurring-delete-dialog {
        width: 100%;
        max-width: 420px;
        padding: 22px 18px;
    }

    .recurring-delete-dialog h3 {
        font-size: 21px;
    }

    .recurring-delete-message {
        font-size: 17px;
    }

    .recurring-delete-actions {
        gap: 10px;
    }

    .recurring-delete-actions button {
        min-height: 54px;
        padding: 11px 12px;
        font-size: 16px;
    }
}




/* =====================================================
   📝 自由メモ編集モーダル
   コンパクト表示・浮かぶカラーパレット
===================================================== */

/* モーダル背景 */
#plannerNoteEditorModal {
    padding: 8px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
}

/* モーダル本体 */
#plannerNoteEditorModal .planner-note-editor {
    width: min(100%, 420px);
    max-width: 420px;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);

    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;

    box-sizing: border-box;
    padding: 14px;
    border-radius: 16px;

    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

/* タイトル */
#plannerNoteEditorTitle {
    margin: 0 0 8px;
    font-size: 19px;
    line-height: 1.3;
}

/* 設定全体 */
#plannerNoteTextSettings {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#plannerNoteTextSettings label,
#plannerNoteTextSettings .planner-note-style-title {
    margin: 2px 0;
    font-size: 13px;
    font-weight: 700;
}

/* メモ入力欄 */
#plannerNoteText {
    width: 100%;
    min-height: 52px;
    height: 52px;
    max-height: 72px;
    padding: 7px 9px;

    box-sizing: border-box;
    font-size: 14px;
    line-height: 1.4;
    resize: vertical;
}

/* フォント */
#plannerNoteFont {
    width: 100%;
    min-height: 34px;
    padding: 5px 8px;
    box-sizing: border-box;
    font-size: 13px;
}

/* 設定グループ */
#plannerNoteTextSettings .planner-note-style-group {
    position: relative;
    min-width: 0;
    margin: 2px 0;
    padding: 5px 7px;

    border-radius: 9px;
    background: rgba(128, 128, 128, 0.07);
}

/* 文字色・背景色・枠線色を横並びにする */
#plannerNoteTextSettings {
    --planner-note-swatch-size: 30px;
}

#plannerNoteTextSettings .planner-note-style-group:has(
    .planner-note-color-list
) {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

/* 色設定の見出し */
#plannerNoteTextSettings
.planner-note-style-group:has(.planner-note-color-list)
.planner-note-style-title {
    align-self: flex-start;
    white-space: nowrap;
}

/* 3つの色設定を横並びにまとめるための配置 */
#plannerNoteTextSettings .planner-note-style-group:has(
    .planner-note-color-list
) {
    width: 100%;
}

/*
   色設定3項目を横並びにする。
   親要素の中で各グループをコンパクトに配置する。
*/
#plannerNoteTextSettings {
    position: relative;
}

/* 色見本一覧 */
#plannerNoteTextSettings .planner-note-color-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;

    min-width: 0;
    margin-top: 4px;
}

/* 色見本 */
#plannerNoteTextSettings .planner-note-color-swatch {
    display: block;
    flex: 0 0 var(--planner-note-swatch-size);

    width: var(--planner-note-swatch-size);
    min-width: var(--planner-note-swatch-size);
    height: var(--planner-note-swatch-size);
    min-height: var(--planner-note-swatch-size);

    margin: 0;
    padding: 0;

    border: 2px solid rgba(100, 100, 100, 0.3);
    border-radius: 5px;

    box-sizing: border-box;
    box-shadow: none;
    cursor: pointer;
    touch-action: manipulation;
}

/* 選択色 */
#plannerNoteTextSettings
.planner-note-color-swatch.is-selected {
    outline: 2px solid var(--text, #333333);
    outline-offset: 2px;
}

/* 閉じたときは選択色だけ表示 */
#plannerNoteTextSettings
.planner-note-style-group:not(.is-color-open)
.planner-note-color-swatch:not(.is-selected) {
    display: none;
}

/* =========================================
   浮かぶカラーパレット
========================================= */

/* 色一覧のあるグループを基準にする */
#plannerNoteTextSettings
.planner-note-style-group:has(.planner-note-color-list) {
    position: relative;
    z-index: 1;
}

/* パレットを開いたグループを最前面に */
#plannerNoteTextSettings
.planner-note-style-group.is-color-open {
    z-index: 100;
}

/* 開いた色一覧をポップアップにする */
#plannerNoteTextSettings
.planner-note-style-group.is-color-open
.planner-note-color-list {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);

    display: grid;
    grid-template-columns: repeat(6, 30px);
    gap: 7px;

    width: max-content;
    max-width: calc(100vw - 48px);
    padding: 12px;

    box-sizing: border-box;
    margin: 0;

    background: var(--card-bg, #ffffff);
    border: 1px solid rgba(140, 100, 120, 0.25);
    border-radius: 14px;

    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.2);
    z-index: 200;

    animation: plannerNotePaletteIn 180ms ease-out;
}

/* ポップアップ内の色を表示 */
#plannerNoteTextSettings
.planner-note-style-group.is-color-open
.planner-note-color-swatch {
    display: block;
}

/* ふわっと上に出るアニメーション */
@keyframes plannerNotePaletteIn {
    from {
        opacity: 0;
        transform: translate(-50%, 8px) scale(0.94);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

/* =========================================
   枠線の種類
========================================= */

#plannerNoteTextSettings .planner-note-border-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    margin-top: 4px;
}

#plannerNoteTextSettings .planner-note-border-option {
    min-width: 0;
    min-height: 30px;

    margin: 0;
    padding: 5px 2px;

    border: 1px solid #d8a0b8;
    border-radius: 7px;

    box-sizing: border-box;
    font-size: 11px;
    line-height: 1.2;
    box-shadow: none;
}

/* 選択中の枠線 */
#plannerNoteTextSettings
.planner-note-border-option.is-selected {
    background: #f7dce8;
    border-color: #d65d91;
    color: #702344;
    font-weight: 700;
}

/* =========================================
   プレビュー
========================================= */

#plannerNotePreview {
    position: relative;
    width: 100%;
    min-height: 48px;
    max-height: 64px;

    padding: 8px;
    margin-top: 4px;

    box-sizing: border-box;
    overflow: hidden;

    border: 2px solid #e8a6c1;
    border-radius: 8px;
    font-size: 14px;
}

#plannerNotePreviewText {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* =========================================
   保存・キャンセル
========================================= */

#plannerNoteEditorModal .planner-note-editor-actions {
    position: sticky;
    bottom: -14px;
    z-index: 10;

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;

    margin: 8px -14px -14px;
    padding: 8px 14px 14px;

    background: var(--card-bg, #ffffff);
}

#plannerNoteEditorModal .planner-note-editor-actions button {
    min-width: 0;
    min-height: 40px;

    margin: 0;
    padding: 8px 5px;

    box-sizing: border-box;
    border-radius: 9px;
    font-size: 14px;
}

/* =========================================
   画面の高さが低いスマホ
========================================= */

@media (max-height: 740px) {
    #plannerNoteEditorModal .planner-note-editor {
        padding: 10px;
    }

    #plannerNoteEditorTitle {
        margin-bottom: 5px;
        font-size: 17px;
    }

    #plannerNoteText {
        min-height: 42px;
        height: 42px;
    }

    #plannerNoteTextSettings .planner-note-style-group {
        padding: 3px 6px;
        margin: 1px 0;
    }

    #plannerNoteTextSettings {
        --planner-note-swatch-size: 25px;
    }

    #plannerNoteTextSettings .planner-note-border-option {
        min-height: 27px;
        padding: 4px 1px;
        font-size: 10px;
    }

    #plannerNotePreview {
        min-height: 40px;
        max-height: 48px;
    }

    #plannerNoteTextSettings
    .planner-note-style-group.is-color-open
    .planner-note-color-list {
        grid-template-columns: repeat(6, 25px);
        gap: 6px;
        padding: 10px;
    }
}




/* =====================================================
   📝 自由メモ：3色設定を横一列に配置
===================================================== */

#plannerNoteTextSettings .planner-note-color-settings {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 5px;

    width: 100%;
    min-width: 0;
}

/* 3つの色設定をコンパクトに */
#plannerNoteTextSettings
.planner-note-color-settings
.planner-note-style-group {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 5px 2px;
    box-sizing: border-box;
}

/* 色のタイトルを中央揃え */
#plannerNoteTextSettings
.planner-note-color-settings
.planner-note-style-title {
    text-align: center;
    font-size: 12px;
    white-space: nowrap;
}

/* 色見本を中央に配置 */
#plannerNoteTextSettings
.planner-note-color-settings
.planner-note-color-list {
    justify-content: center;
    align-items: center;
    min-height: 28px;
}

/* 小さい画面でも3列を維持 */
#plannerNoteTextSettings
.planner-note-color-settings
.planner-note-color-swatch {
    flex-shrink: 0;
}



/* =====================================================
   ✍️ 手書きメモのツールバー
===================================================== */

/* =====================
   ツールバー全体
===================== */

.planner-drawing-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    margin-bottom: 10px;
}

/* =====================
   ペンの色
===================== */

.planner-drawing-color-label {
    display: inline-flex;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid #bdbdbd;
    border-radius: 7px;
    background: #fff;
    cursor: pointer;
}

.planner-drawing-color-label input[type="color"] {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

/* =====================
   ペンの太さ
===================== */

.planner-drawing-width-options {
    display: flex;
    align-items: center;
    gap: 4px;
}

.planner-drawing-width-button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 36px;
    padding: 0;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 7px;
    background: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* 選択中の太さ */

.planner-drawing-width-button.is-active {
    border: 2px solid #6c63ff;
    background: #f0efff;
}

/* 実寸の太さ見本 */

.planner-drawing-width-preview {
    display: block;
    flex: 0 0 auto;
    width: 24px;
    border-radius: 999px;
    background: #222;
}

.planner-drawing-width-preview.thin {
    height: 2px;
}

.planner-drawing-width-preview.normal {
    height: 4px;
}

.planner-drawing-width-preview.thick {
    height: 7px;
}

.planner-drawing-width-preview.extra-thick {
    height: 12px;
}

/* 太さ見本のタップ反応 */

.planner-drawing-width-button:active {
    transform: scale(0.96);
}

/* =====================
   操作アイコン
   ・背景なし
   ・枠線なし
   ・影なし
===================== */

.planner-drawing-action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.planner-drawing-action-buttons button,
.planner-drawing-action-buttons button:hover,
.planner-drawing-action-buttons button:active,
.planner-drawing-action-buttons button[aria-pressed="true"],
.planner-drawing-action-buttons button[aria-pressed="false"] {
    appearance: none;
    -webkit-appearance: none;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 28px;
    width: 28px;
    min-width: 28px;
    height: 36px;

    margin: 0;
    padding: 0;

    border: none;
    border-radius: 0;

    background: transparent !important;
    background-color: transparent !important;

    box-shadow: none !important;

    font-size: 21px;
    line-height: 1;

    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* タップ時も背景を付けない */

.planner-drawing-action-buttons button:active {
    transform: scale(0.92);
}

/* キーボード操作時のフォーカス表示 */

.planner-drawing-action-buttons button:focus-visible {
    outline: 2px solid #6c63ff;
    outline-offset: 2px;
}

/* =====================
   スマートフォン向け
===================== */

@media (max-width: 480px) {

    .planner-drawing-toolbar {
        gap: 6px;
    }

    .planner-drawing-width-options {
        gap: 3px;
    }

    .planner-drawing-width-button {
        flex-basis: 32px;
        width: 32px;
    }

    .planner-drawing-action-buttons {
        gap: 7px;
    }

    .planner-drawing-action-buttons button,
    .planner-drawing-action-buttons button:hover,
    .planner-drawing-action-buttons button:active,
    .planner-drawing-action-buttons button[aria-pressed="true"],
    .planner-drawing-action-buttons button[aria-pressed="false"] {
        flex-basis: 27px;
        width: 27px;
        min-width: 27px;
        height: 36px;
        font-size: 20px;
    }

}
