/* ==========================================
   FanboxVoteSystem 共通CSS
   04_style-guide.md 準拠
   ========================================== */

/* ==========================================
   CSS変数（テーマ）
   ========================================== */
:root {
  --color-text: #333333;
  --color-subtext: #666666;
  --color-border: #cccccc;
  --color-bg-box: #ffffff;
  --color-error: #dc3545;
  --color-error-bg: #ffe6e6;
  --color-success: #155724;
  --color-success-bg: #d4edda;
  --color-disabled: #cccccc;
  --color-vote: #dc3545;
  --color-vote-hover: #c82333;
}

.theme-public {
  --color-bg-page: #f4f7f6;
  --color-heading: #444444;
  --color-primary: #007bff;
  --color-primary-hover: #0056b3;
  --color-link: #007bff;
  --color-link-bg-hover: #f0f8ff;
  --color-notice-bg: #d4edda;
  --color-notice-text: #155724;
  --color-schedule-bg: #fff3cd;
  --color-schedule-border: #ffc107;
  --color-schedule-text: #856404;
  --color-secondary: #6c757d;
  --color-secondary-hover: #5a6268;
  --color-result-count: #28a745;
  --color-result-bar-start: #28a745;
  --color-result-bar-end: #218838;
}

.theme-support {
  --color-bg-page: #fffaf0;
  --color-heading: #ff9900;
  --color-primary: #ff9900;
  --color-primary-hover: #e68a00;
  --color-link: #ff9900;
  --color-link-bg-hover: #fff3cd;
  --color-notice-bg: #fff8e1;
  --color-notice-text: #856404;
  --color-schedule-bg: #fff3cd;
  --color-schedule-border: #ffcc00;
  --color-schedule-text: #856404;
  --color-badge-bg: #ffcc00;
  --color-badge-text: #333333;
  --color-result-count: #d39e00;
  --color-result-bar-start: #ffcc00;
  --color-result-bar-end: #ff9900;
}

/* ==========================================
   ベースレイアウト
   ========================================== */
body {
  font-family: "Helvetica Neue", Arial, sans-serif;
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  text-align: center;
  color: var(--color-text);
  background-color: var(--color-bg-page);
  line-height: 1.6;
}

h2 {
  text-align: center;
  color: var(--color-heading);
  margin-bottom: 20px;
}

label {
  display: block;
  font-weight: bold;
  margin-bottom: 5px;
  text-align: left;
}

/* ==========================================
   ボックス
   ========================================== */
.box {
  background: var(--color-bg-box);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 25px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  text-align: left;
  border-top: 5px solid var(--color-primary);
}
.login-box {
  border-top-color: var(--color-schedule-border);
  text-align: center;
}
.container {
  padding: 25px;
  border-radius: 12px;
  border: 1px solid #ddd;
  background: var(--color-bg-box);
  margin-bottom: 30px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* ==========================================
   ボタン
   ========================================== */
button {
  width: 100%;
  padding: 12px;
  background-color: var(--color-primary);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1.1em;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
}
button:hover { background-color: var(--color-primary-hover); }
button:disabled { background-color: var(--color-disabled); cursor: not-allowed; }

.btn-auth {
  background-color: #ffc107;
  color: var(--color-text);
}
.btn-auth:hover { background-color: #d39e00; }
.btn-auth:disabled { background-color: var(--color-disabled); cursor: not-allowed; }

.vote-btn {
  background: var(--color-vote);
  color: white;
  padding: 8px 16px;
  font-size: 0.9em;
  width: auto;
  margin-top: 0;
}
.vote-btn:hover { background-color: var(--color-vote-hover); }
.vote-btn:disabled { background: var(--color-disabled); cursor: not-allowed; }

/* ==========================================
   入力フィールド
   ========================================== */
input, select, textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  box-sizing: border-box;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 16px;
}

/* ==========================================
   候補カード
   ========================================== */
.candidate-card {
  border: 1px solid #eee;
  padding: 15px;
  margin-bottom: 10px;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* ==========================================
   メッセージ
   ========================================== */
.error-msg {
  color: var(--color-error);
  background: var(--color-error-bg);
  padding: 10px;
  border-radius: 4px;
}
.success-msg {
  color: var(--color-success);
  background: var(--color-success-bg);
  border: 1px solid #c3e6cb;
  padding: 10px;
  border-radius: 4px;
}

/* ==========================================
   注意・スケジュール
   ========================================== */
.notice-box {
  background-color: var(--color-notice-bg);
  color: var(--color-notice-text);
  padding: 15px;
  border-radius: 5px;
  margin-bottom: 20px;
  font-size: 0.9em;
  text-align: left;
}
.schedule-info {
  background-color: var(--color-schedule-bg);
  border-left: 5px solid var(--color-schedule-border);
  padding: 15px;
  margin-bottom: 25px;
  border-radius: 4px;
  text-align: center;
}
.schedule-info p {
  margin: 5px 0;
  font-weight: bold;
  color: var(--color-schedule-text);
}

/* ==========================================
   リンク
   ========================================== */
.top-link { margin-bottom: 20px; }
.top-link a {
  color: var(--color-link);
  text-decoration: none;
  font-weight: bold;
  border: 1px solid var(--color-link);
  padding: 8px 15px;
  border-radius: 20px;
}
.top-link a:hover { background: var(--color-link-bg-hover); }

.logout-link {
  display: block;
  margin-top: 30px;
  font-size: 0.85em;
  color: #999;
  text-decoration: underline;
  cursor: pointer;
  text-align: center;
}

.reload-btn {
  background: transparent;
  border: 1px solid #ccc;
  padding: 5px 15px;
  border-radius: 4px;
  color: #666;
  cursor: pointer;
  font-size: 0.8em;
  width: auto;
}
.reload-btn:hover { background-color: #eee; }

/* ==========================================
   非表示
   ========================================== */
.hidden { display: none; }

/* ==========================================
   メンテナンス
   ========================================== */
.maintenance-box {
  max-width: 500px;
  margin: 100px auto;
  padding: 40px;
  text-align: center;
  background: var(--color-bg-box);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* ==========================================
   ガチャ演出
   ========================================== */
.gacha-ball {
  width: 80px;
  height: 80px;
  line-height: 80px;
  border-radius: 50%;
  font-weight: bold;
  color: white;
  margin: 20px auto;
  font-size: 2em;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  animation: pop 0.5s ease-out;
}
.ball-UR { background: #cc0000; border: 4px solid #ff8c00; color: #ffd700; text-shadow: 0 0 6px rgba(255, 215, 0, 0.6); }
.ball-SSR { background: gold; border: 4px solid orange; color: #a05a00; }
.ball-SR { background: silver; border: 4px solid gray; color: #333; }
.ball-R { background: #cd7f32; border: 4px solid #8b4513; color: white; }
@keyframes pop {
  0% { transform: scale(0); }
  80% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ==========================================
   順位バッジ
   ========================================== */
.rank-badge {
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
  background: #eee;
  font-size: 0.8em;
  font-weight: bold;
  margin-right: 5px;
}
.rank-1 { background: #ffd700; color: #fff; text-shadow: 1px 1px 0 rgba(0,0,0,0.2); }
.rank-2 { background: #c0c0c0; color: #fff; text-shadow: 1px 1px 0 rgba(0,0,0,0.2); }
.rank-3 { background: #cd7f32; color: #fff; text-shadow: 1px 1px 0 rgba(0,0,0,0.2); }

/* ==========================================
   結果表示
   ========================================== */
.result-row {
  margin-bottom: 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}
.result-row:last-child { border-bottom: none; }
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 5px;
}
.char-name { font-weight: bold; font-size: 1.1em; }
.char-theme { font-size: 0.85em; color: var(--color-subtext); margin-left: 5px; }
.vote-count { font-weight: bold; font-size: 1.1em; color: var(--color-result-count); }
.vote-count-unit { font-size: 0.7em; color: #888; }
.result-bar-bg {
  background: #f0f0f0;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  width: 100%;
}
.result-bar-fill {
  background: linear-gradient(90deg, var(--color-result-bar-start), var(--color-result-bar-end));
  height: 100%;
  width: 0%;
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
