/* --- 기본 설정 --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700;800&display=swap');

:root {
  --primary-color: #ff7f50; /* 귀여운 당근색 포인트 */
  --primary-dark: #ff6347;  /* 호버 시 조금 더 진한 당근색 */
  --secondary-color: #1a1f2b; /* 사이드바 딥 네이비/블랙 */
  --bg-color: #f0f2f5; /* 부드러운 배경색 */
  --white: #ffffff;
  --text-color: #333333;
  --border-color: #e2e8f0;
  --font-family: 'Noto Sans KR', sans-serif;
  --transition: all 0.3s ease;
  
  /* 사이드바 너비를 220px로 컴팩트하게 줄임 */
  --sidebar-width: 220px; 
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  overflow-x: hidden;
  /* 전체 폰트 크기를 14px로 줄여서 한눈에 들어오게 만듦 */
  font-size: 14px; 
}

a { text-decoration: none; color: inherit; transition: var(--transition); }
ul { list-style: none; }

/* =========================================
   메인 대시보드 레이아웃
========================================= */
.main-wrapper { display: flex; min-height: 100vh; }

/* 사이드바 */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--secondary-color);
  color: #a0aec0;
  padding: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.logo {
  font-size: 1.6rem; 
  font-weight: 800; 
  color: var(--primary-color);
  text-align: center; 
  padding: 1.5rem 0; 
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 1rem;
  letter-spacing: 1px;
}

.menu { flex: 1; overflow-y: auto; padding: 0 0.5rem; }
.menu-item { margin-bottom: 0.3rem; }
.menu-link {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 0.8rem; 
  border-radius: 8px; font-weight: 500;
}
.menu-title { display: flex; align-items: center; }
.menu-icon { margin-right: 10px; font-size: 16px; width: 20px; text-align: center; }
.chevron { font-size: 0.8rem; transition: transform 0.3s ease; }

.menu-link:hover, .menu-link.active { background-color: rgba(255,255,255,0.1); color: var(--white); }

/* 서브메뉴 */
.submenu {
  max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out;
  background-color: rgba(0, 0, 0, 0.2); border-radius: 8px; margin-top: 5px;
}
.submenu-link {
  display: block; padding: 0.5rem 1rem 0.5rem 3rem; font-size: 0.9rem;
  color: #a0aec0; transition: var(--transition);
}
.submenu-link:hover, .submenu-link.active { color: var(--primary-color); font-weight: 500; }

.logout-link {
  margin: 1rem; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 1.2rem; border-radius: 0; text-align: center;
  justify-content: center; color: var(--white);
}

/* 메인 콘텐츠 영역 */
.main-content {
  margin-left: var(--sidebar-width); flex: 1; padding: 1.5rem 2rem; width: calc(100% - var(--sidebar-width));
}

/* 상단 헤더 */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 2px solid var(--border-color);
}
.sidebar-toggle { display: none; font-size: 1.8rem; cursor: pointer; color: var(--secondary-color); }

.page-title {
  font-size: 1.4rem; font-weight: 700; color: var(--secondary-color);
  flex: 1; text-align: center;
}

.user-info { display: flex; align-items: center; gap: 1rem; font-size: 0.95rem; }

/* 대시보드 위젯 */
.widget-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.widget {
  background: var(--white); padding: 1.5rem; border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.03); text-align: center;
}
.widget-title { font-size: 0.95rem; color: #718096; margin-bottom: 0.5rem; font-weight: 600; }
.widget-value { font-size: 2rem; font-weight: 800; color: var(--secondary-color); }

/* =========================================
   테이블 (목록 화면)
========================================= */
.table-container {
  background-color: var(--white); padding: 1.5rem; border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.03); overflow-x: auto;
}
.table-top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }

.table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.table th, .table td {
  padding: 0.8rem 1rem;
  text-align: center; 
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
.table th { font-weight: 600; color: #4a5568; background-color: #f8fafc; border-top: 1px solid var(--border-color); }
.table tr:hover td { background-color: #f8fafc; }
.text-left { text-align: left !important; }

/* 버튼 디자인 */
.btn {
  display: inline-flex; justify-content: center; align-items: center;
  padding: 0.5rem 1rem; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; transition: var(--transition);
  font-size: 0.9rem;
}
.btn-primary { background-color: var(--primary-color); color: var(--white); }
.btn-primary:hover { background-color: var(--primary-dark); box-shadow: 0 4px 10px rgba(255, 127, 80, 0.3); }
.btn-secondary { background-color: #edf2f7; color: #4a5568; }
.btn-secondary:hover { background-color: #e2e8f0; }

/* =========================================
   폼 스타일 (입력 및 수정 화면 깨짐 복구)
========================================= */
.form-container {
  background-color: var(--white); padding: 2.5rem; border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03); max-width: 800px; margin: 0 auto;
}
.form-group-row {
  display: flex; align-items: center; margin-bottom: 1.2rem; border-bottom: 1px solid #f1f5f9; padding-bottom: 1.2rem;
}
.form-group-row:last-child {
  border-bottom: none; margin-bottom: 0; padding-bottom: 0;
}
.form-group-row label { 
  flex: 0 0 140px; font-weight: 600; color: #4a5568; 
}
.form-group-row input, .form-group-row select, .form-group-row textarea {
  flex: 1; padding: 0.7rem 1rem; border: 1px solid var(--border-color); border-radius: 6px; 
  font-family: var(--font-family); font-size: 14px; outline: none; transition: var(--transition); background: #f8fafc;
}
.form-group-row input:focus, .form-group-row select:focus, .form-group-row textarea:focus {
  border-color: var(--primary-color); background: var(--white); box-shadow: 0 0 0 3px rgba(255,127,80,0.15);
}
.form-actions {
  display: flex; justify-content: flex-end; gap: 1rem; margin-top: 2rem; border-top: 1px solid var(--border-color); padding-top: 1.5rem;
}

/* 페이징 */
.pagination { display: flex; justify-content: center; gap: 0.5rem; margin-top: 2rem; }
.page-item { display: flex; justify-content: center; align-items: center; width: 35px; height: 35px; border: 1px solid var(--border-color); border-radius: 6px; background-color: var(--white); transition: var(--transition); font-weight: 500;}
.page-item:hover, .page-item.active { background-color: var(--primary-color); border-color: var(--primary-color); color: var(--white); }

/* =========================================
   모바일 최적화 (반응형)
========================================= */
@media (max-width: 1024px) {
  .main-content { padding: 1.5rem; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  
  .sidebar { left: -260px; width: 260px; transition: left 0.3s ease; }
  .sidebar.active { left: 0; }
  
  .main-content { margin-left: 0; width: 100%; padding: 1rem; }
  
  .page-header { flex-wrap: wrap; gap: 1rem; }
  .sidebar-toggle { display: block; flex: 0 0 auto; }
  .page-title { flex: 1 1 auto; text-align: left; font-size: 1.2rem; margin-left: 1rem;}
  .user-info { width: 100%; justify-content: flex-end; padding-top: 1rem; border-top: 1px solid var(--border-color); }
  
  .table-top-bar { flex-direction: column; align-items: flex-start; gap: 1rem; }
  
  /* 폼 모바일 화면 최적화 */
  .form-group-row { flex-direction: column; align-items: flex-start; border-bottom: none; padding-bottom: 0;}
  .form-group-row label { margin-bottom: 0.5rem; }
  .form-container { padding: 1.5rem; }
}