/* アイテム取引所スタイル */

/* テーマのh3スタイルを上書き */
.article h3 {
    border: none !important;
    border-bottom: 2px solid #e5e7eb !important;
    font-size: 1.25rem !important;
    padding: 0 0 8px 0 !important;
    margin: 24px 0 16px 0 !important;
    font-weight: 600 !important;
    color: #1f2937 !important;
}

/* ベースコンテナ */
.grv-trading-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 共通フォームスタイル */
.grv-trading-form {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.grv-trading-form h3 {
    margin: 0 0 20px 0;
    color: #1a202c;
    font-size: 1.25rem;
}

.grv-form-group {
    margin-bottom: 16px;
}

.grv-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #4a5568;
}

.grv-form-group input,
.grv-form-group select,
.grv-form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

/* select要素の追加スタイル */
.grv-form-group select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    padding-right: 32px;
}

.grv-form-group input:focus,
.grv-form-group select:focus,
.grv-form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ラジオボタングループ */
.grv-radio-group {
    display: flex;
    gap: 16px;
}

.grv-radio-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    cursor: pointer;
}

.grv-radio-group input[type="radio"] {
    width: auto;
    margin-right: 6px;
}

/* ボタンスタイル */
.grv-btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: #f9fafb;
    color: #374151;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    text-align: center;
    vertical-align: middle;
    line-height: 1.5;
    box-sizing: border-box;
}

.grv-btn:hover {
    background: #f3f4f6;
    text-decoration: none;
}

.grv-btn--primary {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.grv-btn--primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.grv-btn--secondary {
    background: #6b7280;
    color: white;
    border-color: #6b7280;
}

.grv-btn--secondary:hover {
    background: #4b5563;
    border-color: #4b5563;
}

.grv-btn--danger {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.grv-btn--danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

/* モード切替 */
.grv-btn--small {
    padding: 6px 10px;
    font-size: 12px;
}
.grv-mode-toggle {
    display: inline-flex;
    gap: 8px;
}
.grv-mode-btn.active {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

/* アイテム管理 */
.grv-trading-items {
    margin-bottom: 32px;
}

/* 検索ボックス */
.grv-trading-items__search {
    background: #f9fafb;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid #e5e7eb;
}

.grv-items-search-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.grv-items-search-form .grv-search-input-wrapper {
    flex: 1;
}

.grv-items-search-form .grv-search-input {
    width: 100%;
    padding: 10px 40px 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.grv-items-search-form .grv-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
}

/* アイテム種類フィルター（ラベルボタン形式） */
.grv-type-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.grv-type-btn {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    background: white;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    outline: none;
}

.grv-type-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.grv-type-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* 各タイプごとの色分け */
.grv-type-btn--icon.active {
    background: #0ea5e9;
    border-color: #0ea5e9;
}

.grv-type-btn--frame.active {
    background: #a855f7;
    border-color: #a855f7;
}

.grv-type-btn--balloon.active {
    background: #22c55e;
    border-color: #22c55e;
}

.grv-type-btn--background.active {
    background: #f97316;
    border-color: #f97316;
}

.grv-type-btn--other.active {
    background: #6b7280;
    border-color: #6b7280;
}

.grv-clear-search {
    display: inline-block;
    padding: 10px 16px;
    background: #ef4444;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    transition: background 0.2s;
}

.grv-clear-search:hover {
    background: #dc2626;
}

.grv-trading-items__header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.grv-trading-items__header h3 {
    margin: 0 0 4px 0;
    color: #1f2937;
}

.grv-search-result-info {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: #6b7280;
}

/* アイテムヘッダーラッパー */
.grv-items-header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.grv-items-header-info {
    flex: 1;
}

/* アイテム登録ボタン */
#open_item_registration {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
    white-space: nowrap;
    border-radius: 6px;
}

#open_item_registration .grv-btn-icon {
    font-size: 18px;
    line-height: 1;
}

#open_item_registration:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

#open_item_registration:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.grv-no-items {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
}

.grv-trading-items__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.grv-item-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.grv-item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 正方形の画像コンテナ */
.grv-item-card__image-wrapper {
    width: 100%;
    padding-top: 100%; /* 1:1 アスペクト比 */
    position: relative;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.grv-item-card__image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* 正方形に収める */
    padding: 8px; /* 画像の余白 */
}

/* アイテム種別を画像の左上に配置 */
.grv-item-card__type {
    position: absolute;
    top: 4px;
    left: 4px;
    padding: 2px 6px;
    background: rgba(219, 234, 254, 0.95);
    color: #1e40af;
    border-radius: 4px;
    font-size: 8px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* アイテム名のみフッター */
.grv-item-card__footer {
    padding: 6px;
}

.grv-item-card__name {
    margin: 0;
    font-size: 14px !important;
    color: #1f2937;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.grv-item-card__description {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.4;
}

/* マーケットプレイス */
.grv-trading-marketplace {
    margin-bottom: 32px;
}

.grv-trading-search { background:#f9fafb; padding:14px; border-radius:10px; margin-bottom:16px; border:1px solid #e5e7eb; }

.grv-search-filters { display:flex; flex-direction: column; gap:12px; }

/* 検索フィルターラベル */
.grv-filter-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
    font-size: 14px;
}

/* マーケットプレイス用のアイテム種類ボタン（青系統） */
.grv-type-filter-buttons--marketplace {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.grv-type-btn--marketplace {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    background: white;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    outline: none;
}

.grv-type-btn--marketplace:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

.grv-type-btn--marketplace.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* 各タイプごとの色分け（青系統の濃淡） */
.grv-type-btn--marketplace.grv-type-btn--icon.active {
    background: #2563eb;
    border-color: #2563eb;
}

.grv-type-btn--marketplace.grv-type-btn--frame.active {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.grv-type-btn--marketplace.grv-type-btn--balloon.active {
    background: #1e40af;
    border-color: #1e40af;
}

.grv-type-btn--marketplace.grv-type-btn--background.active {
    background: #1e3a8a;
    border-color: #1e3a8a;
}

.grv-type-btn--marketplace.grv-type-btn--other.active {
    background: #6b7280;
    border-color: #6b7280;
}

.grv-type-btn--marketplace.grv-type-btn--scraped.active {
    background: #0284c7;
    border-color: #0284c7;
}

/* 取引方法ボタン（緑系統） */
/* 取引元フィルター（紫系統） */
.grv-source-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.grv-source-btn {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    background: white;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    outline: none;
}

.grv-source-btn:hover {
    background: #faf5ff;
    border-color: #d8b4fe;
}

.grv-source-btn.active {
    background: #a855f7;
    color: white;
    border-color: #a855f7;
    box-shadow: 0 2px 4px rgba(168, 85, 247, 0.3);
}

/* 取引方法フィルター（緑系統） */
.grv-price-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.grv-price-btn {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    background: white;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    outline: none;
}

.grv-price-btn:hover {
    background: #f0fdf4;
    border-color: #86efac;
}

.grv-price-btn.active {
    background: #22c55e;
    color: white;
    border-color: #22c55e;
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
}

/* 星粒・アイテム交換の色分け（緑系統の濃淡） */
.grv-price-btn--stars.active {
    background: #16a34a;
    border-color: #16a34a;
}

.grv-price-btn--item.active {
    background: #15803d;
    border-color: #15803d;
}

/* 検索ヘッダー */
/* 視覚的に非表示（アクセシブル） */
.grv-visually-hidden { position:absolute !important; height:1px; width:1px; overflow:hidden; clip:rect(1px, 1px, 1px, 1px); white-space:nowrap; }

/* 入力アイコン付き */
.grv-input-with-icon { position:relative; }
.grv-input-with-icon .grv-input-icon { position:absolute; left:10px; top:50%; transform:translateY(-50%); color:#6b7280; font-size:14px; pointer-events:none; }
.grv-input-with-icon input[type="text"] { padding-left:32px; }
/* クリアボタン */
.grv-input-with-icon .grv-input-clear { position:absolute; right:8px; top:50%; transform:translateY(-50%); border:none; background:transparent; color:#9ca3af; font-size:16px; line-height:1; padding:4px; cursor:pointer; }
.grv-input-with-icon .grv-input-clear:hover { color:#6b7280; }

/* アクション行 */
.grv-search-actions { display:flex; gap:8px; }
.grv-link-clear { align-self:center; margin-left:6px; color:#64748b; text-decoration:none; font-size:13px; }
.grv-link-clear:hover { color:#334155; text-decoration:underline; }

/* 出品カード */
.grv-listing-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    transition: box-shadow 0.2s;
}

.grv-listing-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.grv-listing-card__seller {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.grv-seller-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.grv-seller-name {
    font-weight: 500;
    color: #1f2937;
}

/* 出品者行: アイコン・ユーザー名・評価を横並び */
.grv-listing-card__seller .grv-seller-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.grv-listing-card__seller .grv-seller-details {
    display: flex;
    align-items: center;
    gap: 8px;
}
.grv-listing-card__seller .grv-rating-stars .grv-star--filled { color: #fbbf24; }
.grv-listing-card__seller .grv-rating-stars .grv-star { color: #d1d5db; }

.grv-listing-card__item {
    margin-bottom: 16px;
}

.grv-listing-card__item-name {
    margin: 0 0 8px 0;
    font-size: 14px !important;
    color: #1f2937;
}

.grv-listing-card__image-price-wrapper {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.grv-listing-card__image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* 引き伸ばし/切り取りなし */
}

/* 正方形の白背景コンテナで画像を保持 */
.grv-image-square {
    width: 80px;
    height: 80px;
    background: #ffffff; /* 余白は白埋め */
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* 念のため */
    position: relative; /* 種別バッジの配置用 */
}

/* 画像をクリック可能にするスタイル */
.grv-image-square a.grv-item-popup {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    cursor: pointer;
    transition: opacity 0.2s;
}

.grv-image-square a.grv-item-popup:hover {
    opacity: 0.85;
}

.grv-image-square a.grv-item-popup:hover .grv-listing-card__image {
    transform: scale(1.05);
    transition: transform 0.2s;
}

/* 取引一覧のアイテム種別を画像の上部に配置 */
.grv-listing-card__type {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(219, 234, 254, 0.95);
    color: #1e40af;
    border-radius: 4px;
    font-size: 8px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    margin-bottom: 2px;
}

.grv-listing-card__details {
    flex: 1;
}

/* 出品/募集のバッジ */
.grv-badge {
    display: inline-block;
    font-weight: 700;
    margin-right: 6px;
}
.grv-badge--sell { color: #ef4444; } /* 赤 */
.grv-badge--buy { color: #3b82f6; }  /* 青 */

.grv-listing-card__price {
    color: #059669;
    font-weight: 500;
    margin-bottom: 4px;
}

.grv-price-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    padding-left: 0 !important;
}

.grv-price-list li {
    padding: 0 !important;
    margin: 0 !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
}

.grv-listing-card__expires {
    color: #6b7280;
    font-size: 14px;
}

.grv-listing-card__expires.grv-expired {
    color: #ef4444;
}

.grv-listing-card__actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
    align-items: stretch;
}

.grv-listing-card__actions .grv-btn {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    font-size: 13px;
    flex-shrink: 0;
}

/* 評価システム */
.grv-rating-stars {
    display: flex;
    align-items: center;
    gap: 2px;
}

.grv-star {
    color: #d1d5db;
    font-size: 16px;
}

.grv-star--filled {
    color: #fbbf24;
}

.grv-rating-count {
    margin-left: 6px;
    color: #6b7280;
    font-size: 14px;
}

.grv-trading-user-ratings {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
}

/* 評価統計 */
.grv-rating-stats {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.grv-rating-average {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.grv-rating-score {
    font-size: 48px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
}

.grv-rating-stars-large {
    display: flex;
    gap: 2px;
}

.grv-rating-stars-large .grv-star {
    font-size: 20px;
}

.grv-rating-total {
    font-size: 13px;
    color: #6b7280;
}

.grv-rating-breakdown {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

/* 積み上げ棒グラフ */
.grv-rating-stacked-bar {
    display: flex;
    height: 32px;
    border-radius: 6px;
    overflow: hidden;
    background: #f3f4f6;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.grv-rating-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.grv-rating-segment:hover {
    filter: brightness(1.1);
}

.grv-rating-segment-label {
    font-size: 11px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
}

.grv-rating-segment:hover .grv-rating-segment-label {
    opacity: 1;
}

/* 各評価のカラー */
.grv-rating-segment--5 {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.grv-rating-segment--4 {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.grv-rating-segment--3 {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

.grv-rating-segment--2 {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.grv-rating-segment--1 {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* 凡例 */
.grv-rating-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.grv-rating-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.grv-rating-legend-star {
    font-weight: 600;
}

.grv-rating-legend-star--5 { color: #10b981; }
.grv-rating-legend-star--4 { color: #3b82f6; }
.grv-rating-legend-star--3 { color: #fbbf24; }
.grv-rating-legend-star--2 { color: #f97316; }
.grv-rating-legend-star--1 { color: #ef4444; }

.grv-rating-legend-count {
    color: #6b7280;
    font-weight: 500;
}

.grv-trading-ratings-list {
    margin-top: 20px;
}

.grv-rating-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
}

.grv-rating-card:last-child {
    margin-bottom: 0;
}

/* 取引履歴 */
.grv-trading-my-listings,
.grv-trading-my-trades {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
}

.grv-trading-my-listings h3,
.grv-trading-my-trades h3 {
    margin: 0 0 20px 0;
    color: #1f2937;
}

/* 検索入力ラッパー */
.grv-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.grv-search-input-wrapper input[type="text"] {
    flex: 1;
    padding-right: 40px;
}

.grv-search-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    background: transparent;
    border: none;
    color: #6b7280;
    padding: 0 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.grv-search-btn:hover {
    color: #3b82f6;
}

.grv-search-btn:active {
    color: #2563eb;
}

/* 交換条件設定エリア */
.grv-price-item {
    margin-bottom: 8px;
}

.grv-price-item label {
    display: block;
    margin-bottom: 4px;
}

/* アイテム検索ラッパー（候補表示の基準点） */
.grv-item-search-wrapper {
    position: relative;
    width: 100%;
}

.grv-item-search-wrapper .grv-input-item-search {
    width: 100%;
}

/* アイテム候補表示 */
.grv-item-suggestions,
.grv-wanted-item-suggestions {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    margin-top: -1px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.grv-item-suggestion {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s;
}

.grv-item-suggestion:hover {
    background: #f3f4f6;
}

.grv-item-suggestion:last-child {
    border-bottom: none;
}

/* 検索中・検索結果なし・エラー表示 */
.grv-item-suggestion.grv-searching,
.grv-item-suggestion.grv-no-result,
.grv-item-suggestion.grv-error {
    cursor: default;
    pointer-events: none;
}

.grv-item-suggestion.grv-searching {
    color: #6b7280;
    font-style: italic;
    text-align: center;
}

.grv-item-suggestion.grv-no-result {
    background: #fef3c7;
    padding: 12px;
}

.grv-no-result-message {
    font-weight: 600;
    color: #92400e;
    margin-bottom: 6px;
}

.grv-no-result-hint {
    font-size: 13px;
    color: #78350f;
}

.grv-item-suggestion.grv-error {
    background: #fef2f2;
    color: #b91c1c;
    text-align: center;
}

/* ユーティリティクラス */
.grv-hidden {
    display: none;
}

.grv-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 16px 0;
}

.grv-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 16px 0;
}

/* 画像アップロード関連 */
.grv-form-group input[type="file"] {
    padding: 8px 0;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
}

.grv-form-group input[type="file"]:hover {
    border-color: #3b82f6;
}

.grv-image-preview {
    margin-top: 12px;
    text-align: center;
}

.grv-image-preview img {
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    max-width: 100%;
    height: auto;
}

/* 類似アイテム警告 */
.grv-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-left: 4px solid #f59e0b;
    color: #92400e;
    padding: 16px;
    border-radius: 6px;
    margin: 16px 0;
}

.grv-warning h4 {
    margin: 0 0 12px 0;
    color: #92400e;
    font-size: 1.1rem;
}

.grv-warning ul {
    margin: 12px 0;
    padding-left: 20px;
}

.grv-warning li {
    margin-bottom: 4px;
}

.grv-warning p {
    margin: 12px 0;
    font-weight: 500;
}

.grv-warning .grv-btn {
    margin-right: 8px;
}

.grv-btn--warning {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
}

.grv-btn--warning:hover {
    background: #d97706;
    border-color: #d97706;
}

/* アイコン性別設定 */
.grv-form-group small {
    display: block;
    margin-top: 4px;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.4;
}

/* メッセージ表示 */
.grv-message {
    padding: 12px 16px;
    border-radius: 4px;
    margin: 16px 0;
    font-weight: 500;
}

.grv-message.grv-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.grv-message.grv-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

/* ユーザーアバター */
.grv-avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.grv-avatar--default {
    background: #e5e7eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-weight: 500;
    border-radius: 50%;
}

/* 出品者情報 */
.grv-seller-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.grv-seller-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* 取引相手情報 */
.grv-trade-partner {
    margin-bottom: 16px;
}

.grv-partner-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.grv-partner-label {
    font-weight: 500;
    color: #6b7280;
}

.grv-partner-name {
    font-weight: 600;
    color: #1f2937;
}

/* 取引カードヘッダー */
.grv-trade-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f3f4f6;
}

.grv-trade-partner-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 評価フォームヘッダー */
.grv-rating-form__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
}

.grv-rating-form__header h3 {
    margin: 0;
    color: #1f2937;
}

/* 評価者情報 */
.grv-rating-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.grv-rater-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.grv-rater-name {
    font-weight: 500;
    color: #1f2937;
}

/* アイテムタイプ別の色分け（画像上に配置） */
.grv-item-card__type.grv-type--icon,
.grv-listing-card__type.grv-type--icon {
    background: rgba(224, 242, 254, 0.95);
    color: #0277bd;
}

.grv-item-card__type.grv-type--frame,
.grv-listing-card__type.grv-type--frame {
    background: rgba(243, 229, 245, 0.95);
    color: #7b1fa2;
}

.grv-item-card__type.grv-type--balloon,
.grv-listing-card__type.grv-type--balloon {
    background: rgba(232, 245, 232, 0.95);
    color: #2e7d32;
}

.grv-item-card__type.grv-type--background,
.grv-listing-card__type.grv-type--background {
    background: rgba(255, 243, 224, 0.95);
    color: #ef6c00;
}

.grv-item-card__type.grv-type--other,
.grv-listing-card__type.grv-type--other {
    background: rgba(245, 245, 245, 0.95);
    color: #616161;
}

/* アイコン性別表示 */
.grv-icon-gender {
    display: inline-block;
    font-size: 10px;
    padding: 2px 4px;
    margin-left: 4px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
}

.grv-icon-gender.grv-gender--male {
    color: #1976d2;
}

.grv-icon-gender.grv-gender--female {
    color: #e91e63;
}

.grv-icon-gender.grv-gender--both {
    color: #9c27b0;
}

/* 取引申し込み一覧 */
.grv-trading-requests {
    max-width: 800px;
    margin: 0 auto;
}

.grv-requests-section {
    margin-bottom: 32px;
}

.grv-requests-section h3 {
    color: #1f2937;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

.grv-trade-request-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    transition: box-shadow 0.2s;
}

.grv-trade-request-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.grv-request-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.grv-requester-info,
.grv-seller-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.grv-requester-details,
.grv-seller-details {
    display: flex;
    flex-direction: column;
}

.grv-requester-name,
.grv-seller-name {
    font-weight: 600;
    color: #1f2937;
}

.grv-request-date {
    font-size: 12px;
    color: #6b7280;
}

.grv-request-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.grv-status--requested {
    background: #fef3c7;
    color: #92400e;
}

.grv-status--accepted {
    background: #d1fae5;
    color: #065f46;
}

.grv-status--rejected {
    background: #fee2e2;
    color: #991b1b;
}

.grv-status--completed {
    background: #dbeafe;
    color: #1e40af;
}

.grv-status--cancelled {
    background: #f3f4f6;
    color: #6b7280;
}

.grv-request-item {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.grv-request-item-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    background: #f9fafb;
}

.grv-request-item-details {
    flex: 1;
}

.grv-request-item-name {
    margin: 0 0 8px 0;
    color: #1f2937;
}

.grv-request-price {
    color: #059669;
    font-weight: 500;
}

.grv-request-message {
    background: #f9fafb;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.grv-request-message strong {
    color: #1f2937;
}

.grv-request-message p {
    margin: 4px 0 0 0;
    color: #4b5563;
}

.grv-request-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* 募集期間設定 */
.grv-period-settings {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.grv-period-preset,
.grv-period-custom {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.grv-period-preset label,
.grv-period-custom label {
    font-size: 14px;
    color: #4b5563;
}

/* 編集フォーム */
.grv-edit-container {
    background: #f8fafc;
    border: 2px solid #3b82f6;
    border-radius: 8px;
    margin-bottom: 16px;
}

.grv-edit-form {
    margin: 0;
}

.grv-edit-form h4 {
    color: #1e40af;
    margin: 0 0 16px 0;
}

.grv-edit-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.grv-current-expires {
    background: #fef3c7;
    padding: 8px 12px;
    border-radius: 4px;
    margin: 0;
    color: #92400e;
    font-weight: 500;
}

/* 読み込み中状態 */
.grv-loading {
    opacity: 0.6;
    pointer-events: none;
}

.grv-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .grv-trading-container {
        padding: 12px;
    }
    
    /* select要素のモバイル対応（iOS自動ズーム防止） */
    .grv-form-group select,
    .grv-items-search-form .grv-type-filter,
    .grv-trading-search select,
    select.grv-type-filter,
    select[id^="item_"],
    select[id^="search_"],
    select[id^="edit_"],
    select[id^="popup_"],
    select[id^="inline_"],
    select[name="item_type"],
    select[name="price_type"],
    select[name="trade_location"],
    select[name="listing_period_preset"],
    select[name="item_validity_type"],
    select[name="item_valid_days_preset"] {
        font-size: 16px !important;
        min-height: 44px !important;
        -webkit-text-size-adjust: 100% !important;
    }
    
    /* アイテム一覧を三列表示 */
    .grv-trading-items__grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    /* アイテムカード内の調整 */
    .grv-item-card__footer {
        padding: 4px;
    }
    
    .grv-item-card__name {
        font-size: 14px !important;
        line-height: 1.2;
    }
    
    .grv-item-card__type {
        font-size: 9px;
        padding: 2px 4px;
        top: 3px;
        left: 3px;
    }
    
    .grv-item-card__image {
        padding: 4px;
    }
    
    /* 検索フォーム */
    .grv-items-search-form {
        gap: 8px;
    }
    
    .grv-items-search-form .grv-search-input {
        font-size: 13px;
        padding: 8px 40px 8px 10px;
    }
    
    /* ラベルボタンのモバイル対応 */
    .grv-type-filter-buttons {
        gap: 6px;
    }
    
    .grv-type-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .grv-clear-search {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .grv-trading-items__search {
        padding: 12px;
    }
    
    .grv-search-filters { grid-template-columns: 1fr; }
    
    /* 検索ボタンとクリアボタン横並び */
    .grv-trading-search .grv-search-actions { 
        display: flex !important;
        flex-direction: row !important; 
        justify-content: space-between !important; 
        gap: 8px !important; 
    }
    .grv-trading-search .grv-search-actions > * { 
        flex: 1 !important; 
        margin-left: 0 !important;
    }
    .grv-trading-search .grv-search-actions .grv-btn { 
        display: inline-block !important;
    }
    
    /* スマホ用アイテムヘッダー */
    .grv-trading-items__header {
        margin-bottom: 16px;
    }
    
    .grv-items-header-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .grv-items-header-info {
        text-align: center;
    }
    
    .grv-items-header-info h3 {
        font-size: 1.1rem !important;
    }
    
    /* スマホ用アイテム登録ボタン */
    #open_item_registration {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
        font-size: 16px;
        font-weight: 700;
        border-radius: 10px;
        background: linear-gradient(135deg, #10b981 0%, #059669 100%);
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
        gap: 10px;
    }
    
    #open_item_registration .grv-btn-icon {
        font-size: 20px;
    }
    
    #open_item_registration .grv-btn-text {
        font-size: 16px;
        letter-spacing: 0.5px;
    }
    
    #open_item_registration:hover {
        background: linear-gradient(135deg, #059669 0%, #047857 100%);
        box-shadow: 0 5px 16px rgba(16, 185, 129, 0.5);
    }
    
    #open_item_registration:active {
        transform: scale(0.97);
        box-shadow: 0 3px 10px rgba(16, 185, 129, 0.35);
    }
    
    .grv-listing-card {
        padding: 12px;
    }
    
    .grv-listing-card__item-name {
        font-size: 13px !important;
        margin-bottom: 6px;
    }
    
    .grv-image-square {
        width: 60px;
        height: 60px;
        flex-shrink: 0;
    }
    
    .grv-listing-card__price {
        font-size: 13px;
    }
    
    .grv-listing-card__expires {
        font-size: 12px;
        margin-top: 8px;
    }
    
    .grv-listing-card__actions {
        justify-content: stretch;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .grv-listing-card__actions .grv-btn {
        flex: 1 1 auto;
        min-width: 90px;
        max-width: calc(50% - 3px);
        font-size: 12px;
        padding: 8px 10px;
        line-height: 1.4;
    }
    
    .grv-warning .grv-btn {
        display: block;
        width: 100%;
        margin: 8px 0 0 0;
    }
    
    .grv-radio-group {
        flex-direction: column;
        gap: 8px;
    }
    
    /* モバイルでのアバター調整 */
    .grv-seller-info,
    .grv-partner-info,
    .grv-trade-partner-info,
    .grv-rater-info {
        gap: 6px;
    }
    
    .grv-rating-form__header {
        gap: 8px;
    }
    
    .grv-rating-form__header .grv-avatar {
        width: 32px !important;
        height: 32px !important;
    }
    
    /* 評価統計のモバイル調整 */
    .grv-rating-stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .grv-rating-average {
        width: 100%;
    }
    
    .grv-rating-breakdown {
        max-width: 100%;
    }
    
    .grv-rating-score {
        font-size: 40px;
    }
    
    .grv-rating-stacked-bar {
        height: 28px;
    }
    
    .grv-rating-segment-label {
        font-size: 10px;
    }
    
    .grv-rating-legend {
        gap: 12px;
    }
    
    .grv-rating-legend-item {
        font-size: 12px;
    }
    
    /* 取引申し込み一覧のモバイル調整 */
    .grv-request-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .grv-request-item {
        flex-direction: column;
    }
    
    .grv-request-item-image {
        width: 100%;
        height: 120px;
    }
    
    .grv-request-actions {
        justify-content: stretch;
        flex-direction: column;
    }
    
    .grv-request-actions .grv-btn {
        width: 100%;
    }
    
    .grv-period-settings {
        gap: 16px;
    }
    
    .grv-edit-actions {
        flex-direction: column;
    }
    
    .grv-edit-actions .grv-btn {
        width: 100%;
    }
}

/* 進行中の取引スタイル */
.grv-active-trade {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
}

.grv-completion-status {
    margin: 16px 0;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.grv-status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
}

.grv-status-item.completed {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.grv-status-item.pending {
    background: #fefce8;
    border: 1px solid #fde047;
    color: #a16207;
}

.grv-status-item.partial {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    color: #1e40af;
}

.grv-status-icon {
    font-size: 16px;
    font-weight: bold;
}

.grv-status-text {
    flex: 1;
}

.grv-trade-partner {
    margin: 12px 0;
    padding: 12px;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.grv-partner-info {
    margin-bottom: 8px;
}

.grv-btn-confirm-completion {
    background: #10b981;
    border-color: #059669;
}

.grv-btn-confirm-completion:hover {
    background: #059669;
}

.grv-btn-evaluate {
    background: #8b5cf6;
    border-color: #7c3aed;
}

.grv-btn-evaluate:hover {
    background: #7c3aed;
}

.grv-status-waiting {
    display: inline-block;
    padding: 8px 16px;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 4px;
    font-size: 14px;
    font-style: italic;
}

.grv-status-completed {
    display: inline-block;
    padding: 8px 16px;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
}

/* 進行中の取引セクション */
.grv-requests-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px 0;
    padding: 8px 0;
    border-bottom: 2px solid #e5e7eb;
    color: #374151;
}

.grv-requests-section:not(:last-child) {
    margin-bottom: 32px;
}

/* 評価フォーム */
.grv-rating-form-container {
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin: 16px 0;
}

.grv-rating-form-container h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.grv-rating-stars {
    margin-bottom: 16px;
}

.grv-rating-stars label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #374151;
}

.grv-star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 4px;
}

.grv-star-rating input[type="radio"] {
    display: none;
}

.grv-star-rating .grv-star {
    font-size: 24px;
    color: #d1d5db;
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
}

.grv-star-rating .grv-star:hover,
.grv-star-rating input[type="radio"]:checked ~ .grv-star,
.grv-star-rating input[type="radio"]:hover ~ .grv-star {
    color: #fbbf24;
}

.grv-rating-comment {
    margin-bottom: 16px;
}

.grv-rating-comment label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #374151;
}

.grv-rating-comment textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
}

.grv-rating-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.grv-btn-complete-trade {
    background: #059669;
    border-color: #047857;
}

.grv-btn-complete-trade:hover {
    background: #047857;
}

.grv-btn-secondary {
    background: #6b7280;
    color: white;
    border-color: #4b5563;
}

.grv-btn-secondary:hover {
    background: #4b5563;
}

/* 詳細セクション（折りたたみ）のスタイル */
.grv-details-section {
    margin-bottom: 20px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    overflow: hidden;
}

.grv-details-toggle {
    width: 100%;
    padding: 12px 16px;
    background: #f8f9fa;
    border: none;
    border-bottom: 1px solid #e1e5e9;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    transition: background-color 0.2s;
}

.grv-details-toggle:hover {
    background: #e9ecef;
}

.grv-details-toggle:focus {
    outline: none;
    background: #e9ecef;
}

.grv-details-arrow {
    font-size: 12px;
    color: #6c757d;
    transition: transform 0.2s;
}

.grv-details-content {
    padding: 16px;
    background: #ffffff;
}

.grv-details-content.grv-hidden {
    display: none;
}

/* --- 購入モードのフォールバック表示制御 --- */
/* JSで mode-buy クラスが付与された場合、交換条件は常に表示（詳細は強制しない） */
.grv-trading-form.mode-buy #price_section,
.grv-trading-form.mode-buy #price_section.grv-hidden { 
    display: block !important; 
    visibility: visible !important;
}
/* 購入モードではオークション設定全体（ラベルとスコープ）を非表示 */
.grv-trading-form.mode-buy #auction_settings_group > label,
.grv-trading-form.mode-buy #auction_settings_group .grv-auction-settings { 
    display: none !important; 
}
/* 他のgrv-form-groupは影響を受けない */
/* .grv-hiddenクラスが付与されても購入モードでは交換条件のみ必ず表示 */
.grv-trading-form.mode-buy #price_section.grv-hidden {
    display: block !important;
    visibility: visible !important;
}

/* トグルスイッチ（モダン・シンプル） */
.grv-form-group label.grv-switch { /* ラベル共通スタイルの上書き用（特異性を上げる） */
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    margin-bottom: 0; /* 共通の6px余白を抑止 */
}
.grv-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}
.grv-switch input {
    display: none;
}
.grv-slider {
    position: relative;
    width: 46px;
    height: 26px;
    background: #e5e7eb;
    border-radius: 9999px;
    transition: background 0.2s ease;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}
.grv-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.grv-switch input:checked + .grv-slider {
    background: #3b82f6;
}
.grv-switch input:checked + .grv-slider::after {
    transform: translateX(20px);
}
.grv-switch-label {
    color: #374151;
    font-size: 14px;
}

/* オークション詳細の並び（最低入札/即決を横並び） */
.grv-form-inline {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.grv-form-inline .grv-form-group {
    flex: 1 1 200px;
    margin-bottom: 0; /* 内側は詰める */
}

/* 画像ポップアップ（モーダル） */
.grv-modal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.grv-modal.grv-hidden { display: none; }
.grv-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.grv-modal__content { position: relative; background: #fff; border-radius: 8px; padding: 16px; width: min(90vw, 480px); box-shadow: 0 10px 30px rgba(0,0,0,0.2); z-index: 1; }
.grv-modal__close { position: absolute; top: 8px; right: 8px; background: transparent; border: none; font-size: 18px; cursor: pointer; color: #6b7280; }
.grv-modal__caption { margin-top: 8px; font-size: 14px; color: #374151; text-align: center; }
.grv-modal .grv-image-square { width: 320px; height: 320px; margin: 0 auto; }
.grv-modal__img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* When a modal is open: prevent body scroll and avoid layout shift when scrollbar disappears */
body.grv-modal-open {
    overflow: hidden; /* fallback */
    -webkit-overflow-scrolling: auto; /* ensure fixed positioning behaves predictably on iOS */
}

/* add touch-action none so background doesn't react to gestures (modal content can still handle its own gestures) */
body.grv-modal-open { touch-action: none; }

/* --- 検索折りたたみ（スマホ優先） --- */
.grv-search-bar { display:none; padding:8px 10px; order:999; }
.grv-search-toggle { display:inline-flex; align-items:center; gap:8px; font-size:14px; line-height:1; padding:8px 12px; background:#eef2f7; border:1px solid #e2e8f0; border-radius:8px; cursor:pointer; }
.grv-search-toggle__icon { opacity:.8; }
.grv-filter-badge { display:inline-flex; min-width:20px; height:20px; padding:0 6px; align-items:center; justify-content:center; border-radius:9999px; background:#2563eb; color:#fff; font-size:12px; font-weight:600; }

@media (max-width: 768px) {
    .grv-search-bar { display:block; order: -1; margin-bottom: 8px; }
    .grv-trading-search { background: #f8fafc; display:flex; flex-direction:column; }
    .grv-trading-search .grv-search-panel { display:none; margin-top:8px; order:1; }
    .grv-trading-search.is-open .grv-search-panel { display:block; }
}

@media (min-width: 769px) {
    .grv-search-bar { display:none; }
    .grv-trading-search .grv-search-panel { display:block; }
}

/* JavaScript無効時のフォールバック（noscript内のクラスに対応） */
.no-js .grv-trading-search .grv-search-panel { display:block !important; }

/* --- タブ用通知バッジ --- */
.grv-tab-badge {
    display: none;
    margin-left: 6px;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 9999px;
    background: #ef4444; /* red-500 */
    color: #fff;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    vertical-align: middle;
    pointer-events: none; /* バッジ自体はクリックを奪わない */
}
.grv-tab-badge::after { content: attr(data-count); }
.grv-tab-badge.is-active { display: inline-block; }

/* タブの高さが小さいテーマでのベースライン調整（必要に応じ有効化） */
/*
.tabs a .grv-tab-badge, .tabs button .grv-tab-badge { position: relative; top: -1px; }
*/

/* --- ファイル選択ボタン --- */
.grv-file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.grv-btn-file-select {
    padding: 10px 20px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    white-space: nowrap;
}

.grv-btn-file-select:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

.grv-btn-file-select:active {
    transform: translateY(0);
}

.grv-file-name {
    color: #6b7280;
    font-size: 13px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.grv-file-name:not(:empty) {
    color: #059669;
    font-weight: 500;
}

/* --- OCRトグル --- */
.grv-ocr-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.grv-ocr-toggle input[type="checkbox"] {
    display: none;
}

.grv-ocr-toggle .grv-slider {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    background: #d1d5db;
    border-radius: 12px;
    transition: background 0.2s ease;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
    margin: 0;
    padding: 0;
    border: none;
    overflow: visible;
    vertical-align: middle;
}

.grv-ocr-toggle .grv-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.grv-ocr-toggle input[type="checkbox"]:checked + .grv-slider {
    background: #10b981;
}

.grv-ocr-toggle input[type="checkbox"]:checked + .grv-slider::after {
    transform: translateX(18px);
}

.grv-ocr-toggle .grv-switch-label {
    font-size: 13px;
    color: #4b5563;
    font-weight: 500;
}

/* --- OCRステータス --- */
.grv-ocr-status {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.grv-ocr-status.grv-hidden {
    display: none;
}

.grv-ocr-status.loading {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    color: #1e40af;
}

.grv-ocr-status.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.grv-ocr-status.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.grv-ocr-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- アイテム登録ポップアップ --- */
.grv-item-registration-popup {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.grv-item-registration-popup.grv-hidden {
    display: none;
}

.grv-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    cursor: pointer;
}

.grv-popup__container {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.grv-popup__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 12px 12px 0 0;
}

.grv-popup__title {
    margin: 0;
    font-size: 1.5rem;
    color: #1f2937;
    font-weight: 600;
}

.grv-popup__close {
    background: transparent;
    border: none;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.grv-popup__close:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.grv-popup__body {
    padding: 24px;
}

/* ポップアップ内のフォームスタイル調整 */
.grv-item-registration-popup .grv-trading-form {
    border: none;
    padding: 0;
    margin: 0;
}

.grv-item-registration-popup .grv-trading-form h3 {
    display: none; /* ヘッダーでタイトルを表示するため非表示 */
}

/* アイテムカードの募集ボタン */
.grv-item-card__listing-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 2px 6px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    transition: all 0.3s ease;
    z-index: 2;
    opacity: 0;
    transform: scale(0.8);
}

.grv-item-card:hover .grv-item-card__listing-btn {
    opacity: 1;
    transform: scale(1);
}

.grv-item-card__listing-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.6);
    transform: scale(1.1);
}

.grv-item-card__listing-btn:active {
    transform: scale(0.95);
}

/* アイテムカードの削除ボタン（編集者以上） */
.grv-item-card__delete-btn {
    position: absolute;
    top: 4px;
    left: 4px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.95);
    border: 1.5px solid #ef4444;
    border-radius: 4px;
    color: #dc2626;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 2;
    opacity: 0;
    transform: scale(0.85);
}

.grv-item-card:hover .grv-item-card__delete-btn {
    opacity: 1;
    transform: scale(1);
}

.grv-item-card__delete-btn:hover {
    background: #ef4444;
    color: white;
    border-color: #dc2626;
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.4);
    transform: scale(1.05);
}

.grv-item-card__delete-btn:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.3);
}

/* 選択されたアイテム表示 */
.grv-selected-item-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.grv-selected-item-display img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 4px;
    background: white;
    border: 1px solid #e5e7eb;
}

.grv-selected-item-display .item-name {
    font-weight: 600;
    color: #1f2937;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .grv-item-registration-popup {
        padding: 0;
    }
    
    .grv-popup__container {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .grv-popup__header {
        border-radius: 0;
    }
    
    /* モバイルでは募集ボタンを常時表示 */
    .grv-item-card__listing-btn {
        opacity: 1;
        transform: scale(1);
    }
}

/* 一括登録モードのスタイル */
.grv-batch-mode-toggle {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.grv-batch-mode-option {
    flex: 1;
    display: flex;
    cursor: pointer;
}

.grv-batch-mode-option input[type="radio"] {
    display: none;
}

.grv-batch-mode-label {
    flex: 1;
    padding: 12px;
    text-align: center;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-weight: 600;
    color: #6b7280;
    transition: all 0.3s ease;
}

.grv-batch-mode-option input[type="radio"]:checked + .grv-batch-mode-label {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #3b82f6;
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* 一括登録フォーム */
.grv-batch-registration {
    padding: 0;
}

.grv-split-mode-options {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.grv-split-mode-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.grv-split-mode-option input[type="radio"] {
    width: auto;
    margin: 0;
}

.grv-split-mode-option:has(input:checked) {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #1e40af;
    font-weight: 600;
}

.grv-split-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.grv-split-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 分割プレビュー */
.grv-batch-preview {
    margin-top: 24px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.grv-batch-preview h4 {
    margin: 0 0 16px 0;
    color: #1f2937;
    font-size: 16px;
    font-weight: 600;
}

.grv-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.grv-preview-item {
    position: relative;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.3s ease;
}

.grv-preview-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

.grv-preview-item__image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    margin-bottom: 8px;
    background: #f9fafb;
    border-radius: 4px;
}

.grv-preview-item__name-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
    margin-bottom: 6px;
}

.grv-preview-item__type-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
    margin-bottom: 6px;
    background: white;
}

.grv-preview-item__gender {
    display: flex;
    gap: 8px;
    justify-content: center;
    font-size: 11px;
    padding: 4px 0;
}

/* hiddenクラスが付いている場合は非表示（優先度を上げる） */
.grv-preview-item__gender.grv-hidden {
    display: none !important;
}

.grv-preview-item__gender label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    margin: 0;
}

.grv-preview-item__gender input[type="radio"] {
    width: auto;
    margin: 0;
}

.grv-preview-item__delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    opacity: 0;
    transition: all 0.2s ease;
}

.grv-preview-item:hover .grv-preview-item__delete {
    opacity: 1;
}

.grv-preview-item__delete:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* 一括登録アクション */
.grv-batch-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.grv-batch-actions button {
    min-width: 150px;
}

/* 登録進捗 */
.grv-batch-progress {
    margin-top: 24px;
    padding: 20px;
    background: #eff6ff;
    border-radius: 8px;
    border: 2px solid #3b82f6;
    text-align: center;
}

.grv-batch-progress h4 {
    margin: 0 0 16px 0;
    color: #1e40af;
    font-size: 18px;
    font-weight: 600;
}

.grv-progress-bar {
    width: 100%;
    height: 24px;
    background: #dbeafe;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

.grv-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
    transition: width 0.3s ease;
    width: 0%;
}

.grv-progress-text {
    margin: 0;
    color: #1e40af;
    font-weight: 600;
    font-size: 14px;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .grv-preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }
    
    .grv-batch-mode-toggle {
        flex-direction: column;
        gap: 8px;
    }
    
    .grv-split-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .grv-split-controls label {
        justify-content: space-between;
    }
    
    .grv-batch-actions {
        flex-direction: column;
    }
    
    .grv-batch-actions button {
        width: 100%;
    }
}

/* グリッド編集エリア */
.grv-batch-grid-area {
    margin-top: 24px;
}

.grv-grid-controls {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.grv-grid-control-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.grv-grid-control-row:last-child {
    margin-bottom: 0;
}

.grv-grid-control-row label {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    margin: 0;
}

.grv-grid-control-row input[type="number"] {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
}

.grv-margin-inputs {
    padding-left: 20px;
}

.grv-margin-inputs label {
    font-weight: 500;
    font-size: 13px;
}

.grv-action-buttons {
    display: flex;
    align-items: center;
    gap: 0;
    justify-content: flex-start;
}

.grv-action-buttons .grv-btn {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.grv-action-buttons .grv-separator {
    color: #9ca3af;
    font-weight: 400;
    padding: 0 8px;
}

.grv-action-buttons .grv-btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.grv-action-buttons .grv-btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.grv-canvas-container {
    position: relative;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
    display: inline-block;
}

.grv-canvas-container canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.grv-grid-info {
    margin-top: 12px;
    padding: 12px;
    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-radius: 6px;
}

.grv-grid-info p {
    margin: 0;
    color: #1e40af;
    font-size: 13px;
    line-height: 1.5;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .grv-grid-control-row {
        gap: 8px;
    }
    
    /* 行×列の行は横並びを維持 */
    .grv-grid-control-row:nth-child(1) {
        flex-wrap: nowrap;
    }
    
    .grv-grid-control-row:nth-child(1) label {
        white-space: nowrap;
        flex-shrink: 0;
        font-size: 13px;
    }
    
    .grv-grid-control-row:nth-child(1) input[type="number"] {
        width: 50px;
    }
    
    .grv-grid-control-row:nth-child(1) span {
        flex-shrink: 0;
    }
    
    /* 行間・列間の余白行は横並びを維持（縦になると使いにくい） */
    .grv-grid-control-row:nth-child(4) {
        flex-wrap: wrap;
    }
    
    .grv-grid-control-row:nth-child(4) label {
        white-space: nowrap;
        flex-shrink: 0;
        font-size: 12px;
    }
    
    .grv-grid-control-row:nth-child(4) input[type="number"] {
        width: 50px;
    }
    
    /* 余白タイトル行は縦並び */
    .grv-grid-control-row:nth-child(2) {
        flex-direction: column;
        align-items: stretch;
    }
    
    /* 余白入力行は縦並び */
    .grv-grid-control-row:nth-child(3) {
        flex-direction: column;
        align-items: stretch;
    }
    
    .grv-grid-control-row:nth-child(3) input[type="number"] {
        width: 100%;
    }
    
    /* アクションボタン行は横並びを維持 */
    .grv-grid-control-row:nth-child(5) {
        flex-wrap: nowrap;
    }
    
    .grv-margin-inputs {
        padding-left: 0;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .grv-action-buttons {
        flex-wrap: nowrap;
        width: 100%;
    }
    
    .grv-action-buttons .grv-btn {
        flex: 1;
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .grv-action-buttons .grv-separator {
        padding: 0 4px;
        font-size: 12px;
    }
    
    .grv-canvas-container {
        width: 100%;
    }
    
    .grv-canvas-container canvas {
        width: 100%;
        height: auto;
    }
}

/* === 交換条件（チェックボックス形式） === */
.grv-price-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 12px;
}

.grv-price-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 最初の行のみ星粒を表示 */
.grv-price-row:not(:first-child) .grv-price-option--stars {
    display: none;
}

/* チェックボックスを左側に配置 */
.grv-price-option > input[type="checkbox"] {
    width: auto;
    min-width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
}

/* ラベルを左側に配置（チェックボックスの右） */
.grv-price-option > .grv-checkbox-label {
    min-width: 70px;
    font-weight: 500;
    color: #374151;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
}

/* 入力欄ラッパーを右側に配置 */
.grv-price-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 非表示時は確実に非表示にする */
.grv-price-input-wrapper.grv-hidden {
    display: none !important;
}

/* 星粒の数値入力 */
.grv-input-stars {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
}

/* アイテム検索入力 */
.grv-price-item-search {
    flex: 1;
    min-width: 0;
}

.grv-item-search-wrapper {
    position: relative;
    width: 100%;
}

.grv-input-item-search {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
}

/* 選択済みアイテム表示 */
.grv-price-item-selected {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    min-width: 0;
}

/* 非表示時は確実に非表示にする */
.grv-price-item-selected.grv-hidden {
    display: none !important;
}

.grv-selected-item-image {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.grv-selected-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    color: #374151;
}

/* クリアボタン（アイテムのみ） */
.grv-btn-clear {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    padding: 0;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.grv-btn-clear:hover {
    background: #dc2626;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .grv-price-row {
        gap: 10px;
        padding: 10px;
    }
    
    .grv-price-option {
        flex-wrap: wrap;
    }
    
    .grv-price-option > .grv-checkbox-label {
        min-width: 60px;
    }
    
    .grv-price-input-wrapper {
        width: 100%;
        margin-left: 24px; /* チェックボックス分のインデント */
    }
    
    /* 一括登録のグリッドコントロール入力欄 - iOS自動ズーム防止 */
    .grv-grid-controls input[type="number"],
    .grv-grid-controls input[type="text"],
    .grv-grid-controls select {
        font-size: 16px !important;
        min-height: 44px !important;
        -webkit-text-size-adjust: 100% !important;
    }
    
    /* プレビューアイテムの入力欄 - iOS自動ズーム防止 */
    .grv-preview-item__name-input,
    .grv-preview-item__type-select {
        font-size: 16px !important;
        min-height: 44px !important;
        -webkit-text-size-adjust: 100% !important;
        padding: 10px 8px !important;
    }
    
    .grv-preview-item__gender label {
        font-size: 14px !important;
    }
    
    .grv-preview-item__gender input[type="radio"] {
        width: 16px !important;
        height: 16px !important;
    }
}

/* --- バッチOCRローディングインジケーター --- */
.grv-ocr-loading-indicator {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 2px solid #93c5fd;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.grv-ocr-loading-indicator .grv-ocr-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #3b82f6;
    border-top-color: transparent;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
}

.grv-ocr-loading-text {
    font-size: 16px;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 12px;
}

.grv-ocr-progress {
    font-size: 14px;
    color: #3b82f6;
    font-weight: 500;
}

.grv-ocr-progress__current {
    font-size: 18px;
    font-weight: 700;
    color: #1e40af;
}

.grv-ocr-progress__total {
    font-size: 18px;
    font-weight: 700;
    color: #60a5fa;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- ページネーション --- */
.grv-pagination {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 32px auto;
    padding: 20px 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    max-width: 600px;
    visibility: visible !important;
    opacity: 1 !important;
}

.grv-pagination__status {
    display: inline-block !important;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    padding: 8px 16px;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    min-width: 120px;
    text-align: center;
}

.grv-pagination .grv-btn,
.grv-pagination a {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 90px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    visibility: visible !important;
    opacity: 1 !important;
    white-space: nowrap;
}

/* 無効化されたボタンスタイル */
.grv-pagination .grv-btn--disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    border-color: #d1d5db;
}

.grv-pagination .grv-btn--disabled:hover {
    background: #e5e7eb;
    color: #9ca3af;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .grv-pagination {
        gap: 8px;
        padding: 16px 12px;
        margin: 24px auto;
    }
    
    .grv-pagination .grv-btn,
    .grv-pagination a {
        min-width: 70px;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .grv-pagination__status {
        font-size: 14px;
        padding: 6px 12px;
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .grv-pagination {
        flex-direction: column;
        gap: 10px;
        padding: 16px;
    }
    
    .grv-pagination .grv-btn,
    .grv-pagination a {
        width: 100%;
        min-width: unset;
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .grv-pagination__status {
        width: 100%;
        order: -1;
        font-size: 15px;
        padding: 10px 16px;
    }
}

/* --- 一括登録類似チェックポップアップ --- */
.grv-batch-similar-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.grv-batch-similar-popup--visible {
    opacity: 1;
    visibility: visible;
}

.grv-batch-similar-popup__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

.grv-batch-similar-popup__content {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.grv-batch-similar-popup--visible .grv-batch-similar-popup__content {
    transform: scale(1);
}

.grv-batch-similar-popup__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 2px solid #e5e7eb;
}

.grv-batch-similar-popup__header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    border: none !important;
}

.grv-batch-similar-popup__close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.grv-batch-similar-popup__close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.grv-batch-similar-popup__body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.grv-batch-similar-popup__description {
    margin: 0 0 24px 0;
    padding: 16px;
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    border-radius: 6px;
    color: #92400e;
    font-size: 14px;
    line-height: 1.6;
}

.grv-batch-similar-popup__items {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.grv-batch-similar-item {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    background: #f9fafb;
}

.grv-batch-similar-item__header h4 {
    margin: 0 0 16px 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
}

.grv-batch-similar-item__comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 16px;
}

.grv-batch-similar-item__new,
.grv-batch-similar-item__existing {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}

.grv-batch-similar-item__label {
    font-weight: 600;
    font-size: 14px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.grv-batch-similar-item__new {
    border-color: #3b82f6;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.grv-batch-similar-item__new img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 6px;
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
}

.grv-batch-similar-item__new .grv-batch-similar-item__name {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.grv-batch-similar-item__new .grv-batch-similar-item__type {
    font-size: 13px;
    color: #6b7280;
}

.grv-batch-similar-item__existing {
    border-color: #ef4444;
}

.grv-batch-similar-item__existing-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.grv-batch-similar-item__existing-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: #fef2f2;
    border-radius: 6px;
    border: 1px solid #fecaca;
}

.grv-batch-similar-item__existing-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    flex-shrink: 0;
}

.grv-batch-similar-item__existing-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
}

.grv-batch-similar-item__existing-type {
    font-size: 12px;
    color: #6b7280;
}

.grv-batch-similar-item__actions {
    display: flex;
    justify-content: center;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.grv-batch-similar-item__action-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.grv-batch-similar-item__action-label:hover {
    background: #f3f4f6;
}

.grv-batch-similar-item__checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.grv-batch-similar-item__action-label span {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
}

.grv-batch-similar-popup__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 2px solid #e5e7eb;
}

.grv-batch-similar-popup__cancel {
    background: #e5e7eb;
    color: #374151;
}

.grv-batch-similar-popup__cancel:hover {
    background: #d1d5db;
}

.grv-batch-similar-popup__confirm {
    background: #10b981;
    color: #ffffff;
}

.grv-batch-similar-popup__confirm:hover {
    background: #059669;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .grv-batch-similar-popup__content {
        width: 95%;
        max-height: 90vh;
    }
    
    .grv-batch-similar-item__comparison {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .grv-batch-similar-popup__header {
        padding: 16px;
    }
    
    .grv-batch-similar-popup__body {
        padding: 16px;
    }
    
    .grv-batch-similar-popup__footer {
        padding: 12px 16px;
        flex-direction: column;
        gap: 8px;
    }
    
    .grv-batch-similar-popup__footer .grv-btn {
        width: 100%;
    }
}