/* --- 1. サイドバー全体の余白を狭くする --- */
.custom-sidebar {
    /* 左の余白を減らす (40px -> 20px) */
    padding: 0 0 0 20px;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    color: #444;
}

/* --- 2. 検索フォームのレイアウト調整 --- */
.widget_search .search-form {
    display: flex;
    align-items: center; /* 上下中央揃え */
    position: relative;
    width: 100%;
    border-bottom: 1px solid #333;
}

/* 入力フィールド (長くする & パディング縮小) */
.widget_search .search-field {
    flex-grow: 1; /* 余った幅を全て使う（これで最大限長くなります） */
    width: auto; /* flex-growに任せる */
    border: none;
    background: transparent;

    /* ★修正: 上下のパディングを狭くする (12px -> 6px) */
    padding: 6px 0;

    font-size: 0.9rem;
    color: #333;
    outline: none;
    border-radius: 0;
    box-shadow: none;
    height: auto; /* 高さの強制指定を解除 */
}

.widget_search .search-field::placeholder {
    color: #aaa;
    font-size: 0.85rem;
}

/* 検索ボタン (小さくする) */
.widget_search .search-submit {
    flex-shrink: 0; /* 縮まないように固定 */
    width: 30px; /* ★修正: 幅を固定してコンパクトに */
    padding: 0; /* 余計なパディングを削除 */
    background: transparent;
    border: none;
    color: #333;
    cursor: pointer;
    font-size: 1.1rem; /* アイコンサイズを微調整 */
    transition: color 0.3s ease;
    text-align: right; /* アイコンを右端に寄せる */
}

.widget_search .search-submit:hover {
    color: #0073aa;
}

/* ボタン内の文字を消してアイコンにする処理（念のため再掲） */
.widget_search .search-submit span {
    display: none;
}
.widget_search .search-submit::before {
    content: '\f179'; /* Dashicons 虫眼鏡 */
    font-family: 'dashicons';
    vertical-align: middle;
}

/* スマホ対応の余白調整 */
@media (max-width: 768px) {
    .custom-sidebar {
        padding: 40px 0 0; /* スマホ時は左右余白なし */
        border-top: 1px solid #eee;
        margin-top: 40px;
    }
}

.wp-block-search__label {
    display: none !important;
}

.wp-block-search__input {
    padding: 6px !important;
    font-size: 15px;
}

.wp-block-search__button.wp-element-button {
    font-size: 14px;
}

@media (min-width: 769px) {
    /* 1. 親要素（サイドバー領域）の高さを確保 */
    .inside-right-sidebar {
        height: 100%;
    }

    /* 2. 最後のウィジェットをSticky化 */
    .inside-right-sidebar .widget:last-child {
        position: -webkit-sticky;
        position: sticky;
        top: 20px; /* 上から20pxの位置で固定 */
        z-index: 10;
    }
}
