@import "../css/common.css";


.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);/*常に3列*/
    gap: 10px;
    max-width: 1000px;
    margin: 0 auto;
}

.grid a {
    display: block;
}

.grid img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    transition: transform 0.2s;
}

.grid img:hover {
    transform: scale(1.05);
}

#back {
  left: 3% !important;
}

.maintext {
    font-size: xx-large;
    font-weight: bolder;
    text-align: center;
    margin-top: 20px;
    text-align: center;
}

.subtext {
    font-size: x-large;
    text-align: center;
    margin-top: 10%;
}

.link {
    margin-top: 10px;
    font-size: large;
    text-align: center;
}

.card{
    background:#fff;
    padding:12px;border-radius:8px;
    box-shadow:0 6px 14px rgba(0,0,0,.06);
    margin-bottom:12px
}

.small{
    font-size:13px;
    color:#666
}

.congestion-item{
    border-bottom:1px solid #eee;
    padding:10px 0
}

.congestion-item-btn {
  width: 100%;
  display: grid;
  gap: 8px;
  text-align: left;
  border: 1px solid #d8e7f6;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  padding: 14px 16px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.congestion-item-btn:hover,
.congestion-item-btn:focus-visible {
  transform: translateY(-2px);
  border-color: #88b7e6;
  box-shadow: 0 12px 28px rgba(40, 76, 120, 0.14);
  outline: none;
}

.congestion-item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.congestion-item-preview {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: #587089;
  font-size: 0.92rem;
}

.congestion-item-preview strong {
  color: #17344f;
}

.congestion-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(11, 23, 36, 0.58);
  z-index: 2000;
}

.congestion-modal.is-open {
  display: flex;
}

.congestion-modal-card {
  position: relative;
  width: min(92vw, 720px);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.congestion-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: #edf5fc;
  color: #28465f;
  font-size: 24px;
  cursor: pointer;
}

.congestion-modal-status {
  margin: 0 0 8px;
  color: #2f8ae6;
  font-weight: 700;
}

.congestion-modal-card h3 {
  margin: 0 0 14px;
  font-size: 1.55rem;
  color: #17344f;
}

.congestion-modal-image {
  display: block;
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 18px;
  margin-bottom: 16px;
}

.congestion-modal-description {
  margin: 0;
  line-height: 1.9;
  color: #2d4054;
  white-space: pre-wrap;
}

.congestion-modal-meta {
  margin-top: 16px;
}

body.modal-open {
  overflow: hidden;
}



.level {
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
}
.level-0 { color: black;}   /*休止中→黒*/ 
.level-1 { color: #558b2f; }
.level-2 { color: #f9a825; }   /* 普通 → 黄 */
.level-3 { color: #ef6c00; }
.level-4 { color: #d84315; }
.level-5 { color: #b71c1c; }   /* 非常に混雑 → 赤 */
.level-6 { color: black;}




#congestion-widget {
  max-width: 800px;
  margin: 30px auto;
  padding: 20px;
  background: #f9fcff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

#congestion-widget h2 {
  margin-top: 0;
  color: #2c3e50;
  text-align: center;
}

/* 管理者用フォーム */
#congestion-admin {
  margin: 20px 0;
  padding: 15px;
  border: 2px solid #3498db;
  border-radius: 6px;
  background: #eef7ff;
}

#congestion-admin label {
  display: block;
  margin: 10px 0;
  font-weight: bold;
}

#congestion-admin input[type="text"],
#congestion-admin textarea,
#congestion-admin select {
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

#congestion-admin button {
  margin-top: 10px;
  padding: 10px 20px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
#congestion-admin button:hover {
  background: #2980b9;
}

#c-msg {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #e74c3c;
}

/* --- コントロールバー --- */
.congestion-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 4px;
}

.view-toggle-group,
.sort-toggle-group {
  display: flex;
  gap: 6px;
}

.view-toggle-btn,
.sort-btn {
  padding: 6px 14px;
  border: 1.5px solid #b8d0ec;
  border-radius: 20px;
  background: #fff;
  color: #3d6a9a;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.view-toggle-btn.active,
.sort-btn.active {
  background: #2f8ae6;
  color: #fff;
  border-color: #2f8ae6;
}

.view-toggle-btn:hover:not(.active),
.sort-btn:hover:not(.active) {
  background: #edf5fc;
  border-color: #7ab2e6;
}

/* --- マップビュー --- */
.congestion-map {
  margin-top: 14px;
}

.congestion-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: #555;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.map-legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
}

.map-floor {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 8px;
}

.map-floor-label {
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #7a95b0;
  flex-shrink: 0;
}

.map-floor-rooms {
  display: flex;
  gap: 6px;
  flex: 1;
}

.map-room {
  flex: 1;
  min-height: 80px;
  border-radius: 10px;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  padding: 8px 4px;
}

.map-room:hover,
.map-room:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.16);
  outline: none;
}

.map-room-empty {
  background: #f0f3f5;
  cursor: default;
  opacity: 0.4;
}

.map-room-team {
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
  color: inherit;
}

.map-room-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: inherit;
}

.map-room-wait {
  font-size: 0.65rem;
  opacity: 0.85;
  color: inherit;
}

/* 混雑レベル背景色 */
.level-bg-0 {
  background: #e8e8e8;
  color: #555;
  border-color: #ccc;
}
.level-bg-1 {
  background: #e8f5e9;
  color: #2e7d32;
  border-color: #a5d6a7;
}
.level-bg-2 {
  background: #fffde7;
  color: #f57f17;
  border-color: #ffe082;
}
.level-bg-3 {
  background: #fff3e0;
  color: #e65100;
  border-color: #ffcc80;
}
.level-bg-4 {
  background: #fbe9e7;
  color: #bf360c;
  border-color: #ffab91;
}
.level-bg-5 {
  background: #ffebee;
  color: #b71c1c;
  border-color: #ef9a9a;
}
.level-bg-unknown {
  background: #f5f5f5;
  color: #9e9e9e;
  border-color: #e0e0e0;
}

/* --- ここから以前のスタイル --- */

/* 一般向け一覧 */
#congestion-list {
  margin-top: 20px;
}

.congestion-item {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 15px;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.congestion-item h3 {
  margin: 0 0 8px;
  color: #2c3e50;
}


.congestion-item .note {
  margin: 5px 0;
}

.congestion-item .small {
  font-size: 0.85rem;
  color: #666;
}

/* 西高展の混雑表示をヒートマップ風に上書き */
#congestion-list {
  margin-top: 20px;
  display: grid;
  gap: 14px;
}

#congestion-list .congestion-item {
  border: none;
  border-radius: 18px;
  padding: 0;
  margin: 0;
  background: transparent;
  box-shadow: none;
}

#congestion-list .congestion-item-btn {
  --card-bg: #e8f1f8;
  --card-fg: #17344f;
  --card-sub: #35556f;
  --card-accent: rgba(23, 52, 79, 0.22);
  --level-edge: #5f86ab;
  --badge-bg: #e4eef7;
  --badge-border: #8ea9c2;
  width: 100%;
  display: grid;
  gap: 12px;
  text-align: left;
  border: 1px solid #d7e1eb;
  border-left: 8px solid var(--level-edge);
  border-radius: 20px;
  background: var(--card-bg);
  color: var(--card-fg);
  padding: 20px 22px;
  box-shadow: 0 8px 20px rgba(24, 45, 74, 0.08);
}

#congestion-list .congestion-item-btn:hover,
#congestion-list .congestion-item-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(24, 45, 74, 0.12);
  border-color: #c8d5e3;
  outline: none;
}

#congestion-list .congestion-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#congestion-list .congestion-location {
  font-size: clamp(1.42rem, 2.4vw, 1.8rem);
  letter-spacing: 0.02em;
  line-height: 1.25;
}

#congestion-list .congestion-wait {
  font-size: clamp(1.34rem, 2.6vw, 1.72rem);
  font-weight: 800;
  color: var(--card-sub);
  line-height: 1.25;
}

#congestion-list .small {
  font-size: 0.8rem;
  color: var(--card-sub);
}

#congestion-list .congestion-item-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--card-sub);
  font-size: 0.88rem;
}

#congestion-list .congestion-item-preview strong {
  color: var(--card-fg);
  font-size: 1rem;
}

#congestion-list .congestion-item-preview span {
  font-size: 0.76rem;
  opacity: 0.9;
}

#congestion-list .level {
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: clamp(1.08rem, 2vw, 1.26rem);
  line-height: 1.15;
  border: 1px solid var(--badge-border);
  background: var(--badge-bg);
  color: var(--card-fg);
}

#congestion-list .congestion-item-btn.congestion-level-0 {
  --card-bg: #eceff2;
  --level-edge: #66717d;
  --badge-bg: #d8dee5;
  --badge-border: #8b98a5;
}

#congestion-list .congestion-item-btn.congestion-level-1 {
  --card-bg: #e6f4e8;
  --level-edge: #4e9a59;
  --badge-bg: #d4ebd8;
  --badge-border: #73a77b;
}

#congestion-list .congestion-item-btn.congestion-level-2 {
  --card-bg: #e6eff8;
  --level-edge: #4b79a5;
  --badge-bg: #d4e4f4;
  --badge-border: #7596b9;
}

#congestion-list .congestion-item-btn.congestion-level-3 {
  --card-bg: #f9f1df;
  --level-edge: #c19338;
  --badge-bg: #f1e3c1;
  --badge-border: #caa462;
}

#congestion-list .congestion-item-btn.congestion-level-4 {
  --card-bg: #f9e8dc;
  --level-edge: #d27a4b;
  --badge-bg: #f3d8c6;
  --badge-border: #d7926f;
}

#congestion-list .congestion-item-btn.congestion-level-5 {
  --card-bg: #f7e1df;
  --level-edge: #cf5a5a;
  --badge-bg: #f0ccca;
  --badge-border: #d67f7f;
}

#congestion-list .congestion-item-btn.congestion-level-6 {
  --card-bg: #eceff2;
  --level-edge: #66717d;
  --badge-bg: #d8dee5;
  --badge-border: #8b98a5;
}

@media (max-width: 680px) {
  #congestion-list .congestion-item-btn {
    padding: 16px;
    border-radius: 16px;
    gap: 10px;
  }

  #congestion-list .congestion-location {
    font-size: 1.3rem;
  }

  #congestion-list .congestion-wait {
    font-size: 1.18rem;
  }

  #congestion-list .congestion-item-preview {
    display: grid;
    gap: 6px;
    justify-content: start;
  }
}

