/* ===== Gallery Search & Favorites ===== */

/* ── Search bar ── */
#gallery-search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 12px 15px;
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    margin: 0 0 16px;
}

#gallery-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

#gallery-search-input {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding: 0 16px;
    font-size: 16px; /* iOS自動ズームを防ぐため16px以上 */
    border: 2px solid #ddd;
    border-radius: 22px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

#gallery-search-input:focus {
    border-color: #FF8C8C;
}

#gallery-result-count {
    font-size: 13px;
    color: #999;
    white-space: nowrap;
}

/* ── Favorites filter button ── */
#gallery-fav-btn {
    height: 44px;
    padding: 0 18px;
    font-size: 14px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 22px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

#gallery-fav-btn.active {
    background: #FF8C8C;
    border-color: #FF8C8C;
    color: #fff;
}

/* ── Heart button on each item ── */
.hs_thumb {
    position: relative;
}

.fav-btn {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.88);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    padding: 0;
    z-index: 10;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.fav-btn:active {
    transform: scale(0.9);
}

.fav-btn.is-fav {
    background: rgba(255, 140, 140, 0.88);
    color: #fff;
}

/* SVGハート色：#gallery-fav-btn */
#gallery-fav-btn svg { color: #FF8C8C; vertical-align: middle; }
#gallery-fav-btn.active svg { color: #fff; }

/* ── Loading state ── */
#grid-content.gl-loading {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* ── No results message ── */
#gallery-no-results {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 15px;
}

/* ── Single gallery page fav button ── */
.gallery-fav-single {
    display: flex;
    justify-content: center;
    margin: 12px 0 40px;
}

.gallery-fav-single .fav-btn {
    position: static;
    width: 250px;
    height: auto;
    border-radius: 999px;
    background: #ccc;
    color: #fff;
    padding: 10px 22px;
    gap: 8px;
    font-size: 15px;
    justify-content: center;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}

.gallery-fav-single .fav-btn svg {
    width: 20px;
    height: 16px;
    flex-shrink: 0;
    vertical-align: middle;
}

.gallery-fav-single__label {
    vertical-align: middle;
}

.gallery-fav-single .fav-btn.is-fav {
    background: #FF8C8C;
    color: #fff;
}

/* ── スマホ：検索バーを縦並びに ── */
@media (max-width: 640px) {
    #gallery-search-bar {
        flex-direction: column;
        align-items: stretch;
    }
    #gallery-search-wrap {
        width: 100%;
    }
    #gallery-fav-btn {
        width: 100%;
        justify-content: center;
    }
}
