﻿.authPage {
  min-height: 100vh;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef4f8;
  box-sizing: border-box;
}

.authCard {
  width: min(420px, 100%);
  padding: 24px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  box-sizing: border-box;
}

.authTitle {
  font-size: 28px;
  font-weight: 800;
  color: #15324a;
  text-align: center;
}

.authSubTitle {
  margin-top: 6px;
  margin-bottom: 20px;
  color: #466278;
  text-align: center;
  font-size: 15px;
}

.authModeSwitch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.authModeSwitch.single {
  grid-template-columns: 1fr;
}

.authModeButton,
.authPrimaryButton,
.authLogoutButton {
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.authModeButton {
  padding: 10px 12px;
  background: #e5edf4;
  color: #29445a;
}

.authModeButton.active {
  background: #15324a;
  color: #ffffff;
}

.authLabel {
  display: block;
  margin-top: 12px;
  color: #29445a;
  font-size: 14px;
  font-weight: 700;
}

.authInput {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid #c7d4df;
  border-radius: 12px;
  font-size: 16px;
  box-sizing: border-box;
}

.authPrimaryButton {
  width: 100%;
  margin-top: 18px;
  padding: 13px 16px;
  background: #15324a;
  color: #ffffff;
  font-size: 16px;
}

.authPrimaryButton:disabled,
.authLogoutButton:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.authMessage {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 14px;
  line-height: 1.5;
}

.authNote {
  margin-top: 14px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.authShell {
  min-height: 100vh;
  background: #eef4f8;
  box-sizing: border-box;
}

.authTopBar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #15324a;
  color: #ffffff;
  box-sizing: border-box;
}

.authUserText {
  min-width: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.authLogoutButton {
  padding: 7px 12px;
  background: #ffffff;
  color: #15324a;
  font-size: 13px;
}

.authInlineMessage {
  padding: 8px 12px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 13px;
}

@media (max-width: 640px) {
  .authPage {
    padding: 16px;
    align-items: flex-start;
  }

  .authCard {
    margin-top: 24px;
    padding: 20px;
  }

  .authTopBar {
    height: auto;
    min-height: 42px;
    justify-content: space-between;
  }
}


/* v023_17_12m_auth_single_topbar
   Supabase Auth導入後の上部帯を1本化する。
   既存App側の .topBar はログイン後だけ非表示にし、AuthGate側の帯へ統合する。
*/
.authShell .authTopBar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 10000 !important;
  height: 42px !important;
  padding: 0 12px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  background: #0f172a !important;
  color: #ffffff !important;
  box-sizing: border-box !important;
}

.authBrandArea {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.authBrandTitle {
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.authBrandSubtitle {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.82;
}

.authAccountArea {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.authShell .authUserText {
  max-width: min(38vw, 340px);
  min-width: 0;
  padding: 0;
  background: transparent;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: none;
}

.authShell .authLogoutButton {
  padding: 7px 12px;
  border-radius: 999px;
  background: #ffffff;
  color: #15324a;
  font-size: 13px;
  font-weight: 800;
  border: 0;
  box-shadow: none;
}

.authShell .app > .topBar {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
}

.authShell .app {
  grid-template-rows: minmax(0, 1fr) !important;
}

.authShell .mapArea {
  grid-row: 1 !important;
}

@media (max-width: 640px) {
  .authShell .authTopBar {
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 8px !important;
    gap: 6px !important;
  }

  .authBrandArea {
    gap: 5px;
  }

  .authBrandTitle {
    font-size: 13px;
  }

  .authBrandSubtitle {
    font-size: 9px;
  }

  .authShell .authUserText {
    max-width: 30vw;
    font-size: 10px;
  }

  .authShell .authLogoutButton {
    padding: 6px 9px;
    font-size: 12px;
  }
}


/* v023_17_12m_leaflet_zoom_below_topbar
   上部固定帯に Leaflet 左上の拡大縮小ボタンが隠れないよう、
   top controls を少し下へずらす。
*/
.authShell .leaflet-top {
  top: 46px !important;
}

@media (max-width: 640px) {
  .authShell .leaflet-top {
    top: 44px !important;
  }
}

/* v023_17_12x_mobile_only_viewport_fix_v001
   ログイン後スマホ画面だけの高さズレ対策。
   PC幅には影響させないため、max-width media内だけで上書きする。
*/
@media (max-width: 640px) {
  .authShell {
    width: 100%;
    max-width: 100dvw;
    min-width: 0;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  .authShell .authTopBar {
    width: 100%;
    max-width: 100dvw;
    overflow: hidden;
  }

  .authShell .app {
    width: 100%;
    max-width: 100dvw;
    min-width: 0;
    height: calc(100dvh - 42px);
    min-height: calc(100dvh - 42px);
    overflow: hidden;
  }

  .authShell .mapArea {
    width: 100%;
    max-width: 100dvw;
    min-width: 0;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
}

/* fieldsprayweb-password-change-dialog-v001 */
.authShell .authUserButton {
  min-width: 0;
  max-width: min(38vw, 340px);
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.authShell .authUserButton:hover,
.authShell .authUserButton:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}

.authShell .authUserButton:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.authPasswordOverlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.58);
  box-sizing: border-box;
}

.authPasswordDialog {
  width: min(420px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.32);
  box-sizing: border-box;
  overscroll-behavior: contain;
}

.authPasswordForm {
  padding: 22px;
  box-sizing: border-box;
}

.authPasswordTitle {
  color: #15324a;
  font-size: 21px;
  font-weight: 800;
  text-align: center;
}

.authPasswordEmail {
  margin-top: 6px;
  margin-bottom: 18px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-align: center;
}

.authPasswordLabel {
  display: block;
  margin-top: 13px;
  color: #29445a;
  font-size: 14px;
  font-weight: 700;
}

.authPasswordInput {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid #c7d4df;
  border-radius: 12px;
  background: #ffffff;
  color: #0f172a;
  font-size: 16px;
  box-sizing: border-box;
}

.authPasswordInput:focus {
  border-color: #2563eb;
  outline: 2px solid rgba(37, 99, 235, 0.18);
  outline-offset: 1px;
}

.authPasswordInput:disabled {
  background: #f1f5f9;
  opacity: 0.75;
}

.authPasswordMessage {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 14px;
  line-height: 1.5;
}

.authPasswordActions {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.authPasswordCancelButton,
.authPasswordSubmitButton {
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.authPasswordCancelButton {
  background: #e5edf4;
  color: #29445a;
}

.authPasswordSubmitButton {
  background: #15324a;
  color: #ffffff;
}

.authPasswordCancelButton:disabled,
.authPasswordSubmitButton:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .authShell .authUserButton {
    max-width: 30vw;
    padding: 4px;
    font-size: 10px;
  }

  .authPasswordOverlay {
    padding:
      max(12px, env(safe-area-inset-top))
      12px
      max(12px, env(safe-area-inset-bottom));
    align-items: flex-start;
  }

  .authPasswordDialog {
    width: 100%;
    max-height: calc(
      100dvh -
      max(24px, env(safe-area-inset-top)) -
      max(24px, env(safe-area-inset-bottom))
    );
    border-radius: 16px;
  }

  .authPasswordForm {
    padding: 18px 16px;
  }

  .authPasswordTitle {
    font-size: 19px;
  }

  .authPasswordActions {
    gap: 8px;
  }

  .authPasswordCancelButton,
  .authPasswordSubmitButton {
    min-height: 46px;
    padding: 10px 8px;
    font-size: 14px;
  }
}
