/* Admin 페이지 전용 스타일 - Material Design 적용 */
body {
  padding-top: 64px; /* navbar 높이만큼 상단 패딩 */
  overflow-x: hidden; /* 창 높이 감소 시 가로 스크롤 방지 */
}

.main-content {
  padding-top: 20px;
  padding-bottom: 3rem; /* 폼 하단 제출 버튼이 뷰포트·사이드바에 가리지 않도록 여유 */
  margin-left: 0;
  background-color: #f5f5f5;
  min-height: calc(100vh - 64px);
  min-width: 0; /* flex 자식이 가로 확장되지 않도록 */
}

/* 데스크톱 (lg 이상) */
@media (min-width: 992px) {
  .main-content {
    margin-left: 280px;
    transition: margin-left 0.3s ease;
  }
  
  .main-content.sidebar-collapsed {
    margin-left: 0;
  }
}

/* Navbar 스타일 */
.navbar {
  height: 64px;
  min-height: 64px;
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
  overflow: visible;
}

.navbar .container-fluid {
  height: 64px;
  display: flex;
  align-items: center;
}

.navbar-brand {
  font-size: 1.25rem;
  line-height: 64px;
  padding: 0;
  margin: 0;
}

.navbar .btn-link {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  width: 40px;
  padding: 0;
  margin: 0;
}

/* 사이드바 메뉴 아이템 스타일 (offcanvas 내부) */
#sidebarMenu .menu-item {
  color: #44474e;
  border-radius: 50px; /* M3 스타일의 둥근 모서리 */
  margin: 4px 12px;
  padding: 10px 16px !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  border-left: none !important;
  font-weight: 500;
}

#sidebarMenu .menu-item:hover {
  background-color: rgba(25, 118, 210, 0.08);
  color: #1976d2;
}

#sidebarMenu .menu-item.active {
  background-color: #e3f2fd;
  color: #1976d2;
}

#sidebarMenu .menu-item i {
  color: #44474e;
  transition: color 0.3s ease;
}

#sidebarMenu .menu-item.active i,
#sidebarMenu .menu-item:hover i {
  color: #1976d2;
}

/* 사이드바 로그아웃 버튼 구분선 스타일 */
#sidebarMenu .border-top {
  border-color: #e0e0e0 !important;
  margin-top: auto;
}

/* 통합 사이드바 스타일 (모바일 기준) */
.offcanvas {
  width: 280px !important;
  z-index: 1040 !important;
}

/* 사이드바 본문: 가로 스크롤 방지, 세로 스크롤 허용 */
.sidebar-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow-x: hidden;
  min-height: 0;
  min-width: 0;
  flex: 1 1 auto;
}

/* Bootstrap .nav 기본값 flex-wrap: wrap이 flex-column과 결합 시
   높이 부족 시 2열 배치를 유발 → nowrap으로 오버라이드 */
.sidebar-nav {
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  flex-wrap: nowrap !important; /* Bootstrap .nav의 flex-wrap: wrap 오버라이드 */
}

/* 메뉴 항목 수직 고정: 줄바꿈 방지, 한 줄 유지로 레이아웃 이동 방지 */
#sidebarMenu .nav-item {
  flex-shrink: 0;
}

#sidebarMenu .menu-item {
  white-space: nowrap;
  min-width: 0;
}

#sidebarMenu .menu-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0; /* flex 자식에서 ellipsis 동작을 위해 필요 */
}

/* nav/ul/li 가로 확장 방지 */
#sidebarMenu .nav,
#sidebarMenu .sidebar-nav,
#sidebarMenu .collapse {
  min-width: 0;
  max-width: 100%;
}

/* 데스크톱에서 offcanvas 기능을 끄고 고정 사이드바로 전환 */
@media (min-width: 992px) {
  #sidebarMenu {
    position: fixed !important;
    top: 64px !important;
    left: 0 !important;
    width: 280px !important;
    max-width: 280px !important;
    height: calc(100vh - 64px) !important;
    transform: none !important; /* MDB 애니메이션 무시 */
    visibility: visible !important;
    z-index: 1020 !important;
    box-shadow: 2px 0 4px rgba(0,0,0,.05);
    background-color: #ffffff;
    border-right: 1px solid #e0e0e0;
    transition: transform 0.3s ease, margin-left 0.3s ease;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }

  #sidebarMenu .offcanvas-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    flex: 1 1 auto;
    padding: 0;
  }

  /* 메뉴가 접혔을 때의 상태 */
  #sidebarMenu.sidebar-hidden {
    transform: translateX(-280px) !important;
  }

  /* 데스크톱에서는 MDB 가림막 절대 금지 */
  .offcanvas-backdrop {
    display: none !important;
  }
}



#sidebarMenu .menu-item.active {
  background-color: #e3f2fd;
  color: #1976d2;
  font-weight: 500;
  border-left-color: #1976d2;
}

/* 사이드바 로그아웃 버튼 구분선 스타일 */
#sidebarMenu .border-top {
  border-color: #e0e0e0 !important;
  margin-top: auto;
}

/* Backdrop 스타일 (Material Design 권장) - 모바일에서만 */
@media (max-width: 991.98px) {
  .offcanvas-backdrop {
    background-color: rgba(0, 0, 0, 0.5) !important;
    z-index: 1035 !important;
    transition: opacity 0.15s linear;
    cursor: pointer;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
  }

  .offcanvas-backdrop.show {
    opacity: 1 !important;
  }

  .offcanvas-backdrop.fade {
    opacity: 0;
  }

  .offcanvas-backdrop.fade.show {
    opacity: 1;
  }
}

/* 모바일에서 Offcanvas가 열릴 때 body 스크롤 방지 */
@media (max-width: 991.98px) {
  body.offcanvas-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
  }
  
  /* 모바일에서 Offcanvas 자체의 z-index */
  #sidebarMenu {
    z-index: 1040 !important;
  }
}

/* Material Design 카드 스타일 */
.card {
  margin-bottom: 24px;
  border: none;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
}

/* 테이블 Material Design 스타일 */
.table {
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  background-color: #f5f5f5;
  color: #424242;
  font-weight: 500;
  border-bottom: 2px solid #e0e0e0;
  padding: 16px;
}

.table tbody tr {
  transition: background-color 0.2s ease;
}

.table tbody tr:hover {
  background-color: #f5f5f5;
}

.table tbody td {
  padding: 16px;
  border-bottom: 1px solid #e0e0e0;
}

/* 테이블 외곽 테두리 (피그마: 얇은 회색 테두리, 세로선 없음) */
.table-outlined {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
}
.table-outlined .table thead th {
  border-top: none;
  border-left: none;
  border-right: none;
}
.table-outlined .table tbody td {
  border-left: none;
  border-right: none;
}

/* Material Design 버튼 개선 */
.btn {
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Material Design 배지 스타일 */
.badge {
  padding: 6px 12px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.75rem;
}

/* 페이지네이션 Material Design 스타일 */
.pagination .page-link {
  border-radius: 4px;
  margin: 0 2px;
  color: #1976d2;
  border: 1px solid #e0e0e0;
  transition: all 0.2s ease;
}

.pagination .page-link:hover {
  background-color: #e3f2fd;
  border-color: #1976d2;
}

.pagination .page-item.active .page-link {
  background-color: #1976d2;
  border-color: #1976d2;
  color: #ffffff;
}

/* 알림 Material Design 스타일 */
.alert {
  border-radius: 4px;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* MDB UI Kit 전용 수정: 라벨이 입력창 아래로 밀리는 현상 방지 */
.form-outline .form-label {
  pointer-events: none; /* 라벨 클릭 시 입력창으로 이벤트 전달 */
}

/* 서브메뉴 스타일 및 애니메이션 개선 */
#sidebarMenu .collapse {
  transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebarMenu .collapse .menu-item {
  margin-left: 28px;
  margin-right: 12px;
  padding: 8px 16px !important;
  font-size: 0.875rem;
  border-left: none;
}

#sidebarMenu .rotate-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.8rem;
  opacity: 0.7;
}

#sidebarMenu .nav-link:not(.collapsed) .rotate-icon {
  transform: rotate(180deg);
  opacity: 1;
}

/* 배경색 조정 */
#sidebarMenu {
  background-color: #fdfbff !important;
}

#sidebarMenu .bg-light {
  background-color: transparent !important;
}

/* 템플릿 상세 탭 - Material 스타일 (플랫, 활성 탭 파란 밑줄) */
.template-detail-tabs {
  border-bottom: 1px solid #e0e0e0;
}
.template-detail-tabs .nav-link {
  border: none;
  background: transparent;
  color: #757575;
  font-weight: 500;
  padding: 12px 16px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}
.template-detail-tabs .nav-link:hover {
  color: #424242;
}
.template-detail-tabs .nav-link.active {
  color: #1976d2;
  font-weight: 600;
  border-bottom-color: #1976d2;
  background: transparent;
}


