/* ==========================================================================
   まなちゃん用レシピ集 (Mana's Kitchen) - メインスタイルシート
   ライトモード標準規約に準拠した、清潔感・視認性・可愛らしさを兼ね備えたデザイン
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@400;500;700;800&family=Nunito:wght@400;600;700&display=swap');

:root {
  /* ライトモード標準カラーパレット */
  --bg-main: #fbf9f6;
  --bg-sub: #f4efe9;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  
  /* テキスト色（高コントラストで抜群の読みやすさ） */
  --text-main: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* キュート＆モダンなアクセントカラー */
  --primary: #ff6b8b;
  --primary-hover: #ff5277;
  --primary-light: #ffeef2;
  --primary-glow: rgba(255, 107, 139, 0.25);
  
  --secondary: #ff9f43;
  --secondary-light: #fff5eb;

  --accent-mint: #10b981;
  --accent-mint-light: #ecfdf5;

  --accent-blue: #3b82f6;
  --accent-blue-light: #eff6ff;

  --accent-purple: #8b5cf6;
  --accent-purple-light: #f5f3ff;

  /* 境界線とシャドウ */
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --border-primary: #ffccd5;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);
  --shadow-primary: 0 8px 24px rgba(255, 107, 139, 0.22);

  /* レイアウトと角丸 */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* フォント */
  --font-base: 'M PLUS Rounded 1c', 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* リセット＆ベース */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-base);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  transition: var(--transition);
}

input, textarea, select {
  font-family: inherit;
  color: var(--text-main);
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* アプリケーションコンテナ */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 60px;
  width: 100%;
  flex: 1;
}

/* ヘッダー */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 24px;
  border-bottom: 2px dashed #f0e6dd;
  margin-bottom: 24px;
  position: relative;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-badge {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: var(--shadow-primary);
  transform: rotate(-3deg);
  transition: var(--transition);
}

.brand-logo-badge:hover {
  transform: rotate(4deg) scale(1.06);
}

.brand-title {
  font-size: 24px;
  font-weight: 800;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.02em;
}

.brand-title span.cute-tag {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-primary);
}

.brand-sub {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
}

/* ヘッダーアクションボタン */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-cute {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.btn-cute:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, #ff6b8b 0%, #ff8e53 100%);
  color: #ffffff;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  filter: brightness(1.05);
  box-shadow: 0 10px 28px rgba(255, 107, 139, 0.35);
  transform: translateY(-2px);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #fdfbf8;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.btn-ai {
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.28);
}

.btn-ai:hover {
  filter: brightness(1.08);
  box-shadow: 0 10px 28px rgba(139, 92, 246, 0.4);
  transform: translateY(-2px);
}

.btn-icon-only {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
}

.btn-icon-only:hover {
  background: #f8fafc;
  color: var(--primary);
  border-color: var(--border-primary);
  transform: translateY(-2px);
}

/* 検索とコントロールバー */
.control-bar {
  background: #ffffff;
  padding: 14px 20px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid #f1ece5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 16px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  background: #f8fafc;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sort-select {
  padding: 10px 36px 10px 16px;
  background: #f8fafc url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") no-repeat right 12px center;
  background-size: 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  outline: none;
  cursor: pointer;
  appearance: none;
  transition: var(--transition);
}

.sort-select:focus {
  border-color: var(--primary);
  background-color: #ffffff;
}

.fav-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  background: #f8fafc;
  border: 1.5px solid var(--border-color);
  color: var(--text-secondary);
  transition: var(--transition);
}

.fav-filter-btn.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* ジャンル・カテゴリータブ */
.category-nav-wrapper {
  margin-bottom: 26px;
  position: relative;
}

.category-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}

.category-nav::-webkit-scrollbar {
  height: 4px;
}

.category-nav::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 4px;
}

.category-tab {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  background: #ffffff;
  color: var(--text-secondary);
  border: 1.5px solid #ece4dc;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}

.category-tab:hover {
  background: #fff8f8;
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.category-tab.active {
  background: linear-gradient(135deg, #ff6b8b 0%, #ff8e53 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(255, 107, 139, 0.32);
}

.category-count {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.06);
}

.category-tab.active .category-count {
  background: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

/* メインコンテンツエリア */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 4px;
}

/* フッター */
.app-footer {
  margin-top: auto;
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid #f1ece5;
}

.app-footer span.heart {
  color: var(--primary);
  display: inline-block;
  animation: heartPulse 1.6s infinite;
}

@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .app-container {
    padding: 0 16px 40px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 0;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .control-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-controls {
    justify-content: space-between;
  }
}
