/* Import Modern Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* CSS Variables for Notion Palette */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f7f7f5; /* Notion warm gray sidebar */
  
  --bg-hover-sidebar: #efefe5; /* Notion sidebar hover */
  --bg-hover-content: #f1f1ef; /* Notion content hover */
  --border-color: #edece9; /* Notion light divider border */

  --text-primary: #37352f; /* Notion main dark gray text */
  --text-secondary: #7c7b77; /* Notion subtext gray */
  --text-muted: #9f9e9a;

  --accent-blue: #2383e2; /* Notion primary blue */
  --accent-blue-hover: #1c62b2;
  --accent-red: #eb5757; /* Notion primary red */
  --accent-red-bg: #fde8e8; /* Notion callout warning bg */
  --accent-amber: #df5b0a; /* Notion orange/amber */
  --accent-amber-bg: #faebdd;
  --accent-emerald: #0f7b4e; /* Notion green */
  --accent-emerald-bg: #e6f4ea;

  --transition-smooth: all 0.15s ease;
}

/* Global Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
}

/* Custom Scrollbar (Notion style: thin & clean) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(55, 53, 47, 0.15);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(55, 53, 47, 0.3);
}

/* ---------------------------------
   NOTION SIDEBAR + WORKSPACE LAYOUT
------------------------------------ */
.app-layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar Styling */
.sidebar {
  width: 240px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  user-select: none;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 14px 14px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.sidebar-header:hover {
  background-color: var(--bg-hover-sidebar);
}

.sidebar-header-emoji {
  font-size: 1.15rem;
}

.sidebar-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  padding: 12px 14px 4px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  padding: 0 4px;
}

/* Collapsible Parent Item */
.sidebar-item-parent {
  padding: 6px 10px;
  margin: 1px 0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-primary);
  transition: var(--transition-smooth);
}

.sidebar-item-parent:hover {
  background-color: var(--bg-hover-sidebar);
}

.sidebar-item-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-grow: 1;
}

.chevron-icon {
  width: 16px;
  height: 16px;
  fill: var(--text-secondary);
  transition: transform 0.15s ease;
  margin-right: 4px;
}

.sidebar-item-parent.expanded .chevron-icon {
  transform: rotate(90deg);
}

/* Child Items Sub-list */
.sidebar-child-container {
  display: none;
  flex-direction: column;
}

.sidebar-child-container.expanded {
  display: flex;
}

.sidebar-item-child {
  padding: 5px 10px 5px 36px;
  margin: 1px 0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition-smooth);
}

.sidebar-item-child:hover {
  background-color: var(--bg-hover-sidebar);
  color: var(--text-primary);
}

.sidebar-item-child.active {
  background-color: var(--bg-hover-sidebar);
  color: var(--text-primary);
  font-weight: 600;
}

/* Main Workspace Pane */
.workspace-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  height: 100%;
  position: relative;
  background-color: var(--bg-primary);
}

/* Breadcrumbs (Notion top bar) */
.breadcrumbs {
  display: none !important; /* Hidden entirely on desktop */
  padding: 12px 48px;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid transparent;
  user-select: none;
}

.breadcrumbs-sep {
  color: var(--text-muted);
}

.breadcrumbs-item {
  cursor: pointer;
  transition: var(--transition-smooth);
}

.breadcrumbs-item:hover {
  color: var(--text-primary);
}

/* Page Contents Container */
.page-content {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 48px 100px;
}

.page-title-container {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.page-emoji {
  font-size: 4.25rem;
  line-height: 1;
  user-select: none;
  margin-bottom: 8px;
  display: inline-block;
}

.page-title-text {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.page-divider {
  border: none;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 30px;
}

.view-section {
  display: none;
  width: 100%;
  animation: pageFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.view-section.active {
  display: block;
}

/* Base Animations */
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sidebar Toggle Button for Mobile Navigation */
.sidebar-toggle-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin-right: 12px;
  color: var(--text-secondary);
  border-radius: 4px;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.sidebar-toggle-btn:hover {
  background-color: var(--bg-hover-content);
  color: var(--text-primary);
}

/* Responsive Rules for Small Devices (Mobile & Tablet) */
@media (max-width: 768px) {
  .sidebar-toggle-btn {
    display: inline-flex;
  }

  .app-layout {
    display: block;
    position: relative;
    overflow: hidden;
  }

  /* Drawer style slide-in menu for mobile */
  .sidebar {
    position: fixed;
    top: 0;
    left: -240px; /* Hide completely offscreen */
    width: 240px;
    height: 100vh;
    height: 100dvh;
    z-index: 9999;
    border-right: 1px solid var(--border-color);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .sidebar.mobile-active {
    transform: translateX(240px); /* Slide into view */
  }

  .workspace-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
  }

  .breadcrumbs {
    display: flex !important; /* Show toggle button wrapper on mobile */
    padding: 16px 16px 12px; /* Adjusted padding to effectively move the button slightly lower */
  }

  .breadcrumbs span {
    display: none; /* Hide text on mobile */
  }

  .page-content {
    padding: 16px 16px 80px;
  }
}

/* ---------------------------------
   GLOBAL TWO-COLUMN LAYOUT SYSTEM
------------------------------------ */
.page-content.wide-layout {
  max-width: 1120px;
}

.two-column-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.two-column-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* 1단 수직 배치 시 실행 화면과 하단 가이드가 가로폭을 전체적으로 채우도록 설정 */
.two-column-layout > .calculator-container,
.two-column-layout > div {
  max-width: 100% !important;
  width: 100%;
}

/* ---------------------------------
   SIDEBAR FOOTER STYLING
------------------------------------ */
.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px;
  /* 모바일 하단 주소창 및 노치 영역 침범 방지 */
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 20px));
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-footer-item {
  padding: 6px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-secondary);
  transition: var(--transition-smooth);
}

.sidebar-footer-item:hover {
  background-color: var(--bg-hover-sidebar);
  color: var(--text-primary);
}

.sidebar-footer-item.active {
  background-color: var(--bg-hover-sidebar);
  color: var(--accent-blue);
  font-weight: 600;
}

/* ---------------------------------
   LUCIDE ICONS INTEGRATION
------------------------------------ */
.lucide {
  width: 16px;
  height: 16px;
  stroke-width: 2.2px;
  display: inline-block;
  vertical-align: -0.15em;
  color: inherit;
  flex-shrink: 0;
}

/* Sidebar header brand icon */
.sidebar-header-emoji {
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
}
.sidebar-header-emoji.lucide {
  color: var(--accent-blue);
}

/* Page top emoji block */
.page-emoji {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 10px;
  margin-bottom: 8px;
  display: inline-block;
}
.page-emoji.lucide {
  stroke-width: 1.5px;
  color: var(--accent-blue);
}

/* Adjustments for sidebar headers and sub-menus */
.sidebar-item-title .lucide {
  width: 16px;
  height: 16px;
  color: var(--text-primary);
}

.sidebar-item-child .lucide {
  width: 14px;
  height: 14px;
}

.sidebar-footer-item .lucide {
  width: 14px;
  height: 14px;
}


