/* ==========================================================================
   iPad Manual - Minimal Help Center / Link Portal Layout
   ========================================================================== */

:root {
  --bg-app: #f5f5f7;
  --bg-sidebar: #ffffff;
  --bg-content: #f5f5f7;
  --bg-card: #ffffff;
  --bg-card-hover: #fcfcfd;
  
  --text-main: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-muted: #86868b;
  
  --brand-blue: #0071e3;
  --brand-blue-hover: #0077ed;
  --brand-blue-light: #e8f2fc;
  
  --border-color: #d2d2d7;
  --border-light: #e5e5ea;
  
  --badge-pending-bg: #fff8e6;
  --badge-pending-border: #f0c36d;
  --badge-pending-text: #8a5700;
  
  --badge-internal-bg: #fdf0ef;
  --badge-internal-border: #e8a598;
  --badge-internal-text: #a82a1e;

  --sidebar-width: 320px;
  --header-height-mobile: 110px;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "PingFang TC", "Noto Sans TC", "Hiragino Sans", "Meiryo", sans-serif;
  color: var(--text-main);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Main Application Layout
   ========================================================================== */

.app-container {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* ==========================================================================
   Desktop Sidebar
   ========================================================================== */

.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border-light);
}

.app-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.app-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 400;
}

/* Language Switcher Styling */
.lang-switch-container {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-app);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.lang-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.lang-btn-group {
  display: flex;
  gap: 4px;
}

.lang-btn {
  background: transparent;
  border: none;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.lang-btn:hover {
  color: var(--text-main);
}

.lang-btn.active {
  background: #ffffff;
  color: var(--brand-blue);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mobile-lang .lang-btn {
  padding: 3px 8px;
  font-size: 12px;
}

.manual-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-blue);
  text-decoration: none;
  padding: 5px 10px;
  background: var(--brand-blue-light);
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}

.manual-switch:hover {
  background: #dbeafe;
}

.chapter-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.chapter-nav-list {
  list-style: none;
}

.chapter-nav-item {
  margin-bottom: 2px;
}

.chapter-nav-item a {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.chapter-nav-item a:hover {
  background-color: var(--bg-app);
}

.chapter-nav-item.active a {
  background-color: var(--brand-blue);
  color: #ffffff;
}

.nav-id {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.75;
  margin-bottom: 2px;
}

.nav-title {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
}

.chapter-nav-item.active .nav-title {
  font-weight: 600;
}

/* ==========================================================================
   Content Pane
   ========================================================================== */

.content-pane {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  background-color: var(--bg-content);
  padding: 40px 48px 80px;
}

.content-inner {
  max-width: 920px;
  margin: 0 auto;
}

.chapter-pane {
  display: none;
}

.chapter-pane.active {
  display: block;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.chapter-header {
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.chapter-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.25;
}

.chapter-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ==========================================================================
   Section Block
   ========================================================================== */

.section-block {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}

.section-block-header {
  margin-bottom: 16px;
}

.section-uid {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-blue);
  background-color: var(--brand-blue-light);
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.section-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

.section-purpose {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.5;
  background-color: #f9f9fb;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--brand-blue);
}

/* Status Badges */
.callout-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  line-height: 1.4;
}

.callout-badge.pending {
  background: var(--badge-pending-bg);
  border: 1px solid var(--badge-pending-border);
  color: var(--badge-pending-text);
}

.callout-badge.internal {
  background: var(--badge-internal-bg);
  border: 1px solid var(--badge-internal-border);
  color: var(--badge-internal-text);
}

/* Source Link Cards */
.source-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 16px 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.source-section-title::before {
  content: "•";
  color: var(--brand-blue);
  font-size: 14px;
}

.source-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.source-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
}

.source-card:hover {
  border-color: var(--brand-blue);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.source-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.source-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
}

.source-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.source-lang-badge {
  background: #f0f0f2;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
}

.source-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  background-color: var(--brand-blue);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease;
  flex-shrink: 0;
}

.source-card:hover .source-btn {
  background-color: var(--brand-blue-hover);
}

/* Footer */
.manual-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Mobile Header (Hidden on Desktop) */
.mobile-header {
  display: none;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    display: none;
  }

  .mobile-header {
    display: block;
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }

  .mobile-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
  }

  .mobile-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
  }

  .chapter-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%231d1d1f%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 10px auto;
  }

  .content-pane {
    padding: 20px 16px 60px;
    overflow-y: visible;
  }

  .chapter-header {
    margin-top: 10px;
    margin-bottom: 20px;
    padding-bottom: 12px;
  }

  .chapter-header h1 {
    font-size: 22px;
  }

  .section-block {
    padding: 18px 16px;
    border-radius: var(--radius-md);
  }

  .section-title {
    font-size: 17px;
  }

  .source-card {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .source-btn {
    width: 100%;
    min-height: 44px;
  }
}
