/* =========================================================
   地元のレストラン CSS 統合版
   - 現行CSSと追加CSSを整理統合
   - v3.8 分離構成向け
   - PC 2列 / スマホ 1列
   - 上位4件おすすめバッジ対応
   - 5件目以降はカードクリックで画像表示
========================================================= */

.jimoto-restaurant-section {
    box-sizing: border-box;
    margin: 24px 0;
    padding: 20px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.jimoto-restaurant-header {
    margin: 0 0 16px;
}

.jimoto-restaurant-label {
    display: inline-block;
    margin: 0 0 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef5ff;
    color: #00377f;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
}

.jimoto-restaurant-title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: #222222;
    line-height: 1.4;
}

.jimoto-restaurant-lead {
    margin: 8px 0 0;
    color: #555555;
    font-size: 14px;
    line-height: 1.7;
}

/* =========================================================
   並び替え
========================================================= */

.jimoto-restaurant-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    padding: 12px;
    background: #f8fafc;
    border-radius: 12px;
    box-sizing: border-box;
}

.jimoto-restaurant-toolbar-label {
    font-weight: 700;
    color: #333333;
    font-size: 13px;
    line-height: 1.5;
}

.jimoto-restaurant-sort-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.jimoto-restaurant-sort-btn,
.jimoto-load-photo-btn {
    border: none;
    border-radius: 999px;
    padding: 8px 14px;
    background: #e8eef7;
    color: #00377f;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1.5;
}

.jimoto-restaurant-sort-btn.is-active,
.jimoto-restaurant-sort-btn:hover {
    background: #00377f;
    color: #ffffff;
}

/* =========================================================
   状態表示
========================================================= */

.jimoto-restaurant-loading,
.jimoto-restaurant-error,
.jimoto-restaurant-empty,
.jimoto-restaurant-cache-note {
    padding: 12px;
    border-radius: 12px;
    background: #f8fafc;
    color: #444444;
    font-size: 14px;
    line-height: 1.6;
}

.jimoto-restaurant-cache-note {
    margin-bottom: 12px;
    font-size: 13px;
    background: #f0fdf4;
    color: #166534;
}

/* =========================================================
   一覧・カード
========================================================= */

.jimoto-restaurant-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
}

.jimoto-restaurant-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #ffffff;
    overflow: hidden;
    cursor: default;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    box-sizing: border-box;
    animation: jimotoRestaurantFadeIn 0.22s ease-out;
}

@keyframes jimotoRestaurantFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.jimoto-restaurant-card.is-hidden {
    display: none;
}

.jimoto-restaurant-card.is-clickable-photo {
    cursor: pointer;
}

.jimoto-restaurant-card.is-clickable-photo:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.jimoto-restaurant-card.is-clickable-photo::after {
    content: "";
    display: none;
}

.jimoto-restaurant-card.rank-top {
    border-color: #d7b45a;
    background: linear-gradient(180deg, #fffdf7 0%, #ffffff 70%);
}

/* =========================================================
   おすすめバッジ
========================================================= */

.jimoto-osusume-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    min-height: 28px;
    padding: 5px 12px;
    border-radius: 999px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.jimoto-osusume-badge.osusume-gold {
    background: linear-gradient(135deg, #f6d365 0%, #d4a017 100%);
    color: #3a2500;
}

.jimoto-osusume-badge.osusume-silver {
    background: linear-gradient(135deg, #f4f6f8 0%, #aeb7c2 100%);
    color: #1f2937;
}

.jimoto-osusume-badge.osusume-bronze {
    background: linear-gradient(135deg, #c98b45 0%, #7c4a18 100%);
    color: #fffaf0;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.28);
}

.jimoto-osusume-badge.osusume-white {
    background: rgba(255, 255, 255, 0.94);
    color: #00377f;
    border: 1px solid rgba(0, 55, 127, 0.22);
}

/* =========================================================
   カード本文
========================================================= */

.jimoto-restaurant-info {
    padding: 14px 14px 16px;
    flex: 1;
}

.jimoto-restaurant-name {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.5;
    color: #222222;
}

.jimoto-restaurant-meta {
    margin: 0;
    padding: 0;
    list-style: none;
    color: #444444;
    line-height: 1.8;
    font-size: 14px;
}

.jimoto-restaurant-meta a {
    color: #00377f;
    font-weight: 700;
    text-decoration: none;
}

.jimoto-restaurant-meta a:hover {
    text-decoration: underline;
}

.jimoto-restaurant-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.jimoto-restaurant-action-link,
.jimoto-restaurant-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    background: #eef5ff;
    color: #00377f;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    line-height: 1.5;
}

.jimoto-restaurant-action-link:hover,
.jimoto-restaurant-link-btn:hover {
    background: #dbeafe;
    color: #00295f;
    text-decoration: none;
}

/* =========================================================
   写真
========================================================= */

.jimoto-restaurant-photo-box,
.jimoto-restaurant-photo-wrap {
    width: 100%;
    height: 160px;
    background: #f1f5f9;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    order: -1;
}

.jimoto-restaurant-photo {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
    background: #f1f5f9;
}

.jimoto-restaurant-photo-placeholder,
.jimoto-restaurant-no-photo {
    width: 100%;
    height: 160px;
    background: linear-gradient(135deg, #f8fafc 0%, #e8eef7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 13px;
    text-align: center;
    line-height: 1.6;
    box-sizing: border-box;
}

.jimoto-restaurant-card.is-clickable-photo .jimoto-restaurant-photo-placeholder::before {
    content: "";
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 0 0 1px rgba(0, 55, 127, 0.08);
}

.jimoto-restaurant-photo-box.is-loaded-by-click {
    animation: jimotoRestaurantPhotoOpen 0.22s ease-out;
}

@keyframes jimotoRestaurantPhotoOpen {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================
   旧HTML互換用：以前のrow/tags構造が残った場合の保険
========================================================= */

.jimoto-restaurant-card-main {
    min-width: 0;
}

.jimoto-restaurant-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 8px;
}

.jimoto-restaurant-tag {
    display: inline-block;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 700;
    color: #00377f;
    background: #eef5ff;
    border-radius: 999px;
    line-height: 1.5;
}

.jimoto-restaurant-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 13px;
    color: #444444;
    line-height: 1.7;
}

.jimoto-restaurant-row-label {
    flex: 0 0 auto;
    min-width: 4.5em;
    font-weight: 700;
    color: #555555;
}

.jimoto-restaurant-row-value {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.jimoto-restaurant-more-wrap {
    margin: 18px 0 0;
    text-align: center;
}

.jimoto-restaurant-more-btn {
    width: 100%;
    max-width: 320px;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    background: #00377f;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    line-height: 1.5;
}

.jimoto-restaurant-more-btn:hover {
    opacity: 0.9;
}

.jimoto-restaurant-count {
    margin: 10px 0 0;
    font-size: 12px;
    color: #777777;
    line-height: 1.6;
}

/* =========================================================
   スマホ表示
========================================================= */

@media screen and (max-width: 760px) {
    .jimoto-restaurant-section {
        margin: 20px 0;
        padding: 16px;
        border-radius: 14px;
    }

    .jimoto-restaurant-title {
        font-size: 20px;
    }

    .jimoto-restaurant-lead {
        font-size: 13px;
    }

    .jimoto-restaurant-toolbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 12px;
    }

    .jimoto-restaurant-sort-buttons {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .jimoto-restaurant-sort-btn {
        width: 100%;
        padding: 10px 12px;
    }

    .jimoto-restaurant-list {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .jimoto-restaurant-photo-box,
    .jimoto-restaurant-photo-wrap,
    .jimoto-restaurant-photo,
    .jimoto-restaurant-photo-placeholder,
    .jimoto-restaurant-no-photo {
        height: 180px;
    }

    .jimoto-restaurant-info {
        padding: 14px;
    }

    .jimoto-restaurant-name {
        font-size: 17px;
    }

    .jimoto-restaurant-meta,
    .jimoto-restaurant-row {
        font-size: 13px;
    }

    .jimoto-restaurant-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .jimoto-restaurant-action-link,
    .jimoto-restaurant-link-btn {
        text-align: center;
        padding: 8px 10px;
    }

    .jimoto-restaurant-more-btn {
        max-width: none;
    }
}