/* ============================
   LINE GROUP BBS - Design System 2026
   Clean, Minimal, Professional
   ============================ */

/* ===== CSS Variables ===== */
:root {
  --bg: #F7F8FC;
  --bg-card: #ffffff;
  --bg-subtle: #F1F3F9;
  --bg-hover: #EBF0F7;
  --text: #181B25;
  --text-secondary: #525868;
  --text-muted: #8C93A8;
  --border: #E4E8F0;
  --border-hover: #D0D5E0;
  --line: #06C755;
  --line-dark: #059B40;
  --line-light: #E5F8ED;
  --accent: #4F7DF3;
  --accent-light: #EBF0FE;
  --ocean: #0EA5E9;
  --warm: #F59E0B;
  --warm-light: #FFF8E6;
  --purple: #7C5CFC;
  --rose: #EF476F;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.03);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  --shadow: 0 4px 12px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.03);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.03);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.08);
  --transition: 0.2s ease;
  --spring: 0.35s cubic-bezier(0.22,1,0.36,1);
}

[data-theme="dark"] {
  --bg: #0D0F14;
  --bg-card: #16181F;
  --bg-subtle: #1C1F28;
  --bg-hover: #23262F;
  --text: #E6E9F0;
  --text-secondary: #8A91A5;
  --text-muted: #545B70;
  --border: #262A34;
  --border-hover: #33374A;
  --line-light: rgba(6,199,85,0.08);
  --accent-light: rgba(79,125,243,0.08);
  --warm-light: rgba(245,158,11,0.08);
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.12);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.16);
  --shadow: 0 4px 12px rgba(0,0,0,0.18);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.22);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.28);
}

/* ===== BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ===== HEADER ===== */
.header-glass {
  background: rgba(247,248,252,0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
[data-theme="dark"] .header-glass {
  background: rgba(13,15,20,0.92);
}

/* ===== LOGO ===== */
.logo-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--line);
  transition: transform var(--transition);
}
.logo-icon:hover { transform: scale(1.04); }

.logo-icon-sm {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--line);
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}
.card-hover { cursor: pointer; }
.card-hover:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.card-hover:active { transform: translateY(0); }

.card-gradient {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--line);
  color: white;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-size: 14px;
}
.btn-primary:hover {
  background: var(--line-dark);
  box-shadow: 0 4px 12px rgba(6,199,85,0.25);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
}
.btn-ghost:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  color: var(--text);
}

.btn-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
  font-size: 15px;
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-hover);
}

/* ===== NAV PILLS ===== */
.nav-pill {
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
}
.nav-pill.active {
  background: var(--line);
  color: white;
}
.nav-pill:not(.active):hover {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.nav-pill-fire {
  background: var(--accent);
  color: white;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  font-size: 13px;
}
.nav-pill-fire:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ===== HERO ===== */
.hero-section {
  position: relative;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background: linear-gradient(145deg, #06C755 0%, #04A94B 40%, #038D3D 60%, #087A4C 100%);
}
.hero-bg::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 80% at 70% 20%, rgba(255,255,255,0.1), transparent);
}
.hero-fade {
  position: absolute; bottom: 0; left: 0; right: 0; height: 60px;
  background: linear-gradient(to top, var(--bg), transparent);
}

.hero-gradient-sm {
  background: linear-gradient(135deg, #06C755 0%, #04A94B 50%, #038D3D 100%);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

/* ===== STAT ===== */
.stat-item { text-align: center; }
.stat-divider {
  width: 1px; height: 40px;
  background: rgba(255,255,255,0.15);
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px 16px;
  text-align: center;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* ===== CATEGORY PILLS ===== */
.cat-pill {
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  user-select: none;
  border: none;
}
.cat-pill.active {
  color: white;
}
.cat-pill:not(.active) {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.cat-pill:not(.active):hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
}

/* ===== SORT BUTTONS ===== */
.sort-btn {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-muted);
}
.sort-btn:hover { color: var(--text-secondary); background: var(--bg-subtle); }
.sort-btn.active {
  background: var(--line-light);
  color: var(--line);
  font-weight: 700;
}

/* ===== INPUTS ===== */
.search-input {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 14px;
  background: var(--bg-subtle);
  transition: all var(--transition);
  color: var(--text);
  outline: none;
}
.search-input:focus {
  border-color: var(--line);
  box-shadow: 0 0 0 3px rgba(6,199,85,0.08);
  background: var(--bg-card);
}
.search-input::placeholder { color: var(--text-muted); }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* ===== BADGES ===== */
.icon-badge {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-badge-sm {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.close-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg-subtle);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none;
  transition: all var(--transition);
  color: var(--text-muted);
}
.close-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ===== THREAD CARDS ===== */
.thread-img {
  width: 80px; height: 80px;
  object-fit: cover;
  border-radius: var(--radius);
  flex-shrink: 0;
  border: 1px solid var(--border);
}
@media (min-width: 640px) { .thread-img { width: 100px; height: 100px; } }

.thread-pinned {
  border-left: 3px solid var(--line);
}

/* ===== LIVE DOT ===== */
.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #06C755;
  display: inline-block;
  animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(6,199,85,0.4); }
  50% { box-shadow: 0 0 0 5px rgba(6,199,85,0); }
}

/* ===== NEW BADGE ===== */
.new-badge {
  display: inline-flex;
  font-size: 9px; font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--rose);
  color: white;
  letter-spacing: 0.3px;
}

/* ===== FAB ===== */
.fab-main {
  background: var(--line);
  color: white;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(6,199,85,0.3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none;
  transition: all var(--transition);
}
.fab-main:hover { transform: scale(1.06); box-shadow: 0 6px 24px rgba(6,199,85,0.35); }
.fab-main:active { transform: scale(0.96); }

/* ===== MOBILE SHEET ===== */
.mobile-sheet {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 -4px 32px rgba(0,0,0,0.08);
  animation: slideUp 0.35s var(--spring) both;
}
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border-hover);
  border-radius: 100px;
  margin: 0 auto 16px;
}

/* ===== MODAL ===== */
.modal-overlay {
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ===== ANIMATIONS ===== */
.fade-up { animation: fadeUp 0.4s var(--spring) both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

.scale-in { animation: scaleIn 0.25s var(--spring) both; }
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* Staggered animation */
.stagger > * { animation: fadeUp 0.4s var(--spring) both; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.04s; }
.stagger > *:nth-child(3) { animation-delay: 0.06s; }
.stagger > *:nth-child(4) { animation-delay: 0.08s; }
.stagger > *:nth-child(5) { animation-delay: 0.10s; }
.stagger > *:nth-child(6) { animation-delay: 0.12s; }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--bg-subtle) 30%, var(--bg-hover) 50%, var(--bg-subtle) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Spinner */
.spinner {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
}
.spinner::after {
  content: '';
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--line);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== SCROLLBAR ===== */
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
.chat-scroll::-webkit-scrollbar { width: 3px; }
.chat-scroll::-webkit-scrollbar-track { background: transparent; }
.chat-scroll::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 100px; }

/* ===== RANK BADGES ===== */
.rank-1 { background: #F59E0B; color: white; }
.rank-2 { background: #94A3B8; color: white; }
.rank-3 { background: #D97706; color: white; }
.rank-default { background: var(--bg-subtle); color: var(--text-muted); }

/* ===== CHAT BUBBLES ===== */
.chat-bubble {
  max-width: 80%;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.7;
  animation: fadeUp 0.25s ease both;
}
.chat-bubble-other {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-bubble-system {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  max-width: 100%;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  z-index: 999;
  box-shadow: var(--shadow-xl);
  opacity: 0;
  transition: all 0.3s var(--spring);
  white-space: nowrap;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== FOOTER ===== */
.footer-section {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

/* ===== CMD CARD ===== */
.cmd-card {
  background: var(--bg-subtle);
  border-radius: var(--radius);
  padding: 14px 18px;
  transition: all var(--transition);
  border: 1px solid transparent;
}
.cmd-card:hover {
  border-color: var(--border);
  background: var(--bg-card);
}

/* ===== ACTIVITY BAR ===== */
.activity-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--bg-subtle);
  overflow: hidden;
}
.activity-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--line);
  transition: width 0.6s ease;
}

/* ===== GROUP TABLE ===== */
.group-row { transition: background var(--transition); }
.group-row:hover { background: var(--bg-subtle); }

/* ===== PAGE TRANSITION ===== */
.page-enter { animation: fadeUp 0.35s var(--spring) both; }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .hero-section .text-3xl { font-size: 1.5rem; }
  .stat-divider { height: 32px; }
  .card { border-radius: var(--radius); }
}

@media print { .header-glass, .fab-main, .mobile-sheet { display: none; } }
