/* ============================
   SNPIT ギルドアプリ - 共通スタイル
   元のspot-style.cssをベースに統合
   ============================ */

html, body {
  min-height: 100%;
  height: auto;
  overflow-y: auto;
  font-family: sans-serif;
  margin: 0;
  padding: 0 10px;
  padding-bottom: 60px;
  background: #1E2C2A;
}

/* ページタイトル */
h1.page-title {
  color: #ffffff;
  text-align: center;
  font-size: 1.8em;
  margin-top: 20px;
  margin-bottom: 24px;
}

/* ============================
   +ボタン（FAB）
   ============================ */
.open-btn {
  position: fixed;
  bottom: 60px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #269973;
  color: white;
  font-size: 30px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  border: none;
  cursor: pointer;
}

/* ============================
   モーダル共通
   ============================ */
.modal-bg {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 9998;
}

.modal {
  width: 96%;
  max-width: 700px;
  padding: 24px;
  border-radius: 24px;
  background-color: #fff;
  font-size: 16px;
  box-shadow: 0 14px 36px rgba(0,0,0,0.35);
  z-index: 100;
  box-sizing: border-box;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal h1 {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 20px;
  display: block;
  text-align: center;
}

.modal label {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
  color: #333;
  font-weight: bold;
}

.modal input[type="text"],
.modal textarea {
  width: 100%;
  padding: 12px;
  font-size: 18px;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 16px;
  box-sizing: border-box;
}

.modal input:not([type="text"]) {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 16px;
  box-sizing: border-box;
}

.modal select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  box-sizing: border-box;
  background-color: #fff;
  cursor: pointer;
  font-size: 16px;
  margin-bottom: 16px;
  height: auto;
}

.modal select option {
  font-size: 14px !important;
  padding: 8px;
  line-height: 1.4;
}

.modal button[type="submit"] {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.modal button[type="submit"]:hover {
  background-color: #45a049;
}

.modal .hidden {
  display: none;
}

.modal .help-text {
  display: block;
  font-size: 10px;
  color: #888;
  margin-top: -2px;
  margin-bottom: 4px;
  line-height: 1.1;
  font-weight: normal;
}

.modal .required-indicator {
  color: #e74c3c;
  font-weight: bold;
  margin-right: 8px;
}

.modal .image-preview {
  max-width: 100%;
  max-height: 200px;
  margin: 8px 0 16px;
  border-radius: 8px;
  object-fit: contain;
  display: none;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
}

/* ============================
   ギャラリー（3列グリッド）
   ============================ */
.spot-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px;
  width: 100%;
  max-width: 1200px;
  margin: 20px auto;
}

.spot-card {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
  background: #2A3A38;
  transition: transform 0.2s;
  position: relative;
  cursor: pointer;
}

.spot-card:hover {
  transform: scale(1.03);
}

.spot-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* プレースホルダー画像（画像なしの場合） */
.spot-card .placeholder-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: rgba(255,255,255,0.3);
  background: linear-gradient(135deg, #2A3A38 0%, #3A5A56 100%);
}

/* カードオーバーレイ */
.card-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
  border-radius: 14px;
}

.overlay-green {
  background-color: rgba(0, 70, 0, 0.65);
  box-shadow: inset 0 0 0 3px rgba(46, 204, 113, 0.9);
}

.overlay-red {
  background-color: rgba(100, 0, 0, 0.65);
  box-shadow: inset 0 0 0 3px rgba(231, 76, 60, 0.9);
}

/* ============================
   バッジ
   ============================ */
.badge {
  position: absolute;
  padding: 3px 7px;
  border-radius: 7px;
  color: white;
  font-size: 11px;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  z-index: 3;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}

.badge.level {
  background-color: rgba(22, 33, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.badge.level.s-rank { color: #FF5252; }
.badge.level.a-rank { color: #BB86FC; }
.badge.level.b-rank { color: #3D5AFE; }
.badge.level.c-rank { color: #00E5B9; }
.badge.level.d-rank { color: #E0E0E0; }

.badge.green { background-color: #2ecc71; }
.badge.red { background-color: #e74c3c; }
.badge.blue { background-color: #3498db; }
.badge.gray { background-color: #95a5a6; }

.pref-tag {
  position: absolute;
  top: 5px; right: 5px;
  background-color: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: bold;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  z-index: 3;
}

/* ============================
   フィルター
   ============================ */
.filter-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 16px auto;
  width: 95%;
  max-width: 600px;
  padding: 0;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 10px;
}

.filter-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-sizing: border-box;
  min-width: 0;
}

.filter-item:not(.keyword-item) {
  flex-basis: calc(50% - 5px);
  flex-grow: 1;
}

.filter-item.keyword-item {
  flex-basis: 100%;
}

.filter-label {
  font-size: 12px;
  margin-bottom: 3px;
  color: #c7d3d1;
  font-weight: bold;
  display: block;
}

.filter-select,
.filter-input {
  width: 100%;
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid #2A4A46;
  border-radius: 4px;
  background: #3A5A56;
  color: #ffffff;
  min-height: 30px;
  margin-bottom: 6px;
}

.filter-input::placeholder {
  color: #aab;
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.25);
}

#keywordFilter.filter-input {
  padding: 4px 8px;
  font-size: 13px;
  height: auto;
  line-height: 1.4;
  width: 90%;
  max-width: 800px;
  margin: 10px auto;
  display: block;
}

#keywordFilter.filter-input::placeholder {
  font-size: 11px;
  color: #aaa;
}

/* 2行目以降のフィルター行 */
.filter-container > .filter-row:nth-child(n+2) {
  gap: 8px;
}

.filter-container > .filter-row:nth-child(n+2) > .filter-item:not(.keyword-item) {
  flex-basis: calc(50% - 4px);
}

/* ============================
   ローディング
   ============================ */
.loading-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 200px;
  width: 100%;
  margin: 30px auto;
}

.loading-spinner {
  border: 8px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  border-top: 8px solid #269973;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  color: #ffffff;
  font-size: 20px;
  font-weight: bold;
  margin-top: 16px;
  text-align: center;
}

/* エラーメッセージ */
.error-message {
  color: #ffdddd;
  text-align: center;
  padding: 24px 16px;
  font-size: 1em;
}

/* ============================
   詳細モーダル
   ============================ */
#spotModal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  padding: 20px 0;
}

.modal-view {
  background-color: #fff;
  margin: 5vh auto 0;
  padding: 24px;
  padding-bottom: 70px;
  border-radius: 24px;
  width: 96%;
  max-width: 700px;
  position: relative;
  z-index: 1001;
  box-shadow: 0 14px 36px rgba(0,0,0,0.35);
  max-height: 80vh;
  overflow-y: auto;
}

.modal-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 24px;
  display: block;
  max-height: 50vh;
}

.modalCloseButton {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #666;
  transition: color 0.2s;
}

.modalCloseButton:hover {
  color: #000;
}

.modal-details p {
  margin: 12px 0;
  line-height: 1.5;
  font-size: 16px;
}

.modal-details strong {
  font-size: 16px;
  font-weight: bold;
}

.modal-details input,
.modal-details select {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid #ccc;
  margin-bottom: 16px;
  box-sizing: border-box;
  height: auto;
  background-color: #fff;
  cursor: pointer;
}

.modal-details label {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 8px;
  display: block;
}

.modal-details select.modal-select-small {
  padding: 6px 8px;
  font-size: 14px;
}

.modal-details select option {
  font-size: 15px;
  padding: 8px;
  line-height: 1.4;
}

.save-button {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 24px;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 1.2px;
  transition: background-color 0.2s;
}

.save-button:hover {
  background-color: #218838;
}

.delete-button {
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  background-color: #e74c3c;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 1.2px;
  transition: background-color 0.2s;
}

.delete-button:hover {
  background-color: #c0392b;
}

/* ============================
   下部タブナビ
   ============================ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0;
  width: 100%;
  height: 50px;
  background-color: #2A3A38;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -2px 5px rgba(0,0,0,0.2);
  z-index: 1100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  height: 100%;
  color: #aaa;
  text-decoration: none;
  text-align: center;
  padding: 4px 0;
  transition: color 0.2s;
}

.nav-item:hover {
  color: #fff;
}

.nav-text {
  font-size: 12px;
  margin-top: 2px;
}

.nav-item.active {
  color: #2ecc71;
  font-weight: bold;
}

/* トースト通知 */
.toast {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* ============================
   レスポンシブ
   ============================ */
@media screen and (max-width: 768px) {
  .modal {
    width: 95%;
    padding: 32px 24px 40px;
    font-size: 24px;
  }
  .modal input, .modal textarea, .modal select {
    font-size: 20px;
    padding: 16px;
  }
  .modal label {
    font-size: 20px;
  }
  .modal button[type="submit"] {
    font-size: 20px;
    padding: 16px;
  }
}

@media screen and (max-width: 480px) {
  .spot-gallery {
    max-width: 100%;
    padding: 10px;
  }
  .spot-card {
    max-width: 100px;
  }
  .modal {
    width: 100%;
    padding: 24px 16px 32px;
    font-size: 20px;
  }
  .modal input[type="text"],
  .modal input[type="file"],
  .modal textarea {
    font-size: 16px;
    padding: 8px;
    min-height: 36px;
    margin-bottom: 10px;
    border-radius: 6px;
  }
  .modal select {
    padding: 4px 6px;
    min-height: 30px;
    margin-bottom: 8px;
    border-radius: 8px;
    font-size: 16px !important;
  }
  .modal label {
    font-size: 10px;
    margin-bottom: 2px;
    font-weight: normal;
  }
  .modal .help-text {
    font-size: 9px;
    color: #999;
  }
  .modal button[type="submit"],
  .modal .save-button,
  .delete-button {
    font-size: 11px;
    padding: 4px 8px;
    margin-top: 6px;
    border-radius: 2px;
  }
  .modal-details p {
    font-size: 11px;
    margin: 4px 0;
    line-height: 1.2;
  }
  .modal-details strong {
    font-size: 11px;
  }
}
