/* =============================================
   お隣さん - ご近所情報共有マップ
   ============================================= */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --positive: #16a34a;
  --positive-bg: #dcfce7;
  --negative: #dc2626;
  --negative-bg: #fee2e2;
  --caution: #d97706;
  --caution-bg: #fef3c7;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.1), 0 10px 10px rgba(0,0,0,0.04);
  --radius: 8px;
  --radius-lg: 12px;
  --header-h: 64px;
  --search-h: 110px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: 1rem; }
ul { list-style: none; }

/* ---- Header ---- */
#header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
.logo h1 {
  font-size: 1.4rem; font-weight: 900; color: var(--gray-900);
  display: flex; align-items: center; gap: 4px;
}
.logo-icon { font-size: 1.5rem; }
.tagline { font-size: 0.7rem; color: var(--gray-400); margin-top: -2px; letter-spacing: 0.05em; }
.header-nav { display: flex; gap: 8px; align-items: center; }
.nav-btn {
  background: none; border: 1px solid var(--gray-200); color: var(--gray-600);
  padding: 6px 14px; border-radius: 6px; font-size: 0.85rem; font-weight: 500;
  transition: all 0.15s;
}
.nav-btn:hover { background: var(--gray-50); border-color: var(--gray-300); }
.nav-btn.btn-primary {
  background: var(--primary); color: var(--white); border-color: var(--primary);
}
.nav-btn.btn-primary:hover { background: var(--primary-dark); }
.mobile-menu-btn {
  display: none; background: none; border: none; padding: 8px;
  flex-direction: column; gap: 5px;
}
.mobile-menu-btn span {
  display: block; width: 22px; height: 2px; background: var(--gray-700); border-radius: 2px;
  transition: all 0.2s;
}

/* Mobile Menu */
.mobile-menu {
  position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 999;
  background: var(--white); border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-md); padding: 8px;
}
.mobile-menu-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 12px 16px; font-size: 0.95rem; color: var(--gray-700); border-radius: 6px;
}
.mobile-menu-item:hover { background: var(--gray-50); }

/* ---- Search Bar ---- */
#search-bar {
  position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 900;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  padding: 12px 20px;
}
.search-inner { max-width: 900px; margin: 0 auto; }
.search-input-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 4px 4px 4px 12px;
  transition: border-color 0.15s;
}
.search-input-wrap:focus-within { border-color: var(--primary); }
.search-icon { color: var(--gray-400); flex-shrink: 0; }
.search-input-wrap input {
  flex: 1; border: none; background: none; outline: none; padding: 8px 4px;
  font-size: 0.95rem; color: var(--gray-800);
}
.search-input-wrap input::placeholder { color: var(--gray-400); }
.btn-search {
  background: var(--primary); color: var(--white); border: none;
  padding: 8px 20px; border-radius: 6px; font-size: 0.9rem; font-weight: 500;
  transition: background 0.15s;
}
.btn-search:hover { background: var(--primary-dark); }

/* Filters */
.search-filters { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.filter-chip {
  display: inline-flex; align-items: center; cursor: pointer;
  padding: 4px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 500;
  background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200);
  transition: all 0.15s; user-select: none;
}
.filter-chip input { display: none; }
.filter-chip:hover { background: var(--gray-200); }
.filter-chip.active { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* ---- Map ---- */
#map-container {
  position: fixed;
  top: calc(var(--header-h) + var(--search-h));
  left: 0; right: 0; bottom: 0;
}
#map { width: 100%; height: 100%; }

/* Google Maps InfoWindow */
.gm-style-iw { border-radius: var(--radius-lg) !important; }
.gm-style-iw-d { overflow: auto !important; }
.popup-card { padding: 16px; }
.popup-category {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 0.75rem; font-weight: 600; margin-bottom: 8px;
}
.popup-category.positive { background: var(--positive-bg); color: var(--positive); }
.popup-category.negative { background: var(--negative-bg); color: var(--negative); }
.popup-category.caution { background: var(--caution-bg); color: var(--caution); }
.popup-title { font-size: 1rem; font-weight: 700; margin-bottom: 6px; color: var(--gray-900); }
.popup-body { font-size: 0.85rem; color: var(--gray-600); margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.popup-meta { font-size: 0.75rem; color: var(--gray-400); display: flex; justify-content: space-between; }
.popup-actions { display: flex; gap: 8px; margin-top: 10px; }
.popup-btn {
  flex: 1; padding: 6px; border: 1px solid var(--gray-200); border-radius: 6px;
  background: var(--white); font-size: 0.8rem; color: var(--gray-600);
  transition: all 0.15s; text-align: center;
}
.popup-btn:hover { background: var(--gray-50); }
.popup-btn.report { color: var(--negative); border-color: var(--negative-bg); }
.popup-btn.report:hover { background: var(--negative-bg); }

/* Floating Action Button */
.fab {
  position: absolute; bottom: 80px; right: 20px; z-index: 800;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); border: none; color: var(--white);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.fab:hover { background: var(--primary-dark); transform: scale(1.05); box-shadow: var(--shadow-xl); }

/* Stats Bar */
#stats-bar {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 800;
  display: flex; gap: 16px; background: rgba(255,255,255,0.95);
  padding: 10px 24px; border-radius: 30px; box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}
.stat-item { text-align: center; }
.stat-num { display: block; font-size: 1.2rem; font-weight: 700; color: var(--gray-800); }
.stat-item.positive .stat-num { color: var(--positive); }
.stat-item.negative .stat-num { color: var(--negative); }
.stat-label { font-size: 0.7rem; color: var(--gray-400); }

/* ---- Side Panel ---- */
.side-panel {
  position: fixed; top: var(--header-h); right: 0; bottom: 0; z-index: 950;
  width: 400px; max-width: 100vw; background: var(--white);
  box-shadow: -4px 0 15px rgba(0,0,0,0.1);
  overflow-y: auto; transition: transform 0.3s ease;
}
.side-panel.hidden { transform: translateX(100%); }
.btn-close-panel {
  position: absolute; top: 12px; right: 12px;
  background: var(--gray-100); border: none; width: 32px; height: 32px;
  border-radius: 50%; font-size: 1.2rem; color: var(--gray-500);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.btn-close-panel:hover { background: var(--gray-200); }

/* Panel Post Detail */
.panel-detail { padding: 24px; }
.panel-category {
  display: inline-block; padding: 4px 14px; border-radius: 16px;
  font-size: 0.8rem; font-weight: 600;
}
.panel-category.positive { background: var(--positive-bg); color: var(--positive); }
.panel-category.negative { background: var(--negative-bg); color: var(--negative); }
.panel-category.caution { background: var(--caution-bg); color: var(--caution); }
.panel-title { font-size: 1.3rem; font-weight: 700; margin: 12px 0 8px; color: var(--gray-900); }
.panel-address { font-size: 0.85rem; color: var(--gray-500); margin-bottom: 16px; }
.panel-body { font-size: 0.95rem; color: var(--gray-700); line-height: 1.8; margin-bottom: 20px;
  white-space: pre-wrap; word-wrap: break-word;
}
.panel-rating { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.panel-rating-label { font-size: 0.85rem; color: var(--gray-500); }
.panel-rating-stars { color: var(--caution); font-size: 1.1rem; }
.panel-meta {
  display: flex; justify-content: space-between; padding-top: 16px;
  border-top: 1px solid var(--gray-100); font-size: 0.8rem; color: var(--gray-400);
}
.panel-actions { display: flex; gap: 10px; margin-top: 20px; }
.panel-actions button {
  flex: 1; padding: 10px; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 500; border: 1px solid var(--gray-200);
  background: var(--white); color: var(--gray-600); transition: all 0.15s;
}
.panel-actions button:hover { background: var(--gray-50); }
.panel-actions .btn-helpful { color: var(--positive); border-color: var(--positive-bg); }
.panel-actions .btn-helpful:hover { background: var(--positive-bg); }
.panel-actions .btn-helpful.active { background: var(--positive-bg); }
.panel-actions .btn-report { color: var(--negative); border-color: var(--negative-bg); }
.panel-actions .btn-report:hover { background: var(--negative-bg); }

/* ---- Modals ---- */
.modal {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
}
.modal.hidden { display: none; }
.modal-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}
.modal-content {
  position: relative; background: var(--white);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
  width: 90%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  padding: 28px;
}
.modal-content-scroll { max-height: 80vh; }
.modal-sm { max-width: 400px; }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.modal-header h2 { font-size: 1.2rem; font-weight: 700; }
.btn-close {
  background: var(--gray-100); border: none; width: 32px; height: 32px;
  border-radius: 50%; font-size: 1.2rem; color: var(--gray-500);
  display: flex; align-items: center; justify-content: center;
}
.btn-close:hover { background: var(--gray-200); }

/* Form Styles */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.9rem; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.required { color: var(--negative); }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--gray-200);
  border-radius: var(--radius); font-size: 0.95rem; color: var(--gray-800);
  background: var(--white); transition: border-color 0.15s;
}
.form-group input:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.form-hint { font-size: 0.78rem; color: var(--caution); margin-top: 4px; }
.char-count { font-size: 0.75rem; color: var(--gray-400); text-align: right; display: block; margin-top: 2px; }

/* Category Select */
.category-select { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.category-option input { display: none; }
.category-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 8px; border: 2px solid var(--gray-200); border-radius: var(--radius);
  cursor: pointer; transition: all 0.15s; text-align: center;
}
.category-card:hover { border-color: var(--gray-300); }
.category-emoji { font-size: 1.8rem; }
.category-name { font-size: 0.85rem; font-weight: 600; }
.category-desc { font-size: 0.7rem; color: var(--gray-400); }
.category-option.positive input:checked ~ .category-card { border-color: var(--positive); background: var(--positive-bg); }
.category-option.negative input:checked ~ .category-card { border-color: var(--negative); background: var(--negative-bg); }
.category-option.caution input:checked ~ .category-card { border-color: var(--caution); background: var(--caution-bg); }

/* Address Input */
.address-input-group { display: flex; gap: 8px; }
.address-input-group input { flex: 1; }
.btn-secondary {
  background: var(--white); color: var(--gray-600); border: 1px solid var(--gray-200);
  padding: 8px 16px; border-radius: var(--radius); font-size: 0.85rem; font-weight: 500;
  white-space: nowrap; transition: all 0.15s;
}
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }
.geocode-result {
  margin-top: 6px; padding: 8px 12px; border-radius: 6px;
  font-size: 0.85rem; background: var(--positive-bg); color: var(--positive);
}
.geocode-result.error { background: var(--negative-bg); color: var(--negative); }

/* Rating Stars */
.rating-select { display: flex; gap: 4px; }
.rating-star {
  background: none; border: none; font-size: 1.6rem; color: var(--gray-300);
  transition: color 0.1s; padding: 2px;
}
.rating-star:hover, .rating-star.active { color: var(--caution); }

/* Agreement */
.agreement { margin-top: 20px; }
.checkbox-label {
  display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.9rem;
}
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }

/* Form Actions */
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
.btn-primary {
  background: var(--primary); color: var(--white); border: none;
  padding: 10px 24px; border-radius: var(--radius); font-size: 0.95rem; font-weight: 600;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-submit { min-width: 120px; }

/* Auth */
.auth-switch { text-align: center; margin-top: 16px; font-size: 0.85rem; color: var(--gray-500); }

/* Guidelines */
.guidelines-body section { margin-bottom: 20px; }
.guidelines-body h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.guidelines-body ul { padding-left: 0; }
.guidelines-body li {
  padding: 8px 0; border-bottom: 1px solid var(--gray-100);
  font-size: 0.9rem; color: var(--gray-600);
}
.guidelines-body p { font-size: 0.9rem; color: var(--gray-600); }
.guidelines-body ol { padding-left: 20px; }
.guidelines-body ol li { padding: 4px 0; font-size: 0.9rem; color: var(--gray-600); }
.guidelines-body ol ul { padding-left: 16px; margin-top: 4px; }
.guidelines-updated { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--gray-200); font-size: 0.8rem; color: var(--gray-400); text-align: right; }

/* About */
.about-body h3 { font-size: 1rem; font-weight: 700; margin: 16px 0 8px; }
.about-body p, .about-body li { font-size: 0.9rem; color: var(--gray-600); }
.about-body li { padding: 4px 0; }

/* ---- Toast ---- */
#toast-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  padding: 12px 24px; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: toast-in 0.3s ease;
  white-space: nowrap;
}
.toast.success { background: var(--positive); color: var(--white); }
.toast.error { background: var(--negative); color: var(--white); }
.toast.info { background: var(--gray-800); color: var(--white); }
@keyframes toast-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Footer ---- */
#footer {
  display: none; /* Hidden when map is fullscreen */
  background: var(--gray-900); color: var(--gray-400); padding: 32px 20px; text-align: center;
}
.footer-links { display: flex; gap: 24px; justify-content: center; margin-bottom: 16px; }
.footer-links a { color: var(--gray-400); font-size: 0.85rem; }
.footer-links a:hover { color: var(--white); }
.disclaimer { font-size: 0.75rem; color: var(--gray-500); max-width: 600px; margin: 0 auto 12px; line-height: 1.6; }
.copyright { font-size: 0.75rem; color: var(--gray-500); }

/* ---- Utility ---- */
.hidden { display: none !important; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  :root { --search-h: 100px; }
  .header-nav { display: none; }
  .mobile-menu-btn { display: flex; }
  .category-select { grid-template-columns: 1fr; }
  .category-card { flex-direction: row; padding: 10px 14px; }
  .category-emoji { font-size: 1.4rem; }
  .address-input-group { flex-direction: column; }
  .side-panel { width: 100%; }
  .modal-content { width: 95%; padding: 20px; }
  #stats-bar { gap: 12px; padding: 8px 16px; }
  .stat-num { font-size: 1rem; }
  .fab { bottom: 70px; right: 16px; }
  .search-input-wrap input { font-size: 0.85rem; }
}

@media (max-width: 480px) {
  .logo h1 { font-size: 1.1rem; }
  .tagline { display: none; }
  .filter-chip { font-size: 0.75rem; padding: 3px 8px; }
}

/* Google Maps overrides */
.gm-style { font-family: 'Noto Sans JP', sans-serif !important; }
