/* ============================================================
   코드잇 강의실 플래너 — 디자인 시스템
   참고: Skedda/Robin 류의 공간 예약 SaaS 관리 화면
   (좌측 다크 사이드바 + 흰 카드 콘텐츠 + 단일 포인트 컬러)
   ============================================================ */

@font-face {
  font-family: "Pretendard Variable";
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
  src: url("vendor/PretendardVariable.woff2") format("woff2-variations");
}

:root {
  --brand: #4f46e5;            /* 포인트 컬러 (인디고) */
  --brand-soft: #eef2ff;
  --sidebar-bg: #111827;       /* 사이드바 다크 네이비 */
  --sidebar-w: 232px;
  --bg: #f5f6f8;
  --card-border: #e9ecf1;
  --text: #1f2937;
  --muted: #6b7280;

  /* 재무 색상 체계: 매출=파랑, 비용=빨강, 이익=초록 */
  --revenue: #2563eb;
  --cost: #dc2626;
  --profit: #16a34a;
  --revenue-bg: #eff6ff;
  --cost-bg: #fef2f2;
  --profit-bg: #f0fdf4;
}

html, body {
  height: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  letter-spacing: -0.01em;
}

/* ---------------- 레이아웃: 사이드바 + 본문 ---------------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #d1d5db;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 1rem 0.75rem;
}

@media (min-width: 992px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }
}

/* 모바일에서는 offcanvas로 동작 (Bootstrap offcanvas-lg).
   데스크톱에서 Bootstrap이 offcanvas-lg 배경을 transparent !important로
   덮어쓰므로, 동일하게 !important로 다크 배경을 강제한다. */
.sidebar.offcanvas-lg {
  background: var(--sidebar-bg) !important;
  color: #d1d5db !important;
}

.sidebar .brand {
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.75rem 1rem;
}

.sidebar .brand .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.sidebar .nav-section {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #6b7280;
  text-transform: uppercase;
  padding: 1rem 0.75rem 0.35rem;
}

.sidebar .nav-link {
  color: #d1d5db;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.55rem;
  font-size: 0.92rem;
  font-weight: 500;
}

.sidebar .nav-link i {
  font-size: 1rem;
  width: 1.15rem;
  text-align: center;
  opacity: 0.85;
}

.sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 700;
}

.sidebar .sidebar-foot {
  margin-top: auto;
  padding: 1rem 0.75rem 0.25rem;
  font-size: 0.72rem;
  color: #6b7280;
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 1.5rem 1.75rem 2.5rem;
}

@media (max-width: 991.98px) {
  .app-main {
    padding: 1rem 1rem 2rem;
  }
}

/* 모바일 상단바 */
.mobile-topbar {
  background: var(--sidebar-bg);
  color: #fff;
}

/* ---------------- 페이지 헤더 ---------------- */

.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.page-header h1 {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0;
}

.page-header .page-sub {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------------- 카드 ---------------- */

.card {
  border: 1px solid var(--card-border);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  border-radius: 0.9rem;
}

.card .card-header {
  background-color: transparent;
  border-bottom: 1px solid var(--card-border);
  font-weight: 700;
  padding: 0.85rem 1.1rem;
}

/* ---------------- 버튼/배지/링크 ---------------- */

/* 링크: 기본 밑줄 제거(호버 시에만), 표 안의 링크는 본문색 → 호버 시 포인트색.
   파란 밑줄 일색이던 예전 느낌을 없애는 핵심 규칙. */
a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

.table a {
  color: var(--text);
  font-weight: 650;
}

.table a:hover {
  color: var(--brand);
  text-decoration: none;
}

.card a.small {
  font-weight: 600;
}

.sidebar a:hover,
.btn:hover {
  text-decoration: none;
}

.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: #4338ca;
  --bs-btn-hover-border-color: #4338ca;
  --bs-btn-active-bg: #3730a3;
  --bs-btn-active-border-color: #3730a3;
}

.btn-outline-primary {
  --bs-btn-color: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand);
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand);
  --bs-btn-active-border-color: var(--brand);
}

.badge { font-weight: 600; }

/* 상태 배지: 예정/확정/완료/취소 */
.badge-status-PLANNED   { background: #fef3c7; color: #92400e; }
.badge-status-CONFIRMED { background: #dbeafe; color: #1e40af; }
.badge-status-COMPLETED { background: #dcfce7; color: #166534; }
.badge-status-CANCELLED { background: #f3f4f6; color: #6b7280; text-decoration: line-through; }

/* ---------------- 테이블 ---------------- */

.table {
  background-color: #fff;
  font-size: 0.92rem;
}

.table th {
  white-space: nowrap;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

/* 금액은 항상 오른쪽 정렬 + 고정폭 숫자 */
td.money, th.money, .text-money {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.money-negative, .amt-neg { color: var(--cost); }
.money-positive, .amt-pos { color: var(--profit); }

/* ---------------- 재무 표 색상 체계 ----------------
   매출 계열 열은 파란 톤, 비용 계열 열은 붉은 톤,
   이익 열은 굵게 + 부호에 따라 초록/빨강. */

.table .fin-rev  { background: var(--revenue-bg); }
.table .fin-cost { background: var(--cost-bg); }
.table .fin-profit {
  background: var(--profit-bg);
  font-weight: 800;
  border-left: 2px solid var(--card-border);
}
.table .fin-cum {
  background: var(--profit-bg);
  color: var(--muted);
}

/* 이익·누적 이익 셀은 부호에 따라 배경까지 갈라진다:
   흑자 = 초록 셀, 손실 = 빨간 셀 — 스캔만으로 적자 달이 보이게. */
.table td.fin-profit.amt-pos { background: var(--profit-bg); color: var(--profit); }
.table td.fin-profit.amt-neg { background: var(--cost-bg); color: var(--cost); }
.table td.fin-cum.amt-pos { background: var(--profit-bg); }
.table td.fin-cum.amt-neg {
  background: var(--cost-bg);
  color: var(--cost);
  font-weight: 700;
}

.fin-profit .bi, .fin-cum .bi {
  font-size: 0.7em;
  vertical-align: 0.1em;
  margin-right: 0.15rem;
}

.table tr.fin-total-row {
  border-top: 2px solid #cbd5e1;
  background: #f8fafc;
  font-weight: 800;
}

.fin-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-right: 0.9rem;
}

.fin-legend .dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 3px;
  display: inline-block;
}

.dot-rev  { background: var(--revenue); }
.dot-cost { background: var(--cost); }
.dot-prof { background: var(--profit); }

/* ---------------- 대시보드 ---------------- */

.stat-card .stat-value {
  font-size: 1.55rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: var(--brand-soft);
  color: var(--brand);
}

/* 이번 달 손익 히어로 */
.pl-hero .pl-item {
  border-left: 4px solid var(--card-border);
  padding: 0.35rem 0 0.35rem 0.9rem;
}

.pl-hero .pl-item.rev  { border-left-color: var(--revenue); }
.pl-hero .pl-item.cost { border-left-color: var(--cost); }
.pl-hero .pl-item.prof { border-left-color: var(--profit); }

.pl-hero .pl-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.pl-hero .pl-value {
  font-size: 1.7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

@media (max-width: 575.98px) {
  .pl-hero .pl-value { font-size: 1.25rem; }
}

/* 월/연도 두 묶음을 나란히 놓을 때의 축소 변형 */
.pl-hero .pl-compact .pl-value { font-size: 1.28rem; }

.pl-hero .pl-scope-label {
  font-size: 0.85rem;
  font-weight: 800;
  margin-bottom: 0.6rem;
}

/* ---------------- 빈 상태 안내 ---------------- */

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 1rem;
  background: #fff;
  border: 1px dashed #d1d5db;
  border-radius: 0.9rem;
}

/* ---------------- 강의실 현황(주간 그리드) ---------------- */

.availability-cell-free {
  background-color: var(--profit-bg);
  color: #15803d;
}

.availability-cell-busy {
  background-color: #fffbeb;
}

/* 점유율 80% 이상 강조 */
.occupancy-high {
  background-color: var(--cost-bg);
  color: var(--cost);
  font-weight: 700;
}

/* ---------------- 시간대(슬롯) ---------------- */

/* 강의실 현황 격자: 하루 = 4칸 (오전/오후1/오후2/저녁) */
.slot-strip {
  display: flex;
  gap: 3px;
}

.slot-block {
  flex: 1 1 0;
  min-width: 2.4rem;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.15;
  padding: 0.22rem 0.1rem;
  border-radius: 5px;
  white-space: nowrap;
  display: block;
  text-decoration: none;
}

.slot-block.slot-free {
  background: var(--profit-bg);
  color: #15803d;
}

.slot-block.slot-busy {
  background: #e0e7ff;
  color: #3730a3;
}

a.slot-block:hover {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
  text-decoration: none;
}

/* 폼의 슬롯 선택 필 버튼 */
.slot-pick {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.slot-pick input[type="checkbox"],
.slot-pick input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.slot-pick label {
  border: 1.5px solid #d1d5db;
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
  background: #fff;
  color: var(--text);
  user-select: none;
}

.slot-pick input:checked + label {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

.slot-pick label:hover {
  border-color: var(--brand);
}

/* ---------------- 폼 ---------------- */

form .form-label { font-weight: 650; }

form .helptext,
form .form-text {
  color: var(--muted);
  font-size: 0.84rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
}

/* ---------------- FullCalendar ---------------- */

#calendar {
  background: #fff;
  padding: 1rem;
  border: 1px solid var(--card-border);
  border-radius: 0.9rem;
}

.fc .fc-button-primary {
  background: #fff;
  border-color: #d1d5db;
  color: var(--text);
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: var(--brand);
  border-color: var(--brand);
}

.fc .fc-button-primary:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}
