/* ==========================================================================
   千葉県道路防災マップ - アクセス認証ゲートスタイル (auth.css)
   Ri2MAPS Emerald Green (#07760a) テーマ連携
   ========================================================================== */

/* 認証オーバーレイ (全画面カバー・背景ぼかし) */
#auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

#auth-overlay.auth-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* 未認証時の背景コンテンツ保護 (操作無効化・ぼかし) */
body:not(.authenticated) #app-container {
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
  transition: filter 0.35s ease;
}

body.authenticated #app-container {
  filter: none;
  pointer-events: auto;
  user-select: auto;
}

/* 認証カード */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  padding: 32px 24px;
  box-sizing: border-box;
  text-align: center;
  animation: authFadeSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

@keyframes authFadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* シェイクアニメーション (認証失敗時) */
.auth-card.auth-shake {
  animation: authShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes authShake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* カードヘッダー */
.auth-header {
  margin-bottom: 24px;
}

.auth-logo-img {
  max-height: 46px;
  max-width: 180px;
  object-fit: contain;
  margin-bottom: 12px;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #07760a;
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
  letter-spacing: 0.03em;
}

.auth-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 6px 0;
  letter-spacing: -0.01em;
}

.auth-subtitle {
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.5;
  margin: 0;
}

/* 入力フォーム */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 6px;
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 12px;
  color: #94a3b8;
  font-size: 0.95rem;
  pointer-events: none;
  transition: color 0.2s;
}

.auth-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  font-size: 0.92rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  outline: none;
  color: #1e293b;
  background: #f8fafc;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  box-sizing: border-box;
}

.auth-input:focus {
  border-color: #07760a;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(7, 118, 10, 0.15);
}

.auth-input.has-toggle {
  padding-right: 40px;
}

/* パスワード表示切替トグルボタン */
.auth-pw-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  border-radius: 4px;
  transition: color 0.2s;
}

.auth-pw-toggle:hover {
  color: #475569;
}

/* 保持チェックボックス */
.auth-remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #475569;
  margin-top: -4px;
}

.auth-remember-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.auth-remember-label input[type="checkbox"] {
  accent-color: #07760a;
  cursor: pointer;
}

/* エラーメッセージ */
.auth-error {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #dc2626;
  font-size: 0.82rem;
  text-align: left;
  line-height: 1.4;
  margin-top: -4px;
}

.auth-error.show {
  display: flex;
}

/* ログインボタン */
.auth-submit-btn {
  width: 100%;
  padding: 11px 16px;
  background: #07760a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 6px -1px rgba(7, 118, 10, 0.3);
  margin-top: 4px;
}

.auth-submit-btn:hover {
  background: #055a07;
  box-shadow: 0 6px 10px -1px rgba(7, 118, 10, 0.4);
}

.auth-submit-btn:active {
  transform: translateY(1px);
}

.auth-submit-btn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

/* フッター注意書き */
.auth-footer-notice {
  margin-top: 20px;
  font-size: 0.72rem;
  color: #94a3b8;
  line-height: 1.5;
  border-top: 1px solid #f1f5f9;
  padding-top: 14px;
}

.auth-footer-notice-text {
  display: inline-block;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

@media (max-width: 480px) {
  .auth-footer-notice-text {
    font-size: 0.65rem;
  }
}

/* ==========================================================================
   ヘッダー内 ログアウトボタン スタイル
   ========================================================================== */
.header-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.header-logout-btn:hover {
  background: rgba(239, 68, 68, 0.85);
  border-color: #ef4444;
}

.header-logout-btn i {
  font-size: 0.82rem;
}


/* ==========================================================================
   ご利用規約・注意事項 カードスタイル (terms-card)
   ========================================================================== */
.auth-card.terms-card {
  max-width: 714px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 24px 24px 20px 24px;
  text-align: left;
}

.terms-header {
  margin-bottom: 12px;
  text-align: center;
  flex-shrink: 0;
}

.terms-header .auth-logo-img {
  vertical-align: middle;
  margin-bottom: 0;
  margin-right: 10px;
}

.terms-header .auth-badge {
  vertical-align: middle;
  margin-bottom: 0;
}

.terms-title {
  font-size: 1.12rem;
  line-height: 1.45;
  margin-top: 12px;
  color: #0f172a;
}

.terms-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.84rem;
  line-height: 1.7;
  color: #334155;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f8fafc;
  margin-bottom: 16px;
}

.terms-content::-webkit-scrollbar {
  width: 6px;
}
.terms-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.terms-lead {
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #cbd5e1;
}

.terms-section {
  margin-bottom: 14px;
}

.terms-section:last-child {
  margin-bottom: 4px;
}

.terms-sec-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #07760a;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
}

.terms-section p {
  margin-bottom: 4px;
}

.terms-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.terms-agreement-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
}

.terms-agreement-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #166534;
  cursor: pointer;
  user-select: none;
}

.terms-agreement-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #07760a;
  cursor: pointer;
}

.terms-proceed-btn {
  width: 100%;
  padding: 12px 16px;
  background: #07760a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px -1px rgba(7, 118, 10, 0.3);
}

.terms-proceed-btn:hover:not(:disabled) {
  background: #055a07;
  box-shadow: 0 6px 12px -1px rgba(7, 118, 10, 0.4);
  transform: translateY(-1px);
}

.terms-proceed-btn:disabled {
  background: #94a3b8;
  color: #f1f5f9;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.65;
  transform: none;
}
