/**
 * Cart Page Styles
 */

/* カートページレイアウト */
.cart-page {
  padding: 20px 0 40px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--brand);
}

.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--accent);
}

.cart-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

/* カートアイテム */
.cart-items {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.cart-loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

.cart-empty {
  text-align: center;
  padding: 60px 20px;
}

.cart-empty p {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 20px;
}

.cart-item {
  display: grid;
  grid-template-columns: 80px 1fr auto auto auto;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid #eee;
}

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

.cart-item-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  background: #f5f5f5;
}

.cart-item-info {
  min-width: 0;
}

.cart-item-name {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 6px;
  line-height: 1.4;
}

.cart-item-price {
  font-size: 14px;
  color: var(--brand);
  font-weight: 700;
  margin: 0;
}

.cart-item-quantity {
  display: flex;
  align-items: center;
  gap: 4px;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
}

.qty-btn:hover {
  background: #f0f0f0;
}

.qty-input {
  width: 50px;
  height: 32px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.cart-item-subtotal {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand);
  min-width: 100px;
  text-align: right;
}

.cart-item-remove {
  width: 32px;
  height: 32px;
  border: none;
  background: #f0f0f0;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-item-remove:hover {
  background: var(--brand);
  color: #fff;
}

/* カートサマリー */
.cart-summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  position: sticky;
  top: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.summary-row.shipping {
  color: var(--muted);
}

.summary-row.total {
  border-bottom: none;
  font-size: 18px;
  font-weight: 700;
  padding-top: 16px;
}

.total-price {
  color: var(--brand);
}

.btn-checkout {
  width: 100%;
  padding: 14px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 16px;
}

.btn-checkout:hover {
  background: var(--brand-dark);
}

.btn-clear {
  width: 100%;
  padding: 10px;
  background: #fff;
  color: var(--muted);
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  margin-top: 8px;
}

.btn-clear:hover {
  background: #f5f5f5;
}

.btn-primary {
  display: inline-block;
  padding: 12px 24px;
  background: var(--brand);
  color: #fff;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--brand-dark);
  text-decoration: none;
}

/* 通知 */
.cart-notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #333;
  color: #fff;
  padding: 14px 20px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 9999;
}

.cart-notification.show {
  transform: translateY(0);
  opacity: 1;
}

.notification-icon {
  width: 24px;
  height: 24px;
  background: #4CAF50;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* チェックアウトモーダル */
.checkout-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.checkout-modal {
  background: #fff;
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}

.checkout-modal h2 {
  margin: 0 0 20px;
  font-size: 20px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f0f0f0;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}

.form-group textarea {
  resize: vertical;
}

.required {
  color: var(--brand);
}

.checkout-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-top: 2px solid var(--brand);
  margin-top: 16px;
  font-size: 18px;
  font-weight: 700;
}

.checkout-total .price {
  color: var(--brand);
}

.btn-submit {
  width: 100%;
  padding: 14px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn-submit:hover {
  background: var(--brand-dark);
}

/* 注文完了 */
.order-complete {
  text-align: center;
  padding: 40px 20px;
}

.complete-icon {
  width: 80px;
  height: 80px;
  background: #4CAF50;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin: 0 auto 20px;
}

.order-complete h2 {
  font-size: 24px;
  margin-bottom: 16px;
}

.order-complete p {
  color: var(--muted);
  margin-bottom: 8px;
}

.order-details {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 20px;
  margin: 24px 0;
  text-align: left;
}

.order-details h3 {
  font-size: 14px;
  margin: 0 0 12px;
}

.order-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}

.order-total {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  font-weight: 700;
  font-size: 16px;
}

/* カートバッジ */
.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.global-nav-item {
  position: relative;
}

/* カートに追加ボタン */
.add-to-cart-btn {
  width: 100%;
  padding: 10px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
}

.add-to-cart-btn:hover {
  background: var(--brand-dark);
}

/* レスポンシブ */
@media (max-width: 860px) {
  .cart-layout {
    grid-template-columns: 1fr;
  }

  .cart-summary {
    position: static;
  }

  .cart-item {
    grid-template-columns: 60px 1fr;
    gap: 12px;
  }

  .cart-item-image {
    width: 60px;
    height: 60px;
  }

  .cart-item-quantity {
    grid-column: 2;
  }

  .cart-item-subtotal {
    grid-column: 2;
    text-align: left;
  }

  .cart-item-remove {
    position: absolute;
    top: 16px;
    right: 0;
  }

  .cart-item {
    position: relative;
    padding-right: 40px;
  }
}

@media (max-width: 520px) {
  .checkout-modal {
    padding: 16px;
  }

  .page-title {
    font-size: 20px;
  }
}

/* 中古品注意書き */
.cart-notice {
  background: #fff8e1;
  border: 1px solid #ffcc02;
  border-radius: 6px;
  padding: 12px;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.6;
}

.cart-notice p {
  margin: 0 0 6px;
}

.cart-notice p:last-child {
  margin-bottom: 0;
}

.cart-notice .notice-warning {
  color: #d32f2f;
  font-weight: 600;
}

/* チェックアウト注意書き */
.checkout-notice {
  background: #fff8e1;
  border: 1px solid #ffcc02;
  border-radius: 6px;
  padding: 12px;
  margin: 16px 0;
  font-size: 13px;
}

.checkout-notice p {
  margin: 0 0 8px;
}

.checkout-notice ul {
  margin: 0;
  padding-left: 20px;
}

.checkout-notice li {
  margin-bottom: 4px;
}

/* 同意チェックボックス */
.checkout-agreement {
  margin: 16px 0;
  padding: 12px;
  background: #f5f5f5;
  border-radius: 6px;
}

.checkout-agreement label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.checkout-agreement input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* 警告通知スタイル */
.cart-notification.warning {
  background: #ff9800;
}
