:root {
  --header-height: 80px;
  --selected-list-width: 300px;
  --fabric-img-max-width: 150px;
}

body { 
  font-family: sans-serif; 
  margin: 0; 
  padding-top: var(--header-height);
  background: #f5f5f5;
}

header {
  position: fixed; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: var(--header-height);
  background: #fff; 
  border-bottom: 2px solid #ddd;
  display: flex; 
  align-items: center; 
  justify-content: space-between;
  padding: 0 20px; 
  box-sizing: border-box; 
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.buttons { 
  display: flex; 
  gap: 10px; 
}

button {
  padding: 10px 20px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

button:hover {
  background: #f0f0f0;
}

.manufacturer-links {
  display: flex;
  gap: 15px;
}

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown > a {
  cursor: pointer;
  font-weight: bold;
  padding: 5px 10px;
  display: inline-block;
  color: #007bff;
  text-decoration: none;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #fff;
  min-width: 180px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  z-index: 1001;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.dropdown-content a {
  display: block;
  padding: 8px 12px;
  text-decoration: none;
  color: #007bff;
}

.dropdown-content a:hover {
  background-color: #e7f3ff;
}

.dropdown:hover .dropdown-content {
  display: block;
}

main { 
  padding: 20px; 
  margin-right: var(--selected-list-width);
}

.manufacturer-section { 
  margin-bottom: 50px;
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.manufacturer-section h2 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 24px;
  border-bottom: 3px solid #007bff;
  padding-bottom: 10px;
}

.group-section {
  margin-bottom: 30px;
}

.group-section h3 {
  margin: 0 0 15px 0;
  color: #555;
  font-size: 18px;
  font-weight: normal;
}

.fabric-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.fabric-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 300px;
  padding: 10px;
  border: 2px solid #eee;
  border-radius: 8px;
  background: #fafafa;
  transition: all 0.2s;
}

.fabric-card:hover {
  border-color: #007bff;
  box-shadow: 0 4px 12px rgba(0,123,255,0.2);
  transform: translateY(-2px);
}

.fabric-card.selected {
  border-color: #007bff;
  background: #f0f8ff;
}

/*カードの画像サイズ設定*/
.fabric-card img {
  max-width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: contain;
  border: 1px solid #ddd;
  border-radius: 5px;
  margin-bottom: 10px;
}

.fabric-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-bottom: 8px;
  cursor: pointer;
}

.fabric-info {
  width: 100%;
  text-align: center;
}

.fabric-name {
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 3px;
  word-wrap: break-word;
}

.fabric-type {
  font-size: 12px;
  color: #666;
  margin-bottom: 8px;
}

.comment-input {
  width: 100%;
  padding: 5px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 12px;
  box-sizing: border-box;
}

.comment-input:focus {
  outline: none;
  border-color: #007bff;
}

.char-counter {
  font-size: 10px;
  color: #999;
  margin-top: 2px;
}

#selectedListArea {
  position: fixed;
  top: var(--header-height);
  right: 0;
  width: var(--selected-list-width);
  height: calc(100% - var(--header-height));
  overflow-y: auto;
  background: #f9f9f9;
  border-left: 2px solid #ddd;
  padding: 15px;
  box-sizing: border-box;
  z-index: 999;
}

#selectedListArea h3 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 18px;
  border-bottom: 2px solid #007bff;
  padding-bottom: 8px;
}

.selected-list { 
  padding: 0; 
  margin: 0; 
  list-style: none; 
}

.selected-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 5px;
  cursor: grab;
  transition: all 0.2s;
}

.selected-item:active {
  cursor: grabbing;
}

.selected-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.selected-item img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border: 1px solid #ddd;
  border-radius: 3px;
}

.selected-item .number { 
  font-weight: bold; 
  min-width: 25px; 
  color: #007bff;
  font-size: 16px;
}

.selected-item .info {
  flex: 1;
  min-width: 0;
}

.selected-item .name { 
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 3px;
  word-wrap: break-word;
}

.selected-item .comment { 
  background: #e3f2fd; 
  padding: 3px 8px; 
  border-radius: 3px; 
  font-size: 11px; 
  color: #1565c0;
  word-wrap: break-word;
}

.no-selection { 
  color: #999; 
  font-style: italic; 
  text-align: center; 
  padding: 20px; 
}

.sortable-ghost {
  opacity: 0.4;
  background: #e3f2fd;
}

.sortable-drag {
  cursor: grabbing;
}

#errorMsg { 
  color: #d32f2f; 
  background: #ffebee;
  padding: 12px;
  border-radius: 5px;
  margin-bottom: 20px;
  display: none;
}

.image-placeholder {
  width: 150px;
  height: 150px;
  background: #e0e0e0;
  border: 1px solid #ccc;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #666;
  margin-bottom: 10px;
}

@media (max-width: 1024px) {
  main {
    margin-right: 0;
    padding-bottom: 80px;
  }
  
  #selectedListArea {
    display: none;
  }
}