/* ==========================================================================
   統一コンテンツカードシステム - シンプル＆統一
   記事・Instagram・全コンテンツ共通
   ========================================================================== */

@layer components {

/* =============================================================================
 * 統一グリッドレイアウト（記事・Instagram共通）
 * ============================================================================= */

.article-grid,
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

/* Instagram専用グリッド: PC・タブレットで2列固定 */
.content-grid.is-content {
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  max-width: 100%;
}

.article-grid.is-empty,
.article-grid.is-loading,
.article-grid.is-error,
.content-grid.is-empty,
.content-grid.is-loading,
.content-grid.is-error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 40px 0;
}

.article-grid.is-empty .empty-state,
.article-grid.is-loading .empty-state,
.article-grid.is-error .empty-state,
.content-grid.is-empty .empty-state,
.content-grid.is-loading .empty-state,
.content-grid.is-error .empty-state {
  width: min(520px, 100%);
  cursor: default;
}

/* =============================================================================
 * 統一カード基本構造（記事・Instagram共通）
 * ============================================================================= */

.article-card,
.content-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* 選択強調 */
.article-card.card-selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15), 0 4px 12px rgba(0,0,0,0.12);
}

.article-card.card-selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #2563eb;
}

.article-card:hover,
.content-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: #3b82f6;
  transform: translateY(-2px);
}

/* =============================================================================
 * カードヘッダー
 * ============================================================================= */

.article-card-header {
  padding: 1.5rem 1.5rem 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 60px;
}

/* 選択チェックボックスがある場合はヘッダ左余白を確保 */
.article-card .article-card-checkbox + .article-card-header {
  padding-left: calc(1.5rem + 28px);
}

.article-card-checkbox {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0.75rem;
  z-index: 2;
}

.card-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.card-checkbox-label input.article-select {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-decorator {
  width: 20px;
  height: 20px;
  border: 2px solid #94a3b8;
  border-radius: 6px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.card-checkbox-label input:checked + .checkbox-decorator {
  background: #2563eb;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.card-checkbox-label input:checked + .checkbox-decorator::after {
  content: '\f00c'; /* fa-check */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 12px;
  color: #fff;
}

.article-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.article-card-date {
  font-size: 0.875rem;
  color: #64748b;
  font-weight: 500;
  white-space: nowrap;
  background: #f1f5f9;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

/* =============================================================================
 * カードコンテンツ
 * ============================================================================= */

.article-card-content {
  padding: 0.75rem 1.5rem 1.5rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.article-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.4;
  margin: 0;
  word-break: auto-phrase;
}

.article-card-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.article-card-title a:hover {
  color: #3b82f6;
}

.article-card-summary {
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =============================================================================
 * カテゴリバッジ
 * ============================================================================= */

.category-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  background-color: #64748b;
}

.category-badge.announcement { background-color: #4a90e2; }
.category-badge.event { background-color: #50c8a3; }
.category-badge.media { background-color: #9b59b6; }
.category-badge.important { background-color: #e74c3c; }
.category-badge.featured { background-color: #ff6f3c; }

/* =============================================================================
 * アクションエリア（管理画面のみ）
 * ============================================================================= */

.article-actions,
.content-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-top: 1px solid #e2e8f0;
  background: #fafbfc;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.article-status {
  display: flex;
  align-items: center;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.status-badge.published,
.status-badge.visible {
  background-color: #22c55e;
  color: white;
}

.status-badge.published:hover,
.status-badge.visible:hover {
  background-color: #16a34a;
  transform: scale(1.05) translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.status-badge.draft {
  background-color: #f59e0b;
  color: white;
}

.status-badge.draft:hover {
  background-color: #d97706;
  transform: scale(1.05) translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.action-buttons {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.action-buttons .btn {
  min-width: 84px;
  padding: 0.5rem 0.75rem;
  line-height: 1;
  transition: all 0.2s ease;
  font-size: 0.8rem;
}

.action-buttons .btn i {
  font-size: 0.75rem;
}

.action-buttons .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ダッシュボードの一覧は選択UI無しでヘッダーの密度を最適化 */
.dashboard-optimized .article-card .article-card-header {
  padding: 1rem 1rem 0.25rem 1rem;
}
.dashboard-optimized .article-card .article-card-content {
  padding: 0.5rem 1rem 1rem 1rem;
}

/* =============================================================================
 * エラー・空状態
 * ============================================================================= */

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem;
  color: #64748b;
  text-align: center;
  grid-column: 1 / -1;
}

.error-state i {
  font-size: 3rem;
  color: #f59e0b;
}

.error-state p {
  font-size: 1.125rem;
  margin: 0;
}

/* =============================================================================
 * レスポンシブ対応
 * ============================================================================= */

/* =============================================================================
 * Instagramコンテンツ専用スタイル
 * ============================================================================= */

/* =============================================================================
 * レスポンシブ対応
 * ============================================================================= */

/* モバイル (768px以下): 1列レイアウト */
@media (max-width: 768px) {
  .article-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .article-card-header {
    padding: 1rem 1rem 0 1rem;
  }

  .article-card .article-card-checkbox + .article-card-header {
    padding-left: calc(1rem + 28px);
  }

  .article-card-content {
    padding: 0.5rem 1rem 1rem 1rem;
  }
  
  .article-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }
  
  .action-buttons {
    justify-content: center;
    width: 100%;
  }
  
  .action-buttons .btn {
    flex: 1;
    min-width: 0;
    padding: 0.625rem 1rem;
  }
  
  .status-badge {
    align-self: center;
  }
}

@media (max-width: 480px) {
  .article-card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .article-card-meta {
    justify-content: center;
  }

  .article-card-date {
    text-align: center;
  }
}

/* =============================================================================
 * ニュースカード統合（LP側）
 * news.cssからの完全移行
 * ============================================================================= */

/* 
 * .news-card = .article-card のエイリアス
 * LP側（news.html, index.html）で使用
 * 管理画面の.article-cardと完全互換
 */

/* ニュースグリッド（LP側） */
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 48px;
}

.news-grid.news-grid--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
  min-height: 320px;
}

.news-grid.news-grid--empty .empty-state {
  margin: auto;
  width: min(520px, 100%);
  cursor: default;
}

.news-grid__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 320px;
  grid-column: 1 / -1;
  font-weight: 600;
  color: #2563eb;
  text-align: center;
}

/* ニュースカード基本構造 */
.news-card {
  /* article-cardと同じ基本スタイルを継承 */
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.news-card.instagram-empty-state,
.news-card.instagram-loading-state {
  align-items: center;
  justify-content: center;
  padding: 32px;
  min-height: 320px;
  text-align: center;
}

.news-card.instagram-empty-state .empty-state,
.news-card.instagram-loading-state .empty-state {
  margin: auto;
  width: min(480px, 100%);
}

.news-card.instagram-empty-state:hover,
.news-card.instagram-loading-state:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.news-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ニュースカードヘッダー */
.news-card__header {
  padding: 1.5rem 1.5rem 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 60px;
}

/* ニュースカードメタ情報 */
.news-card__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.news-card__date {
  font-size: 0.875rem;
  color: #64748b;
  font-weight: 500;
  white-space: nowrap;
  background: #f1f5f9;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

/* ニュースカードコンテンツ */
.news-card__body {
  padding: 0.75rem 1.5rem 1.5rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.news-card__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.4;
  margin: 0;
  word-break: auto-phrase;
}

.news-card__title-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.news-card__title-link:hover {
  color: #3b82f6;
}

.news-card__summary {
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ニュースカテゴリバッジ（既存のcategory-badgeと統合） */
.news-card__category {
  /* category-badgeと同じスタイル */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  background-color: #64748b;
}

/* カテゴリカラー統一 */
.news-card__category.announcement,
.news-category.announcement { 
  background-color: #4a90e2; 
}

.news-card__category.event,
.news-category.event { 
  background-color: #50c8a3; 
}

.news-card__category.media,
.news-category.media { 
  background-color: #9b59b6; 
}

.news-card__category.important,
.news-category.important { 
  background-color: #e74c3c; 
}

.news-card__category.featured,
.news-category.featured { 
  background-color: #ff6f3c; 
}

/* 「続きを読む」ボタン（LP固有） */
.news-card__read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #4a90e2;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
  align-self: flex-start;
  margin-top: auto;
}

.news-card__read-more:hover {
  background: #357abd;
  transform: translateX(4px);
}

.news-card__read-more i {
  transition: transform 0.2s ease;
}

.news-card__read-more:hover i {
  transform: translateX(4px);
}

/* =============================================================================
 * レスポンシブ対応（ニュースカード）
 * ============================================================================= */

/* タブレット */
@media (max-width: 1024px) {
  .news-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

/* モバイル */
@media (max-width: 768px) {
  .news-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 32px;
  }

  .news-card__header {
    padding: 1rem 1rem 0 1rem;
  }

  .news-card__body {
    padding: 0.5rem 1rem 1rem 1rem;
  }

  .news-card__title {
    font-size: 1.1rem;
  }

  .news-card__summary {
    font-size: 0.9rem;
  }
}

}
