/* =============================================
   GEAL Product Comments — ラウンド 2
   ============================================= */

.product-comments {
    display: flex;
    flex-direction: column;
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
}

.product-comments-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid #f1f5f9;
}

.product-comments-title {
    font-family: 'Noto Serif JP', serif;
    font-size: 16px;
    font-weight: 700;
    color: #0a0a0a;
    margin: 0;
}

.product-comments-count {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    color: #6b7280;
}

.product-comments-form-area {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafafa;
}

.product-comments-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.product-comments-input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 8px 10px;
    font: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 56px;
    box-sizing: border-box;
    background: #ffffff;
}

.product-comments-input:focus {
    outline: none;
    border-color: #6B21A8;
    box-shadow: 0 0 0 2px rgba(107, 33, 168, 0.15);
}

.product-comments-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.product-comments-counter {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    color: #6b7280;
}

.product-comments-submit {
    background: #6B21A8;
    color: #ffffff;
    border: 0;
    padding: 8px 18px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.product-comments-submit:hover:not(:disabled) {
    background: #581c87;
}

.product-comments-submit:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.product-comments-error {
    color: #ef4444;
    font-size: 12px;
    padding: 4px 0;
}

.product-comments-login-prompt {
    color: #6b7280;
    font-size: 13px;
    text-align: center;
    padding: 6px 0;
}

.product-comments-login-prompt a {
    color: #6B21A8;
    text-decoration: underline;
}

.product-comments-list {
    padding: 8px 0;
    max-height: 600px;
    overflow-y: auto;
}

.product-comments-empty {
    text-align: center;
    color: #6b7280;
    padding: 28px 12px;
    font-size: 13px;
}

.product-comment {
    padding: 12px 16px;
    border-bottom: 1px solid #f9fafb;
}

.product-comment:last-child {
    border-bottom: 0;
}

.product-comment-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.product-comment-author {
    font-weight: 600;
    color: #0a0a0a;
    font-size: 13px;
}

.product-comment-author.is-mine {
    color: #6B21A8;
}

.product-comment-author-tag {
    background: #ede9fe;
    color: #6B21A8;
    padding: 1px 6px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 4px;
}

/* =============================================
   Product Q&A UI — ラウンド 2
   ============================================= */

.product-qa {
    display: flex;
    flex-direction: column;
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
}

.product-qa-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid #f1f5f9;
}

.product-qa-title {
    font-family: 'Noto Serif JP', serif;
    font-size: 16px;
    font-weight: 700;
    color: #0a0a0a;
    margin: 0;
}

.product-qa-count {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    color: #6b7280;
}

.product-qa-form-area {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafafa;
}

.product-qa-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.product-qa-input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 8px 10px;
    font: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 56px;
    box-sizing: border-box;
    background: #ffffff;
}

.product-qa-input:focus {
    outline: none;
    border-color: #15803D;
    box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.15);
}

.product-qa-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.product-qa-counter {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    color: #6b7280;
}

.product-qa-submit {
    background: #15803D;
    color: #ffffff;
    border: 0;
    padding: 8px 18px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.product-qa-submit:hover:not(:disabled) {
    background: #166534;
}

.product-qa-submit:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.product-qa-error {
    color: #ef4444;
    font-size: 12px;
    padding: 4px 0;
}

.product-qa-login-prompt {
    color: #6b7280;
    font-size: 13px;
    text-align: center;
    padding: 6px 0;
}

.product-qa-login-prompt a {
    color: #15803D;
    text-decoration: underline;
}

/* ===== Phase 1b: AI 統合フロー ===== */
.product-qa-ai {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-qa-ai-head {
    display: flex;
    align-items: center;
    gap: 6px;
}

.product-qa-ai-icon {
    width: 18px;
    height: 18px;
    color: #6B21A8;
    flex-shrink: 0;
}

.product-qa-ai-icon.ok {
    color: #15803D;
}

.product-qa-ai-icon.spin {
    animation: product-qa-spin 0.9s linear infinite;
}

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

.product-qa-ai-title {
    font-family: 'Noto Serif JP', serif;
    font-size: 15px;
    font-weight: 700;
    color: #0a0a0a;
}

.product-qa-ai-sub {
    margin: 0;
    font-size: 12px;
    line-height: 1.6;
    color: #6b7280;
}

.product-qa-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.product-qa-chip {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 2px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.product-qa-chip:hover {
    border-color: #6B21A8;
    background: #faf5ff;
}

.product-qa-btn-icon {
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    margin-right: 4px;
}

.product-qa-ai-result {
    margin-top: 4px;
}

.product-qa-ai-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    font-size: 13px;
    padding: 10px 12px;
    background: #faf5ff;
    border: 1px solid #ede9fe;
    border-radius: 8px;
}

.product-qa-ai-answer {
    border: 1px solid #ede9fe;
    border-radius: 8px;
    background: #faf5ff;
    padding: 12px 14px;
}

.product-qa-ai-answer-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #6B21A8;
    margin-bottom: 6px;
}

.product-qa-ai-answer-text {
    font-size: 14px;
    line-height: 1.7;
    color: #1f2937;
    white-space: normal;
}

.product-qa-citations {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.product-qa-citation {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #6B21A8;
    background: #ffffff;
    border: 1px solid #ddd6fe;
    border-radius: 2px;
    padding: 2px 8px;
}

.product-qa-cite-icon {
    width: 12px;
    height: 12px;
}

.product-qa-ai-disclaimer {
    margin: 10px 0 0;
    font-size: 11px;
    line-height: 1.6;
    color: #9333ea;
    opacity: 0.85;
}

.product-qa-ai-resolve {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #ede9fe;
}

.product-qa-ai-resolve-q {
    font-size: 13px;
    color: #374151;
}

.product-qa-resolve-btn {
    display: inline-flex;
    align-items: center;
    background: #15803D;
    color: #ffffff;
    border: 0;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.product-qa-resolve-btn:hover {
    background: #166534;
}

.product-qa-ask-seller-link {
    background: none;
    border: 0;
    color: #6B21A8;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
    padding: 6px 4px;
}

.product-qa-ai-escalate {
    border: 1px solid #fde68a;
    border-radius: 8px;
    background: #fffbeb;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-qa-ai-escalate-msg {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    line-height: 1.6;
    color: #92400e;
}

.product-qa-ai-escalate .product-qa-ai-icon {
    color: #d97706;
}

.product-qa-ai-escalate .product-qa-submit {
    align-self: flex-start;
}

.product-qa-ai-sent {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #15803D;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 10px 12px;
}

.product-qa-list {
    padding: 8px 0;
    max-height: 600px;
    overflow-y: auto;
}

.product-qa-empty {
    text-align: center;
    color: #6b7280;
    padding: 28px 12px;
    font-size: 13px;
}

.product-qa-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f9fafb;
}

.product-qa-item:last-child {
    border-bottom: 0;
}

.product-qa-question-block,
.product-qa-answer-block {
    display: flex;
    gap: 10px;
    margin-bottom: 6px;
}

.product-qa-answer-block {
    margin-top: 8px;
    margin-bottom: 0;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}

.product-qa-q-label {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: #6B21A8;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.product-qa-a-label {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: #15803D;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.product-qa-q-body,
.product-qa-a-body {
    flex: 1;
    min-width: 0;
}

.product-qa-q-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.product-qa-author {
    font-weight: 600;
    color: #0a0a0a;
    font-size: 13px;
}

.product-qa-author.is-mine {
    color: #6B21A8;
}

.product-qa-author-tag {
    background: #ede9fe;
    color: #6B21A8;
    padding: 1px 6px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 4px;
}

.product-qa-store-label {
    font-weight: 700;
    color: #15803D;
    font-size: 13px;
}

.product-qa-time {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    color: #6b7280;
}

.product-qa-status-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 2px;
}

.product-qa-status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.product-qa-status-badge.answered {
    background: #d1fae5;
    color: #065f46;
}

.product-qa-text {
    font-size: 14px;
    line-height: 1.6;
    color: #1f2937;
    word-break: break-word;
    white-space: normal;
}

.product-qa-delete-btn {
    background: transparent;
    border: 0;
    color: #6b7280;
    font-size: 11px;
    padding: 2px 0;
    cursor: pointer;
    text-decoration: underline;
    margin-top: 4px;
    display: block;
    transition: color 0.15s ease;
}

.product-qa-delete-btn:hover:not(:disabled) {
    color: #ef4444;
}

/* =============================================
   Seller dashboard Q&A panel — Modern card UI
   ============================================= */

.lab-qa-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0;
}

.lab-qa-item {
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px 16px 12px;
    background: #fff;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.lab-qa-item:hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border-color: #d1d5db;
}

.lab-qa-item.is-pending {
    border-left: 3px solid #f59e0b;
    background: #fffbf3;
}

.lab-qa-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.lab-qa-author {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    font-size: 13px;
    color: #374151;
}

.lab-qa-author i {
    color: #9ca3af;
    font-size: 14px;
}

.lab-qa-date {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    color: #9ca3af;
}

.lab-qa-status-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.02em;
}

.lab-qa-status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.lab-qa-status-badge.answered {
    background: #d1fae5;
    color: #065f46;
}

/* Question / Answer ブロック共通: マーカー + 本文の横並び */
.lab-qa-question,
.lab-qa-answer-view {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    line-height: 1.65;
    margin-bottom: 8px;
}

.lab-qa-q-marker,
.lab-qa-a-marker {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    line-height: 1;
}

.lab-qa-q-marker {
    background: #6B21A8;
}

.lab-qa-a-marker {
    background: #15803D;
}

.lab-qa-q-text {
    flex: 1;
    color: #1f2937;
    word-break: break-word;
    white-space: pre-wrap;
}

.lab-qa-a-text {
    flex: 1;
    color: #374151;
    word-break: break-word;
    white-space: pre-wrap;
}

.lab-qa-answer-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.lab-qa-answer-form.is-edit-mode {
    border-top: 1px dashed #e5e7eb;
    padding-top: 10px;
}

.lab-qa-answer-input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 9px 11px;
    font: inherit;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    min-height: 64px;
    box-sizing: border-box;
    transition: border-color 0.12s, box-shadow 0.12s;
}

.lab-qa-answer-input:focus {
    outline: none;
    border-color: #15803D;
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.12);
}

.lab-qa-answer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.lab-qa-counter {
    margin-right: auto;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    color: #9ca3af;
}

.lab-qa-answer-error {
    color: #ef4444;
    font-size: 12px;
    margin-top: -2px;
}

.lab-btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 5px;
}

/* アクションアイコンボタン（編集 / 削除）: カード右下に控えめに配置 */
.lab-qa-item-actions {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f3f4f6;
}

.lab-qa-icon-btn {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s;
}

.lab-qa-icon-btn:hover:not(:disabled) {
    background: #f3f4f6;
    color: #374151;
}

.lab-qa-icon-btn-danger:hover:not(:disabled) {
    background: #fee2e2;
    color: #ef4444;
}

.lab-qa-icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* =============================================
   Q&A 商品グループ（折りたたみ式・コンパクト）
   ============================================= */

.lab-qa-list {
    max-width: 720px; /* 横幅を制限してデカ画像問題を防ぐ */
}

/* <details> 要素: native な開閉 + Circular ID 管理 と同型のカード */
.lab-qa-group {
    display: block;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    margin-bottom: 10px;
    overflow: hidden;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.lab-qa-group:hover {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    border-color: #d1d5db;
}

.lab-qa-group[open] {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-color: #d1d5db;
}

/* <summary> = クリック可能なヘッダ。default の三角マーカーを完全消去 */
.lab-qa-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 18px;
    background: #fff;
    cursor: pointer;
    transition: background 0.12s ease;
    list-style: none;
    user-select: none;
}

.lab-qa-group-header::-webkit-details-marker { display: none; }
.lab-qa-group-header::marker { display: none; content: ''; }

.lab-qa-group-header:hover {
    background: #f9fafb;
}

.lab-qa-group[open] .lab-qa-group-header {
    background: #fafafa;
    border-bottom: 1px solid #e5e7eb;
}

.lab-qa-group-name-text {
    flex: 1;
    min-width: 0;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #0a0a0a;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 件数表示: 「2件 質問・1件 回答待ち」風の控えめなテキスト */
.lab-qa-group-count {
    flex-shrink: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

.lab-qa-group-count-pending {
    color: #ef4444;
    font-weight: 700;
}

.lab-qa-group-flag-mini {
    flex-shrink: 0;
    background: #fee2e2;
    color: #991b1b;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.lab-qa-group-chevron {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.12s;
}

.lab-qa-group-header:hover .lab-qa-group-chevron {
    background: #e5e7eb;
    color: #374151;
}

.lab-qa-group[open] .lab-qa-group-chevron {
    transform: rotate(180deg);
}

/* 展開部分: <details>[open] の時のみ表示（native 動作）*/
.lab-qa-group-body {
    padding: 12px 18px 18px;
    background: #fcfcfd;
}

.lab-qa-group-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lab-qa-group-items .lab-qa-item {
    border-color: #e5e7eb;
    margin: 0;
}

.product-comment-time {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    color: #6b7280;
}

.product-comment-body {
    font-size: 14px;
    line-height: 1.6;
    color: #1f2937;
    word-break: break-word;
    white-space: normal;
    margin: 4px 0;
}

.product-comment-footer {
    display: flex;
    gap: 12px;
    margin-top: 6px;
}

.product-comment-action-btn {
    background: transparent;
    border: 0;
    color: #6b7280;
    font-size: 11px;
    padding: 2px 0;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.15s ease;
}

.product-comment-action-btn:hover:not(:disabled) {
    color: #ef4444;
}

.product-comment-action-btn:disabled {
    color: #d1d5db;
    cursor: not-allowed;
    text-decoration: none;
}

/* =============================================
   Circular ID 出自継承 UI（ラウンド 2）
   ============================================= */

.cd-provenance-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    background: #fafafa;
    margin-top: 16px;
    margin-bottom: 16px;
}

.cd-provenance-title {
    font-family: 'Noto Serif JP', serif;
    font-size: 14px;
    font-weight: 700;
    color: #0a0a0a;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cd-provenance-title::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 16px;
    background: #15803D;
    border-radius: 2px;
}

.cd-provenance-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid #f1f5f9;
}

.cd-provenance-row:last-child {
    border-bottom: 0;
}

.cd-provenance-label {
    color: #6b7280;
    font-weight: 500;
}

.cd-provenance-value {
    color: #1f2937;
    font-weight: 500;
}

.cd-provenance-value a {
    color: #6B21A8;
    font-weight: 600;
    text-decoration: none;
}

.cd-provenance-value a:hover {
    text-decoration: underline;
}

.cd-provenance-immutable-note {
    font-size: 11px;
    color: #6b7280;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
    line-height: 1.5;
}

.cd-provenance-tier-badge {
    display: inline-block;
    background: #15803D;
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 2px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 600;
}
