/* トーストがモーダルより前面に出るようにする */
#toast {
	position: fixed;
	top: 70px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 9999;
	/* コンパクトなサイズ */
	width: auto;
	max-width: 280px;
	padding: 4px 10px;
	background: rgba(0, 0, 0, 0.85);
	color: #fff;
	border-radius: 4px;
	font-size: 12px;
	line-height: 1.2;
	box-shadow: 0 2px 8px rgba(0,0,0,0.2);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	pointer-events: none;
}
#toast:not(.hidden) { 
	display: inline-block; 
}
#toast.hidden { 
	display: none !important; 
}
/* アクションシート/履歴の簡易スタイル（既存モーダルに準拠） */
.list .post-item { padding: 8px 0; border-bottom: 1px solid #eee; }
.list .post-item-title { font-weight: bold; }
.list .post-item-time { color: #666; font-size: 12px; }
/* プロフィール用：左下赤ボタン */
.modal .actions.profile-footer { margin-top: 8px; }
.modal .actions.profile-footer .danger {
	background: #ff4d4f;
	color: #fff;
	border: 1px solid #ff4d4f;
	padding: 8px 12px;
	border-radius: 6px;
	cursor: pointer;
}
.modal .actions.profile-footer .danger:hover { background: #ff6b6d; border-color: #ff6b6d; }
/* 位置選択キャンセルバー */
.cancel-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(255,255,255,0.95);
	box-shadow: 0 -2px 10px rgba(0,0,0,0.12);
	display: none;
	padding: 8px;
	z-index: 2000;
}
.cancel-bar.hidden { display: none; }
.cancel-bar .cancel-full {
	width: 100%;
	padding: 12px 16px;
	font-size: 16px;
	border: 1px solid #ccc;
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
}
.cancel-bar .cancel-full:active { background: #f0f0f0; }
.side.right #btn-lang-toggle { background:#fff; }
.side.right #btn-lang-toggle.active { background:#e0f3ff; }
html, body, #app { height: 100%; margin: 0; padding: 0; }
#map { height: 100%; width: 100%; }

/* 認証ボタン（画面右上） */
.auth-button.top-right {
  position: absolute;
  top: 16px;
  right: 16px;
  display: none; /* 初期状態は非表示 */
  z-index: 1600;
}

.auth-btn {
  padding: 8px 16px;
  border: 1px solid #ccc;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  background: #fff;
  color: #0078d4;
  border-color: #0078d4;
}

.auth-btn:hover {
  background: #f0f8ff;
}

.auth-btn.logout {
  background: #fff;
  color: #0078d4;
  border-color: #0078d4;
}

.auth-btn.logout:hover {
  background: #f0f8ff;
}

/* モバイル対応 */
@media (max-width: 640px) {
  .auth-button.top-right {
    top: 12px;
    right: 12px;
  }
  
  .auth-btn {
    padding: 6px 12px;
    font-size: 13px;
  }
}
/* 左上固定は廃止 */
.lang-control.top-left { display: none; }
/* モーダル表示中は言語切替を隠す */
body.hide-lang .lang-control { display: none !important; }
body.hide-lang .side.right.lang-under-profile { display: none !important; }
/* 右側の旧配置はPC/スマホともに非表示（配置を左上へ統一） */
.side.right select#lang-switch { display: block; position: relative; z-index: 2000; width: 40px; height: 40px; padding: 0; box-sizing: border-box; -webkit-appearance: none; appearance: none; background: #fff; color: #000; text-align: center; }
.side.right.lang-under-profile select#lang-switch { display: block !important; }

/* PC/スマホ共通の見た目を統一 */
.lang-control.top-left select#lang-switch {
  width: 40px !important;
  height: 40px !important;
  padding: 0 !important;
  -webkit-appearance: none;
  appearance: none;
  text-align: center;
  box-sizing: border-box;
  display: block;
  background: #fff;
  color: #000;
}
#top-right-stack,
.side,
.auth-button.top-right {
	transition: opacity 0.2s ease;
}
.side { position: absolute; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 1500; }
.side.left { left: 8px; }
.side.right { right: 8px; }
.icon { width: 40px; height: 40px; border-radius: 8px; border: 1px solid #ccc; background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
.icon:hover { background: #f5f5f5; }
select#lang-switch { width: 40px; height: 40px; border-radius: 8px; border: 1px solid #ccc; background: #fff; padding: 0; text-align: center; box-sizing: border-box; -webkit-appearance: none; appearance: none; }
select#lang-switch.icon { width: 40px; }

/* モバイルでのネイティブUIを抑制してサイズを強制 */
@media (pointer: coarse), (max-width: 640px) {
  select#lang-switch { width: 40px !important; height: 40px !important; padding: 0 !important; }
}
/* フローティングUIより前面（トースト #toast 9999 より下） */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 9000; }
/* モーダル表示中は左上スタック・左右バーをほぼ透明に（:has 非対応のモバイルは body.modal-open を app.js で付与） */
body.modal-open #top-right-stack,
body.modal-open .side,
body.modal-open .auth-button.top-right {
	opacity: 0.12;
	pointer-events: none;
}
.modal.hidden { display: none; }
.modal-content { width: 90%; max-width: 420px; background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.2); display: flex; flex-direction: column; gap: 12px; }
.modal-content label { display: flex; flex-direction: column; gap: 6px; }
.modal-content textarea { min-height: 90px; resize: vertical; }
.actions { display: flex; gap: 8px; justify-content: flex-end; }
/* 全画面モーダルユーティリティ */
.modal.fullscreen { background: rgba(0,0,0,0.5); }
.modal.fullscreen .modal-content {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border-radius: 0;
  padding: 16px;
}
button.primary { background: #0078d4; color: #fff; border: none; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
button.secondary { background: #e6e6e6; color: #222; border: none; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: #333; color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 1500; }
.toast.hidden { display: none; }

/* フレンド機能のスタイル */
.tab-container {
  display: flex;
  border-bottom: 1px solid #ddd;
  margin-bottom: 16px;
}

.tab-button {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: #f5f5f5;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-button.active {
  background: #fff;
  border-bottom-color: #0078d4;
  color: #0078d4;
}

.tab-button:hover:not(.active) {
  background: #e6e6e6;
}

.tab-content {
  display: none;
  min-height: 200px;
}

.tab-content.active {
  display: block;
}

.request-list, .friends-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px;
}

.request-item, .friend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid #eee;
  gap: 8px;
}

.request-item:last-child, .friend-item:last-child {
  border-bottom: none;
}

.request-info, .friend-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.request-actions, .friend-actions {
  display: flex;
  gap: 4px;
}

.request-actions button, .friend-actions button {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
}

.status-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
}

.status-pending {
  background: #fff3cd;
  color: #856404;
}

.status-accepted {
  background: #d4edda;
  color: #155724;
}

.status-rejected {
  background: #f8d7da;
  color: #721c24;
}

.loading {
  text-align: center;
  color: #666;
  padding: 20px;
}

.empty-state {
  text-align: center;
  color: #666;
  padding: 20px;
  font-style: italic;
}

.success-message {
  color: #155724;
  background: #d4edda;
  padding: 8px;
  border-radius: 4px;
  border: 1px solid #c3e6cb;
}

.error-message {
  color: #721c24;
  background: #f8d7da;
  padding: 8px;
  border-radius: 4px;
  border: 1px solid #f5c6cb;
}

/* タブ機能のスタイル */
.tab-container {
  display: flex;
  border-bottom: 1px solid #ddd;
  margin-bottom: 16px;
}

.tab-button {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: #f5f5f5;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-button.active {
  background: #fff;
  border-bottom-color: #0078d4;
  color: #0078d4;
}

.tab-button:hover:not(.active) {
  background: #e6e6e6;
}

.tab-content {
  display: none;
  min-height: 200px;
}

.tab-content.active {
  display: block;
}

.request-list, .friends-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px;
}

.request-item, .friend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid #eee;
  gap: 8px;
}

.request-item:last-child, .friend-item:last-child {
  border-bottom: none;
}

.request-info, .friend-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.request-actions, .friend-actions {
  display: flex;
  gap: 4px;
}

.request-actions button, .friend-actions button {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
}

.loading {
  text-align: center;
  color: #666;
  padding: 20px;
}

.empty-state {
  text-align: center;
  color: #666;
  padding: 20px;
  font-style: italic;
}