/* -------------------------------------------------------------
 * 1. Global Themes & Reset
 * ------------------------------------------------------------- */
:root {
  /* 라이트 모드 변수군 */
  --bg-primary: #f3f7fb;
  --bg-sidebar: rgba(255, 255, 255, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.6);
  --bg-glass-hover: rgba(255, 255, 255, 0.85);
  --border-glass: rgba(255, 255, 255, 0.4);
  --border-glass-subtle: rgba(0, 0, 0, 0.05);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
  --shadow-modal: 0 20px 40px rgba(0, 0, 0, 0.1);
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  
  --accent-primary: #4f46e5;
  --accent-hover: #4338ca;
  --accent-glow: rgba(79, 70, 229, 0.15);
  
  --bg-today: rgba(79, 70, 229, 0.08);
  --border-today: rgba(79, 70, 229, 0.3);
  
  /* 태그별 색상 (라이트 모드) */
  --color-school: #e11d48;
  --bg-school: rgba(225, 29, 72, 0.08);
  --color-academy: #0284c7;
  --bg-academy: rgba(2, 132, 199, 0.08);
  --color-personal: #059669;
  --bg-personal: rgba(5, 150, 105, 0.08);

  /* 과목별 색상 매핑 */
  --sub-kor: #ea580c; /* 국어 */
  --sub-math: #7c3aed; /* 수학 */
  --sub-soc: #854d0e; /* 사회 */
  --sub-sci: #0891b2; /* 과학 */
  --sub-eng: #db2777; /* 영어 */
  --sub-his: #b45309; /* 역사 */
  --sub-com: #16a34a; /* 컴퓨터 */
  --sub-for: #2563eb; /* 외국어 */
  --sub-etc: #475569; /* 기타 */
  
  --glass-blur: 16px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

[data-theme="dark"] {
  /* 다크 모드 변수군 */
  --bg-primary: #070a13;
  --bg-sidebar: rgba(13, 18, 33, 0.65);
  --bg-glass: rgba(15, 23, 42, 0.45);
  --bg-glass-hover: rgba(15, 23, 42, 0.65);
  --border-glass: rgba(255, 255, 255, 0.06);
  --border-glass-subtle: rgba(255, 255, 255, 0.03);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-modal: 0 24px 48px rgba(0, 0, 0, 0.5);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  
  --accent-primary: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);
  
  --bg-today: rgba(99, 102, 241, 0.12);
  --border-today: rgba(99, 102, 241, 0.4);

  /* 태그별 색상 (다크 모드) */
  --color-school: #ff4b72;
  --bg-school: rgba(255, 75, 114, 0.14);
  --color-academy: #38bdf8;
  --bg-academy: rgba(56, 189, 248, 0.14);
  --color-personal: #34d399;
  --bg-personal: rgba(52, 211, 153, 0.14);

  /* 과목별 색상 매핑 */
  --sub-kor: #ff7849;
  --sub-math: #a78bfa;
  --sub-soc: #fbbf24;
  --sub-sci: #22d3ee;
  --sub-eng: #f472b6;
  --sub-his: #fb923c;
  --sub-com: #4ade80;
  --sub-for: #60a5fa;
  --sub-etc: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.2s ease;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
  background-image: 
    radial-gradient(at 10% 20%, var(--accent-glow) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(139, 92, 246, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
}

/* -------------------------------------------------------------
 * 2. Layout Structure
 * ------------------------------------------------------------- */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  padding: 16px;
  gap: 16px;
}

/* 사이드바 */
.sidebar {
  width: 320px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 24px;
  box-shadow: var(--shadow-glass);
  z-index: 10;
  flex-shrink: 0;
}

/* 메인 영역 */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  overflow: hidden;
}

/* 상단 헤더 */
.header {
  height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
}

/* 콘텐츠 그리드 */
.content-grid {
  display: flex;
  flex-grow: 1;
  gap: 16px;
  overflow: hidden;
  height: calc(100% - 86px);
}

/* 캘린더 영역 */
.calendar-card {
  flex-grow: 1.5;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
  min-width: 500px;
}

/* 일별 상세 보기 */
.details-panel {
  flex-grow: 1;
  width: 440px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow: hidden;
  flex-shrink: 0;
}

/* -------------------------------------------------------------
 * 3. Sidebar Components
 * ------------------------------------------------------------- */
.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.logo-icon i {
  width: 24px;
  height: 24px;
}
.logo-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.logo-text span {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* 통계 카드 */
.stats-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stats-card h3 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.progress-bar-container {
  height: 8px;
  background: var(--border-glass-subtle);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), #a855f7);
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(0.1, 0.8, 0.2, 1);
}
.stats-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: right;
  font-weight: 600;
}

/* 사이드바 섹션 */
.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sidebar-section h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.section-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* 필터 아이템 */
.filter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--border-glass-subtle);
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
}
.filter-item:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass);
}
.filter-label {
  font-size: 0.88rem;
  font-weight: 500;
  flex-grow: 1;
  margin-left: 12px;
}
.tag-count {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

/* 체크박스 스타일 커스텀 */
.filter-item input[type="checkbox"] {
  display: none;
}
.custom-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--text-muted);
  position: relative;
  transition: all 0.2s ease;
}
.filter-item input[type="checkbox"]:checked + .custom-checkbox {
  border-color: currentColor;
  background-color: currentColor;
}
.filter-item input[type="checkbox"]:checked + .custom-checkbox::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* 태그 테마 적용 */
.filter-school { color: var(--color-school); }
.filter-school .tag-count { background: var(--bg-school); }
.filter-academy { color: var(--color-academy); }
.filter-academy .tag-count { background: var(--bg-academy); }
.filter-personal { color: var(--color-personal); }
.filter-personal .tag-count { background: var(--bg-personal); }

/* 업로드 드롭존 */
.upload-dropzone {
  border: 2px dashed var(--text-muted);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--border-glass-subtle);
}
.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--accent-primary);
  background: var(--accent-glow);
}
.upload-dropzone i {
  width: 36px;
  height: 36px;
  color: var(--text-secondary);
}
.upload-dropzone:hover i, .upload-dropzone.dragover i {
  color: var(--accent-primary);
  transform: translateY(-2px);
}
.upload-text {
  font-size: 0.85rem;
  font-weight: 600;
}
.upload-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* 사이드바 하단 */
.sidebar-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-glass-subtle);
  padding-top: 16px;
}
.theme-toggle-container {
  display: flex;
  background: var(--border-glass-subtle);
  border-radius: 20px;
  padding: 3px;
  border: 1px solid var(--border-glass);
}
.theme-toggle-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: pointer;
  background-color: var(--bg-glass-hover);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.theme-toggle-btn i {
  width: 18px;
  height: 18px;
}

/* -------------------------------------------------------------
 * 4. Header & Button Components
 * ------------------------------------------------------------- */
.month-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}
.month-nav h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
}
.nav-btn:hover {
  background: var(--bg-glass-hover);
  transform: scale(1.05);
}
.nav-btn i {
  width: 20px;
  height: 20px;
}

/* 공통 버튼 */
.btn-primary {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.btn-primary i {
  width: 18px;
  height: 18px;
}

.btn-secondary {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary:hover {
  background: var(--bg-glass-hover);
}

.icon-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
}
.icon-btn:hover {
  color: var(--text-primary);
}
.icon-btn i {
  width: 18px;
  height: 18px;
}

/* -------------------------------------------------------------
 * 5. Calendar Board Components
 * ------------------------------------------------------------- */
.calendar-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border-glass-subtle);
  padding-bottom: 10px;
  margin-bottom: 8px;
  text-align: center;
}
.day-header {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}
.text-red { color: var(--color-school); }
.text-blue { color: var(--color-academy); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  flex-grow: 1;
  gap: 6px;
}

/* 날짜 셀 */
.calendar-day-cell {
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--border-glass-subtle);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  position: relative;
  min-height: 50px;
}
.calendar-day-cell:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass);
}
.calendar-day-cell.other-month {
  opacity: 0.25;
}
.calendar-day-cell.selected {
  border-color: var(--accent-primary);
  box-shadow: inset 0 0 0 1px var(--accent-primary);
}
.calendar-day-cell.today {
  background: var(--bg-today);
  border-color: var(--border-today);
}
.date-number {
  font-size: 0.82rem;
  font-weight: 700;
  align-self: flex-start;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.calendar-day-cell.today .date-number {
  background: var(--accent-primary);
  color: #fff;
}

/* 셀 내의 이벤트 도트/지시자 */
.cell-events-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-grow: 1;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
}
.cell-events-container::-webkit-scrollbar {
  display: none; /* Chrome */
}

/* 미니 일정 바 */
.mini-event-bar {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 2px;
}
.mini-event-bar.checklist-type {
  opacity: 0.9;
}
.mini-event-bar.announcement-type {
  border-left: 2px solid currentColor;
  color: var(--text-primary);
  background: var(--border-glass-subtle);
}

/* -------------------------------------------------------------
 * 6. Details Panel Components
 * ------------------------------------------------------------- */
.details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass-subtle);
  padding-bottom: 16px;
  margin-bottom: 20px;
}
.selected-date-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.selected-date-title i {
  color: var(--accent-primary);
  width: 22px;
  height: 22px;
}
.selected-date-title h3 {
  font-size: 1.1rem;
  font-weight: 700;
}
.selected-day-badge {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--accent-primary);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
}

.schedule-list-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex-grow: 1;
  overflow-y: auto;
  padding-right: 4px;
}
/* 스크롤바 세팅 */
.schedule-list-container::-webkit-scrollbar {
  width: 5px;
}
.schedule-list-container::-webkit-scrollbar-track {
  background: transparent;
}
.schedule-list-container::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 10px;
}

.schedule-sub-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px dashed var(--border-glass-subtle);
  padding-bottom: 6px;
}
.section-title i {
  width: 16px;
  height: 16px;
}
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.empty-state {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 20px;
  background: var(--border-glass-subtle);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-glass);
}

/* 일정 카드 */
.schedule-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: var(--border-glass-subtle);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}
.schedule-card:hover {
  background: var(--bg-glass-hover);
  box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}
.schedule-card.completed {
  opacity: 0.5;
}
.schedule-card.completed .card-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* 태그 색상에 따른 카드 좌측 보더 라인 */
.schedule-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: var(--tag-color);
}
.schedule-card-school { --tag-color: var(--color-school); }
.schedule-card-academy { --tag-color: var(--color-academy); }
.schedule-card-personal { --tag-color: var(--color-personal); }

/* 체크박스 디자인 */
.card-checkbox-container {
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
}
.card-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.schedule-card.completed .card-checkbox {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}
.schedule-card.completed .card-checkbox::after {
  content: '';
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-0.5px, -0.5px);
}

/* 카드 텍스트 */
.card-details {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card-meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
}
.subject-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  color: #fff;
  background-color: var(--sub-color);
}
.card-tag-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}
.card-tag-school { color: var(--color-school); background: var(--bg-school); }
.card-tag-academy { color: var(--color-academy); background: var(--bg-academy); }
.card-tag-personal { color: var(--color-personal); background: var(--bg-personal); }

.card-title {
  font-size: 0.88rem;
  font-weight: 700;
}
.card-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  white-space: pre-wrap;
}

/* 카드 액션 버튼 */
.card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
  align-self: flex-start;
}
.schedule-card:hover .card-actions {
  opacity: 1;
}
.action-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.action-btn:hover {
  background: var(--border-glass);
  color: var(--text-primary);
}
.action-btn.btn-delete:hover {
  color: var(--color-school);
  background: var(--bg-school);
}
.action-btn i {
  width: 14px;
  height: 14px;
}

/* -------------------------------------------------------------
 * 7. Modals Overlay & Content
 * ------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 100;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.modal-content {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 480px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}
.modal-overlay.active .modal-content {
  transform: scale(1);
}
.modal-large {
  max-width: 680px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass-subtle);
  padding-bottom: 14px;
}
.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}
.close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
}
.close-btn i {
  width: 20px;
  height: 20px;
}
.modal-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
}

/* 모달 양식 */
.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
}
input[type="text"], input[type="date"], input[type="password"], select, textarea {
  background: var(--border-glass-subtle);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea {
  resize: vertical;
}

/* 라디오 버튼 디자인 */
.radio-group {
  display: flex;
  gap: 20px;
  padding: 6px 0;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.radio-label input[type="radio"] {
  display: none;
}
.custom-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  position: relative;
  transition: all 0.2s ease;
}
.radio-label input[type="radio"]:checked + .custom-radio {
  border-color: var(--accent-primary);
}
.radio-label input[type="radio"]:checked + .custom-radio::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-primary);
}

/* 체크박스 양식 */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  display: none;
}
.checkbox-label .custom-checkbox {
  width: 16px;
  height: 16px;
  border-color: var(--text-muted);
}
.checkbox-label input[type="checkbox"]:checked + .custom-checkbox {
  border-color: var(--accent-primary);
  background-color: var(--accent-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--border-glass-subtle);
  padding-top: 16px;
  margin-top: 8px;
}

/* -------------------------------------------------------------
 * 8. AI Review & Loading Spinner Elements
 * ------------------------------------------------------------- */
.ai-results-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}
.ai-results-container::-webkit-scrollbar {
  width: 5px;
}
.ai-results-container::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 10px;
}

/* AI가 생성한 항목 카드 */
.ai-result-item {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: var(--border-glass-subtle);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  align-items: flex-start;
}
.ai-result-item.deselected {
  opacity: 0.4;
}
.ai-result-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai-result-input-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.ai-result-input-row input, .ai-result-input-row select {
  padding: 6px 10px;
  font-size: 0.78rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  width: auto;
  min-width: 100px;
}
.ai-result-input-row input.ai-title-input {
  flex-grow: 1;
  font-weight: 700;
}
.ai-result-desc-input {
  width: 100%;
}

/* 로딩 스피너 */
.modal-spinner-content {
  align-items: center;
  text-align: center;
  max-width: 380px;
  padding: 40px;
}
.spinner-container {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 16px;
}
.spinner {
  width: 100%;
  height: 100%;
  border: 4px solid var(--border-glass);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.loading-sparkle {
  position: absolute;
  top: 28px;
  left: 28px;
  width: 24px;
  height: 24px;
  color: #fbbf24;
  animation: pulse 1.5s ease-in-out infinite;
}
.text-sparkle {
  color: #fbbf24;
}

/* 애니메이션 */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 1; }
}

/* -------------------------------------------------------------
 * 9. Responsive Adjustments
 * ------------------------------------------------------------- */
@media (max-width: 1100px) {
  .app-container {
    flex-direction: column;
    overflow-y: auto;
    height: auto;
  }
  .sidebar {
    width: 100%;
    height: auto;
  }
  .content-grid {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }
  .details-panel {
    width: 100%;
    height: 500px;
  }
  .calendar-card {
    min-height: 480px;
  }
}

/* -------------------------------------------------------------
 * 10. Intro Splash Screen Components
 * ------------------------------------------------------------- */
.splash-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #070a13; /* 항상 어두운 시네마틱 백그라운드 */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  opacity: 1;
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.8s;
  overflow: hidden;
}

.splash-container.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 90%;
}

.splash-logo {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
  margin-bottom: 8px;
}

.splash-icon {
  width: 44px;
  height: 44px;
  color: var(--accent-primary);
  animation: splashSparkle 2s ease-in-out infinite;
}

.splash-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #fff 30%, #a5b4fc 70%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: splashTextReveal 1.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  opacity: 0;
  filter: blur(8px);
  text-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
}

.splash-loader-bar {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 10px;
}

.splash-loader-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-primary), #a855f7);
  border-radius: 2px;
  animation: splashLoad 2s cubic-bezier(0.1, 0.8, 0.2, 1) forwards;
}

/* 스플래시 애니메이션 정의 */
@keyframes splashTextReveal {
  0% {
    letter-spacing: -0.2em;
    opacity: 0;
    filter: blur(10px);
    transform: scale(0.9);
  }
  100% {
    letter-spacing: 0.15em;
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}

@keyframes splashSparkle {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    opacity: 0.8;
    filter: drop-shadow(0 0 5px rgba(99, 102, 241, 0.5));
  }
  50% {
    transform: scale(1.2) rotate(180deg);
    opacity: 1;
    filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.9));
  }
}

@keyframes splashLoad {
  0% { width: 0%; }
  40% { width: 30%; }
  70% { width: 85%; }
  100% { width: 100%; }
}

/* -------------------------------------------------------------
 * 11. Authentication UI Components
 * ------------------------------------------------------------- */
.auth-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 20% 20%, var(--accent-glow) 0px, transparent 40%),
    radial-gradient(at 80% 80%, rgba(168, 85, 247, 0.08) 0px, transparent 40%);
  z-index: 999;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  transform: translateY(0);
  animation: authCardEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes authCardEntrance {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

.auth-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.auth-logo {
  width: 56px;
  height: 56px;
  background: var(--accent-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  box-shadow: 0 8px 20px var(--accent-glow);
  margin-bottom: 8px;
}

.auth-logo i {
  width: 28px;
  height: 28px;
}

.auth-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.auth-header p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.auth-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-submit-btn {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 0.95rem;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.link-btn {
  background: transparent;
  border: none;
  color: var(--accent-primary);
  font-weight: 700;
  cursor: pointer;
  outline: none;
}

.link-btn:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

.footer-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.footer-actions .text-red {
  color: var(--color-school);
}
.footer-actions .text-red:hover {
  background: var(--bg-school);
}
