/* ============================
   フードアプリ - メインCSS
   ============================ */
:root {
  --primary: #ff6b35;
  --primary-dark: #e55a27;
  --secondary: #4a90d9;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --bg: #f8f5f0;
  --card-bg: #ffffff;
  --text: #2d2d2d;
  --text-muted: #666;
  --border: #e0d8d0;
  --homemade-color: #ff8c00;
  --restaurant-color: #4169e1;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

/* Navbar */
.navbar {
  background: #fff;
  border-bottom: 2px solid var(--primary);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.nav-container {
  max-width: 1200px; margin: 0 auto;
  padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; position: relative;
}
.nav-brand {
  font-size: 1.1rem; font-weight: 700;
  color: var(--primary); text-decoration: none;
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 200px;
}
.nav-links {
  display: flex; align-items: center; gap: 12px;
}
.nav-links a {
  color: var(--text); text-decoration: none; font-size: 0.88rem;
  padding: 4px 6px; border-radius: 6px;
  transition: color 0.2s; white-space: nowrap;
}
.nav-links a:hover { color: var(--primary); }
.admin-link { color: var(--secondary) !important; font-weight: 600; }

/* ハンバーガーボタン（PC では非表示） */
.nav-toggle {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 40px; height: 40px;
  background: none; border: none; cursor: pointer; padding: 4px;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block; width: 24px; height: 2px;
  background: var(--primary); border-radius: 2px;
  transition: all 0.3s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* モバイル */
@media (max-width: 640px) {
  .nav-brand { font-size: 0.95rem; max-width: 160px; }
  .nav-toggle { display: flex; }
  .nav-links {
    display: none;
    position: absolute; top: 56px; left: 0; right: 0;
    background: #fff; border-top: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    flex-direction: column; align-items: stretch;
    gap: 0; padding: 8px 0; z-index: 200;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: 12px 20px; font-size: 0.95rem;
    border-radius: 0; border-bottom: 1px solid #f5f0eb;
  }
  .nav-links a:last-child { border-bottom: none; }
  .btn-primary-sm, .btn-outline-sm {
    margin: 4px 12px; border-radius: 8px !important;
    text-align: center; padding: 10px 16px !important;
  }
}

/* Container */
.container {
  max-width: 1200px; margin: 0 auto;
  padding: 24px 20px;
}

/* Alerts */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  margin-bottom: 16px; font-size: 0.9rem;
}
.alert-success { background: #d4edda; color: #155724; border-left: 4px solid #28a745; }
.alert-danger { background: #f8d7da; color: #721c24; border-left: 4px solid #dc3545; }
.alert-warning { background: #fff3cd; color: #856404; border-left: 4px solid #ffc107; }
.alert-info { background: #d1ecf1; color: #0c5460; border-left: 4px solid #17a2b8; }

/* Buttons */
.btn-primary {
  background: var(--primary); color: white; border: none;
  padding: 10px 24px; border-radius: var(--radius);
  font-size: 0.95rem; font-weight: 500; cursor: pointer;
  text-decoration: none; display: inline-block;
  transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-primary-sm {
  background: var(--primary); color: white !important; border: none;
  padding: 5px 14px; border-radius: 8px; font-size: 0.85rem;
  cursor: pointer; text-decoration: none; display: inline-block;
  transition: background 0.2s;
}
.btn-primary-sm:hover { background: var(--primary-dark) !important; color: white !important; }

.btn-secondary {
  background: #f0f0f0; color: var(--text); border: none;
  padding: 10px 24px; border-radius: var(--radius);
  font-size: 0.95rem; cursor: pointer;
  text-decoration: none; display: inline-block;
  transition: background 0.2s;
}
.btn-secondary:hover { background: #e0e0e0; }

.btn-outline-sm {
  background: transparent; color: var(--primary) !important;
  border: 1.5px solid var(--primary);
  padding: 4px 12px; border-radius: 8px; font-size: 0.85rem;
  cursor: pointer; text-decoration: none; display: inline-block;
}

.btn-danger {
  background: var(--danger); color: white; border: none;
  padding: 10px 20px; border-radius: var(--radius);
  font-size: 0.9rem; cursor: pointer;
  transition: background 0.2s;
}
.btn-danger:hover { background: #c82333; }

.btn-sm-secondary {
  background: #f0f0f0; color: var(--text); border: none;
  padding: 4px 10px; border-radius: 6px; font-size: 0.8rem;
  cursor: pointer; text-decoration: none; display: inline-block;
}
.btn-sm-danger {
  background: var(--danger); color: white; border: none;
  padding: 4px 10px; border-radius: 6px; font-size: 0.8rem; cursor: pointer;
}
.btn-sm-danger:disabled, .btn-sm-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

/* Auth */
.auth-container {
  max-width: 440px; margin: 40px auto;
}
.auth-card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 40px; box-shadow: var(--shadow);
}
.auth-title { font-size: 1.6rem; text-align: center; color: var(--primary); margin-bottom: 8px; }
.auth-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 28px; font-size: 0.9rem; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-link { text-align: center; margin-top: 20px; font-size: 0.9rem; color: var(--text-muted); }
.auth-link a { color: var(--primary); }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-weight: 500; font-size: 0.9rem; color: var(--text); }
.form-control {
  padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 0.95rem; font-family: inherit;
  transition: border-color 0.2s;
  background: white;
}
.form-control:focus { outline: none; border-color: var(--primary); }
textarea.form-control { resize: vertical; min-height: 100px; }
.error { color: var(--danger); font-size: 0.82rem; }

.form-check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }

/* Post Form */
.form-container {
  max-width: 680px; margin: 0 auto;
}
.form-title { font-size: 1.5rem; margin-bottom: 28px; color: var(--primary); }
.post-form { display: flex; flex-direction: column; gap: 20px; }

/* Image Upload */
.image-upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius);
  text-align: center; cursor: pointer;
  transition: border-color 0.2s; overflow: hidden;
}
.image-upload-area:hover { border-color: var(--primary); }
.file-input { display: none; }
.image-upload-label {
  display: block; padding: 30px 20px; cursor: pointer;
}
#uploadText { display: block; color: var(--text-muted); font-size: 0.95rem; }
.image-preview {
  width: 100%; max-height: 300px; object-fit: cover; display: block;
}
.current-image-preview {
  width: 100%; max-height: 200px; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--border);
}

/* Type Selector */
.type-selector {
  display: flex; gap: 16px;
}
.type-option {
  flex: 1; text-align: center; padding: 16px;
  border: 2px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all 0.2s;
}
.type-option:hover { border-color: var(--primary); }
.type-option.active { border-color: var(--primary); background: #fff5f0; }
.type-option input { display: none; }
.type-icon { display: block; font-size: 1.8rem; margin-bottom: 6px; }

/* Conditional fields */
.conditional-fields { display: flex; flex-direction: column; gap: 16px; }
.hidden { display: none !important; }

/* Form Actions */
.form-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* AI Prediction */
.ai-prediction-box {
  background: linear-gradient(135deg, #667eea22, #764ba222);
  border: 1.5px solid #764ba2;
  border-radius: var(--radius); padding: 14px 20px;
  font-size: 0.95rem; color: #5a3a8a;
}
.ai-loading {
  font-size: 0.85rem; color: #888;
  animation: pulse 1s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* Posts Grid */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 1.5rem; }

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.post-card {
  background: var(--card-bg); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  cursor: pointer; transition: box-shadow 0.2s, transform 0.2s;
}
.post-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }

.post-image-wrap { position: relative; }
.post-thumbnail {
  width: 100%; height: 200px; object-fit: cover; display: block;
}
.post-type-badge {
  position: absolute; top: 10px; left: 10px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 0.78rem; font-weight: 600; color: white;
}
.post-type-badge.homemade { background: var(--homemade-color); }
.post-type-badge.restaurant { background: var(--restaurant-color); }
.post-type-badge.large { position: static; font-size: 0.9rem; }

.post-card-body { padding: 16px; }
.post-title { font-size: 1rem; font-weight: 600; margin-bottom: 8px; }
.post-meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.post-price { font-size: 0.9rem; color: var(--text-muted); }
.post-actions { display: flex; gap: 8px; margin-top: 12px; }

/* Detail */
.detail-container { max-width: 900px; margin: 0 auto; }
.detail-back { margin-bottom: 16px; }
.detail-back a { color: var(--primary); text-decoration: none; font-size: 0.9rem; }
.detail-card {
  background: white; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
}
@media (max-width: 700px) {
  .detail-card { grid-template-columns: 1fr; }
}
.detail-image { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 300px; }
.detail-body { padding: 28px; }
.detail-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.detail-header h1 { font-size: 1.4rem; flex: 1; }
.detail-meta { display: flex; gap: 16px; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 20px; flex-wrap: wrap; }
.detail-section { display: flex; flex-direction: column; gap: 16px; }
.detail-actions { display: flex; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

/* Price Grid */
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.price-card {
  background: #f8f5f0; border-radius: 10px; padding: 14px;
  text-align: center; border: 1.5px solid transparent;
}
.price-card.highlight { background: #fff5f0; border-color: var(--primary); }
.price-card.profit { background: #f0fff4; border-color: var(--success); }
.price-label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.price-value { display: block; font-size: 1.1rem; font-weight: 700; color: var(--text); }

/* AI Prediction in detail */
.ai-prediction {
  background: linear-gradient(135deg, #667eea15, #764ba215);
  border: 1.5px solid #764ba240; border-radius: 10px; padding: 14px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.ai-badge {
  background: #764ba2; color: white; padding: 3px 10px;
  border-radius: 20px; font-size: 0.8rem; font-weight: 600;
}
.ai-price { font-size: 1.1rem; font-weight: 700; color: #5a3a8a; }
.ai-note { font-size: 0.75rem; color: var(--text-muted); }

/* Recipe / Review */
.recipe-section h3, .review-section h3 { font-size: 1rem; margin-bottom: 8px; }
.recipe-content, .review-content {
  background: #f8f8f8; border-radius: 8px; padding: 14px;
  font-size: 0.9rem; white-space: pre-wrap; line-height: 1.7;
}

/* Stats */
.stats-container { max-width: 1000px; margin: 0 auto; }
.stats-container h1 { font-size: 1.5rem; margin-bottom: 24px; }
.stats-section { background: white; border-radius: var(--radius); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow); }
.stats-section h2 { font-size: 1.1rem; margin-bottom: 16px; color: var(--text); }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: white; border-radius: var(--radius); padding: 20px;
  text-align: center; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px;
}
.stat-card.homemade { border-top: 3px solid var(--homemade-color); }
.stat-card.restaurant { border-top: 3px solid var(--restaurant-color); }
.stat-icon { font-size: 1.6rem; }
.stat-number { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-muted); }

/* Stats Table */
.stats-table-wrap { overflow-x: auto; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.stats-table th {
  background: #f5f0eb; padding: 10px 14px; text-align: left;
  font-weight: 600; border-bottom: 2px solid var(--border);
}
.stats-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.stats-table tr:last-child td { border-bottom: none; }
.profit-row td { color: var(--success); font-weight: 600; }
.clickable-row { cursor: pointer; transition: background 0.15s; }
.clickable-row:hover { background: #f8f5f0; }

/* Chart */
.chart-section { }
.period-selector { display: flex; gap: 8px; margin-bottom: 16px; }
.period-btn {
  background: #f0f0f0; border: none; padding: 8px 20px;
  border-radius: 20px; cursor: pointer; font-size: 0.9rem;
  transition: all 0.2s;
}
.period-btn.active { background: var(--primary); color: white; }
.chart-wrap { position: relative; height: 300px; }

/* Badges */
.badge-homemade { background: #fff3e0; color: #e65100; padding: 3px 8px; border-radius: 20px; font-size: 0.8rem; }
.badge-restaurant { background: #e3f2fd; color: #1565c0; padding: 3px 8px; border-radius: 20px; font-size: 0.8rem; }
.badge-admin { background: #f3e5f5; color: #6a1b9a; padding: 3px 8px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; }
.badge-user { background: #f5f5f5; color: #555; padding: 3px 8px; border-radius: 20px; font-size: 0.8rem; }
.badge-yes { color: var(--success); font-weight: 700; }
.badge-no { color: var(--danger); font-weight: 700; }

.btn-sm-warning {
  background: #ffc107; color: #333; border: none;
  padding: 4px 10px; border-radius: 6px; font-size: 0.8rem; cursor: pointer;
  font-weight: 600;
}
.btn-sm-warning:disabled { opacity: 0.4; cursor: not-allowed; }

/* Landing / Slideshow */
.landing { max-width: 700px; margin: 0 auto; text-align: center; }
.landing-hero { padding: 40px 20px 28px; }
.landing-title { font-size: 2rem; color: var(--primary); margin-bottom: 10px; }
.landing-subtitle { font-size: 1rem; color: var(--text-muted); margin-bottom: 28px; }
.landing-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.slideshow-wrap { margin: 0 auto 12px; max-width: 600px; }
.slideshow-label { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 12px; }
.slideshow { position: relative; width: 100%; height: 360px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-hover); background: #eee; }
.slide { position: absolute; inset: 0; opacity: 0; transition: opacity 0.7s ease; }
.slide.active { opacity: 1; }
.slide-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slide-overlay { position: absolute; bottom: 12px; left: 12px; }
.slide-badge { padding: 5px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; color: white; }
.slide-badge.homemade { background: var(--homemade-color); }
.slide-badge.restaurant { background: var(--restaurant-color); }
.slideshow-dots { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); cursor: pointer; transition: background 0.3s; }
.dot.active { background: var(--primary); }
.slideshow-hint { color: var(--text-muted); font-size: 0.85rem; margin-top: 8px; }
.admin-container { max-width: 1100px; margin: 0 auto; }
.admin-container h1 { font-size: 1.5rem; margin-bottom: 24px; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; }
.admin-section { background: white; border-radius: var(--radius); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow); }
.admin-section h2 { font-size: 1.1rem; margin-bottom: 16px; }
.admin-actions { display: flex; gap: 6px; white-space: nowrap; }

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin-top: 32px;
}
.page-link {
  background: white; color: var(--primary); padding: 8px 18px;
  border-radius: 8px; text-decoration: none; box-shadow: var(--shadow);
  transition: background 0.2s;
}
.page-link:hover { background: var(--primary); color: white; }
.page-info { color: var(--text-muted); font-size: 0.9rem; }

/* Empty State */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state p { margin-bottom: 20px; font-size: 1.1rem; }

/* Suspended account banner */
.suspended-banner {
  background: #dc3545;
  color: white;
  padding: 14px 20px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 2px 8px rgba(220,53,69,0.4);
  border-left: 6px solid #9b1c2a;
}

/* Footer */
.footer {
  text-align: center; padding: 24px;
  color: var(--text-muted); font-size: 0.85rem;
  border-top: 1px solid var(--border); margin-top: 40px;
}

