/**
 * Anti-Slop Design Utilities
 *
 * Tsunavo らしい独自性を維持するためのデザインユーティリティ
 *
 * Usage:
 * - Import in global styles or specific components
 * - Use utility classes for consistent Anti-Slop patterns
 */

/* =============================================================================
   Background Layers
   3レイヤー: グラデーション + ノイズ + ドットパターン
   ============================================================================= */

/* Noise texture overlay */
.bg-noise {
  position: relative;
}

.bg-noise::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* Dot pattern overlay */
.bg-dots {
  position: relative;
}

.bg-dots::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(hsl(220, 10%, 80%) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.3;
  pointer-events: none;
}

/* Grid pattern overlay */
.bg-grid {
  position: relative;
}

.bg-grid::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, hsl(220, 10%, 90%) 1px, transparent 1px),
    linear-gradient(to bottom, hsl(220, 10%, 90%) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.5;
  pointer-events: none;
}

/* Combined 3-layer background */
.bg-tsunavo-layered {
  position: relative;
  background: linear-gradient(180deg, hsl(220, 20%, 98%) 0%, hsl(220, 15%, 95%) 100%);
}

.bg-tsunavo-layered::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  mix-blend-mode: overlay;
}

.bg-tsunavo-layered::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(hsl(220, 10%, 80%) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.15;
  pointer-events: none;
}

/* Dark variant */
.bg-tsunavo-dark {
  position: relative;
  background: linear-gradient(180deg, hsl(220, 15%, 12%) 0%, hsl(220, 20%, 6%) 100%);
}

.bg-tsunavo-dark::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.05;
  pointer-events: none;
}

/* =============================================================================
   Shadow Hierarchy
   カード shadow の階層化 (sm/md/lg)
   ============================================================================= */

.shadow-card-sm {
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.shadow-card-md {
  box-shadow:
    0 4px 6px -1px rgb(0 0 0 / 0.1),
    0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.shadow-card-lg {
  box-shadow:
    0 10px 15px -3px rgb(0 0 0 / 0.1),
    0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Elevated card with layered shadows */
.shadow-card-elevated {
  box-shadow:
    0 1px 2px 0 rgb(0 0 0 / 0.03),
    0 4px 8px -2px rgb(0 0 0 / 0.08),
    0 12px 24px -4px rgb(0 0 0 / 0.12);
}

/* =============================================================================
   Stagger Animation
   初回ロード 400ms stagger
   ============================================================================= */

/* Stagger container */
.stagger-container > * {
  opacity: 0;
  transform: translateY(8px);
  animation: stagger-fade-in 400ms ease-out forwards;
}

/* Stagger delays */
.stagger-container > *:nth-child(1) { animation-delay: 0ms; }
.stagger-container > *:nth-child(2) { animation-delay: 50ms; }
.stagger-container > *:nth-child(3) { animation-delay: 100ms; }
.stagger-container > *:nth-child(4) { animation-delay: 150ms; }
.stagger-container > *:nth-child(5) { animation-delay: 200ms; }
.stagger-container > *:nth-child(6) { animation-delay: 250ms; }
.stagger-container > *:nth-child(7) { animation-delay: 300ms; }
.stagger-container > *:nth-child(8) { animation-delay: 350ms; }

@keyframes stagger-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Alternative: slide from left */
.stagger-slide-container > * {
  opacity: 0;
  transform: translateX(-12px);
  animation: stagger-slide-in 400ms ease-out forwards;
}

.stagger-slide-container > *:nth-child(1) { animation-delay: 0ms; }
.stagger-slide-container > *:nth-child(2) { animation-delay: 50ms; }
.stagger-slide-container > *:nth-child(3) { animation-delay: 100ms; }
.stagger-slide-container > *:nth-child(4) { animation-delay: 150ms; }
.stagger-slide-container > *:nth-child(5) { animation-delay: 200ms; }

@keyframes stagger-slide-in {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* =============================================================================
   Interaction Feedback
   インタラクション即時フィードバック (150ms 以下)
   ============================================================================= */

.interactive-feedback {
  transition: all 150ms ease-out;
}

.interactive-feedback:hover {
  transform: translateY(-1px);
}

.interactive-feedback:active {
  transform: translateY(0);
  transition-duration: 50ms;
}

/* Button press effect */
.btn-feedback {
  transition:
    background-color 150ms ease-out,
    transform 100ms ease-out,
    box-shadow 150ms ease-out;
}

.btn-feedback:active {
  transform: scale(0.98);
}

/* =============================================================================
   2-Column Layout
   会話×CRM 向け 2 カラム最適化
   ============================================================================= */

.layout-conversation-crm {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 0;
  height: 100%;
}

/* Responsive variant */
@media (max-width: 1024px) {
  .layout-conversation-crm {
    grid-template-columns: 1fr;
  }
}

/* Asymmetric 3-column */
.layout-asymmetric {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 0;
  height: 100%;
}

@media (max-width: 1280px) {
  .layout-asymmetric {
    grid-template-columns: 240px 1fr;
  }
}

/* =============================================================================
   Unread Indicator
   未読スレッドの視覚的強調
   ============================================================================= */

.unread-indicator {
  position: relative;
}

.unread-indicator::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 70%;
  background: hsl(220, 100%, 58%);
  border-radius: 0 2px 2px 0;
}

/* Unread badge */
.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: white;
  background: hsl(340, 100%, 55%);
  border-radius: 10px;
}

/* =============================================================================
   Typography Utilities
   Tsunavo トークンに準拠
   ============================================================================= */

/* Heading with extreme weight contrast */
.heading-bold {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.heading-light {
  font-weight: 200;
  letter-spacing: 0.01em;
}

/* Size jump 3.5x */
.text-hero {
  font-size: 3.5rem; /* 56px */
  line-height: 1.1;
}

/* =============================================================================
   Empty State Actions
   空状態に「すぐできる行動」を表示
   ============================================================================= */

.empty-state-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
}

.empty-state-action .action-button {
  margin-top: 0.5rem;
}

