/* サイドバー共通スタイル */

/* サイドバーコンテナ */
.archive-sidebar,
.single-sidebar {
    box-sizing: border-box;
    max-width: 100%;

    @media screen and (max-width: 1024px) {
        order: 2;
    }
}

/* single専用のmin-width */
.single-sidebar {
    min-width: 300px;

    @media screen and (max-width: 1024px) {
        min-width: 250px;
        width: 100%;
    }
}

/* サイドバーセクション */
.archive-sidebar__section,
.single-sidebar__section {
    background-color: #fff;
    border-radius: 10px;
    margin-bottom: 30px;
    padding: 30px;
    box-sizing: border-box;
    max-width: 100%;

    @media screen and (max-width: 768px) {
        margin-bottom: 20px;
        padding: 15px;
    }

    &:last-child {
        margin-bottom: 0;
    }
}

/* サイドバータイトル */
.archive-sidebar__title,
.single-sidebar__title {
    font-size: 20px;
    font-family: var(--sub-font-family);
    color: var(--main-color);
    font-weight: 500;
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--main-color);

    @media screen and (max-width: 768px) {
        font-size: 18px;
        margin-bottom: 15px;
        padding-bottom: 10px;
    }
}

/* 検索フォーム */
.archive-sidebar__search,
.single-sidebar__search {
    display: flex;
    gap: 0;
    border: 1px solid #E5E5E5;
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.archive-sidebar__search-input,
.single-sidebar__search-input {
    flex: 1;
    width: 100%;
    min-width: 0;
    padding: 12px 15px;
    border: none;
    font-size: 14px;
    font-family: var(--third-font-family);
    color: var(--text-color);
    outline: none;
    box-sizing: border-box;

    &::placeholder {
        color: #999;
    }
}

.archive-sidebar__search-button,
.single-sidebar__search-button {
    padding: 12px 20px;
    border: none;
    background-color: var(--main-color);
    color: #fff;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.2s ease, background-color 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 60px;
    flex-shrink: 0;
    font-size: 0;
    text-indent: -9999px;
    overflow: visible;
    box-sizing: border-box;

    &::before {
        content: "";
        width: 20px;
        height: 20px;
        border: 2.5px solid #ffffff;
        border-radius: 50%;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        display: block;
        flex-shrink: 0;
        text-indent: 0;
    }

    &::after {
        content: "";
        width: 8px;
        height: 2.5px;
        background-color: #ffffff;
        position: absolute;
        bottom: 14px;
        right: 16px;
        transform: rotate(45deg);
        transform-origin: right center;
        text-indent: 0;
    }

    &:hover {
        opacity: 0.9;
        transform: translateY(-1px);
        background-color: var(--main-color);
    }

    &:active {
        transform: translateY(0);
        opacity: 0.8;
    }
}

/* 最近の投稿 */
.archive-sidebar__recent,
.single-sidebar__recent {
    list-style: none;
    padding: 0;
    margin: 0;
}

.archive-sidebar__recent-item,
.single-sidebar__recent-item {
    padding: 10px 0;
    border-bottom: 1px solid #F5E6F8;

    &:last-child {
        border-bottom: none;
    }
}

.archive-sidebar__recent-link,
.single-sidebar__recent-link {
    font-size: 14px;
    font-family: var(--third-font-family);
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease, transform 0.2s ease, opacity 0.3s ease;
    display: block;
    line-height: 1.6;

    &:hover {
        color: var(--main-color);
        transform: translateX(3px);
        opacity: 0.9;
    }
}

/* ウィジェット共通スタイル */
.archive-sidebar__section,
.single-sidebar__section {
    /* ウィジェット内のリストスタイル */
    ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    li {
        padding: 10px 0;
        border-bottom: 1px solid #F5E6F8;

        &:last-child {
            border-bottom: none;
        }
    }

    /* ウィジェット内のリンクスタイル */
    a {
        font-size: 14px;
        font-family: var(--third-font-family);
        color: var(--text-color);
        text-decoration: none;
        transition: color 0.3s ease, transform 0.2s ease, opacity 0.3s ease;
        display: block;
        line-height: 1.6;

        &:hover {
            color: var(--main-color);
            transform: translateX(3px);
            opacity: 0.9;
        }
    }

    /* ウィジェット内の段落スタイル */
    p {
        font-size: 14px;
        font-family: var(--third-font-family);
        color: var(--text-color);
        line-height: 1.6;
        margin: 0 0 1em 0;

        &:last-child {
            margin-bottom: 0;
        }
    }

    /* ウィジェット内のselect要素 */
    select {
        width: 100%;
        padding: 12px 15px;
        border: 1px solid #E5E5E5;
        border-radius: 4px;
        font-size: 14px;
        font-family: var(--third-font-family);
        color: var(--text-color);
        background-color: #fff;
        outline: none;
        transition: border-color 0.3s ease;

        &:focus {
            border-color: var(--main-color);
        }
    }

    /* ウィジェット内のテキスト入力 */
    input[type="text"],
    input[type="email"],
    input[type="url"],
    textarea {
        width: 100%;
        padding: 12px 15px;
        border: 1px solid #E5E5E5;
        border-radius: 4px;
        font-size: 14px;
        font-family: var(--third-font-family);
        color: var(--text-color);
        outline: none;
        transition: border-color 0.3s ease;

        &:focus {
            border-color: var(--main-color);
        }

        &::placeholder {
            color: #999;
        }
    }

    /* カテゴリーウィジェットのカウント表示 */
    .cat-item,
    .widget_categories li {
        padding: 10px 0;
        border-bottom: 1px solid #F5E6F8;

        &:last-child {
            border-bottom: none;
        }
    }

    /* 最近の投稿ウィジェットの日付 */
    .post-date {
        font-size: 12px;
        color: #999;
        display: block;
        margin-top: 4px;
    }

    /* タグクラウドウィジェット */
    .tagcloud {
        a {
            display: inline-block;
            padding: 4px 12px;
            margin: 4px 4px 4px 0;
            background-color: #F5E6F8;
            border-radius: 4px;
            font-size: 14px !important;
            transition: background-color 0.3s ease;

            &:hover {
                background-color: var(--main-color);
                color: #fff;
            }
        }
    }

    /* カテゴリ固定検索フォーム */
    .category-search-form {
        display: flex;
        gap: 0;
        border: 1px solid #E5E5E5;
        border-radius: 4px;
        overflow: hidden;
        margin-top: 10px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .category-search-form__input {
        flex: 1;
        width: 100%;
        min-width: 0;
        padding: 12px 15px;
        border: none;
        font-size: 14px;
        font-family: var(--third-font-family);
        color: var(--text-color);
        outline: none;
        background-color: #fff;
        transition: border-color 0.3s ease;
        box-sizing: border-box;

        @media screen and (max-width: 768px) {
            padding: 10px 12px;
            font-size: 14px;
        }

        &:focus {
            border-color: var(--main-color);
        }
    }

    .category-search-form__button {
        padding: 12px 20px;
        border: none;
        background-color: var(--main-color);
        color: #fff;
        cursor: pointer;
        transition: opacity 0.3s ease, transform 0.2s ease, background-color 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        width: auto;
        min-width: 60px;
        flex-shrink: 0;
        box-sizing: border-box;

        @media screen and (max-width: 768px) {
            padding: 10px 16px;
            min-width: 50px;
        }

        &:hover {
            opacity: 0.9;
            transform: translateY(-1px);
            background-color: var(--main-color);
        }

        &:active {
            transform: translateY(0);
            opacity: 0.8;
        }
    }

    .category-search-form__icon {
        width: 20px;
        height: 20px;
        stroke: #ffffff;
        fill: none;
        stroke-width: 2.5;
        display: block;
        flex-shrink: 0;
    }
}

/* カテゴリーリスト */
.archive-sidebar__categories {
    list-style: none;
    padding: 0;
    margin: 0;
}

.archive-sidebar__category-item {
    padding: 10px 0;
    border-bottom: 1px solid #F5E6F8;

    &:last-child {
        border-bottom: none;
    }
}

.archive-sidebar__category-link {
    font-size: 14px;
    font-family: var(--third-font-family);
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease, transform 0.2s ease, opacity 0.3s ease;
    display: block;

    &:hover {
        color: var(--main-color);
        transform: translateX(3px);
        opacity: 0.9;
    }
}

