/* photo-vote-nb.css — 改訂版 */

/* container */
#photo-vote-wrap {
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* note (user modified to 1rem) */
.pv-note {
  margin-bottom: 12px;
  font-size: 1rem;
}

/* grid: PC 3 col, mobile 1 col */
.pv-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* item */
.pv-item {
  border: 1px solid #ddd;
  padding: 8px;
  border-radius: 6px;
  background: #fff;
  box-sizing: border-box;
}
.pv-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  border-radius: 4px;
}

/* caption: place controls in left and right positions */
.pv-item figcaption {
  display: flex;
  justify-content: space-between; /* 左右に分けてボタンを配置 */
  gap: 8px;
  align-items: center; /* input とテキストを縦中央揃え */
  margin-top: 8px;
  padding: 0 8px;
  box-sizing: border-box;
  flex-wrap: wrap; /* 幅が足りないときは次行に回る */
}

/* remarks input (Vol.2) */
.pv-remark-input {
  width: 100%;
  margin-top: 6px;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  box-sizing: border-box;
}
.pv-remark-input:focus {
  outline: none;
  border-color: #0073aa;
  box-shadow: 0 0 0 1px #0073aa;
}
.pv-remark-input::placeholder {
  color: #999;
}
/* 投票かイチオシを選ぶまでは書けない */
.pv-remark-input:disabled {
  background: #f3f3f3;
  cursor: not-allowed;
}

/* label: make input and text aligned horizontally and vertically */
.pv-item label {
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap; /* ラベル内では折り返さない（"投票" 等が分割されないように） */
  line-height: 1;
}

/* ensure inputs align well and are not oversized */
.pv-item input[type='checkbox'],
.pv-item input[type='radio'] {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  vertical-align: middle;
  -webkit-appearance: auto;
  appearance: auto;
  flex: 0 0 auto;
}

/* Footer (fixed) */
#pv-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #ccc;
  padding: 10px 0;
  z-index: 9999;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.03);
  box-sizing: border-box;
}

/* center the content block but distribute items left/right inside */
#pv-footer .pv-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  gap: 12px;
}

/* mobile bottom row container (hidden on desktop) */
.pv-mobile-bottom-row {
  display: contents; /* on desktop, contents flow normally */
}

/* left: used votes — take available space and left-align */
#pv-used {
  font-weight: 700;
  font-size: 1.2rem;
  text-align: left;
  flex: 0 0 auto; /* fixed width, don't grow */
  margin: 0;
  min-width: 150px;
}

/* on desktop, ensure proper ordering */
@media (min-width: 769px) {
  .pv-voter-info {
    order: 2; /* center on desktop */
  }

  #pv-used {
    order: 1; /* left on desktop */
  }

  #pv-submit {
    order: 3; /* right on desktop */
  }
}

/* center: voter info inputs */
.pv-voter-info {
  display: flex;
  gap: 8px;
  flex: 1 1 auto; /* grow to fill available space */
  align-items: center;
}

.pv-voter-info input {
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  flex: 1;
  min-width: 120px;
  box-sizing: border-box;
}

.pv-voter-info input:focus {
  outline: none;
  border-color: #0073aa;
  box-shadow: 0 0 0 1px #0073aa;
}

/* right: submit button */
#pv-submit {
  background: #0073aa;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.2rem;
  flex: 0 0 auto;
  white-space: nowrap;
}

/* disabled state */
#pv-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 投票とイチオシの視覚的フィードバック */
.pv-item.pv-voted {
  border: 2px solid #ff0000;
}
.pv-item.pv-ichioshi {
  border: 5px solid #ff0000;
}

/* ファイル名隠蔽のための設定 */
.pv-item img {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  pointer-events: none; /* マウスイベントを無効化 */
}

/* 画像コンテナでマウスイベントを再有効化（チェックボックス操作のため） */
.pv-item figcaption {
  pointer-events: auto;
}

/* small-screen adjustments */
@media (max-width: 768px) {
  /* small horizontal padding for the whole content */
  #photo-vote-wrap {
    padding: 0 5px;
  }

  /* one column layout */
  .pv-grid {
    grid-template-columns: 1fr;
  }

  /* maintain square aspect ratio on mobile */
  .pv-item img {
    aspect-ratio: 1;
  }

  /* slightly reduce label font on narrow screens if needed */
  .pv-item label {
    font-size: 14px;
  }

  /* mobile layout: reorganize to requested format */
  #pv-footer .pv-inner {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
  }

  /* voter info: stack inputs vertically (affiliation first, then name) */
  .pv-voter-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .pv-voter-info input {
    min-width: auto;
    width: 100%;
  }

  /* bottom row: votes counter and submit button side by side */
  .pv-mobile-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }

  #pv-used {
    text-align: left;
    min-width: auto;
    flex: 1 1 auto;
    margin: 0;
  }

  #pv-submit {
    flex: 0 0 auto;
    margin: 0;
  }
}
