/* common.css - 共通スタイル */

/* ========================================
   CSS変数（カラーパレット）
   ======================================== */
:root {
  --bg-main: #1A1A1A;
  --bg-card: #2D2D2D;
  --bg-input: #3A3A3A;
  --accent: #C5A55A;
  --accent-hover: #D4B86A;
  --text-main: #F0F0F0;
  --text-sub: #A0A0A0;
  --success: #4CAF50;
  --danger: #E53935;
  --border: #404040;
  --nav-bg: #111111;
  --nav-active: #C5A55A;
  --nav-inactive: #777777;
}

/* ========================================
   ベーススタイル
   ======================================== */
html {
  font-size: 16px;
}

body {
  font-family: system-ui, sans-serif;
  font-size: 14px;
  color: var(--text-main);
  background-color: var(--bg-main);
  min-height: 100vh;
  min-height: 100dvh;
}

/* PC表示：スマホアプリ風に中央寄せ */
@media (min-width: 768px) {
  body {
    max-width: 480px;
    margin: 0 auto;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    position: relative;
  }
}

/* ========================================
   ヘッダーバー
   ======================================== */
.header-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  background-color: var(--nav-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 768px) {
  .header-bar {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
}

.header-bar__title {
  font-size: 16px;
  font-weight: bold;
  color: var(--accent);
}

.header-bar__user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.header-bar__username {
  color: var(--text-sub);
}

.header-bar__logout {
  color: var(--text-sub);
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: color 0.2s, border-color 0.2s;
}

.header-bar__logout:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ========================================
   下段ナビゲーション
   ======================================== */
.nav-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: var(--nav-bg);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  border-top: 1px solid var(--border);
}

@media (min-width: 768px) {
  .nav-bottom {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
}

.nav-bottom__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  height: 100%;
  color: var(--nav-inactive);
  transition: color 0.2s;
}

.nav-bottom__item--active {
  color: var(--nav-active);
}

.nav-bottom__icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-bottom__icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.nav-bottom__label {
  font-size: 10px;
  line-height: 1;
}

/* 管理者専用タブ（非表示制御） */
.nav-bottom__item--admin.is-hidden {
  display: none;
}

/* ========================================
   コンテンツエリア
   ======================================== */
.content {
  padding-top: 50px;   /* ヘッダー高さ分 */
  padding-bottom: 60px; /* ナビ高さ分 */
  min-height: 100vh;
  min-height: 100dvh;
}

.content__inner {
  padding: 16px;
}

/* ========================================
   画面タイトル
   ======================================== */
.page-title {
  font-size: 20px;
  font-weight: bold;
  color: var(--text-main);
  margin-bottom: 16px;
}

/* ========================================
   セクション見出し
   ======================================== */
.section-title {
  font-size: 16px;
  font-weight: bold;
  color: var(--text-main);
  margin-bottom: 12px;
  padding-left: 8px;
  border-left: 3px solid var(--accent);
}

/* ========================================
   カード
   ======================================== */
.card {
  background-color: var(--bg-card);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

/* ========================================
   ボタン
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  transition: background-color 0.2s, opacity 0.2s;
  width: 100%;
}

.btn--primary {
  background-color: var(--accent);
  color: var(--bg-main);
}

.btn--primary:hover {
  background-color: var(--accent-hover);
}

.btn--secondary {
  background-color: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn--secondary:hover {
  background-color: rgba(197, 165, 90, 0.1);
}

.btn--danger {
  background-color: var(--danger);
  color: #FFFFFF;
}

.btn--danger:hover {
  opacity: 0.9;
}

.btn:disabled,
.btn--disabled {
  background-color: #555555;
  color: #888888;
  cursor: not-allowed;
  border: none;
}

/* ボタン横並び */
.btn-group {
  display: flex;
  gap: 12px;
}

.btn-group .btn {
  flex: 1;
}

/* ========================================
   入力フィールド
   ======================================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 16px;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--accent);
}

.form-input::placeholder {
  color: var(--nav-inactive);
}

/* プルダウン（select） */
.form-select {
  width: 100%;
  height: 44px;
  padding: 0 36px 0 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23C5A55A' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.2s;
}

.form-select:focus {
  border-color: var(--accent);
}

/* ========================================
   ステータスラベル
   ======================================== */
.label {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
}

.label--success {
  background-color: rgba(76, 175, 80, 0.2);
  color: var(--success);
}

.label--danger {
  background-color: rgba(229, 57, 53, 0.2);
  color: var(--danger);
}

.label--gold {
  background-color: rgba(197, 165, 90, 0.2);
  color: var(--accent);
}

.label--gray {
  background-color: rgba(160, 160, 160, 0.15);
  color: var(--text-sub);
}

/* ========================================
   ローディングオーバーレイ
   ======================================== */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

.loading-overlay.is-active {
  display: flex;
}

.loading-overlay__spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   確認ダイアログ
   ======================================== */
.dialog-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 998;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.dialog-overlay.is-active {
  display: flex;
}

.dialog {
  background-color: var(--bg-card);
  border-radius: 12px;
  padding: 24px;
  max-width: 320px;
  width: 100%;
}

.dialog__title {
  font-size: 16px;
  font-weight: bold;
  color: var(--text-main);
  margin-bottom: 12px;
}

.dialog__message {
  font-size: 14px;
  color: var(--text-sub);
  margin-bottom: 20px;
  line-height: 1.6;
}

.dialog__actions {
  display: flex;
  gap: 12px;
}

.dialog__actions .btn {
  flex: 1;
  height: 40px;
  font-size: 14px;
}

/* ========================================
   トーストメッセージ
   ======================================== */
.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
}

.toast--success {
  background-color: var(--success);
  color: #FFFFFF;
}

.toast--error {
  background-color: var(--danger);
  color: #FFFFFF;
}

@media (min-width: 768px) {
  .loading-overlay,
  .dialog-overlay {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }

  .toast {
    max-width: 480px;
  }
}

/* ========================================
   ユーティリティ
   ======================================== */
.text-accent {
  color: var(--accent);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-sub {
  color: var(--text-sub);
}

.text-center {
  text-align: center;
}

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
