/* === 기본 리셋 & 베이스 === */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  color: #222;
  background: #f3f5f8;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
}

/* === 레이아웃 공통 === */

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 상단 헤더 */
.top-header {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: #ffffff;
  border-bottom: 1px solid #e1e4ea;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.top-header .logo {
  font-weight: 700;
  font-size: 18px;
  color: #111827;
}

.top-header nav {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.top-header nav a {
  padding: 6px 10px;
  border-radius: 999px;
  color: #4b5563;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.top-header nav a:hover {
  background: #f3f4f6;
  color: #111827;
}

/* 레이아웃 바디 (좌측 메뉴 + 메인) */
.layout-body {
  flex: 1;
  display: flex;
  min-height: 0; /* flex 자식 스크롤용 */
}

/* 좌측 메뉴 (다크) */
.left-menu {
  width: 220px;
  background: #111827;
  color: #e5e7eb;
  padding: 12px 0;
  border-right: 1px solid #0f172a;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.left-menu .menu-title {
  padding: 0 16px 8px;
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #6b7280;
}

.left-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.left-menu li {
  font-size: 14px;
}

.left-menu a,
.left-menu .menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: #e5e7eb;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.left-menu a:hover,
.left-menu .menu-item:hover {
  background: #1f2937;
}

.left-menu .menu-item.active {
  background: #2563eb;
  color: #ffffff;
}

/* 메인 영역 */
.main-area {
  flex: 1;
  padding: 16px 18px;
  overflow: auto;
}

/* 메인 내부 카드 스타일 */
.page {
  background: #ffffff;
  border-radius: 10px;
  padding: 16px 18px 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.page > h2 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}

/* 검색 박스 공통 */
.search-box {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 10px;
  margin-bottom: 10px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.search-box input,
.search-box select {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 13px;
}

/* 버튼 공통 */
.page button,
.btn-row button,
.search-box button {
  border-radius: 6px;
  border: none;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  background: #2563eb;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.page button:hover,
.btn-row button:hover,
.search-box button:hover {
  background: #1d4ed8;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.4);
}

/* 버튼 색상 변형 */
.btn-secondary {
  background: #6b7280;
}
.btn-secondary:hover {
  background: #4b5563;
}
.btn-danger {
  background: #ef4444;
}
.btn-danger:hover {
  background: #dc2626;
}

/* 폼 공통 */
.form-box {
  margin-top: 10px;
  margin-bottom: 10px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.form-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.form-row label {
  width: 90px;
  font-size: 13px;
  color: #4b5563;
}

.form-row input,
.form-row select {
  flex: 1;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 13px;
}

/* 테이블 공통 */
.list-table,
.page table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 13px;
  background: #ffffff;
}

.list-table thead tr,
.page table thead tr {
  background: #f3f4f6;
}

.list-table th, .list-table td,
.page th, .page td {
  border: 1px solid #e5e7eb;
  padding: 6px 8px;
  text-align: left;
}

.list-table tbody tr:nth-child(even),
.page tbody tr:nth-child(even) {
  background: #f9fafb;
}

.list-table tbody tr:hover,
.page tbody tr:hover {
  background: #e5f2ff;
}

/* 메뉴 트리 페이지 전용 (menu_admin) */
.menu-layout {
  display: flex;
  gap: 16px;
}

.tree-box {
  width: 40%;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
  max-height: 500px;
  overflow: auto;
}

.menu-tree-root,
.menu-tree-root ul {
  list-style: none;
  padding-left: 14px;
  margin: 0;
}

.tree-item {
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 4px;
}
.tree-item.selected {
  background: #dbeafe;
}

/* 모달 공통 */
.modal-mask {
  position: fixed;
  z-index: 9999;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  background: #ffffff;
  border-radius: 10px;
  padding: 16px 18px;
  width: 320px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.45);
}

/* 모바일 대응 (간단 버전) */
@media (max-width: 900px) {
  .layout-body {
    flex-direction: column;
  }
  .left-menu {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    white-space: nowrap;
  }
  .main-area {
    padding: 10px;
  }
  .menu-layout {
    flex-direction: column;
  }
}

/* === 공통 select 스타일 === */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  background: #ffffff url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") 
              no-repeat right 10px center;
  
  border: 1px solid #d1d5db;
  padding: 6px 32px 6px 10px;
  border-radius: 6px;
  
  font-size: 13px;
  font-family: inherit;
  color: #111827;
  
  background-color: #ffffff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* hover */
select:hover {
  border-color: #9ca3af;
}

/* focus */
select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

/* disabled 스타일 */
select:disabled {
  background-color: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}
/* === 본문 입력 요소 공통 스타일 === */
.page input,
.page select,
.page textarea,
.form-section input,
.form-section select,
.form-section textarea {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background-color: #ffffff;
  font-size: 13px;
  font-family: inherit;
  color: #111827;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* hover */
.page input:hover,
.page select:hover,
.page textarea:hover,
.form-section input:hover,
.form-section select:hover,
.form-section textarea:hover {
  border-color: #9ca3af;
}

/* focus */
.page input:focus,
.page select:focus,
.page textarea:focus,
.form-section input:focus,
.form-section select:focus,
.form-section textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}
/* === 버튼 기본 간격 === */
.page button,
.form-section button,
.toolbar button {
  margin-right: 6px;
}
.page button:last-child,
.form-section button:last-child,
.toolbar button:last-child {
  margin-right: 0;
}
/* 좌측 메뉴 접기/펼치기 */
.left-menu.collapsed {
  width: 50px !important;
  overflow: hidden;
  transition: width 0.25s ease;
}

.left-menu {
  transition: width 0.25s ease;
}

/* 메뉴 텍스트 숨기기 */
.left-menu.collapsed .menu-item {
  padding-left: 8px !important;
}

.left-menu.collapsed .menu-item,
.left-menu.collapsed a {
  font-size: 0;   /* 글자 숨기기 */
}

.left-menu.collapsed .menu-item::before,
.left-menu.collapsed a::before {
  font-size: 16px;
}

/* 토글 버튼 */
.menu-toggle-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #333;
  margin-left: 10px;
}
