/* ========== 기본 설정 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  color: #2d3748;
  background-color: #f7fafc;
  font-size: 14px;
}

/* ========== 상단 헤더 ========== */
.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.75rem 1rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  height: 60px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  font-size: 1.25rem;
  font-weight: 600;
  color: white;
  text-decoration: none;
}

.logo i {
  margin-right: 0.5rem;
}

.logo:hover {
  color: white;
  text-decoration: none;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: background-color 0.2s;
}

.menu-toggle:hover {
  background-color: rgba(255,255,255,0.1);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.current-time {
  font-size: 0.875rem;
  opacity: 0.9;
}

.logout-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logout-btn:hover {
  background: rgba(255,255,255,0.3);
}

/* ========== 좌측 사이드바 ========== */
.sidebar {
  position: fixed;
  top: 60px;
  left: 0;
  width: 260px;
  height: calc(100vh - 60px);
  background: white;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  z-index: 999;
  transition: transform 0.3s ease;
}

.sidebar-menu {
  padding: 1rem 0;
}

.menu-item {
  margin: 0.25rem 0;
}

.menu-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  color: #4a5568;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.menu-title:hover {
  background-color: #f7fafc;
  color: #667eea;
}

.menu-title.active {
  background-color: #edf2f7;
  color: #667eea;
  border-left-color: #667eea;
}

.menu-icon {
  width: 20px;
  text-align: center;
  margin-right: 0.75rem;
}

.menu-arrow {
  transition: transform 0.2s;
  font-size: 0.75rem;
}

.menu-arrow.rotated {
  transform: rotate(90deg);
}

.submenu {
  background-color: #f8f9fa;
  border-top: 1px solid #e9ecef;
  display: none;
}

.submenu.show {
  display: block;
}

.submenu-item {
  display: block;
  padding: 0.625rem 1rem 0.625rem 3rem;
  color: #718096;
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.submenu-item:hover {
  background-color: #e2e8f0;
  color: #4a5568;
  text-decoration: none;
}

.submenu-item.active {
  background-color: #667eea;
  color: white;
  border-left-color: #5a67d8;
}

/* ========== 메인 컨텐츠 ========== */
.main-content {
  margin-left: 260px;
  margin-top: 60px;
  padding: 2rem;
  min-height: calc(100vh - 60px);
  transition: margin-left 0.3s ease;
}

.content-area {
  background: white;
  border-radius: 0.5rem;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  min-height: 500px;
}

.content-header {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

.content-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #2d3748;
  margin: 0;
}

.content-subtitle {
  color: #718096;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.content-body {
  color: #4a5568;
}

/* ========== 반응형 ========== */
/* 태블릿 */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .menu-toggle {
    display: block;
  }
  
  .user-info {
    gap: 0.5rem;
  }
  
  .user-info .user-name {
    display: none;
  }
  
  .current-time {
    display: none;
  }
}

/* 모바일 */
@media (max-width: 768px) {
  .header {
    padding: 0.5rem 1rem;
  }
  
  .header-right {
    gap: 1rem;
  }
  
  .user-info {
    gap: 0.25rem;
  }
  
  .user-info .user-role {
    display: none;
  }
  
  .logout-btn span {
    display: none;
  }
  
  .main-content {
    padding: 1rem;
  }
  
  .content-area {
    padding: 1.5rem;
  }
  
  .content-title {
    font-size: 1.25rem;
  }
}

/* 작은 모바일 */
@media (max-width: 480px) {
  .header {
    height: 50px;
  }
  
  .sidebar {
    top: 50px;
    height: calc(100vh - 50px);
    width: 100%;
  }
  
  .main-content {
    margin-top: 50px;
    padding: 0.75rem;
  }
  
  .content-area {
    padding: 1rem;
    border-radius: 0.25rem;
  }
  
  .logo {
    font-size: 1rem;
  }
  
  .user-avatar {
    width: 28px;
    height: 28px;
  }
}

/* ========== 사이드바 오버레이 (모바일) ========== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 998;
}

.sidebar-overlay.show {
  display: block;
}

@media (max-width: 992px) {
  .sidebar-overlay.show {
    display: block;
  }
}

/* ========== 푸터 ========== */
.footer {
  background: white;
  border-top: 1px solid #e2e8f0;
  padding: 1rem 2rem;
  margin-left: 260px;
  margin-top: 2rem;
  transition: margin-left 0.3s ease;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: #718096;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-separator {
  color: #cbd5e0;
}

/* 반응형 푸터 */
@media (max-width: 992px) {
  .footer {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .footer {
    padding: 1rem;
  }
  
  .footer-content {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
  
  .footer-right {
    justify-content: center;
  }
}

/* ========== 대시보드 스타일 ========== */
.stat-card {
  background: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  font-size: 1.5rem;
  color: white;
}

.stat-content {
  flex: 1;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
  color: #2d3748;
}

.stat-label {
  color: #718096;
  margin: 0;
  font-size: 0.875rem;
}

.chart-container, .activity-container, .quick-links-container {
  background: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  height: 100%;
}

.chart-header, .activity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.chart-header h5, .activity-header h5 {
  margin: 0;
  font-weight: 600;
  color: #2d3748;
}

.chart-controls {
  display: flex;
  gap: 0.5rem;
}

.activity-link {
  color: #667eea;
  text-decoration: none;
  font-size: 0.875rem;
}

.activity-link:hover {
  color: #5a67d8;
}

.chart-body {
  height: 300px;
  position: relative;
}

.chart-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: #718096;
}

.activity-body {
  max-height: 400px;
  overflow-y: auto;
}

.activity-loading, .activity-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #718096;
  gap: 0.5rem;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  padding: 1rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.75rem;
  color: white;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
}

.activity-title {
  margin: 0 0 0.25rem 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #2d3748;
}

.activity-description {
  margin: 0 0 0.25rem 0;
  font-size: 0.8125rem;
  color: #718096;
}

.activity-time {
  font-size: 0.75rem;
  color: #a0aec0;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.quick-link {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-link:hover {
  background: #e9ecef;
  transform: translateY(-2px);
}

.quick-link-icon {
  width: 48px;
  height: 48px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  color: white;
  font-size: 1.25rem;
}

.quick-link-text h6 {
  margin: 0 0 0.25rem 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #2d3748;
}

.quick-link-text p {
  margin: 0;
  font-size: 0.75rem;
  color: #718096;
}

/* 반응형 대시보드 */
@media (max-width: 768px) {
  .stat-card {
    padding: 1rem;
  }
  
  .stat-icon {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }
  
  .stat-number {
    font-size: 1.5rem;
  }
  
  .chart-container, .activity-container, .quick-links-container {
    padding: 1rem;
  }
  
  .chart-body {
    height: 250px;
  }
  
  .quick-links {
    grid-template-columns: 1fr;
  }
}

/* ========== 테스트 모달 영역 ========== */
.test-modal-container {
  background: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.test-modal-container h5 {
  margin-bottom: 1rem;
  color: #2d3748;
  font-weight: 600;
}

.menu-error {
  text-align: center;
  padding: 2rem 1rem;
  color: #e53e3e;
  font-size: 0.875rem;
}

/* ========== 유틸리티 클래스 ========== */
.text-primary { color: #667eea !important; }
.bg-primary { background-color: #667eea !important; }
.border-primary { border-color: #667eea !important; }
.bg-success { background-color: #48bb78 !important; }
.bg-warning { background-color: #ed8936 !important; }
.bg-info { background-color: #4299e1 !important; }

/* 로딩 상태 */
.loading {
  text-align: center;
  padding: 3rem;
  color: #718096;
}

.loading i {
  font-size: 2rem;
  margin-bottom: 1rem;
  animation: spin 1s linear infinite;
}

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

/* ========== 툴바 스타일 ========== */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.search-box {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.search-box input {
  min-width: 200px;
}

@media (max-width: 768px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-box {
    flex: 1;
  }
  
  .search-box input {
    min-width: auto;
    flex: 1;
  }
}