/* eco Admin 공통 레이아웃 */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #0a0c14;
  color: #f1f5f9;
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* ── 사이드바 ── */
.sidebar {
  width: 220px;
  background: #0f1118;
  border-right: 1px solid #1a1d2e;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 16px 14px 12px;
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
  border-bottom: 1px solid #1a1d2e;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo span { color: #e11d48; }
.logo-badge { font-size: 10px; background: #e11d4820; border: 1px solid #e11d4840; color: #e11d48; border-radius: 4px; padding: 1px 6px; font-weight: 600; }

.nav-group { padding: 10px 8px 4px; }
.nav-group-label { font-size: 10px; color: #334155; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; padding: 0 6px 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #64748b;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 1px;
}

.nav-item:hover { background: #1a1d2e; color: #e2e8f0; }
.nav-item.active { background: #e11d4815; color: #f87171; }
.nav-item .icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-user {
  margin-top: auto;
  border-top: 1px solid #1a1d2e;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #e11d48, #f97316);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: #475569; }

/* ── 메인 ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.page-header {
  padding: 14px 24px;
  border-bottom: 1px solid #1a1d2e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.page-header-left { display: flex; align-items: center; gap: 8px; }
.page-header h1 { font-size: 15px; font-weight: 700; color: #f1f5f9; }
.page-header p { font-size: 11px; color: #475569; margin-top: 2px; }
.page-header-icon { font-size: 18px; }

.content { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* ── 공통 컴포넌트 ── */
.btn { padding: 7px 16px; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer; border: none; transition: background 0.2s; display: inline-flex; align-items: center; gap: 5px; }
.btn-primary { background: #e11d48; color: #fff; }
.btn-primary:hover { background: #be1235; }
.btn-secondary { background: #1f2232; color: #94a3b8; border: 1px solid #2a2d3e; }
.btn-secondary:hover { background: #252840; color: #e2e8f0; }
.btn-ghost { background: transparent; color: #64748b; border: 1px solid #2a2d3e; }
.btn-ghost:hover { background: #1a1d2e; color: #e2e8f0; }
.btn-danger { background: transparent; color: #ef4444; border: 1px solid #ef444430; }
.btn-danger:hover { background: rgba(239,68,68,0.08); }
.btn-sm { padding: 4px 10px; font-size: 11px; }

.card { background: #13161f; border: 1px solid #1f2232; border-radius: 10px; }
.card-header { padding: 12px 16px; border-bottom: 1px solid #1f2232; display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 13px; font-weight: 700; color: #e2e8f0; }
.card-body { padding: 16px; }

/* 테이블 */
.table-wrap { background: #13161f; border: 1px solid #1f2232; border-radius: 10px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: #0f1118; }
th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid #1f2232; }
td { padding: 11px 14px; font-size: 13px; color: #cbd5e1; border-bottom: 1px solid #141720; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #1a1d2e; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.badge-green { background: #10b98115; border: 1px solid #10b98130; color: #34d399; }
.badge-blue { background: #6366f115; border: 1px solid #6366f130; color: #818cf8; }
.badge-red { background: #ef444415; border: 1px solid #ef444430; color: #f87171; }
.badge-gray { background: #1f2232; border: 1px solid #2a2d3e; color: #64748b; }
.badge-yellow { background: #f59e0b15; border: 1px solid #f59e0b30; color: #fbbf24; }

/* 폼 */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-label { font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.3px; }
.form-input, .form-textarea, .form-select {
  background: #0f1118;
  border: 1px solid #1f2232;
  border-radius: 7px;
  padding: 8px 11px;
  color: #e2e8f0;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus { border-color: #e11d48; }
.form-input[disabled] { opacity: 0.5; cursor: not-allowed; }
.form-textarea { resize: vertical; line-height: 1.6; }
.form-select option { background: #13161f; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row.col3 { grid-template-columns: 1fr 1fr 1fr; }
.col-span-2 { grid-column: 1 / -1; }

/* 모달 */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: #13161f; border: 1px solid #1f2232; border-radius: 14px; overflow: hidden; box-shadow: 0 24px 64px rgba(0,0,0,0.6); }
.modal-header { padding: 14px 18px; border-bottom: 1px solid #1f2232; display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 14px; font-weight: 700; color: #f1f5f9; }
.modal-close { background: none; border: none; color: #475569; cursor: pointer; font-size: 16px; line-height: 1; }
.modal-close:hover { color: #f1f5f9; }
.modal-body { padding: 18px; }
.modal-footer { padding: 12px 18px; border-top: 1px solid #1f2232; display: flex; justify-content: flex-end; gap: 8px; }

/* 검색바 */
.search-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.search-input { background: #0f1118; border: 1px solid #1f2232; border-radius: 7px; padding: 7px 12px; color: #e2e8f0; font-size: 12px; outline: none; flex: 1; }
.search-input:focus { border-color: #e11d48; }
.search-input::placeholder { color: #334155; }

/* 페이지네이션 */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 16px; }
.page-btn { width: 30px; height: 30px; border-radius: 6px; border: 1px solid #1f2232; background: transparent; color: #64748b; cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.page-btn:hover { background: #1a1d2e; color: #e2e8f0; }
.page-btn.active { background: #e11d48; border-color: #e11d48; color: #fff; }

/* 다크/라이트 토글 버튼 */
.theme-btn {
  position: fixed !important;
  top: 12px; right: 16px; z-index: 9999 !important;
  background: #1f2232; border: 1px solid #2a2d3e;
  border-radius: 20px; padding: 5px 12px;
  font-size: 12px; color: #94a3b8; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all 0.15s;
}
.theme-btn:hover { border-color: #6366f1; color: #f1f5f9; }
body.light-mode .theme-btn { background: #fff; border-color: #cbd5e1; color: #475569; }

/* 햄버거 버튼 */
.hamburger-btn {
  position: absolute; top: 14px; right: -13px;
  width: 26px; height: 26px;
  background: #1f2232; border: 1px solid #2a2d3e;
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #94a3b8; z-index: 200;
  transition: all 0.15s; box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.hamburger-btn:hover { color: #f1f5f9; border-color: #6366f1; background: #1a1d2e; }
body.light-mode .hamburger-btn { background: #fff; border-color: #cbd5e1; color: #64748b; }

.sidebar-wrap { position: relative; display: flex; flex-shrink: 0; }
.sidebar { transition: width 0.25s ease; overflow: hidden; }
.sidebar.collapsed { width: 52px !important; }
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .user-info,
.sidebar.collapsed .logo-badge,
.sidebar.collapsed .sidebar-logo-text { display: none !important; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 9px 0; }
.sidebar.collapsed .sidebar-logo { justify-content: center; padding: 14px 6px; }
.sidebar.collapsed .user-avatar { margin: 0 auto; }
.sidebar.collapsed .sidebar-user { justify-content: center; padding: 10px 0; }
.sidebar.collapsed [style*="padding:6px 6px 0"] { display: none !important; }

/* 라이트 모드 */
body.light-mode { background: #f1f5f9; color: #0f172a; }
body.light-mode .sidebar { background: #e2e8f0; border-color: #cbd5e1; }
body.light-mode .sidebar-logo { color: #0f172a; border-color: #cbd5e1; }
body.light-mode .nav-item { color: #475569; }
body.light-mode .nav-item:hover, body.light-mode .nav-item.active { background: #cbd5e1; color: #0f172a; }
body.light-mode .nav-group-label { color: #94a3b8; }
body.light-mode .main { background: #f8fafc; }
body.light-mode .page-header { border-color: #cbd5e1; background: #f1f5f9; }
body.light-mode .card, body.light-mode .table-wrap { background: #fff; border-color: #e2e8f0; }
body.light-mode th { color: #64748b; border-color: #e2e8f0; }
body.light-mode td { color: #334155; border-color: #f1f5f9; }
body.light-mode tbody tr:hover td { background: #f8fafc; }
body.light-mode .user-name { color: #0f172a; }
body.light-mode .form-input, body.light-mode .form-textarea, body.light-mode .form-select { background: #f8fafc; border-color: #e2e8f0; color: #0f172a; }

/* 반응형 */
@media (max-width: 768px) {
  .sidebar-wrap { position: fixed !important; top: 0; left: 0; height: 100vh; z-index: 500; transition: transform 0.25s ease; }
  .sidebar-wrap.collapsed { transform: translateX(-100%) !important; }
  .sidebar-wrap:not(.collapsed) { transform: translateX(0) !important; }
  .sidebar { height: 100vh !important; overflow-y: auto; box-shadow: 2px 0 16px rgba(0,0,0,0.5); width: 220px !important; }
  .sidebar.collapsed { width: 220px !important; }
  .hamburger-btn { position: fixed !important; top: 12px !important; left: 12px !important; right: auto !important; width: 34px !important; height: 34px !important; font-size: 14px !important; z-index: 600 !important; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 499; }
  .sidebar-overlay.show { display: block; }
  .main { margin-left: 0 !important; width: 100% !important; }
  .page-header { padding: 14px 14px 14px 56px !important; }
  .theme-btn { top: 12px !important; right: 12px !important; font-size: 11px !important; padding: 4px 8px !important; }
  .content { padding: 14px !important; }
  .table-wrap { overflow-x: auto; }
  .stat-grid { grid-template-columns: 1fr 1fr !important; }
  .row2, .row3 { grid-template-columns: 1fr !important; }
}
