/**
 * ご意見箱 スタイル
 * フローティングボタンとフィードバックモーダル
 */

/* ========================================
   フローティングボタン
   ======================================== */
.feedback-floating-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.5);
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 2050; /* 試合モーダル(.modal-container: 2000)より上 */
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feedback-floating-btn:hover {
  background: rgba(37, 99, 235, 0.85);
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.feedback-floating-btn:active {
  transform: scale(0.95);
}

/* 試合モーダル表示中はさらに透過 */
body:has(.modal-overlay) .feedback-floating-btn {
  background: rgba(37, 99, 235, 0.25);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body:has(.modal-overlay) .feedback-floating-btn:hover {
  background: rgba(37, 99, 235, 0.6);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ========================================
   フィードバックモーダル
   ======================================== */
.feedback-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2100; /* フローティングボタン(2050)より上 */
  justify-content: center;
  align-items: center;
}

.feedback-modal.show {
  display: flex;
}

.feedback-modal-content {
  background: #ffffff;
  border-radius: 12px;
  width: 90%;
  max-width: 640px;
  height: 70vh;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: feedbackModalIn 0.3s ease;
  display: flex;
  flex-direction: column;
}

@keyframes feedbackModalIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ヘッダー */
.feedback-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 12px 12px 0 0;
}

.feedback-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
}

.feedback-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.feedback-modal-close:hover {
  color: #1f2937;
}

/* フォーム */
.feedback-form {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* スクロール可能領域 */
.feedback-form-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

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

.feedback-form .form-group:has(textarea) {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.feedback-form .form-group:has(textarea) textarea {
  flex-shrink: 0;
}

.feedback-form label,
.feedback-form .feedback-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

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

.feedback-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-weight: normal;
  color: #374151;
  background: #ffffff;
  transition: all 0.2s;
  margin-bottom: 0;
}

.feedback-radio-label:hover {
  border-color: #2563eb;
  background: #f0f7ff;
}

.feedback-radio-label:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.feedback-radio-label input[type='radio'] {
  margin: 0;
  accent-color: #2563eb;
}

.feedback-radio-text {
  white-space: nowrap;
}

.feedback-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #1f2937;
  background: #ffffff;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  box-sizing: border-box;
  min-height: 200px;
  resize: vertical;
  font-family: inherit;
}

.feedback-form textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 文字数カウンター */
.feedback-char-count {
  display: block;
  text-align: right;
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

.feedback-char-count.warning {
  color: #ea580c;
}

.feedback-char-count.error {
  color: #dc2626;
}

/* コンテキスト情報 */
.feedback-context-info {
  padding: 12px;
  background: #f3f4f6;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #4b5563;
}

.feedback-context-info:empty {
  display: none;
}

.feedback-context-info .context-item {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.feedback-context-info .context-item:last-child {
  margin-bottom: 0;
}

.feedback-context-info .context-label {
  color: #6b7280;
}

.feedback-context-info .context-value {
  color: #1f2937;
  font-weight: 500;
}

/* エラーメッセージ */
.feedback-form-error {
  padding: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  font-size: 14px;
  margin-bottom: 16px;
}

.feedback-form-error:empty {
  display: none;
}

/* 成功メッセージ */
.feedback-form:has(.feedback-form-success) {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.feedback-form-success {
  padding: 24px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  color: #16a34a;
  font-size: 16px;
  text-align: center;
  width: 100%;
}

/* フッター */
.feedback-form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
  flex-shrink: 0;
}

.feedback-form-footer .btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.feedback-form-footer .btn-secondary {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #374151;
}

.feedback-form-footer .btn-secondary:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.feedback-form-footer .btn-primary {
  background: #2563eb;
  border: 1px solid #2563eb;
  color: #ffffff;
}

.feedback-form-footer .btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.feedback-form-footer .btn-primary:disabled {
  background: #93c5fd;
  border-color: #93c5fd;
  cursor: not-allowed;
}

/* ========================================
   タブ
   ======================================== */
.feedback-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 20px;
  background: #f9fafb;
}

.feedback-tab {
  padding: 12px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -1px;
}

.feedback-tab:hover {
  color: #2563eb;
}

.feedback-tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

/* ========================================
   タブコンテンツ
   ======================================== */
.feedback-tab-content {
  flex: 1;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* 履歴タブ用のパディング */
#feedback-tab-history {
  padding: 20px;
  overflow-y: auto;
}

/* ========================================
   履歴リスト
   ======================================== */
.feedback-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feedback-history-loading,
.feedback-history-empty,
.feedback-history-error {
  padding: 40px 20px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

.feedback-history-error {
  color: #dc2626;
}

.feedback-history-retry {
  margin-top: 12px;
  padding: 8px 16px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
}

.feedback-history-retry:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

/* 履歴アイテム */
.feedback-history-item {
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.feedback-history-item:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.feedback-history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* カテゴリバッジ */
.feedback-history-category {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.feedback-history-category-bug {
  background: #fef2f2;
  color: #dc2626;
}

.feedback-history-category-feature {
  background: #eff6ff;
  color: #2563eb;
}

.feedback-history-category-other {
  background: #f3f4f6;
  color: #4b5563;
}

/* 日付 */
.feedback-history-date {
  font-size: 12px;
  color: #9ca3af;
}

/* コメントプレビュー */
.feedback-history-comment-preview {
  font-size: 14px;
  color: #374151;
  line-height: 1.5;
}

/* コメント全文（デフォルト非表示） */
.feedback-history-comment-full {
  display: none;
  font-size: 14px;
  color: #374151;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

/* 展開時 */
.feedback-history-item.expanded {
  background: #f9fafb;
}

.feedback-history-item.expanded .feedback-history-comment-preview {
  display: none;
}

.feedback-history-item.expanded .feedback-history-comment-full {
  display: block;
}
