@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

.mb-container * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Pretendard', sans-serif;
}

.mb-container {
  color: #212529;
  width: 100%;
  max-width: 760px;
  overflow: hidden;
  margin: 20px auto;
  border-radius: 8px;
}

/* 헤더 */
.mb-header {
  padding: 0 0 24px;
  border-bottom: 1px solid #e9ecef;
}
.mb-header h1 {
  font-size: 26px;
  font-weight: 800;
  text-align: left;
  line-height: 1.2;
}
.mb-header-description {
  margin-top: 8px;
  font-size: 15px;
  color: #495057;
}

/* 메인 컨텐츠 */
.mb-main-content {
  padding: 30px 0 30px;
}

/* 섹션 제목 */
.mb-input-section h3,
.mb-result-section h3,
.mb-reference-section h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* 입력 그룹 */
.mb-input-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

/* 버튼들이 많아졌으므로 모바일 대응을 위해 flex-wrap 추가 */
.mb-search-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
  flex-wrap: wrap; 
}

.mb-search-input {
  flex: 1; /* 남은 여백을 채우도록 변경 */
  min-width: 200px; /* 창이 너무 작아질 때 줄바꿈되도록 최소 너비 지정 */
  padding: 12px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 16px;
  transition: all 0.2s ease;
  background-color: #ffffff;
}
.mb-search-input:focus {
  outline: none;
  border-color: #4c6ef5;
  box-shadow: 0 0 0 2px rgba(76, 110, 245, 0.2);
}

/* 버튼 */
.mb-btn {
  padding: 14px;
  border-radius: 6px;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.mb-btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.mb-btn-query {
  background-color: #4c6ef5;
  color: #ffffff;
}
.mb-btn-query:hover {
  background-color: #364fc7;
}

.mb-btn-reset {
  background-color: #f1f3f5;
  color: #495057;
}
.mb-btn-reset:hover {
  background-color: #e9ecef;
}

.mb-btn-secondary {
  background-color: #fff4e6;
  color: #d9480f;
}
.mb-btn-secondary:hover {
  background-color: #ffe8cc;
}

.mb-btn-aslink {
  width: 100%;
}

/* 키워드 알림창 (공간 고정) */
.mb-keyword-hint {
  visibility: hidden; /* 공간은 차지하되 글자만 보이지 않게 처리 */
  color: #fa5252;
  font-size: 14px;
  margin-top: 10px;
  min-height: 20px; /* 고정 높이 할당 (덜컹거림 방지) */
}

/* API 에러 메시지 (글자가 있을 때만 간격을 갖도록 가변 처리) */
.mb-error-message {
  color: #fa5252;
  font-size: 14px;
}
.mb-error-message:not(:empty) {
  margin-top: 8px;
}

/* 구분선 */
.mb-divider {
  border: 0;
  height: 1px;
  background-color: #e9ecef;
  /* 알림창 ~ 구분선 / 구분선 ~ 목록 글자 사이 여백을 28px로 완벽히 동일하게 맞춤 */
  margin: 28px 0; 
}

/* 글로벌 로딩 */
.mb-loader {
  display: none;
  margin: 20px auto;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #4c6ef5;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: mb-spin 1s linear infinite;
}

/* 내부 스피너 */
.mb-spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #4c6ef5;
  border-radius: 50%;
  animation: mb-spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes mb-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 목록 */
.mb-result-section {
  display: none;
}

.mb-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mb-card {
  padding: 12px 16px;
  border-radius: 10px;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.mb-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.06);
}

.mb-card__header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.mb-card__title {
  font-size: 16px;
  font-weight: 800;
  color: #212529;
  line-height: 1.35;
}

.mb-card__id {
  font-size: 13px;
  color: #868e96;
  font-weight: 600;
  flex-shrink: 0;
}

.mb-card__excerpt {
  margin-top: 6px;
  font-size: 14px;
  color: #495057;
  line-height: 1.6;
}

/* 페이지네이션 */
.mb-pagination {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.mb-page-btn {
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid #dee2e6;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: #495057;
}
.mb-page-btn:hover {
  border-color: #4c6ef5;
  color: #364fc7;
}
.mb-page-btn.is-active {
  background: #4c6ef5;
  border-color: #4c6ef5;
  color: #fff;
}

/* 참고 */
.mb-reference-section ul {
  list-style: none;
  padding-left: 0;
}
.mb-reference-section li {
  font-size: 14px;
  color: #495057;
  line-height: 1.6;
  margin-bottom: 4px;
}

/* --- 모달 애니메이션 & 스타일 --- */
.mb-modal {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.mb-modal[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

.mb-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}

.mb-modal__panel {
  position: relative;
  max-width: 860px;
  width: calc(100% - 24px);
  margin: 6vh auto;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e9ecef;
  box-shadow: 0 20px 60px rgba(0,0,0,0.22);
  transform: translateY(15px) scale(0.98);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.mb-modal[aria-hidden="false"] .mb-modal__panel {
  transform: translateY(0) scale(1);
}

.mb-modal__head {
  padding: 18px 18px 12px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.mb-modal__kicker {
  font-size: 13px;
  color: #868e96;
  font-weight: 700;
}
.mb-modal__title {
  font-size: 20px;
  font-weight: 900;
  margin-top: 4px;
  line-height: 1.25;
}
.mb-icon-btn {
  border: none;
  background: #f1f3f5;
  color: #495057;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 900;
}
.mb-icon-btn:hover {
  background: #e9ecef;
}

.mb-modal__body {
  padding: 18px;
  min-height: 200px;
}
.mb-modal__summary {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 12px 14px;
  color: #495057;
  line-height: 1.6;
  margin-bottom: 14px;
}

/* 모달 내부 본문 로더 */
.mb-inner-loader {
  display: none;
  text-align: center;
  padding: 40px 0;
  color: #868e96;
  font-size: 14px;
  font-weight: 600;
}

.mb-modal__content {
  line-height: 1.75;
  color: #212529;
}
.mb-modal__content h2,
.mb-modal__content h3 {
  margin: 18px 0 10px;
}
.mb-modal__content p {
  margin: 10px 0;
}

.mb-modal__foot {
  padding: 14px 18px;
  border-top: 1px solid #e9ecef;
  display: flex;
  gap: 12px;
}
.mb-modal__foot .mb-btn {
  flex: 1;
}

/* 새 문서 폼 */
.mb-form__group {
  margin-bottom: 12px;
}
.mb-form__group label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.mb-input,
.mb-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  font-size: 15px;
  transition: all 0.2s ease;
}
.mb-input:focus,
.mb-textarea:focus {
  outline: none;
  border-color: #4c6ef5;
  box-shadow: 0 0 0 2px rgba(76, 110, 245, 0.2);
}
.mb-textarea {
  resize: vertical;
}

.mb-form__hint {
  margin-top: 8px;
  font-size: 13px;
  color: #868e96;
}