/* ========================================
   Linka - メインスタイルシート
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Poppins:wght@600;700&display=swap');

:root {
  --teal: #40E0D0;
  --teal-dark: #2bc4b4;
  --teal-light: #e0faf8;
  --teal-bg: #f0fdfb;
  --text: #1a1a1a;
  --text-muted: #888;
  --border: #e5e7eb;
  --white: #fff;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-full: 999px;
  --shadow: 0 2px 16px rgba(64,224,208,0.10);
  --font: 'Nunito', sans-serif;
  --font-display: 'Poppins', sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--teal-bg);
  color: var(--text);
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* ---- 共通部品 ---- */
.btn {
  display: block;
  width: 100%;
  padding: 13px;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  text-align: center;
  text-decoration: none;
}
.btn:hover { opacity: .9; transform: scale(.99); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--teal);
  color: var(--teal);
}
.btn-sm { padding: 8px 16px; font-size: 14px; border-radius: 10px; width: auto; display: inline-block; }

.input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: border .2s;
  color: var(--text);
  background: #fff;
}
.input:focus { border-color: var(--teal); }

.label {
  font-size: 13px;
  font-weight: 700;
  color: #444;
  display: block;
  margin-bottom: 6px;
}

.field { margin-bottom: 1rem; }

.card {
  background: #fff;
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.error-msg {
  display: none;
  background: #fff0f0;
  color: #d32;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* ---- ロゴ ---- */
.linka-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.linka-logo img { width: 40px; height: 40px; border-radius: 50%; }
.linka-logo-text {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.linka-logo-sub {
  font-size: 10px;
  font-weight: 700;
  color: var(--teal);
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* ---- タブバー（下部ナビ） ---- */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  z-index: 100;
}
.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 16px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: color .15s;
}
.tab-item.active, .tab-item:hover { color: var(--teal); }
.tab-item svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- ヘッダー ---- */
.page-header {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  z-index: 50;
}
.page-header h1 { font-size: 20px; font-weight: 800; }

/* ---- チャット一覧 ---- */
.chat-list { padding: 0 0 80px; }
.chat-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
  text-decoration: none;
  color: inherit;
}
.chat-item:hover { background: var(--teal-bg); }
.chat-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--teal-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--teal-dark);
  flex-shrink: 0;
  overflow: hidden;
}
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-info { flex: 1; min-width: 0; }
.chat-name { font-weight: 700; font-size: 15px; margin-bottom: 3px; }
.chat-preview { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.chat-time { font-size: 11px; color: var(--text-muted); }
.chat-badge {
  background: var(--teal);
  color: #fff;
  border-radius: var(--radius-full);
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- メッセージ画面 ---- */
.messages-container {
  padding: 16px 16px 80px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: calc(100vh - 120px);
}
.message-row { display: flex; align-items: flex-end; gap: 8px; }
.message-row.mine { flex-direction: row-reverse; }
.bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
}
.bubble.theirs { background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble.mine { background: var(--teal); color: #fff; border-bottom-right-radius: 4px; }
.bubble img { max-width: 100%; border-radius: 10px; display: block; }
.msg-time { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }

/* ---- 入力エリア ---- */
.chat-input-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 10px 12px env(safe-area-inset-bottom, 10px);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  z-index: 100;
}
.chat-input-bar textarea {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 22px;
  padding: 10px 16px;
  font-family: var(--font);
  font-size: 15px;
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.5;
  transition: border .2s;
}
.chat-input-bar textarea:focus { border-color: var(--teal); }
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--teal-light);
  color: var(--teal-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.icon-btn:hover { background: var(--teal); color: #fff; }
.icon-btn.send { background: var(--teal); color: #fff; }
.icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- プロフィール ---- */
.profile-header {
  background: linear-gradient(160deg, var(--teal) 0%, var(--teal-dark) 100%);
  padding: 40px 24px 60px;
  text-align: center;
  position: relative;
}
.profile-avatar-wrap {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid #fff;
  overflow: hidden;
  margin: 0 auto 12px;
  background: var(--teal-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 800;
  color: var(--teal-dark);
}
.profile-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { color: #fff; font-size: 22px; font-weight: 800; }
.profile-id { color: rgba(255,255,255,0.8); font-size: 14px; margin-top: 4px; }
.profile-body { padding: 20px; padding-bottom: 100px; margin-top: -30px; }
.profile-card {
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.profile-row {
  display: flex;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  gap: 14px;
  cursor: pointer;
  transition: background .1s;
}
.profile-row:last-child { border-bottom: none; }
.profile-row:hover { background: var(--teal-bg); }
.profile-row-icon { color: var(--teal); }
.profile-row svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.profile-row-label { flex: 1; font-size: 15px; font-weight: 600; }
.profile-row-value { font-size: 14px; color: var(--text-muted); }

/* ---- スキャン ---- */
.scan-section {
  margin: 16px;
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.scan-section h2 { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.scan-section p { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.qr-placeholder {
  width: 140px;
  height: 140px;
  margin: 0 auto 14px;
  background: var(--teal-light);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
}

/* ---- スイッチ（通知） ---- */
.toggle-row { display: flex; align-items: center; justify-content: space-between; }
.toggle {
  position: relative;
  width: 48px;
  height: 28px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: var(--radius-full);
  transition: .3s;
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .3s;
}
.toggle input:checked + .toggle-slider { background: var(--teal); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ---- ログイン画面 ---- */
.auth-page {
  min-height: 100vh;
  background: var(--teal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}
.auth-card {
  background: #fff;
  border-radius: 28px;
  padding: 2.2rem 1.8rem;
  width: 100%;
  max-width: 380px;
}
.auth-tabs {
  display: flex;
  background: #f3f4f6;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 1.6rem;
}
.auth-tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  border-radius: 9px;
  cursor: pointer;
  border: none;
  background: none;
  color: #888;
  transition: all .2s;
}
.auth-tab.active { background: var(--teal); color: #fff; }

/* ---- アバター選択 ---- */
.avatar-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.2rem;
}
.avatar-preview {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--teal-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 800;
  color: var(--teal-dark);
  overflow: hidden;
  border: 3px solid var(--teal);
  cursor: pointer;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---- ユーティリティ ---- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none; }
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #bbb;
  font-size: 13px;
  margin: 1.2rem 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
