/* 購入ページコンテナ */
.purchases-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* ヒーローセクション */
.purchases-hero {
  text-align: center;
  margin-bottom: 24px;
}

.purchases-title {
  font-size: 1.6em;
  margin: 0 0 8px 0;
  color: #1c1e21;
}

.purchases-subtitle {
  font-size: 0.95em;
  color: #65676b;
  margin: 0;
}

/* 投稿枠状況カード */
.quota-status-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

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

.quota-status-label {
  font-size: 0.9em;
  opacity: 0.9;
}

.quota-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin: 20px 0;
}

.quota-stat-item {
  text-align: center;
}

.quota-stat-value {
  display: block;
  font-size: 2.5em;
  font-weight: bold;
  line-height: 1.2;
}

.quota-stat-unit {
  font-size: 0.4em;
  opacity: 0.8;
}

.quota-stat-label {
  font-size: 0.85em;
  opacity: 0.9;
}

.quota-stat-divider {
  width: 1px;
  height: 50px;
  background: rgba(255, 255, 255, 0.3);
}

.quota-progress {
  margin-top: 8px;
}

.quota-bar {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  height: 8px;
  overflow: hidden;
}

.quota-used {
  background: white;
  height: 100%;
  border-radius: 8px;
  transition: width 0.3s ease;
}

/* プラン情報表示 */
.plan-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 1.1em;
}

.plan-badge.plan-free {
  background: rgba(255, 255, 255, 0.2);
}

.plan-badge.plan-active {
  background: rgba(255, 255, 255, 0.95);
  color: #667eea;
}

.plan-expiry {
  margin: 8px 0 0 0;
  font-size: 0.85em;
  opacity: 0.9;
}

/* 有効プラン注意書き */
.active-plan-notice {
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  color: #e65100;
  font-size: 0.9em;
  border-left: 4px solid #ff9800;
}

.active-plan-notice p {
  margin: 0;
}

/* プラン選択セクション */
.plans-section {
  margin-bottom: 32px;
}

.section-title {
  font-size: 1.2em;
  margin-bottom: 20px;
  color: #1c1e21;
  text-align: center;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  align-items: start;
}

/* プランカード共通 */
.plan-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.plan-card:hover:not(.disabled) {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.plan-card.disabled {
  opacity: 0.6;
  pointer-events: none;
}

/* ベーシックプラン */
.plan-basic {
  border: 2px solid #e0e0e0;
}

.plan-basic:hover:not(.disabled) {
  border-color: #5c6bc0;
}

.plan-header-basic {
  background: linear-gradient(135deg, #e8eaf6 0%, #c5cae9 100%);
  color: #3949ab;
}

.plan-header-basic .plan-icon {
  background: rgba(57, 73, 171, 0.15);
}

/* プロプラン */
.plan-pro {
  border: 2px solid #ffd54f;
  box-shadow: 0 4px 16px rgba(255, 193, 7, 0.2);
}

.plan-pro:hover:not(.disabled) {
  border-color: #ffb300;
  box-shadow: 0 8px 32px rgba(255, 193, 7, 0.3);
}

.plan-header-pro {
  background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
  color: #f57c00;
}

.plan-header-pro .plan-icon {
  background: rgba(245, 124, 0, 0.15);
}

.plan-recommended-badge {
  position: absolute;
  top: -1px;
  right: 16px;
  background: linear-gradient(135deg, #ff6f00 0%, #ff8f00 100%);
  color: white;
  padding: 6px 16px;
  font-size: 0.75em;
  font-weight: bold;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 2px 8px rgba(255, 111, 0, 0.3);
}

/* プランヘッダー */
.plan-header {
  padding: 24px 20px;
  text-align: center;
}

.plan-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin-bottom: 12px;
}

.plan-name {
  font-size: 1.4em;
  margin: 0 0 4px 0;
  font-weight: bold;
}

.plan-tagline {
  font-size: 0.85em;
  margin: 0;
  opacity: 0.8;
}

/* プラン本体 */
.plan-body {
  padding: 20px;
}

.plan-price-section {
  text-align: center;
  margin-bottom: 16px;
}

.plan-price {
  display: inline-flex;
  align-items: baseline;
}

.price-currency {
  font-size: 1.2em;
  font-weight: bold;
  color: #1c1e21;
}

.price-amount {
  font-size: 2.8em;
  font-weight: bold;
  color: #1c1e21;
  line-height: 1;
}

.price-period {
  display: block;
  font-size: 0.85em;
  color: #65676b;
  margin-top: 4px;
}

/* 投稿数ハイライト */
.plan-quota-highlight {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
}

.plan-quota-pro {
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
}

.plan-quota-highlight .quota-number {
  display: block;
  font-size: 2.5em;
  font-weight: bold;
  color: #1565c0;
  line-height: 1;
}

.plan-quota-pro .quota-number {
  color: #e65100;
}

.plan-quota-highlight .quota-label {
  font-size: 0.9em;
  color: #1976d2;
}

.plan-quota-pro .quota-label {
  color: #f57c00;
}

/* 機能リスト */
.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
}

.plan-features li {
  padding: 8px 0 8px 28px;
  position: relative;
  color: #424242;
  font-size: 0.9em;
  line-height: 1.4;
}

.plan-features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 18px;
  height: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234caf50'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
}

.plan-features li.feature-main {
  font-weight: 600;
  color: #1c1e21;
}

.plan-features li.feature-highlight {
  color: #e65100;
  font-weight: 500;
}

.plan-features li.feature-highlight::before {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff9800'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
}

/* プランフッター */
.plan-footer {
  padding: 16px 20px 20px;
}

.purchase-button {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.purchase-button-basic {
  background: linear-gradient(135deg, #5c6bc0 0%, #3949ab 100%);
  color: white;
}

.purchase-button-basic:hover {
  background: linear-gradient(135deg, #3949ab 0%, #303f9f 100%);
  transform: scale(1.02);
}

.purchase-button-pro {
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.purchase-button-pro:hover {
  background: linear-gradient(135deg, #f57c00 0%, #ef6c00 100%);
  transform: scale(1.02);
  box-shadow: 0 6px 16px rgba(255, 152, 0, 0.4);
}

.disabled-badge {
  display: block;
  text-align: center;
  padding: 14px;
  background: #f0f0f0;
  color: #999;
  border-radius: 10px;
  font-weight: bold;
}

/* 比較表セクション */
.comparison-section {
  margin-bottom: 32px;
}

.comparison-title {
  font-size: 1.1em;
  text-align: center;
  margin-bottom: 16px;
  color: #1c1e21;
}

.comparison-table {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.comparison-row {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, 1fr);
  border-bottom: 1px solid #e0e0e0;
}

.comparison-row:last-child {
  border-bottom: none;
}

.comparison-header {
  background: #f5f5f5;
  font-weight: bold;
}

.comparison-cell {
  padding: 12px 8px;
  text-align: center;
  font-size: 0.9em;
}

.comparison-label {
  text-align: left;
  padding-left: 16px;
  color: #65676b;
}

.comparison-cell-basic {
  background: #e8eaf6;
  font-weight: 600;
  color: #3949ab;
}

.comparison-cell-pro {
  background: #fff8e1;
  font-weight: 600;
  color: #f57c00;
}

/* 情報セクション共通 */
.info-section {
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.info-title {
  font-size: 0.95em;
  font-weight: bold;
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-title::before {
  font-size: 1.2em;
}

.info-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.info-list li {
  padding: 4px 0 4px 20px;
  position: relative;
  font-size: 0.9em;
  line-height: 1.5;
}

.info-list li::before {
  content: "•";
  position: absolute;
  left: 4px;
  font-weight: bold;
}

.info-footer {
  margin: 12px 0 0 0;
  font-size: 0.85em;
  font-style: italic;
  opacity: 0.8;
}

/* 料金の使い道セクション */
.why-paid-section {
  background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
  border-left: 4px solid #ffa000;
}

.why-paid-section .info-title {
  color: #e65100;
}

.why-paid-section .info-title::before {
  content: "💰";
}

.why-paid-section .info-list li {
  color: #5d4037;
}

.why-paid-section .info-list li::before {
  color: #ffa000;
}

.why-paid-section .info-list li.highlight {
  color: #e65100;
  font-weight: 500;
}

.why-paid-section .info-list li.highlight::before {
  content: "🍚";
}

.why-paid-section .info-footer {
  color: #795548;
}

/* 注意事項 */
.purchase-notes {
  background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  border-left: 4px solid #e53935;
}

.purchase-notes h3 {
  font-size: 0.95em;
  color: #c62828;
  margin: 0 0 10px 0;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 6px;
}

.purchase-notes h3::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: #e53935;
  color: white;
  border-radius: 50%;
  font-size: 0.8em;
  font-weight: bold;
}

.purchase-notes ul {
  margin: 0;
  padding-left: 20px;
  color: #b71c1c;
  font-size: 0.9em;
}

.purchase-notes li {
  margin-bottom: 6px;
}

/* 購入結果ページ */
.purchase-result-container {
  max-width: 500px;
  margin: 40px auto;
  padding: 20px;
  text-align: center;
}

.success-icon {
  color: #4caf50;
  margin-bottom: 24px;
}

.result-title {
  font-size: 1.5em;
  color: #1c1e21;
  margin-bottom: 24px;
}

.purchase-details {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.purchase-details .plan-name {
  font-size: 1.2em;
  font-weight: bold;
  color: #667eea;
  margin-bottom: 8px;
}

.purchase-details .quota-added {
  font-size: 1.5em;
  font-weight: bold;
  color: #1c1e21;
}

.new-quota-info {
  margin-bottom: 24px;
  color: #666;
}

.new-quota-info p {
  margin: 8px 0;
}

.processing-notice {
  background: #fff3e0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 24px;
  color: #e65100;
  font-size: 0.9em;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.primary-button {
  display: block;
  padding: 14px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  transition: opacity 0.2s;
}

.primary-button:hover {
  opacity: 0.9;
  color: white;
}

.secondary-button {
  display: block;
  padding: 14px 24px;
  background: #f0f2f5;
  color: #1c1e21;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.2s;
}

.secondary-button:hover {
  background: #e4e6e9;
}

/* レスポンシブ */
@media (max-width: 700px) {
  .purchases-container {
    padding: 15px;
  }

  .plans-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .plan-pro {
    order: -1; /* モバイルではプロプランを上に */
  }

  .quota-stat-value {
    font-size: 2em;
  }

  .quota-stats {
    gap: 16px;
  }

  .quota-stat-divider {
    height: 40px;
  }

  .price-amount {
    font-size: 2.2em;
  }

  .plan-quota-highlight .quota-number {
    font-size: 2em;
  }

  .comparison-row {
    grid-template-columns: 1fr repeat(3, 0.8fr);
  }

  .comparison-cell {
    padding: 10px 4px;
    font-size: 0.8em;
  }

  .comparison-label {
    padding-left: 8px;
  }
}

/* ==================== */
/* 購入履歴ページ */
/* ==================== */

.purchase-history-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

.purchase-history-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.purchase-history-header-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.purchase-history-header-icon svg {
  color: #fff;
}

.purchase-history-header-content {
  flex: 1;
}

.purchase-history-header-content h1 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1c1e21;
  margin: 0 0 2px 0;
}

.purchase-history-count {
  font-size: 0.8rem;
  color: #999;
}

/* 現在有効なプランカード */
.active-plan-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}

.active-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85em;
  margin-bottom: 12px;
}

.active-plan-badge svg {
  color: #4ade80;
}

.active-plan-name {
  font-size: 1.5em;
  font-weight: 700;
  margin: 0 0 16px 0;
}

.active-plan-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.plan-detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  padding: 12px 16px;
  border-radius: 10px;
}

.plan-detail-label {
  font-size: 0.9em;
  opacity: 0.9;
}

.plan-detail-value {
  font-size: 1.1em;
  font-weight: 600;
}

.plan-detail-unit {
  font-size: 0.8em;
  opacity: 0.8;
  font-weight: 400;
}

/* プランなしカード */
.no-active-plan-card {
  background: #f5f5f5;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  margin-bottom: 24px;
}

.no-active-plan-card p {
  color: #65676b;
  margin: 0 0 16px 0;
}

.no-active-plan-card .button {
  display: inline-block;
  padding: 12px 24px;
  background: #667eea;
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}

/* 購入履歴セクション */
.purchase-history-section {
  margin-bottom: 24px;
}

.purchase-history-section .section-title {
  font-size: 1.1em;
  color: #1c1e21;
  margin: 0 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #e4e6eb;
}

.purchase-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.purchase-history-item {
  background: white;
  border: 1px solid #e4e6eb;
  border-radius: 12px;
  overflow: hidden;
}

.purchase-history-item.failed {
  opacity: 0.7;
}

.purchase-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e4e6eb;
}

.purchase-plan-name {
  font-weight: 600;
  color: #1c1e21;
}

.purchase-status {
  font-size: 0.8em;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.purchase-status.status-completed {
  background: #d4edda;
  color: #155724;
}

.purchase-status.status-pending {
  background: #fff3cd;
  color: #856404;
}

.purchase-status.status-failed {
  background: #f8d7da;
  color: #721c24;
}

.purchase-status.status-refunded {
  background: #e2e3e5;
  color: #383d41;
}

.purchase-item-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.purchase-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.purchase-detail-label {
  font-size: 0.9em;
  color: #65676b;
}

.purchase-detail-value {
  font-size: 0.95em;
  color: #1c1e21;
  font-weight: 500;
}

/* 履歴なし */
.purchase-history-empty {
  text-align: center;
  padding: 32px;
  color: #65676b;
}

/* フッター */
.purchase-history-footer {
  text-align: center;
  padding-top: 16px;
}

.purchase-history-footer .button {
  display: inline-block;
  padding: 12px 24px;
  background: white;
  color: #1c1e21;
  border: 1px solid #ddd;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
}

.purchase-history-footer .button:hover {
  background: #f5f5f5;
}
