/* ==========================================
   콘블라 멤버스 - 글로벌 스타일
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;800&display=swap');
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

:root {
  --orange:       #be4020;
  --orange-light: #d9521f;
  --orange-bg:    #fff5f2;
  --dark:         #212121;
  --gray:         #666666;
  --light-gray:   #f5f5f5;
  --border:       #e0e0e0;
  --white:        #ffffff;
  --shadow:       0 2px 16px rgba(0,0,0,0.07);
  --shadow-md:    0 6px 28px rgba(0,0,0,0.11);
  --radius:       14px;
  --radius-sm:    8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
button { color: inherit; }

body {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  color: var(--dark);
  background: var(--white);
  font-size: 15px;
  line-height: 1.6;
}

h1, h2, h3, .logo {
  font-family: 'Poppins', 'Pretendard', sans-serif;
}

/* ── 네비게이션 ───────────────────────── */
.navbar {
  height: auto;
  min-height: 64px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 40px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-submenu {
  display: flex;
  gap: 2px;
  margin-left: 52px;
}

.nav-menu-item {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.18s;
}

.nav-menu-item:hover {
  color: var(--orange);
  background: var(--orange-bg);
}

.nav-menu-item.active {
  color: var(--orange);
  background: var(--orange-bg);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.nav-logo-mark {
  width: 26px;
  height: 26px;
  object-fit: cover;
  font-size: 17px;
}

.nav-logo-text {
  font-weight: 700;
  font-size: 20px;
  color: var(--dark);
}

.nav-logo-text span {
  color: var(--orange);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── 버튼 ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--orange);
  color: white;
}
.btn-primary:hover {
  background: var(--orange-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(190,64,32,0.3);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--dark);
}
.btn-outline:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.btn-ghost {
  background: transparent;
  color: var(--gray);
  padding: 8px 14px;
}
.btn-ghost:hover { color: var(--dark); }

.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
  border-radius: 10px;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

.btn-danger {
  background: #fff0ee;
  color: #c0392b;
  border: 1.5px solid #ffd5cf;
}
.btn-danger:hover { background: #ffe0dc; }

.btn-block {
  width: 100%;
}

/* ── 컨테이너 ─────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-sm {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── 카드 ─────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* ── 폼 ───────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 7px;
  color: var(--dark);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--dark);
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  background: white;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--orange);
}

.form-hint {
  font-size: 12px;
  color: var(--gray);
  margin-top: 5px;
}

.form-error {
  font-size: 12px;
  color: #c0392b;
  margin-top: 5px;
  display: none;
}

/* ── 모달 ─────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: white;
  border-radius: 18px;
  padding: 32px;
  width: 440px;
  max-width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity:0; transform: translateY(14px) scale(0.97); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 24px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ── 토스트 ───────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--dark);
  color: white;
  padding: 13px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: toastIn 0.25s ease, toastOut 0.3s ease 2.3s forwards;
}

.toast-error {
  background: #c0392b;
}

@keyframes toastIn  { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; } }

/* ── 빈 상태 ──────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}

.empty-icon { font-size: 48px; margin-bottom: 14px; }
.empty-state h3 { font-size: 16px; color: var(--dark); margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ── 배지 ─────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-green  { background: #e8f8f0; color: #27ae60; }
.badge-red    { background: #feeeee; color: #c0392b; }
.badge-gray   { background: #f0f0f0; color: var(--gray); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }

/* ── 아바타 ───────────────────────────── */
.avatar {
  border-radius: 50%;
  background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  flex-shrink: 0;
  text-shadow: 0 1px 3px rgba(0,0,0,0.2);
  letter-spacing: -0.5px;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
}
.avatar-sm { width: 36px; height: 36px; font-size: 10px; }
.avatar-md { width: 48px; height: 48px; font-size: 13px; }
.avatar-lg { width: 64px; height: 64px; font-size: 16px; }

/* ── 분리선 ───────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── 마이페이지 팝업 ──────────────────── */
.mypage-popup-backdrop {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}
.mypage-popup-frame {
  width: 520px;
  max-width: 95vw;
  height: 85vh;
  background: white;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  position: relative;
}
.mypage-popup-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.mypage-popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.06);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.15s;
}
.mypage-popup-close:hover { background: rgba(0,0,0,0.12); }

/* ── 스피너 ───────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── 페이지 로딩 ──────────────────────── */
.page-loading {
  position: fixed; inset: 0;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.page-loading .spinner {
  border-color: rgba(190,64,32,0.2);
  border-top-color: var(--orange);
  width: 32px; height: 32px;
}

/* ── 대시보드 공통 ───────────────────── */
.page-wrap {
  background: var(--light-gray);
  min-height: calc(100vh - 64px);
  padding: 28px 0 60px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
}

/* 요약 카드 그리드 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--orange);
  font-family: 'Poppins', sans-serif;
  line-height: 1.1;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.stat-sub {
  font-size: 12px;
  color: var(--gray);
  margin-top: 3px;
}

/* 차트 카드 */
.chart-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 16px;
}

.chart-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.chart-wrap { position: relative; height: 230px; }
.chart-wrap-sm { position: relative; height: 160px; }

/* 차트 스크롤바 */
::-webkit-scrollbar { height: 10px; }
::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 5px; }
::-webkit-scrollbar-thumb { background: #bbb; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #999; }

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* 탭 */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 11px 24px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.18s;
  font-family: inherit;
}

.tab-btn.active { color: var(--orange); border-bottom-color: var(--orange); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* 주차 탭 */
.week-tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }

.week-tab {
  position: relative;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: white;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
}

.week-tab:hover { border-color: var(--orange); color: var(--orange); }
.week-tab.active { background: var(--orange); border-color: var(--orange); color: white; }

.week-tab .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #27ae60;
  position: absolute;
  top: 5px; right: 6px;
}

.week-tab.active .dot { background: rgba(255,255,255,0.7); }

/* 섹션 카드 */
.section-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 14px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* 릴스 입력 */
.reels-header {
  display: grid;
  grid-template-columns: 130px 1fr 1fr 1fr 36px;
  gap: 8px;
  padding: 0 12px 8px;
}

.reels-header span {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.reel-row {
  display: grid;
  grid-template-columns: 130px 1fr 1fr 1fr 36px;
  gap: 8px;
  align-items: center;
  background: var(--light-gray);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.reel-row input {
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  width: 100%;
  background: white;
  font-family: inherit;
}

.reel-row input:focus { border-color: var(--orange); }
.reel-row input[type="number"] { text-align: right; }

.reel-remove-btn {
  background: none; border: none;
  color: var(--border); cursor: pointer;
  font-size: 15px; padding: 4px;
  border-radius: 4px;
  transition: color 0.2s;
}
.reel-remove-btn:hover { color: #c0392b; }

.add-reel-btn {
  width: 100%; padding: 10px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--orange);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: all 0.18s;
  font-family: inherit;
}
.add-reel-btn:hover { border-color: var(--orange); background: var(--orange-bg); }

/* 수강생 테이블 */
.student-table {
  width: 100%;
  border-collapse: collapse;
}

.student-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
}

.student-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
}

.student-table tr:last-child td { border-bottom: none; }
.student-table tr:hover td { background: var(--light-gray); }
.student-table tr { transition: background 0.15s; }

/* 반응형 */
@media (max-width: 768px) {
  .navbar { padding: 0 20px; }
  .charts-grid { grid-template-columns: 1fr; }
  .reels-header { display: none; }
  .reel-row { grid-template-columns: 1fr 1fr; }
}

.mobile-only { display: none; }

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .modal { padding: 24px; }
  #navName, #navUserInfo { display: none !important; }
  .nav-menu { margin-left: 0; }
  .nav-menu-item { font-size: 13px; padding: 5px 8px; white-space: nowrap; }
  .pc-only { display: none !important; }
  .mobile-only { display: block !important; }
}
