@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@900&display=swap');

:root {
  --surface-main: #313338;
  --surface-canvas: #2b2d31;
  --surface-accent: #1e1f22;
  --surface-hover: #393c41;
  --color-primary: #3b61b4;
  --color-online: #23a55a;
  --text-main: #dbdee1;
  --text-dim: #949ba4;
  --text-darker: #4e5058;
  --pure-white: #ffffff;
  --border-light: rgba(255, 255, 255, 0.08);
}

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  overflow-x: hidden;
  background: var(--surface-main);
  color: var(--text-main);
  display: flex;
}

/* --- 동맹/커뮤니티 카드 그리드 레이아웃 --- */
#AlliesList,
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

/* --- 카테고리 카드 전체 감싸는 스타일 --- */
.Allies-item { 
  text-decoration: none !important; 
  color: var(--text-dim); 
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  background-color: var(--surface-accent) !important;
  padding: 16px !important;
  border-radius: 16px !important;
  border: 1px solid var(--border-light) !important;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  box-sizing: border-box;
  width: 100%;
}

.Allies-item:hover {
  transform: translateY(-4px);
  border-color: var(--color-primary) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* --- 아이콘 엠블럼 상자 --- */
.icon-wrapper { 
  width: 100%; 
  aspect-ratio: 1 / 1;
  margin-bottom: 12px; 
  background-color: #000000;
  border-radius: 12px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  overflow: hidden; 
}

.icon-wrapper img { 
  width: 100%; 
  height: 100%; 
  object-fit: cover;
  border-radius: 12px;
}

/* --- 그룹 이름 (상단 배치) --- */
.Allies-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--pure-white);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  display: block !important;
}

/* --- 멤버 수 (그룹 이름 하단 배치) --- */
.Allies-members {
  font-size: 12px;
  color: var(--color-online);
  margin-top: 2px;
  display: block !important;
  width: 100%;
}

.download-btn {
  display: inline-block;
  padding: 10px 20px;
  background-color: #007bff;
  color: white;
  text-decoration: none;
  border-radius: 5px;
}
.download-btn:hover {
  background-color: #0056b3;
}

/* --- PC 사이드바 --- */
.sidebar {
  width: 350px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--surface-accent);
  box-sizing: border-box;
  overflow-y: auto;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar-logo-section {
  padding: 10px 20px;
  display: flex;
  align-items: center;
}

.sidebar-logo-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--pure-white);
}

.sidebar-logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.sidebar-logo-text {
  font-family: 'Montserrat', 'Impact', 'Arial Black', sans-serif;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
  text-transform: uppercase;
  color: var(--pure-white);
  line-height: 1;
  position: relative;
  top: -8px;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-light);
  margin: 8px 16px;
}

.sidebar a {
  padding: 10px 15px;
  text-decoration: none;
  color: var(--text-dim);
  display: block;
  font-size: 15px;
  margin: 2px 10px;
  border-radius: 4px;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.sidebar a:hover {
  background: var(--surface-hover);
  color: var(--text-main);
}

.sidebar a.disabled {
  color: var(--text-darker) !important;
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.6;
  background: transparent !important;
}

/* --- 메인 콘텐츠 --- */
.main-content {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  margin-left: 350px;
  background: var(--surface-main);
  transition: margin-left 0.3s ease;
}

.container {
  max-width: 2000px;
  margin: 40px auto;
  padding: 0 40px;
}

.box {
  background: var(--surface-canvas);
  padding: 32px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  animation: view-in 0.4s ease-out;
}

h1, h2, h4 {
  margin-top: 0;
  color: var(--pure-white);
}

/* --- 모바일 UI --- */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1100;
  background: var(--surface-accent);
  color: var(--pure-white);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 18px;
  cursor: pointer;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
}

.sidebar-overlay.active {
  display: block;
}

/* --- 애니메이션 및 모바일 반응형 --- */
@keyframes view-in {
  from {
    opacity: 0;
    transform: scale(0.99);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 768px) {
  .sidebar-toggle {
    display: block;
  }

  .sidebar {
    width: 100vw;
    max-width: 100%;
    height: 100vh;
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0 !important;
    padding-top: 60px;
  }

  .container {
    padding: 0 16px;
    margin: 20px auto;
  }
}