/* ════════ 기본 리셋 & 공통 ════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body, html {
  height: 100%;
  font-family: 'Noto Sans KR', sans-serif;
  background-color: #0B1220; /* 책상(배경) — 노트보다 한 단계 더 어둡게 */
  overflow: hidden;
}

/* ════════ 노트 구조 ════════ */
.notebook-container {
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* iOS 주소창 대응 */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 24px 24px 40px; /* 좌측은 견출지 탭 돌출 여유 */
}

.notebook-body {
  position: relative;
  width: 100%;
  max-width: 1440px;
  height: 100%;
  display: flex;
  background-color: #0F172A; /* 앱(속지)과 같은 다크 슬레이트 */
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(148, 163, 184, 0.08);
  border-radius: 16px;
}

/* ════════ 콘텐츠 페이지 (왼쪽) ════════ */
.notebook-right-page {
  flex: 1;
  order: 1;
  background-color: #0F172A;
  position: relative;
  border-radius: 16px 0 0 16px;
  overflow: hidden;
}

.app-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: none;
  background: transparent;
}
.app-frame.visible { display: block; }

/* ════════ 메뉴 페이지 (오른쪽, 다크 모눈 종이) ════════ */
.notebook-left-page {
  flex: 0 0 260px;
  order: 2;
  background-color: #1E293B; /* 앱 사이드바와 동일 톤 */
  border-left: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 0 16px 16px 0;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
  background-size: 18px 18px;
}

/* ════════ 스프링 바인더 고리 (미니멀 스틸 와이어) ════════ */
.notebook-rings {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  display: flex;
}

@media (min-width: 768px) {
  .notebook-rings {
    right: 260px; /* 메뉴 페이지 폭과 일치 (콘텐츠|메뉴 경계) */
    top: 0;
    bottom: 0;
    width: 20px;
    transform: translateX(50%);
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    padding: 20px 0;
  }
}

.ring-item {
  width: 6px;
  height: 30px;
  background: linear-gradient(90deg, #475569, #94a3b8 35%, #e2e8f0 50%, #94a3b8 65%, #334155);
  border-radius: 3px;
  box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.4);
  position: relative;
}

/* 종이에 뚫린 구멍 — PC에서만 */
@media (min-width: 768px) {
  .ring-item::before, .ring-item::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 8px;
    background: #0B1220;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
  }
  .ring-item::before { left: -7px; }
  .ring-item::after { right: -7px; }
}

/* ════════ 색인 견출지 탭 (왼쪽 가장자리) ════════ */
.notebook-tabs {
  position: absolute;
  display: flex;
  z-index: 5;
}

@media (min-width: 768px) {
  .notebook-tabs {
    right: 100%; /* 노트 몸체 왼쪽 바깥에 부착 */
    top: 60px;
    flex-direction: column;
    gap: 12px;
  }
  .tab-item {
    width: 30px;
    height: 84px;
    margin-right: -6px; /* 살짝 책 속에 꽂힌 느낌 */
    border-radius: 8px 0 0 8px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: margin-right 0.2s, filter 0.2s;
  }
  .tab-item.active {
    margin-right: 0; /* 활성 탭은 끝까지 튀어나옴 */
    filter: brightness(1.06);
    box-shadow: -4px 2px 10px rgba(0, 0, 0, 0.35);
  }
}

.tab-item {
  border: none;
  background: var(--tab-color);
  color: #0F172A;
  font-weight: 700;
  cursor: pointer;
  box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.3);
}

.tab-text {
  font-size: 13px;
  letter-spacing: 0.1em;
}

/* ════════ 브랜드 헤더 ════════ */
.brand-header { margin-bottom: 24px; }
.brand-logo { font-size: 32px; margin-bottom: 8px; }
.brand-title {
  font-size: 19px;
  font-weight: 900;
  color: #F1F5F9;
  letter-spacing: 0.02em;
}
.brand-desc {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

/* ════════ 메뉴 ════════ */
.sub-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.nav-section-title {
  font-size: 9px;
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.2em;
  color: #67E8F9;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-weight: bold;
}
.app-subnav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.subnav-group-label {
  font-size: 10px;
  color: #64748b;
  margin: 14px 2px 4px;
  padding-top: 12px;
  border-top: 1px dashed rgba(148, 163, 184, 0.15);
}
.nav-link {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}
.nav-link:hover {
  background: rgba(148, 163, 184, 0.08);
  color: #cbd5e1;
}
.nav-link.active {
  background: rgba(148, 163, 184, 0.16);
  color: #F1F5F9;
}
.nav-link-ext {
  margin-top: 14px;
  border-top: 1px dashed rgba(148, 163, 184, 0.15);
  border-radius: 0 0 8px 8px;
  padding-top: 14px;
  font-weight: 500;
  font-size: 12px;
}

.left-footer {
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  padding-top: 16px;
  font-size: 12px;
  color: #64748b;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.status-indicator { color: #10B981; font-weight: bold; }
.status-dot {
  display: inline-block;
  animation: status-pulse 2s ease-in-out infinite;
}
@keyframes status-pulse {
  0%, 100% { opacity: 1; text-shadow: 0 0 6px rgba(16, 185, 129, 0.8); }
  50%      { opacity: 0.25; text-shadow: none; }
}

.mobile-menu-toggle { display: none; }
.sidebar-backdrop { display: none; }

/* ════════ 모바일 (세로 수첩 모드) ════════ */
@media (max-width: 767px) {
  .notebook-container { padding: 0; }
  .notebook-body {
    flex-direction: column;
    border-radius: 0;
  }

  /* 1. 메뉴 페이지 → 햄버거 드로어 */
  .notebook-left-page {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 260px;
    z-index: 100;
    border-radius: 0;
    border-left: none;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.45);
  }
  .notebook-left-page.open { transform: translateX(0); }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(2, 6, 23, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }
  .sidebar-backdrop.show { display: block; opacity: 1; pointer-events: auto; }

  /* 메뉴 버튼은 body 직속(transform 부모 밖)이라 항상 보임 */
  .mobile-menu-toggle {
    display: block;
    position: fixed;
    top: 7px; left: 12px;
    z-index: 98; /* 드로어(100)·백드롭(99)보다 아래 → 열리면 가려짐 */
    padding: 7px 14px;
    background: #1E293B;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    color: #E2E8F0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    cursor: pointer;
  }

  /* 2. 본문: 상단 스프링 + 하단 탭바 사이를 채움 */
  .notebook-right-page {
    flex: 1;
    min-height: 0;
    padding: 42px 0 60px;
    border-radius: 0;
    background-color: #1E293B; /* 상단 띠 색 — 속지와 살짝 구분 */
  }
  .app-frame { background: #0F172A; }

  /* 3. 상단 수첩 스프링 */
  .notebook-rings {
    top: 15px;
    left: 0; right: 0;
    height: 12px;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
  }
  .ring-item {
    width: 28px;
    height: 6px;
    background: linear-gradient(180deg, #475569, #94a3b8 35%, #e2e8f0 50%, #94a3b8 65%, #334155);
    border-radius: 3px;
  }

  /* 4. 하단 탭 내비게이션 바 */
  .notebook-tabs {
    bottom: 0; left: 0; right: 0;
    top: auto;
    height: 60px;
    flex-direction: row;
    background-color: #1E293B;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.3);
  }
  .tab-item {
    flex: 1;
    height: 100%;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    display: flex;
    justify-content: center;
    align-items: center;
    border-top: 3px solid transparent;
    color: #94a3b8;
  }
  .tab-item.active {
    border-top: 3px solid var(--tab-color);
    background-color: rgba(148, 163, 184, 0.06);
    color: #F1F5F9;
  }
}
