/*
Theme Name:  Thailand Insight
Theme URI:   https://thainews-insight.com
Author:      Thailand Insight Team
Description: タイのニュースを日本語でお届けするカスタムニュースポータルテーマ
Version:     1.0.0
Text Domain: thailand-insight
*/

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700;900&family=Noto+Sans+Thai:wght@300;400;600&family=Inter:wght@300;400;500;600;700&display=swap');

/* =============================================
   CSS カスタムプロパティ
   ============================================= */
:root {
  --white:        #ffffff;
  --bg:           #f4f5f7;
  --bg-card:      #ffffff;
  --bg-dark:      #001859;
  --bg-header:    #00247D;
  --bg-nav:       #001F6B;
  --bg-ticker:    #CE1126;

  --primary:      #00247D;
  --accent:       #CE1126;
  --accent2:      #e9c46a;
  --gold:         #e9c46a;
  --teal:         #2a9d8f;

  --text:         #1a1a2e;
  --text-sub:     #555e6a;
  --text-muted:   #8a9ab0;
  --text-white:   #ffffff;

  --border:       #e0e4ea;
  --border-dark:  #001859;

  --radius:       8px;
  --radius-sm:    4px;
  --shadow:       0 2px 12px rgba(0,0,0,0.08);
  --shadow-md:    0 4px 24px rgba(0,0,0,0.13);
  --transition:   0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 15px; }

body {
  font-family: 'Noto Sans JP', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }

/* =============================================
   HEADER TOP BAR
   ============================================= */
.header-top-bar {
  background: var(--bg-dark);
  padding: 4px 0;
  font-size: 12px;
  color: #aab;
}
.header-top-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header-date { font-weight: 500; }
.header-slogan { letter-spacing: 0.05em; }

/* =============================================
   HEADER MAIN
   ============================================= */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.header-main {
  background: var(--bg-header);
  padding: 10px 0;
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-flag { font-size: 28px; line-height: 1; }
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-text-jp {
  font-size: 17px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.03em;
}
.logo-text-sub {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.1em;
  font-weight: 500;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
}
.nav-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.75);
  font-size: 13px;
  font-weight: 500;
  border-radius: 20px;
  transition: var(--transition);
  white-space: nowrap;
  letter-spacing: 0.03em;
}
.nav-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.nav-btn.active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.header-right { margin-left: auto; flex-shrink: 0; }
.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255,255,255,0.8);
}
.live-dot {
  width: 8px; height: 8px;
  background: #4caf50;
  border-radius: 50%;
  animation: pulse 2s ease infinite;
}
@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50% { opacity:0.5; transform:scale(1.2); }
}

/* =============================================
   速報ティッカー
   ============================================= */
.ticker-wrap {
  background: var(--bg-ticker);
  display: flex;
  align-items: center;
  height: 34px;
  overflow: hidden;
}
.ticker-label {
  background: rgba(0,0,0,0.3);
  color: #fff;
  padding: 0 14px;
  height: 100%;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.ticker-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  color: var(--white);
  font-size: 13px;
  white-space: nowrap;
  animation: ticker-scroll 40s linear infinite;
  cursor: pointer;
}
.ticker-item { display: inline-block; padding: 0 32px; }
.ticker-item:hover { opacity: 0.75; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* =============================================
   メインレイアウト
   ============================================= */
.main-layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px;
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 24px;
  align-items: start;
}

/* セクション共通ヘッダー */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.title-accent {
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.news-count-badge {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 10px;
  border-radius: 20px;
}

/* =============================================
   フィーチャーカード（TOPニュース3件）
   ============================================= */
.feature-section { margin-bottom: 28px; }
.feature-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 12px;
}
.feature-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.feature-card-img {
  height: 140px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.feature-card--main .feature-card-img { height: 180px; }
.feature-card-overlay {
  position: absolute;
  top: 10px; left: 10px;
}
.feature-cat-badge {
  font-size: 10px;
  color: #fff;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.feature-card-emoji { font-size: 36px; opacity: 0.85; }
.feature-card-body { padding: 14px; flex: 1; }
.feature-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
}
.feature-source { color: var(--text-muted); font-weight: 600; }
.feature-time { color: var(--text-muted); }
.feature-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.5;
}
.feature-card--main .feature-card-title { font-size: 16px; }
.feature-card-summary { font-size: 12px; color: var(--text-sub); line-height: 1.55; }

/* =============================================
   モバイルカテゴリバー
   ============================================= */
.mobile-cats { display: none; overflow-x: auto; margin-bottom: 16px; }
.mobile-cats-inner {
  display: flex;
  gap: 8px;
  padding-bottom: 4px;
  width: max-content;
}
.mcat-btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-sub);
  font-size: 13px;
  white-space: nowrap;
  transition: var(--transition);
}
.mcat-btn:hover { border-color: var(--primary); color: var(--primary); }
.mcat-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* =============================================
   ニュースリスト
   ============================================= */
.date-group { margin-bottom: 24px; }
.date-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  background: var(--bg-card);
  border-left: 4px solid var(--accent);
  padding: 6px 14px;
  margin-bottom: 2px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.news-item {
  background: var(--bg-card);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}
.news-item:first-of-type { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.news-item:last-of-type { border-bottom: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.news-item:hover { background: #f8f9ff; }
.news-item-thumb {
  width: 90px;
  height: 68px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.news-item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.news-item-emoji { font-size: 28px; }
.news-item-body { flex: 1; min-width: 0; }
.news-item-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 11px; }
.item-source { font-weight: 700; color: var(--text-muted); }
.item-cat { font-size: 11px; font-weight: 600; }
.item-time { color: var(--text-muted); margin-left: auto; }
.news-item-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-item-summary {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-item-footer { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.item-tag {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 20px;
}
.item-read-more { margin-left: auto; font-size: 12px; color: var(--accent); font-weight: 600; }

/* ローディング・空状態 */
.loading-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  background: var(--bg-card);
  border-radius: var(--radius);
}
.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-card);
  border-radius: var(--radius);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }

/* =============================================
   サイドバー
   ============================================= */
.sidebar {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sidebar-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.sidebar-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  letter-spacing: 0.05em;
}
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-item { text-align: center; padding: 10px 6px; background: var(--bg); border-radius: var(--radius-sm); }
.stat-num { font-size: 20px; font-weight: 900; color: var(--accent); line-height: 1.1; }
.stat-lbl { font-size: 10px; color: var(--text-muted); margin-top: 3px; letter-spacing: 0.08em; }
.cat-list { display: flex; flex-direction: column; gap: 2px; }
.cat-btn {
  width: 100%;
  background: none;
  border: none;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-sub);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-align: left;
}
.cat-btn:hover { background: var(--bg); color: var(--primary); }
.cat-btn.active { background: #ffeef0; color: var(--accent); font-weight: 700; }
.cat-count {
  font-size: 11px;
  background: var(--bg);
  color: var(--text-muted);
  padding: 1px 8px;
  border-radius: 12px;
  min-width: 28px;
  text-align: center;
}
.cat-btn.active .cat-count { background: var(--accent); color: #fff; }
.media-list { display: flex; flex-direction: column; gap: 4px; }
.media-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-sub);
  transition: var(--transition);
}
.media-item:hover { background: var(--bg); color: var(--primary); }
.media-icon { font-size: 16px; }
.media-name { flex: 1; font-weight: 500; }
.media-lang {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.media-lang.th { background: #e8f5e9; color: #2e7d32; }
.media-lang.en { background: #e3f2fd; color: #1565c0; }
.about-card { background: linear-gradient(135deg, #001859 0%, #00247D 100%); color: #fff; }
.about-card .sidebar-card-title { color: var(--gold); border-color: var(--gold); }
.about-text { font-size: 12px; line-height: 1.7; color: rgba(255,255,255,0.85); }

/* =============================================
   フィルタコントロール（検索・ソート）
   ============================================= */
.filter-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search-box { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 12px; font-size: 14px; color: var(--text-muted); }
.search-input {
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-family: inherit;
  width: 180px;
  background: var(--bg-card);
  color: var(--text);
  transition: var(--transition);
}
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(206,17,38,0.1); width: 220px; }
.sort-select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
}

/* エリア別サブフィルター */
.subfilters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0;
  margin-bottom: 4px;
}
.sub-btn {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-sub);
  transition: var(--transition);
}
.sub-btn:hover { border-color: var(--accent); color: var(--accent); }
.sub-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

/* =============================================
   記事詳細ページ
   ============================================= */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  font-size: 13px;
  color: var(--text-sub);
  transition: var(--transition);
}
.back-btn:hover { background: var(--bg); color: var(--primary); }
.article-detail {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.article-detail-image {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}
.article-detail-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 12px;
  flex-wrap: wrap;
}
.article-detail-title {
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 4px;
}
.article-source-link { padding-top: 16px; border-top: 1px solid var(--border); }
.source-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
}
.source-link-btn:hover { background: var(--accent); }
.article-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.article-summary { font-size: 16px; line-height: 1.8; color: var(--text-sub); margin-bottom: 24px; }
.article-explanation {
  font-size: 15px; line-height: 1.8; color: var(--text-sub);
  margin-bottom: 24px; padding: 16px 20px;
  background: var(--bg); border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
}

/* 関連ニュース */
.related-news-section {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.related-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.related-title::before { content: "🔗"; }
.related-list { display: flex; flex-direction: column; gap: 12px; }

/* =============================================
   フッター
   ============================================= */
.site-footer {
  background: var(--bg-dark);
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 24px;
  font-size: 12px;
  margin-top: 48px;
}

/* =============================================
   レスポンシブ
   ============================================= */
@media (max-width: 1024px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}
@media (max-width: 768px) {
  .feature-grid { grid-template-columns: 1fr; }
  .feature-card--main .feature-card-img { height: 160px; }
  .header-nav { display: none; }
  .mobile-cats { display: block; }
  .main-layout { padding: 12px; gap: 16px; }
}
@media (max-width: 600px) {
  .filter-controls { width: 100%; margin-top: 8px; }
  .search-box { flex: 1; }
  .search-input { width: 100%; }
  .article-detail { padding: 18px; }
  .article-detail-title { font-size: 18px; }
}
