/* MoNoI 산업도시 - 공용 디자인 (분류저장소 기준 통일)
 * chest.html / gulag.html / index.html 공유
 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Malgun Gothic', 'Noto Sans KR', sans-serif;
  background: #2b2b2e; color: #e0e0e0; min-height: 100vh; overflow-x: hidden;
}

/* ── 헤더 ── */
.header {
  background: #2d2d30; padding: 10px 22px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid #3d3d40; position: sticky; top: 0; z-index: 50;
}
.logo { font-size: 1.25rem; font-weight: bold; color: #fff; letter-spacing: 1px; text-decoration: none; }
.nav-tabs { display: flex; gap: 8px; }
.nav-tab {
  background: #3d3d40; color: #fff; border: none; padding: 7px 18px; border-radius: 6px;
  cursor: pointer; font-size: .88rem; font-weight: bold; transition: .15s; text-decoration: none;
}
.nav-tab:hover, .nav-tab.active { background: #555; }
.user-chip { color: #4ecca3; font-weight: bold; font-size: .88rem; display: flex; align-items: center; gap: 8px; }
.user-chip a { color: #fff; }

/* ── 툴바 (탭 + 검색) ── */
.toolbar {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px; background: #292929; border-bottom: 1px solid #353538; position: relative; min-height: 52px;
}
.floor-tab {
  background: #3a3a3d; color: #ddd; border: none; padding: 6px 18px; border-radius: 6px;
  cursor: pointer; font-size: .85rem; font-weight: bold; transition: .15s;
}
.floor-tab:hover { background: #48484c; }
.floor-tab.active { background: #f0f0f0; color: #1a1a1a; }
.search-wrap { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); display: flex; gap: 6px; align-items: center; }
.search-input {
  background: #d9d9d9; border: none; padding: 7px 14px; border-radius: 6px; color: #222;
  font-size: .85rem; width: 170px;
}
.search-input::placeholder { color: #777; }

/* ── 맵 영역 (좌표 기반 그리드) ── */
.map-area { padding: 30px 20px 60px; min-height: calc(100vh - 110px); }
.section-hint { text-align: center; color: #888; font-size: .9rem; margin-bottom: 18px; letter-spacing: .5px; }
.coord-map, .chest-map {
  display: grid; gap: 14px; justify-content: center; align-items: start; justify-items: center;
  max-width: 1400px; margin: 0 auto;
}

.coord-map { gap: 4px; }
/* 상자 셀 (균일 1칸, 첫 아이템 표시) */
.chest-map { gap: 3px; }
.chest-cell {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; border-radius: 5px; transition: .1s; background: rgba(255,255,255,.03);
}
.chest-cell:hover { background: rgba(255,255,255,.15); outline: 1px solid rgba(255,255,255,.35); transform: scale(1.1); }
.cell-icon { width: 28px; height: 28px; image-rendering: pixelated; }
.cell-box { opacity: .25; font-size: 1rem; }
.cell-empty { opacity: .4; text-align: center; padding: 40px 20px; }

/* 주민 타일 (직업별 색상 셀, 균일) */
.villager-tile {
  width: 30px; height: 30px; border-radius: 5px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(0,0,0,.25); transition: .1s; background: #4a4a52;
}
.villager-tile:hover { transform: scale(1.18); z-index: 2; box-shadow: 0 4px 12px rgba(0,0,0,.6); border-color: #fff; }
.villager-tile .vt-icon { font-size: 1rem; line-height: 1; }

/* 굴라그 3단 레이아웃 */
.gulag-main {
  display: flex; gap: 18px; padding: 20px; align-items: flex-start;
  max-width: 1500px; margin: 0 auto;
}
.gulag-center { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 14px; min-width: 0; }
.gulag-center .coord-map { margin: 0; }
.side-panel { background: #2a2a2e; border: 1px solid #3d3d40; border-radius: 12px; padding: 16px; }
.prof-legend { width: 240px; flex-shrink: 0; }
.notice-panel { width: 300px; flex-shrink: 0; }

.legend-head { font-weight: bold; color: #ccc; font-size: .95rem; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.legend-clear { background: #4ecca3; color: #1a1a1a; border: none; border-radius: 5px; padding: 2px 8px; font-size: .72rem; font-weight: bold; cursor: pointer; }
.legend-item { margin-bottom: 12px; cursor: pointer; opacity: .9; transition: .12s; }
.legend-item:hover, .legend-item.active { opacity: 1; transform: translateX(3px); }
.legend-badge { display: inline-block; color: #fff; font-weight: bold; font-size: .82rem; padding: 4px 10px; border-radius: 7px; }
.legend-desc { display: block; color: #999; font-size: .72rem; margin-top: 4px; padding-left: 2px; }

.notice-title { color: #888; font-size: 1.4rem; font-weight: bold; margin-bottom: 14px; }
.notice-list { list-style: none; }
.notice-list li { color: #aaa; font-size: .8rem; line-height: 1.5; margin-bottom: 10px; padding-left: 14px; position: relative; }
.notice-list li::before { content: '•'; position: absolute; left: 0; color: #4ecca3; }

.entrance {
  background: #1c1c1f; color: #ddd; font-weight: bold; padding: 10px 28px;
  border-radius: 8px; border: 1px solid #3d3d40; font-size: .95rem; letter-spacing: 1px;
}

/* ── 업데이트 타이머 (좌하단) ── */
.update-card {
  position: fixed; left: 18px; bottom: 18px; background: #1c1c1f; border-radius: 12px;
  padding: 14px 18px; z-index: 35; box-shadow: 0 4px 16px rgba(0,0,0,.4); min-width: 150px;
}
.uc-status { display: flex; align-items: center; gap: 7px; font-size: .82rem; font-weight: bold; margin-bottom: 10px; color: #999; }
.uc-status .dot { width: 9px; height: 9px; border-radius: 50%; background: #777; transition: .2s; }
.uc-status.online { color: #4ecca3; }
.uc-status.online .dot { background: #4ecca3; box-shadow: 0 0 7px #4ecca3; }
.uc-status.offline { color: #e74c3c; }
.uc-status.offline .dot { background: #e74c3c; box-shadow: 0 0 7px #e74c3c; }
.uc-row { display: flex; align-items: center; gap: 6px; color: #888; font-size: .7rem; letter-spacing: 1px; }
.uc-time { font-size: 1.5rem; font-weight: bold; color: #fff; margin: 2px 0 8px; }
.uc-next-label { color: #777; font-size: .65rem; letter-spacing: 1px; }
.uc-next { font-size: 1.3rem; font-weight: bold; color: #4ecca3; }

/* ── 좌측 상세 패널 ── */
.detail-panel {
  position: fixed; top: 60px; left: 16px; width: 460px; max-height: calc(100vh - 80px);
  background: #2a2a2e; border-radius: 14px; border: 1px solid #3d3d40;
  box-shadow: 0 8px 30px rgba(0,0,0,.6); z-index: 45; display: none; flex-direction: column;
  animation: slideL .2s ease-out;
}
.detail-panel.active { display: flex; }
@keyframes slideL { from { transform: translateX(-30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.dp-header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: #1f1f22; border-bottom: 1px solid #3d3d40; border-radius: 14px 14px 0 0; }
.dp-title { flex: 1; font-weight: bold; font-size: 1.05rem; color: #fff; display: flex; align-items: center; gap: 8px; }
.dp-badge { background: #3d3d40; color: #4ecca3; font-size: .7rem; padding: 2px 8px; border-radius: 6px; font-weight: bold; }
.dp-tp, .dp-close { width: 34px; height: 34px; border: none; border-radius: 8px; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; transition: .15s; }
.dp-tp { background: #f0f0f0; color: #222; }
.dp-tp:hover { background: #fff; transform: scale(1.05); }
.dp-close { background: #e74c3c; color: #fff; }
.dp-close:hover { background: #c0392b; }
.dp-body { padding: 14px; overflow-y: auto; }

/* 상세 인벤토리 (상자) */
.chest-section { margin-bottom: 16px; }
.chest-section-title { display: flex; align-items: center; gap: 6px; font-size: .9rem; color: #ccc; margin-bottom: 8px; font-weight: bold; }
.inv-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; background: #1f1f22; padding: 8px; border-radius: 8px; }
.inv-slot { aspect-ratio: 1; background: #3a3a3f; border-radius: 4px; position: relative; display: flex; align-items: center; justify-content: center; }
.inv-slot.filled { cursor: pointer; }
.inv-slot img { width: 80%; height: 80%; image-rendering: pixelated; }
.inv-count { position: absolute; right: 1px; bottom: -1px; font-size: .68rem; font-weight: bold; color: #fff; text-shadow: 1px 1px 2px #000; }

/* 거래 행 (주민) */
.trade-row { display: flex; align-items: center; gap: 10px; background: #34343a; border-radius: 10px; padding: 10px; margin-bottom: 8px; border: 1px solid #3d3d40; }
.trade-row .ti-img { width: 40px; height: 40px; image-rendering: pixelated; background: #1f1f22; border-radius: 6px; padding: 3px; }
.trade-row .ti-info { flex: 1; min-width: 0; }
.trade-row .ti-name { font-weight: bold; font-size: .95rem; color: #fff; }
.trade-row .ti-sub { font-size: .75rem; color: #c9a44a; margin-top: 2px; }
.buy-badge { background: #2e8b3d; color: #fff; border-radius: 8px; padding: 6px 10px; text-align: center; min-width: 56px; }
.buy-badge .bb-label { font-size: .6rem; opacity: .85; letter-spacing: 1px; }
.buy-badge .bb-price { font-size: .95rem; font-weight: bold; display: flex; align-items: center; gap: 3px; justify-content: center; }
.emerald-dot { width: 12px; height: 12px; image-rendering: pixelated; }

/* 검색 결과 드롭다운 */
.search-results {
  position: absolute; top: calc(100% + 6px); right: 0; width: 320px; max-height: 60vh; overflow-y: auto;
  background: #2a2a2e; border: 1px solid #3d3d40; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.6);
  padding: 8px; display: none; z-index: 60;
}
.search-results.active { display: block; }
.result-card { display: flex; align-items: center; gap: 10px; background: #34343a; border-radius: 10px; padding: 10px; margin-bottom: 8px; border: 1px solid #3d3d40; cursor: pointer; transition: .15s; }
.result-card:hover { border-color: #4ecca3; background: #3a3a40; }
.result-card .rc-img { width: 40px; height: 40px; image-rendering: pixelated; background: #1f1f22; border-radius: 6px; padding: 3px; }
.result-card .rc-info { flex: 1; min-width: 0; }
.result-card .rc-loc { font-size: .62rem; color: #888; background: #1f1f22; display: inline-block; padding: 1px 6px; border-radius: 5px; margin-bottom: 3px; }
.result-card .rc-name { font-weight: bold; font-size: .9rem; color: #fff; }
.result-card .rc-sub { font-size: .7rem; color: #c9a44a; }
.sr-empty { color: #666; text-align: center; padding: 18px; font-size: .85rem; }

/* ── 아이템 호버 툴팁 ── */
.item-tooltip {
  position: fixed; z-index: 200; background: #100010ee; border: 1px solid #2d0a4e;
  color: #fff; padding: 6px 10px; border-radius: 4px; font-size: .85rem; pointer-events: none;
  display: none; align-items: center; gap: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.6);
}
.item-tooltip img { width: 24px; height: 24px; image-rendering: pixelated; }

/* ── 토스트 ── */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #2e8b3d; color: #fff;
  padding: 12px 26px; border-radius: 8px; font-weight: bold; z-index: 300; box-shadow: 0 4px 16px rgba(0,0,0,.5); }
.toast.error { background: #e74c3c; }

.loading { text-align: center; color: #777; padding: 80px 20px; }

/* ── 메인 페이지: 그래프 + 카드 ── */
.main-content { padding: 30px; max-width: 1400px; margin: 0 auto; }
.graph-section { background: #2d2d30; border-radius: 12px; padding: 20px; margin-bottom: 30px; border: 1px solid #3d3d40; }
.graph-legend { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; margin-bottom: 15px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: #ccc; }
.legend-color { width: 20px; height: 3px; border-radius: 2px; }
.legend-color.cpu { background: #e74c3c; }
.legend-color.players { background: #ecf0f1; }
.legend-color.tps { background: #2ecc71; }
.legend-color.mspt { background: #3498db; }
.legend-color.mspt-max { background: #f1c40f; }
.legend-color.ram { background: #9b59b6; }
.graph-box { background: #1c1c1f; border-radius: 8px; height: 280px; position: relative; overflow: hidden; }
.graph-box svg { width: 100%; height: 100%; display: block; }
.graph-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #666; gap: 6px; }

.cards-section { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }
.card { background: #2d2d30; border-radius: 14px; overflow: hidden; border: 1px solid #3d3d40; transition: .25s; text-decoration: none; color: inherit; display: block; }
.card:hover { transform: translateY(-5px); box-shadow: 0 10px 28px rgba(78,204,163,.18); border-color: #4ecca3; }
.card-image { height: 160px; display: flex; align-items: center; justify-content: center; font-size: 3rem; background: linear-gradient(135deg,#2d2d30,#3a3a3f); }
.card-content { padding: 22px; }
.card-title { font-size: 1.4rem; font-weight: bold; color: #4ecca3; margin-bottom: 6px; }
.card-description { color: #aaa; }
.card-status { display: inline-block; margin-top: 14px; padding: 5px 12px; background: rgba(78,204,163,.18); color: #4ecca3; border-radius: 5px; font-size: .82rem; font-weight: bold; }

.server-badge { display: inline-block; padding: 6px 16px; border-radius: 20px; font-size: .85rem; font-weight: bold; background: #3a3a3d; color: #999; }
.server-badge.online { background: rgba(78,204,163,.18); color: #4ecca3; }
.server-badge.offline { background: rgba(231,76,60,.18); color: #e74c3c; }

.footer { background: #2d2d30; padding: 20px; text-align: center; margin-top: 40px; border-top: 1px solid #3d3d40; color: #666; }

@media (max-width: 900px) {
  .detail-panel { width: calc(100vw - 32px); }
  .search-input { width: 120px; }
  .search-results { width: calc(100vw - 32px); right: -8px; }
}
