
/* DBアイテムリストのスタイル */
.db-item-list {
  position: fixed;
  right: 0;
  top: 60px;
  width: 280px;
  height: calc(100vh - 140px);
  background: #fff;
  border-left: 2px solid var(--hex-border-color);
  z-index: 100;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.db-item-list.show {
  transform: translateX(0);
}

/* アコーディオンセクション */
.accordion-section {
  border-bottom: 1px solid var(--hex-border-color);
}

.accordion-section:last-child {
  border-bottom: none;
}

/* アコーディオンヘッダー */
.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: var(--theme-color1);
  color: white;
  cursor: pointer;
  transition: background-color 0.3s ease;
  user-select: none;
}

.accordion-header:hover {
  opacity: 0.7;
}

.accordion-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: bold;
  flex: 1;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.accordion-toggle {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  border-radius: 3px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.accordion-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.accordion-toggle.collapsed .fas {
  transform: rotate(-90deg);
}

/* アコーディオンコンテンツ */
.accordion-content {
  max-height: 300px;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: #f8f9fa;
}

.accordion-content.collapsed {
  max-height: 0;
}

.accordion-content:not(.collapsed) {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    max-height: 0;
  }
  to {
    max-height: 300px;
  }
}

/* スクロール可能なコンテナ */
.db-item-container {
  height: 100%;
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--hex-border-color) transparent;
}

.db-item-container::-webkit-scrollbar {
  width: 6px;
}

.db-item-container::-webkit-scrollbar-track {
  background: transparent;
}

.db-item-container::-webkit-scrollbar-thumb {
  background: var(--hex-border-color);
  border-radius: 3px;
}

.db-item-container::-webkit-scrollbar-thumb:hover {
  background: var(--theme-color2);
}

/* トグルボタンのスタイル */
#dbToggleBtn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 8px;
  border-radius: 3px;
  transition: background-color 0.3s;
}

#dbToggleBtn:hover {
  background: rgba(255, 255, 255, 0.2);
}

#dbToggleBtn.active {
  background: rgba(255, 255, 255, 0.3);
}

.db-item-header {
  border-bottom: none; /* アコーディオンヘッダーで統一 */
}

.refresh-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 5px;
  border-radius: 3px;
  transition: background-color 0.3s;
}

.refresh-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.db-item {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 5px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.db-item:hover {
  background: #e9ecef;
  border-color: var(--theme-color1);
  transform: translateX(2px);
}

.db-item.selected {
  background: var(--theme-color1);
  color: white;
  border-color: var(--theme-color1);
}

.db-item-title {
  font-weight: bold;
  margin-bottom: 5px;
  font-size: 13px;
  line-height: 1.3;
}

.db-item-meta {
  font-size: 11px;
  color: #6c757d;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
}

.db-item.selected .db-item-meta {
  color: rgba(255, 255, 255, 0.8);
}

.loading {
  text-align: center;
  padding: 20px;
  color: #6c757d;
  font-style: italic;
  font-size: 12px;
}

.db-item-empty {
  text-align: center;
  padding: 20px;
  color: #6c757d;
  font-size: 12px;
}

/* メインコンテンツエリアを調整 */
section#contents {
  margin-right: 0;
  transition: margin-right 0.3s ease;
}

section#contents.with-db-list {
  margin-right: 280px;
}

/* footerの調整 */
footer {
  transition: right 0.3s ease;
}

footer.with-db-list {
  right: 280px;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .db-item-list {
    width: 250px;
  }
  
  section#contents.with-db-list {
    margin-right: 250px;
  }
  
  footer.with-db-list {
    right: 250px;
  }

  .accordion-content {
    max-height: 200px;
  }

  .db-item-container {
    max-height: 200px;
  }
}

@media (max-width: 599px) {
  
  .db-item-list.show {
    transform: translateY(0);
  }
  
  section#contents.with-db-list {
    margin-right: 0;
    margin-bottom: 300px;
  }
  
  footer.with-db-list {
    right: 0;
  }

  .accordion-content {
    max-height: 150px;
  }

  .db-item-container {
    max-height: 150px;
  }

  #db-list{
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 99;;
  }

}
