/* 認証ページ（ログイン・パスワードリセット等）共通スタイル */
/* Pencil Registration Screen デザインに準拠 */

/* 最小リセット（Bulmaなしで使用する場合にも正しく表示されるよう） */
*,
*::before,
*::after {
  box-sizing: border-box;
}

fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", "Arial", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root {
  --auth-bg-page: #faf3dc;
  --auth-bg-card: #ffffff;
  --auth-text-primary: #1a1918;
  --auth-text-secondary: #6d6c6a;
  --auth-text-tertiary: #9c9b99;
  --auth-accent: #8b6200;
  --auth-accent-dark: #6a4b00;
  --auth-accent-light: #fff3cc;
  --auth-border-strong: #d1d0cd;
  --auth-border-subtle: #e5e4e1;
  --auth-danger: #c0392b;
  --auth-danger-bg: #fde8e8;
}

.auth-page {
  min-height: 100svh;
  background-color: var(--auth-bg-page);
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.auth-page--with-header {
  display: flex;
  flex-direction: column;
  min-height: unset;
  flex: 1;
  align-items: center;
  justify-content: start;
}

.auth-card {
  background-color: var(--auth-bg-card);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 600px;
}

/* カード幅: 登録フォームは項目が多いため少し広め */
.auth-card--wide {
  max-width: 600px;
}

.auth-header {
  background-color: #f5a800;
  background-size: cover;
  background-position: center;
  padding: 2rem 2rem 1.75rem;
  margin: -2.5rem -2rem 1.75rem;
  border-radius: 12px 12px 0 0;
}

.auth-header-logo {
  display: block;
  max-width: 260px;
  width: 100%;
  height: auto;
  margin-inline: auto;
}

.auth-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--auth-text-primary);
  margin: 0 0 0.5rem;
  line-height: 1.2;
}

.auth-subtitle {
  font-size: 0.875rem;
  color: var(--auth-text-secondary);
  margin: 0 0 1.75rem;
}

.auth-link {
  color: var(--auth-accent);
  text-decoration: none;
}

@media (any-hover: hover) {
  .auth-link:hover {
    text-decoration: underline;
  }
}

/* フラッシュメッセージ */
.auth-flash {
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.auth-flash--success {
  background-color: var(--auth-accent-light);
  color: var(--auth-accent);
}

.auth-flash--danger {
  background-color: var(--auth-danger-bg);
  color: var(--auth-danger);
}

/* エラーメッセージリスト */
.auth-error-list {
  margin: 0;
  padding-left: 1.25rem;
}

/* フォームフィールド */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.auth-field--checkbox {
  gap: 0.5rem;
}

.auth-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--auth-text-primary);
}

.auth-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.9375rem;
  color: var(--auth-text-primary);
}

.auth-checkbox {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--auth-accent);
}

.auth-input,
.auth-textarea,
.auth-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--auth-text-primary);
  background-color: var(--auth-bg-card);
  border: 1px solid var(--auth-border-strong);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}

.auth-select {
  padding-right: 2.5rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236d6c6a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  background-size: 16px;
  cursor: pointer;
}

.auth-select:disabled,
.auth-input:disabled {
  background-color: var(--auth-bg-page);
  color: var(--auth-text-tertiary);
  cursor: not-allowed;
}

/* テキストエリア専用 */
.auth-textarea {
  resize: vertical;
  min-height: 100px;
}

.auth-input::placeholder,
.auth-textarea::placeholder {
  color: var(--auth-text-tertiary);
}

.auth-input:focus,
.auth-textarea:focus,
.auth-select:focus {
  border-color: var(--auth-accent);
}

.auth-input:focus-visible,
.auth-textarea:focus-visible,
.auth-select:focus-visible {
  border-color: var(--auth-accent);
  outline: 2px solid var(--auth-accent);
  outline-offset: 2px;
}

/* 入力エラー状態 */
.auth-input.is-danger,
.auth-input.is-danger:focus {
  border-color: var(--auth-danger);
}

/* ヘルプテキスト（説明・エラー） */
.auth-help {
  font-size: 0.8125rem;
  color: var(--auth-text-secondary);
  margin: 0;
}

.auth-help--danger {
  font-size: 0.8125rem;
  color: var(--auth-danger);
  margin: 0;
}

/* 送信・確認ボタン（全幅プライマリ） */
.auth-submit {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--auth-bg-card);
  background-color: var(--auth-accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s;
  margin-top: 0.5rem;
}

@media (any-hover: hover) {
  .auth-submit:hover {
    background-color: var(--auth-accent-dark);
  }
}

.auth-submit:focus-visible {
  background-color: var(--auth-accent-dark);
  outline: 2px solid var(--auth-accent);
  outline-offset: 2px;
}

.auth-submit:disabled {
  background-color: var(--auth-text-tertiary);
  cursor: not-allowed;
}

/* フッターリンク */
.auth-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--auth-border-subtle);
}

.auth-footer-link {
  text-align: right;
}

.auth-footer-link a {
  font-size: 0.875rem;
  color: var(--auth-text-secondary);
  text-decoration: none;
}

@media (any-hover: hover) {
  .auth-footer-link a:hover {
    color: var(--auth-accent);
    text-decoration: underline;
  }
}

.auth-footer-link a:focus-visible {
  color: var(--auth-accent);
  text-decoration: underline;
}

/* フラッシュ内の見出し・本文 */
.auth-flash-heading {
  font-weight: 600;
  margin: 0 0 0.375rem;
}

.auth-flash-body {
  margin: 0;
}

/* ヒント・注意書きボックス */
.auth-tips {
  background-color: var(--auth-bg-page);
  border: 1px solid var(--auth-border-subtle);
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.875rem;
  color: var(--auth-text-secondary);
  margin-top: 1rem;
}

.auth-tips-heading {
  font-weight: 600;
  color: var(--auth-text-primary);
  margin: 0 0 0.5rem;
}

.auth-tips-list {
  margin: 0 0 0.5rem;
  padding-left: 1.25rem;
}

.auth-tips-list li {
  margin-bottom: 0.25rem;
}

.auth-tips p:last-child {
  margin: 0;
}

/* ---- 登録フォーム拡張スタイル ---- */

/* 2列グリッド（姓/名など横並びフィールド） */
.auth-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.auth-field-group-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}

.auth-field-group-inputs .auth-field {
  gap: 0.25rem;
}

/* ---- 確認モーダル ---- */

.auth-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-modal.is-active {
  display: flex;
}

.auth-modal-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
}

.auth-modal-box {
  position: relative;
  z-index: 1;
  background-color: var(--auth-bg-card);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  max-height: 90svh;
  overflow-y: auto;
}

.auth-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--auth-text-primary);
  margin: 0 0 0.5rem;
}

.auth-modal-desc {
  font-size: 0.875rem;
  color: var(--auth-text-secondary);
  margin: 0 0 1.25rem;
}

/* 確認テーブル */
.auth-confirm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.auth-confirm-table th,
.auth-confirm-table td {
  padding: 0.625rem 0.5rem;
  border-bottom: 1px solid var(--auth-border-subtle);
  text-align: left;
  vertical-align: top;
}

.auth-confirm-table th {
  color: var(--auth-text-secondary);
  font-weight: 600;
  width: 40%;
  white-space: nowrap;
}

.auth-confirm-table td {
  color: var(--auth-text-primary);
  word-break: break-all;
}

/* モーダルフッターボタン */
.auth-modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.auth-btn-cancel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--auth-text-secondary);
  background-color: var(--auth-bg-page);
  border: 1px solid var(--auth-border-strong);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s;
}

@media (any-hover: hover) {
  .auth-btn-cancel:hover {
    background-color: var(--auth-border-subtle);
  }
}

.auth-btn-cancel:focus-visible {
  background-color: var(--auth-border-subtle);
  outline: 2px solid var(--auth-border-strong);
  outline-offset: 2px;
}

.auth-btn-submit {
  flex: 1;
  padding: 0.625rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--auth-bg-card);
  background-color: var(--auth-accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s;
}

@media (any-hover: hover) {
  .auth-btn-submit:hover {
    background-color: var(--auth-accent-dark);
  }
}

.auth-btn-submit:focus-visible {
  background-color: var(--auth-accent-dark);
  outline: 2px solid var(--auth-accent);
  outline-offset: 2px;
}

.auth-btn-submit:disabled {
  background-color: var(--auth-text-tertiary);
  cursor: not-allowed;
}

/* 危険な操作（削除・キャンセル等）用ボタン */
.auth-btn-submit--danger {
  background-color: var(--auth-danger);
}

@media (any-hover: hover) {
  .auth-btn-submit--danger:hover {
    background-color: #a93226;
  }
}

.auth-btn-submit--danger:focus-visible {
  background-color: #a93226;
  outline-color: var(--auth-danger);
}

/* フォームフッター（戻るボタン + 確認ボタン） */
.auth-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* エントリーキャンセルリンク */
.auth-cancel-entry-link {
  font-size: 0.875rem;
  color: var(--auth-danger);
  text-decoration: none;
}

.auth-cancel-entry-link:focus-visible {
  text-decoration: underline;
  outline: 2px solid var(--auth-danger);
  outline-offset: 2px;
}

@media (any-hover: hover) {
  .auth-cancel-entry-link:hover {
    text-decoration: underline;
  }
}
