/* ==========================================================================
   Shikakus - 資格用語集 専用スタイル (Glossary Modern UI)
   ========================================================================== */

/* コントロールパネル全体 */
.glossary-controls-wrapper {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
}

/* 検索ボックス */
.glossary-search-box {
  position: relative;
  margin-bottom: 1.25rem;
}

.glossary-search-box .search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 1.1rem;
  pointer-events: none;
}

.glossary-search-input {
  width: 100%;
  padding: 0.9rem 2.8rem 0.9rem 2.8rem;
  font-size: 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background-color: #f8fafc;
  color: #1e293b;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.glossary-search-input:focus {
  border-color: #345d4d;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(52, 93, 77, 0.15);
}

.glossary-clear-btn {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
}
.glossary-clear-btn:hover {
  color: #64748b;
}

/* フィルタ行 */
.glossary-filters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.glossary-filter-group {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
  min-width: 68px;
  padding-top: 0.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1;
}

.filter-btn {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 0.4rem 0.95rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.filter-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.filter-btn.active {
  background: #345d4d;
  color: #ffffff;
  border-color: #345d4d;
  box-shadow: 0 2px 6px rgba(52, 93, 77, 0.25);
}

.filter-btn-bookmark .star-gold {
  color: #f59e0b;
  font-size: 1rem;
}

.filter-btn-bookmark.active {
  background: #f59e0b;
  border-color: #d97706;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.filter-btn-bookmark.active .star-gold {
  color: #ffffff;
}

.filter-btn.btn-sm {
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

.kana-buttons {
  gap: 0.35rem;
}

/* ツールバー・件数表示 */
.glossary-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.count-display {
  font-size: 0.92rem;
  color: #64748b;
}

.count-display strong {
  color: #345d4d;
  font-size: 1.05rem;
}

.toggle-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.text-action-btn {
  background: none;
  border: none;
  color: #345d4d;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}
.text-action-btn:hover {
  background: #f0fdf4;
}

.separator {
  color: #cbd5e1;
}

/* 用語カード一覧 */
.glossary-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.glossary-item-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.glossary-item-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

/* カードヘッダー */
.glossary-item-header {
  padding: 1.1rem 1.4rem 0.8rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: #ffffff;
  user-select: none;
}

.item-title-wrap {
  flex: 1;
  text-align: left;
}

.item-meta-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}

.cat-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  background: #e6f4ea;
  color: #137333;
}

/* カテゴリ別カラーアクセント */
.cat-strategy, .cat-rights, .cat-life, .cat-basic, .cat-business {
  background: #e0f2fe; color: #0369a1;
}
.cat-management, .cat-takken_law, .cat-risk, .cat-commercial, .cat-hr {
  background: #fef3c7; color: #92400e;
}
.cat-technology, .cat-regulations, .cat-finance, .cat-closing, .cat-logistics {
  background: #ede9fe; color: #6d28d9;
}
.cat-tax, .cat-industrial, .cat-marketing {
  background: #fce7f3; color: #be185d;
}
.cat-real_estate, .cat-inheritance, .cat-grammar {
  background: #dcfce7; color: #15803d;
}

.star-badge {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 1px;
}
.star-badge.star-3 { color: #f59e0b; }
.star-badge.star-2 { color: #f59e0b; }
.star-badge.star-1 { color: #cbd5e1; }

.item-term {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.4;
  text-align: left;
}

.item-ruby {
  display: block;
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.15rem;
  text-align: left;
}

/* 右上ボタングループ（☆/★星ボタン ＋ 開閉矢印） */
.item-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: 0.8rem;
}

/* ☆ / ★ ブックマークボタン（文字なし、星マークのみ） */
.btn-glossary-star {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  color: #94a3b8;
  outline: none;
}

.btn-glossary-star .star-symbol {
  font-size: 1.35rem;
  line-height: 1;
  display: inline-block;
  transition: transform 0.2s ease;
  user-select: none;
}

.btn-glossary-star:hover {
  background: #fffbeb;
  border-color: #fde68a;
  color: #f59e0b;
  transform: scale(1.08);
}

/* ブックマーク登録済み（★） */
.btn-glossary-star.is-bookmarked {
  background: #fffbeb;
  border-color: #fef08a;
  color: #f59e0b;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.2);
}

.btn-glossary-star.is-bookmarked .star-symbol {
  animation: starPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes starPop {
  0% { transform: scale(0.6); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* アコーディオン開閉トグルボタン */
.btn-item-toggle {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.glossary-item-card:hover .btn-item-toggle {
  background: #345d4d;
  color: #ffffff;
  border-color: #345d4d;
}

.glossary-item-card.is-open .btn-item-toggle i {
  transform: rotate(180deg);
}

/* 要約ボックス */
.item-summary-box {
  padding: 0 1.4rem 1.1rem;
  cursor: pointer;
}

.item-summary {
  margin: 0;
  font-size: 0.95rem;
  color: #334155;
  line-height: 1.6;
}

/* 詳細解説ボディ（アコーディオン） */
.item-details-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
  background: #f8fafc;
  border-top: 1px dashed transparent;
}

.glossary-item-card.is-open .item-details-body {
  max-height: 1000px;
  transition: max-height 0.4s ease-in-out;
  border-top-color: #e2e8f0;
}

.details-inner {
  padding: 1.25rem 1.4rem 1.4rem;
}

.details-heading {
  margin: 0 0 0.5rem 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: #345d4d;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.details-desc {
  margin: 0;
  font-size: 0.92rem;
  color: #475569;
  line-height: 1.7;
}

/* 空状態 */
.glossary-empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  background: #ffffff;
  border: 2px dashed #e2e8f0;
  border-radius: 16px;
  margin: 2rem 0;
}

.empty-star-icon {
  font-size: 3.5rem;
  color: #cbd5e1;
  line-height: 1;
  margin-bottom: 0.8rem;
}

/* レスポンシブ調整 */
@media (max-width: 640px) {
  .glossary-controls-wrapper {
    padding: 1rem;
  }
  .item-term {
    font-size: 1.05rem;
  }
  .filter-label {
    min-width: 100%;
    margin-bottom: 0.2rem;
  }
}
