/* ==================================================
   File Upload Component
   ================================================== */

.file-upload-container {
  margin-bottom: 20px;
}

.file-upload-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.file-upload-label {
  font-size: 13px;
  color: #73879C;
  font-weight: 500;
  margin: 0;
}

.file-upload-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #73879C;
  font-weight: 500;
}

.file-counter-icon {
  font-size: 16px;
  transition: color 0.3s ease;
}

.file-counter-icon[data-status="normal"] {
  color: #1ABB9C;
}

.file-counter-icon[data-status="warning"] {
  color: #F39C12;
}

.file-counter-icon[data-status="danger"] {
  color: #E74C3C;
}

.counter-text {
  font-size: 14px;
}

.current-count {
  font-weight: 600;
  color: #2A3F54;
}

.file-upload-description {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  color: #B8C7D6;
}

/* Upload Area */
.file-upload-area {
  border: 2px dashed #CCC;
  border-radius: 3px;
  background: #FAFAFA;
  transition: all 0.3s ease;
  position: relative;
}

.file-upload-area.drag-over {
  border-color: #1ABB9C;
  background: #F0FDF4;
}

.upload-placeholder {
  padding: 40px 20px;
  text-align: center;
}

.upload-icon {
  font-size: 48px;
  color: #B8C7D6;
  margin-bottom: 15px;
}

.upload-text {
  font-size: 16px;
  color: #2A3F54;
  margin: 0 0 5px 0;
  font-weight: 500;
}

.upload-subtext {
  font-size: 13px;
  color: #73879C;
  margin: 0 0 15px 0;
}

.btn-select-file {
  margin-bottom: 15px;
}

.upload-info {
  font-size: 12px;
  color: #B8C7D6;
  margin: 0;
}

/* File List */
.file-list {
  padding: 15px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  background: #FFFFFF;
  border: 1px solid #E6E9ED;
  border-radius: 3px;
  margin-bottom: 10px;
  transition: all 0.2s ease;
}

.file-item:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.file-item-info {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.file-icon {
  font-size: 24px;
  color: #1ABB9C;
  margin-right: 12px;
  flex-shrink: 0;
}

.file-details {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 13px;
  color: #2A3F54;
  margin: 0 0 3px 0;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 11px;
  color: #B8C7D6;
  margin: 0;
}

.file-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-remove-file {
  background: none;
  border: none;
  color: #E74C3C;
  cursor: pointer;
  padding: 5px 10px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.btn-remove-file:hover {
  color: #C0392B;
  background: #FFEBEE;
  border-radius: 3px;
}

/* Error Message */
.file-upload-error {
  margin-top: 10px;
  padding: 10px 15px;
  background: #FFEBEE;
  border: 1px solid #FFCDD2;
  border-radius: 3px;
  color: #C62828;
  font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
  .file-upload-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .upload-placeholder {
    padding: 30px 15px;
  }

  .upload-icon {
    font-size: 36px;
  }

  .upload-text {
    font-size: 14px;
  }

  .file-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .file-item-info {
    width: 100%;
  }

  .file-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ===== メイン画像 UI ===== */
.file-item {
  position: relative;
}

/* メイン選択時の強調（カードの縁） */
.file-item.is-main {
  outline: 2px solid rgba(13, 110, 253, 0.55);
  outline-offset: 2px;
  border-radius: 10px;
}

/* ===== メイン画像：カード背景をほんのり赤 ===== */
.file-item.is-main {
  background: rgba(255, 99, 71, 0.08);
  /* ほんのり赤 */
  outline: 2px solid rgba(255, 99, 71, 0.35);
  outline-offset: 2px;
  border-radius: 10px;
}

/* ===== 画面中央の吹き出し + 矢印線 ===== */
.main-image-hint {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

.main-image-hint.hidden {
  display: none;
}

/* 吹き出し本体：位置はJSで left/top を指定 */
.main-image-hint .bubble {
  position: absolute;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
  font-size: 13px;
  font-weight: 700;
  color: #333;
  backdrop-filter: blur(6px);
  transform-origin: 50% 100%;
  animation: bubble-float 1.8s ease-in-out infinite;
}

/* ▼（下向き三角）…カード上辺を指す想定 */
.main-image-hint .bubble::after {
  content: "";
  position: absolute;
  left: var(--arrow-x, 50%);
  bottom: -10px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid rgba(255, 255, 255, 0.96);
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.10));
}

/* ふわふわ浮遊 */
@keyframes bubble-float {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }

  100% {
    transform: translateY(0);
  }
}

/* 線を描くSVG */
.main-image-hint svg {
  position: absolute;
  inset: 0;
}

/* カードが最初から「ボタン」に見えるように */
.file-item {
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
  border-radius: 10px;
}

.file-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.10);
}

.file-item:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.10);
}

/* メイン選択（ほんのり赤） */
.file-item.is-main {
  background: rgba(255, 0, 0, 0.05);
  outline: 2px solid rgba(255, 0, 0, 0.18);
}

/* ゴミ箱ボタンはカードクリックと分離したいので前面に */
.file-item .btn-remove-file {
  cursor: pointer;
}

/* 中央吹き出し＋線 */
.main-image-hint-layer {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
}

.main-image-hint-layer.hidden {
  display: none;
}

.main-image-hint {
  position: absolute;
  inset: 0;
}

/* left/top をJSで付けるので position:fixed にする */
.main-image-hint .bubble {
  position: fixed;
  transform: translate(-50%, -100%);
  /* 上辺中央に“乗っかる” */
  background: #fff;
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 0, 0, 0.18);
  animation: floaty 1.6s ease-in-out infinite;
}

/* 吹き出しの▼（カード方向に向ける） */
.main-image-hint .bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #fff;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.08));
}

@keyframes floaty {
  0%, 100% {
    transform: translate(-50%, -100%) translateY(0);
  }

  50% {
    transform: translate(-50%, -100%) translateY(-6px);
  }
}

.file-thumb-wrap {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  flex: 0 0 44px;
  background: rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-item-info {
  display: flex;
  align-items: center;
}

/* ===== サムネ調整 ===== */
.file-item .thumb {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  flex: 0 0 72px;
  background: #f3f5f7;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-item .thumb-inner {
  width: 100%;
  height: 100%;
}

.file-item .thumb-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.file-item .thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  font-size: 20px;
}

.registered-item.dragging {
  opacity: 0.8;
}