/* =========================================================================
   에이스 어학원 통합 관리 포털 - 전역 메인 스타일시트
   ========================================================================= */

/* 1. 기본 폰트 및 배경 */
body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  background-color: #f7f9fc; 
  color: #333333;
}

/* 2. 브랜드 테마 컬러 (따뜻한 레드 & 코랄) */
.has-background-warm { 
  background-color: #e53935 !important; 
  color: #ffffff !important; 
}
.has-background-warm .title, 
.has-background-warm .subtitle, 
.has-background-warm th { 
  color: #ffffff !important; 
}
.has-background-warm-light { 
  background-color: #ffebee !important; 
}

.navbar { 
  background-color: #e53935; 
  border-bottom: 2px solid #b71c1c; 
}

/* 3. 공통 박스 및 타이포그래피 */
.box { 
  border-radius: 20px; 
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03); 
  border: 2px solid #eaeaea; 
  background-color: #ffffff;
}

.title, .subtitle { 
  color: #333333; 
}

/* Bulma 기본 음수 마진(-1.25rem) 상쇄 */
.title:not(.is-spaced) + .subtitle,
.title + .subtitle,
.subtitle {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* 4. 테이블 공통 */
.table { 
  background-color: transparent; 
}
.table th { 
  color: #333333; 
  font-weight: bold; 
}
.r2-table th { 
  font-size: 0.78rem; 
  color: #475569; 
  font-weight: 700; 
}
.r2-table td { 
  font-size: 0.80rem; 
}

/* 5. 2단 레이아웃 & 사이드바 메뉴 */
.sidebar-menu-column { 
  width: 230px; 
  min-width: 230px; 
  max-width: 230px; 
  flex: 0 0 230px; 
  flex-shrink: 0; 
}
.main-content-column { 
  flex: 1 1 auto; 
  min-width: 0; 
  width: calc(100% - 230px); 
}

/* 사이드바 메뉴 섹션 상단 여백 (이전 섹션과 구분감 부여) */
.sidebar-menu-section {
  margin-top: 1.25rem;
}
.sidebar-menu-section:first-child {
  margin-top: 0;
}

/* 사이드바 대메뉴 헤더 (h3.menu-label) */
.menu-label,
.sidebar-menu-section .menu-label,
aside.menu .menu-label {
  font-size: 1rem;
  font-weight: 800;
  color: #e53935;
  text-transform: none;
  letter-spacing: -0.01em;
  margin-top: 0;
  margin-bottom: 0.1rem;
  padding-bottom: 0.1rem;
}

/* 사이드바 소메뉴 리스트 */
.menu-list a { 
  border-radius: 10px; 
  margin-bottom: 2px; 
  color: #4a4a4a; 
  font-size: 0.90rem; 
  padding: 6px 10px; 
  transition: all 0.2s ease; 
}
.menu-list a:hover { 
  background-color: #ffebee; 
  color: #e53935; 
  font-weight: bold; 
}
.menu-list a.is-active, 
.menu-list a.is-current-page { 
  background-color: #ffebee; 
  color: #e53935; 
  font-weight: 700; 
  border-left: 4px solid #e53935; 
}

/* 6. 상단 네비게이션 바 */
.navbar-menu {
  display: flex;
  box-shadow: none;
  background-color: transparent;
}
.navbar > .container,
.navbar > .container.is-fluid {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.navbar-end {
  display: flex;
  align-items: center;
  margin-left: auto;
}

/* 7. 반응형 미디어 쿼리 */
@media screen and (max-width: 1200px) {
  .section {
    padding-left: 0;
    padding-right: 0;
  }
  .container,
  .container.is-fluid {
    margin-left: 0;
    margin-right: 0;
    max-width: 100%;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
  }
  .columns {
    margin-left: 0;
    margin-right: 0;
  }
  .column {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

@media screen and (max-width: 1024px) and (min-width: 769px) {
  .main-layout-columns {
    display: flex;
    flex-direction: column;
  }
  .sidebar-menu-column {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
    margin-bottom: 1rem;
  }
  .sidebar-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
  .sidebar-menu-section {
    background: #f8fafc;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    margin-top: 0;
  }
  .main-content-column {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
  }
}

@media screen and (max-width: 768px) {
  .sidebar-menu-column {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
    margin-bottom: 1rem;
  }
  .main-content-column {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
  }
  .sidebar-menu-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .sidebar-menu-section {
    margin-top: 0.5rem;
  }
  .sidebar-menu-section:first-child {
    margin-top: 0;
  }
}

/* 8. 오프캔버스 (드로어) 스타일 */
.offcanvas-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.offcanvas-overlay.is-active {
  opacity: 1;
  visibility: visible;
}
.offcanvas-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 580px;
  max-width: 95vw;
  height: 100vh;
  background: #ffffff;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 1050;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.offcanvas-drawer.is-active {
  transform: translateX(0);
}

/* 2단 중첩 오프캔버스 */
.offcanvas-overlay-tier2 {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.35);
  z-index: 1045;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.offcanvas-overlay-tier2.is-active {
  opacity: 1;
  visibility: visible;
}
.offcanvas-drawer-tier2 {
  position: fixed;
  top: 0;
  right: 580px;
  width: calc(100vw - 580px);
  min-width: 500px;
  max-width: calc(100vw - 320px);
  height: 100vh;
  background: #ffffff;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.2), 4px 0 15px rgba(0, 0, 0, 0.08);
  border-right: 2px solid #e2e8f0;
  z-index: 1048;
  transform: translateX(calc(100% + 580px));
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}
.offcanvas-drawer-tier2.is-active {
  transform: translateX(0);
}

@media screen and (max-width: 1024px) {
  .offcanvas-drawer-tier2 {
    right: 0;
    left: 0;
    width: 100vw;
    min-width: 100vw;
    max-width: 100vw;
    z-index: 1060;
    transform: translateX(100%);
  }
  .offcanvas-drawer-tier2.is-active {
    transform: translateX(0);
  }
  .offcanvas-drawer-tier2 .curriculum-columns {
    display: flex;
    flex-direction: row;
  }
  .offcanvas-drawer-tier2 .curriculum-columns > .column.is-5 {
    width: 40%;
    min-width: 260px;
    flex: 0 0 40%;
  }
  .offcanvas-drawer-tier2 .curriculum-columns > .column.is-7 {
    width: 60%;
    flex: 1 1 60%;
    display: block;
  }
}

/* 9. CSV/TSV 에디터 테이블 & 컬럼 리사이저 */
.csv-editor-table {
  table-layout: fixed;
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}
.csv-editor-table tbody tr {
  height: 100%;
}
.csv-editor-table td {
  height: 100%;
  padding: 0;
  margin: 0;
  vertical-align: stretch;
  position: relative;
  background: #ffffff;
}
.csv-th-resizable {
  position: relative;
  user-select: none;
  background: #e2e8f0;
}
.csv-col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 20;
  transition: background 0.15s;
}
.csv-col-resizer:hover, .csv-col-resizer.is-resizing {
  background-color: #0284c7;
}
.input-csv-cell {
  width: 100%;
  height: 100%;
  min-height: 28px;
  box-sizing: border-box;
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 5px 6px;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.4;
  resize: none;
  outline: none;
  background: transparent;
  display: block;
  box-shadow: none;
  transition: background 0.15s;
}
.input-csv-cell:focus {
  background: #ffffff;
  box-shadow: inset 0 0 0 2px #0284c7;
  z-index: 2;
}

/* 10. 이동 가능한 플로팅 오디오 미니 플레이어 */
.r2-floating-audio-player {
  position: fixed;
  bottom: 30px;
  right: 40px;
  width: 380px;
  background: #1e293b;
  color: #ffffff;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.12);
  z-index: 2000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  backdrop-filter: blur(10px);
}
.r2-floating-player-header {
  padding: 8px 12px;
  background: #0f172a;
  cursor: move;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.r2-floating-player-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.r2-track-slider {
  width: 100%;
  accent-color: #38bdf8;
  cursor: pointer;
  height: 6px;
  border-radius: 3px;
  outline: none;
  background: #334155;
  transition: all 0.15s ease;
}
.r2-track-slider:hover {
  height: 8px;
  accent-color: #0ea5e9;
}
.r2-speed-btn {
  background: #334155;
  color: #f1f5f9;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.r2-speed-btn:hover {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
}
.r2-speed-btn.is-active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
  font-weight: 700;
}
.r2-mini-slider {
  accent-color: #38bdf8;
  cursor: pointer;
  height: 4px;
  border-radius: 2px;
  width: 100%;
}

/* 11. R2 폴더 트리 뷰 */
.r2-tree-container {
  user-select: none;
  font-size: 0.82rem;
  color: #334155;
}
.r2-tree-node {
  display: flex;
  align-items: center;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  gap: 4px;
  margin-bottom: 1px;
}
.r2-tree-node:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}
.r2-tree-node.is-active {
  background-color: #0284c7;
  color: #ffffff;
  font-weight: 700;
}
.r2-tree-node.is-active .r2-tree-icon {
  color: #ffffff;
}
.r2-tree-toggle {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.70rem;
  color: #64748b;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.15s;
}
.r2-tree-toggle:hover {
  background: rgba(0, 0, 0, 0.06);
}
.r2-tree-toggle.is-empty {
  visibility: hidden;
}
.r2-tree-children {
  padding-left: 16px;
  border-left: 1px dashed #cbd5e1;
  margin-left: 8px;
}
