/**
 * 2026年選挙候補者一覧ページ用スタイル
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', sans-serif;
  background: #fff;
  color: #1a1a1a;
  line-height: 1.5;
  min-height: 100vh;
}

.election-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.election-header {
  margin-bottom: 24px;
}

.election-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  gap: 10px;
}

.election-title svg {
  width: 28px;
  height: 28px;
  color: #2D8A6E;
}

.election-subtitle {
  font-size: 0.875rem;
  color: #666;
  margin-top: 6px;
  font-weight: 400;
}

/* フィルターセクション */
.filter-section {
  padding: 12px 0;
  margin-bottom: 24px;
}

.filter-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-group {
  flex: 1;
  min-width: 160px;
}

.filter-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.filter-select,
.filter-input {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.9rem;
  border: 1px solid #999;
  background: #fff;
  font-family: inherit;
  color: #1a1a1a;
  transition: border-color 0.15s ease;
}

.filter-select:focus,
.filter-input:focus {
  outline: none;
  border-color: #2D8A6E;
}

.filter-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M1 4l5 4 5-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.filter-input::placeholder {
  color: #999;
}

.filter-clear {
  padding: 9px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
  background: #fff;
  border: 1px solid #999;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.15s ease;
  white-space: nowrap;
}

.filter-clear:hover {
  background: #f5f5f5;
  border-color: #666;
}

.filter-clear:active {
  background: #e8e8e8;
}

/* モバイル版フィルター */
.filter-mobile-tabs {
  display: none;
}

.filter-mobile-expanded {
  display: none;
}

/* 都道府県セクション */
.prefecture-section {
  margin-bottom: 32px;
}

.prefecture-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111;
  padding-left: 12px;
  border-left: 4px solid #2D8A6E;
  margin-bottom: 16px;
}

/* テーブル */
.candidates-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.candidates-table thead {
  background: #2D8A6E;
  color: #fff;
}

.candidates-table th {
  padding: 12px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
}

.candidates-table th:nth-child(2),
.candidates-table th:nth-child(3),
.candidates-table th:nth-child(4) {
  text-align: center;
}

/* 選挙区ヘッダー */
.district-row {
  background: #E8F5F0;
}

.district-row td {
  padding: 8px 16px;
  font-size: 1rem;
  font-weight: 600;
  color: #2D8A6E;
  border-bottom: 1px solid #ddd;
}

/* 候補者行 */
.candidate-row {
  border-bottom: 1px solid #eee;
}

.candidate-row:hover {
  background: #fafafa;
}

.candidate-row td {
  padding: 14px 16px;
  vertical-align: middle;
}

.candidate-name-cell {
  min-width: 200px;
}

.candidate-reading {
  font-size: 0.7rem;
  color: #888;
  margin-bottom: 2px;
}

.candidate-name {
  font-size: 1rem;
  font-weight: 600;
  color: #111;
}

.candidate-age {
  color: #666;
  font-weight: 400;
}

.candidate-party {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.candidate-party a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.candidate-party a:hover {
  text-decoration: underline;
}

.candidate-party .no-page {
  cursor: default;
  opacity: 0.7;
}

.candidate-party .no-page:hover {
  text-decoration: none;
}

/* ツールチップ */
.tooltip-container {
  position: relative;
  display: inline-block;
}

.tooltip-text {
  visibility: hidden;
  background: #fff;
  color: #333;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 6px 10px;
  position: absolute;
  z-index: 100;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  margin-bottom: 6px;
  border: 1px solid #ddd;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #fff;
}

.tooltip-text::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #ddd;
}

.tooltip-container:hover .tooltip-text {
  visibility: visible;
}

.candidate-attribute {
  text-align: center;
  font-size: 0.9rem;
  color: #333;
}

.candidate-wins {
  text-align: center;
  font-size: 0.9rem;
  color: #333;
}

/* 空状態 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: #ccc;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 0.9rem;
}

/* ローディング */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

/* 投票参加モーダル */
.invite-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.invite-modal-overlay.show {
  display: flex;
}

.invite-modal {
  background: #fff;
  border-radius: 12px;
  padding: 32px 28px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.invite-modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 12px;
}

.invite-modal-text {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.6;
  margin-bottom: 24px;
}

.invite-modal-btn {
  display: inline-block;
  background: #2D8A6E;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 32px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.invite-modal-btn:hover {
  background: #247a5e;
}

.invite-modal-close {
  display: block;
  margin-top: 16px;
  font-size: 0.8rem;
  color: #999;
  background: none;
  border: none;
  cursor: pointer;
}

.invite-modal-close:hover {
  color: #666;
}

/* モバイル対応 */
@media (max-width: 640px) {
  .election-container {
    padding: 16px 12px 40px;
  }

  .election-header {
    margin-bottom: 12px;
  }

  .election-title {
    font-size: 1.2rem;
  }

  .election-title svg {
    width: 22px;
    height: 22px;
  }

  .election-subtitle {
    font-size: 0.75rem;
  }

  .filter-section {
    padding: 0;
    margin-bottom: 16px;
  }

  /* デスクトップ版を非表示 */
  .filter-row {
    display: none;
  }

  /* モバイル版を表示 */
  .filter-mobile-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    border-bottom: 1px solid #ddd;
  }

  .filter-mobile-tab {
    flex: 1;
    padding: 10px 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #666;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
  }

  .filter-mobile-tab.active {
    border-bottom-color: #2D8A6E;
    color: #2D8A6E;
  }

  .filter-mobile-expanded {
    display: none;
    padding-top: 12px;
  }

  .filter-mobile-expanded.active {
    display: block;
  }

  .filter-mobile-expanded .filter-group {
    margin-bottom: 16px;
  }

  .filter-mobile-search-wrapper {
    position: relative;
  }

  .filter-mobile-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .filter-mobile-search-btn svg {
    width: 20px;
    height: 20px;
    color: #2D8A6E;
  }

  .filter-mobile-expanded .filter-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
  }

  .filter-mobile-expanded .filter-select,
  .filter-mobile-expanded .filter-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    border: 1px solid #999;
    background: #fff;
    font-family: inherit;
    color: #1a1a1a;
  }

  .filter-mobile-expanded .filter-select:focus,
  .filter-mobile-expanded .filter-input:focus {
    outline: none;
    border-color: #2D8A6E;
  }

  .filter-mobile-expanded .filter-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M1 4l5 4 5-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
  }

  .candidates-table th,
  .candidates-table td {
    padding: 10px 8px;
    font-size: 0.8rem;
  }

  .candidate-name-cell {
    min-width: 140px;
  }

  .candidate-name {
    font-size: 0.9rem;
  }

  .candidate-reading {
    font-size: 0.65rem;
  }

  .prefecture-title {
    font-size: 1.1rem;
    margin-bottom: 12px;
  }

  .prefecture-section {
    margin-bottom: 24px;
  }
}
