* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  background: #f5f5f5;
  padding-top: 60px;
  padding-bottom: 70px;
}

/* ヘッダー */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #fff;
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
  font-size: 16px;
  margin: 0;
  color: #333;
}

.menu-btn, .list-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

.list-btn {
  position: relative;
}

.list-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #dc3545;
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 11px;
  min-width: 18px;
  text-align: center;
}

/* サイドメニュー */
.side-menu {
  position: fixed;
  top: 0;
  left: -80%;
  width: 80%;
  height: 100%;
  background: white;
  z-index: 2000;
  overflow-y: auto;
  transition: left 0.3s ease;
  box-shadow: 2px 0 10px rgba(0,0,0,0.2);
}

.side-menu.active {
  left: 0;
}

.menu-header {
  padding: 20px 15px;
  border-bottom: 2px solid #007bff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.menu-header h2 {
  margin: 0;
  font-size: 18px;
}

.close-menu {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
}

.accordion {
  border-bottom: 1px solid #eee;
}

.accordion-header {
  padding: 15px;
  background: #f8f9fa;
  cursor: pointer;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.accordion-icon {
  transition: transform 0.3s;
}

.accordion.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.accordion.active .accordion-content {
  max-height: 500px;
}

.accordion-link {
  display: block;
  padding: 12px 15px 12px 30px;
  color: #007bff;
  text-decoration: none;
  border-bottom: 1px solid #f0f0f0;
}

.accordion-link:active {
  background: #e7f3ff;
}

/* 選択リストパネル */
.selected-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  height: 100%;
  background: white;
  z-index: 2000;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.selected-panel.active {
  right: 0;
}

.panel-header {
  padding: 15px;
  border-bottom: 2px solid #007bff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
}

.panel-header h3 {
  margin: 0;
  font-size: 18px;
}

.close-panel {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
}

.panel-footer {
  padding: 15px;
  border-top: 1px solid #ddd;
  background: #f8f9fa;
  display: flex;
  gap: 10px;
}

.panel-footer button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.btn-reset {
  background: #6c757d;
  color: white;
}

.btn-export {
  background: #28a745;
  color: white;
}

/* オーバーレイ */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1500;
  display: none;
}

.overlay.active {
  display: block;
}

/* メインコンテンツ */
main {
  padding: 15px;
}

.manufacturer-section {
  margin-bottom: 30px;
  background: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.manufacturer-section h2 {
  margin: 0 0 15px 0;
  font-size: 20px;
  color: #333;
  border-bottom: 2px solid #007bff;
  padding-bottom: 8px;
}

.group-section {
  margin-bottom: 20px;
}

.group-section h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
  color: #555;
}

/*表示列数*/
.fabric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); 
  gap: 15px;
}

.fabric-card {
  background: #fafafa;
  border: 2px solid #eee;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.fabric-card.selected {
  border-color: #007bff;
  background: #f0f8ff;
}

/*イメージのサイズ設定*/
.fabric-card img {
  width: 100%;
  height: auto;
  max-height: 180px;
  object-fit: contain;
  border-radius: 4px;
  margin-bottom: 8px;
}

.fabric-card input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 8px 0;
}

.fabric-name {
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 4px;
}

.fabric-type {
  font-size: 12px;
  color: #666;
  margin-bottom: 8px;
}

.comment-input {
  width: 100%;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  margin-top: 4px;
}

.char-counter {
  font-size: 10px;
  color: #999;
  margin-top: 2px;
}

/* 選択アイテム */
.selected-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.selected-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-bottom: 10px;
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: grab;
}

.selected-item:active {
  cursor: grabbing;
}

.selected-item .number {
  font-weight: bold;
  color: #007bff;
  font-size: 16px;
  min-width: 25px;
}

.selected-item img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  border-radius: 4px;
}

.selected-item .info {
  flex: 1;
  min-width: 0;
}

.selected-item .maker {
  font-size: 11px;
  color: #666;
}

.selected-item .name {
  font-weight: bold;
  font-size: 13px;
  margin: 2px 0;
}

.selected-item .group {
  font-size: 11px;
  color: #888;
}

.selected-item .comment {
  background: #e3f2fd;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: #1565c0;
  margin-top: 4px;
}

.no-selection {
  text-align: center;
  color: #999;
  padding: 40px 20px;
  font-style: italic;
}

.image-placeholder {
  width: 100%;
  height: 120px;
  background: #e0e0e0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #666;
  margin-bottom: 8px;
}

.sortable-ghost {
  opacity: 0.4;
}