﻿/* 
 * 規格文件樣式表
 * 用於電子券管理相關規格文件
 * 最後更新：2026-01-19
 */

/* ===== 基礎樣式 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Consolas', 'Monaco', 'Courier New', 'Microsoft JhengHei', '微軟正黑體', monospace, sans-serif !important;
}

body {
  font-family: 'Consolas', 'Monaco', 'Courier New', 'Microsoft JhengHei', '微軟正黑體', monospace, sans-serif;
  line-height: 1.6;
  color: #222;
  background-color: #f5f7fa;
  display: flex;
  flex-direction: column;
  font-size: 15px;
}

input, select, textarea, button {
  font-family: 'Consolas', 'Monaco', 'Courier New', 'Microsoft JhengHei', '微軟正黑體', monospace, sans-serif;
}

/* ===== 頁面布局 ===== */
.page-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===== 側邊欄樣式 ===== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 220px;
  height: 100vh;
  background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
  color: white;
  overflow-y: auto;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transition: transform 0.3s ease;
}

/* ===== 麵包屑導航（側邊欄版） ===== */
.breadcrumb-sidebar {
  background: rgba(0, 0, 0, 0.2);
  padding: 16px 20px;
  margin: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.breadcrumb-sidebar .breadcrumb-link {
  color: #74b9ff;
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 500;
}

.breadcrumb-sidebar .breadcrumb-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

.breadcrumb-sidebar .breadcrumb-separator {
  margin: 0 8px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  user-select: none;
}

.breadcrumb-sidebar .breadcrumb-current {
  color: #ffffff;
  font-weight: 600;
  opacity: 0.9;
}

.sidebar-header {
  padding: 25px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
  color: white;
  font-size: 1.3em;
  margin: 0;
  border: none;
  padding: 0;
}

.sidebar-nav {
  padding: 8px 0;
  background: rgba(255, 255, 255, 0.08);
  border-top: 2px solid rgba(255, 255, 255, 0.15);
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li {
  margin: 0;
}

.sidebar-nav a {
  display: block;
  padding: 6px 20px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
  font-size: 0.8em;
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-left-color: #667eea;
  padding-left: 25px;
}

.sidebar-nav a.active {
  background: rgba(102, 126, 234, 0.2);
  color: white;
  border-left-color: #667eea;
  font-weight: bold;
}

/* 側邊欄滾動條樣式 */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* 側邊欄遮罩層 (手機版) */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ===== 模組導航（樹狀結構） ===== */
.module-nav {
  background: rgba(0, 0, 0, 0.2);
  padding: 0;
  margin: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.module-menu {
  list-style: none;
  padding: 8px 0;
  margin: 0;
}

.module-menu li {
  display: flex;
  align-items: center;
  padding: 6px 20px 6px 35px;
  transition: background-color 0.2s ease;
  position: relative;
}

.module-menu li:hover {
  background: rgba(255, 255, 255, 0.05);
}

.module-menu li.active {
  background: rgba(52, 152, 219, 0.3);
  border-left: 3px solid #3498db;
  padding-left: 32px;
}

.module-arrow {
  color: rgba(255, 255, 255, 0.5);
  margin-right: 8px;
  font-size: 12px;
  user-select: none;
}

.module-menu li.active .module-arrow {
  color: #74b9ff;
}

.module-menu a {
  color: #d0d7de;
  text-decoration: none;
  font-size: 13px;
  flex: 1;
  transition: color 0.2s ease;
}

.module-menu a:hover {
  color: #ffffff;
}

.module-menu li.active a {
  color: #ffffff;
  font-weight: 600;
}

/* ===== 模組導航（樹狀結構） ===== */
.module-nav {
  background: rgba(0, 0, 0, 0.25);
  padding: 0;
  margin: 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.15);
}

.module-title {
  padding: 6px 15px;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 500;
  font-size: 0.8em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
}

.module-title:hover {
  background: rgba(255, 255, 255, 0.05);
}

.module-title:not(:first-child) {
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.module-icon {
  margin-right: 8px;
  font-size: 14px;
}

.module-toggle {
  margin-right: 8px;
  font-size: 9px;
  transition: transform 0.3s ease;
  display: inline-block;
}

.module-title.collapsed .module-toggle {
  transform: rotate(-90deg);
}

.module-menu {
  list-style: none;
  padding: 3px 0;
  margin: 0;
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}

.module-menu.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0;
}

.module-menu li {
  display: flex;
  align-items: center;
  padding: 4px 15px 4px 35px;
  transition: background-color 0.2s ease;
  position: relative;
}

.module-menu li:hover {
  background: rgba(255, 255, 255, 0.05);
}

.module-menu li.active {
  background: rgba(52, 152, 219, 0.3);
  border-left: 3px solid #3498db;
  padding-left: 32px;
}

.module-arrow {
  color: rgba(255, 255, 255, 0.6);
  margin-right: 8px;
  font-size: 10px;
  user-select: none;
}

.module-menu li.active .module-arrow {
  color: #74b9ff;
}

.module-menu a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.8em;
  flex: 1;
  transition: color 0.2s ease;
}

.module-menu a:hover {
  color: #ffffff;
}

.module-menu li.active a {
  color: #ffffff;
  font-weight: 600;
}

/* ===== 主內容區域 ===== */
.main-content {
  margin-left: 220px;
  flex: 1;
  min-width: 0;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 40px;
}

/* ===== 漢堡選單按鈕 (手機版) ===== */
.menu-toggle {
  display: none;
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1001;
  background: #667eea;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1.2em;
}

/* ===== 標題區域 ===== */
header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 40px 0;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
}

/* ===== 文件資訊 ===== */
.doc-info {
  background: white;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.doc-info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.doc-info-item {
  padding: 8px 12px;
  background: #f8f9fa;
  border-left: 4px solid #667eea;
  border-radius: 4px;
  font-size: 0.95em;
}

.doc-info-item strong {
  color: #667eea;
  display: block;
  margin-bottom: 4px;
  font-size: 0.9em;
}

/* ===== 內容區塊 ===== */
.content-section {
  background: white;
  padding: 22px;
  margin: 10px 0;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ===== 標題樣式 ===== */
h2 {
  color: #667eea;
  font-size: 1.9em;
  margin: 0 0 18px 0;
  padding-bottom: 8px;
  border-bottom: 3px solid #667eea;
}

h3 {
  color: #764ba2;
  font-size: 1.5em;
  margin: 22px 0 12px 0;
  padding-left: 15px;
  border-left: 5px solid #764ba2;
}

h4 {
  color: #333;
  font-size: 1.3em;
  margin: 12px 0 6px 0;
}

/* ===== 欄位說明文字樣式 ===== */
.field-hint {
  color: #FF0000;
  font-size: 12px;
  font-weight: normal;
  margin-left: 8px;
}

/* ===== 按鈕規格卡片 ===== */
.button-spec {
  background: #f8f9fa;
  padding: 20px;
  margin: 20px 0;
  border-radius: 8px;
  border: 2px solid #e9ecef;
}

.button-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.button-icon {
  font-size: 1.3em;
  background: white;
  padding: 6px;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.button-name {
  font-size: 1.1em;
  font-weight: bold;
  color: #333;
}

.button-badge {
  display: inline-block;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.9em;
  font-weight: bold;
  margin-left: 10px;
}

.badge-primary {
  background: #007bff;
  color: white;
}

.badge-success {
  background: #28a745;
  color: white;
}

.badge-danger {
  background: #dc3545;
  color: white;
}

.badge-info {
  background: #17a2b8;
  color: white;
}

/* ===== 表格樣式 ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  table-layout: auto;
  font-family: 'Consolas', 'Monaco', 'Courier New', 'Microsoft JhengHei', '微軟正黑體', monospace, sans-serif !important;
}

table th {
  background: #5b9bd5;
  color: white;
  padding: 12px 10px;
  text-align: left;
  font-weight: bold;
  font-size: 15px;
  border: 1px solid #ddd;
  font-family: 'Consolas', 'Monaco', 'Courier New', 'Microsoft JhengHei', '微軟正黑體', monospace, sans-serif !important;
}

table td {
  padding: 10px 8px;
  border: 1px solid #ddd;
  font-size: 15px;
  color: #222;
  font-family: 'Consolas', 'Monaco', 'Courier New', 'Microsoft JhengHei', '微軟正黑體', monospace, sans-serif !important;
}

table tr:hover {
  background: #ffffe1;
}

/* ===== 代碼區塊 ===== */
.code-block {
  backgroun22;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  overflow-x: auto;
  margin: 12px 0;
  font-family: 'Consolas', 'Monaco', 'Courier New', 'Microsoft JhengHei', '微軟正黑體', monospace;
  font-size: 14px;
  line-height: 1.6;
}

.code-block strong {
  color: #1a365d;
  font-weight: 600;
  display: block;
  margin-top: 10px;
  margin-bottom: 6px;
  font-family: 'Consolas', 'Monaco', 'Courier New', 'Microsoft JhengHei', '微軟正黑體', monospace, sans-serif;
  font-size: 1em;
}

.code-block strong:first-child {
  margin-top: 0;
}

.code-block pre {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  font-family: 'Consolas', 'Monaco', 'Courier New', 'Microsoft JhengHei', '微軟正黑體', monospace;
  font-size: 1em;
  line-height: 1.6;
  white-space: pre;
  word-wrap: normal;
  overflow-x: auto;
  color: inherit;
}

/* JSON 語法高亮 */
.code-block pre .json-key {
  color: #d73a49;
}

.code-block pre .json-string {
  color: #22863a;
}

.code-block pre .json-number {
  color: #005cc5;
}

.code-block pre .json-boolean {
  color: #005cc5;
}

/* ===== 流程圖 ===== */
.flow-diagram {
  background: white;
  padding: 20px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  margin: 20px 0;
  font-family: 'Consolas', 'Monaco', 'Courier New', 'Microsoft JhengHei', '微軟正黑體', monospace, sans-serif;
  white-space: pre-line;
  line-height: 2;
}

/* ===== 提示框樣式 ===== */
.info-box {
  background: #e7f3ff;
  border-left: 4px solid #2196F3;
  padding: 12px;
  margin: 10px 0;
  border-radius: 4px;
}

.info-box ul {
  margin: 5px 0 0 0;
}

.warning-box {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 12px;
  margin: 10px 0;
  border-radius: 4px;
}

.success-box {
  background: #d4edda;
  border-left: 4px solid #28a745;
  padding: 15px;
  margin: 15px 0;
  border-radius: 4px;
}

.danger-box {
  background: #f8d7da;
  border-left: 4px solid #dc3545;
  padding: 15px;
  margin: 15px 0;
  border-radius: 4px;
}

/* ===== 列表樣式 ===== */
ul, ol {
  margin: 5px 0;
  padding-left: 30px;
  line-height: 1.7;
}

li {
  margin: 3px 0;
  line-height: 1.6;
}

/* ===== 目錄樣式 ===== */
.toc {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  margin: 20px 0;
}

.toc h3 {
  border: none;
  padding: 0;
  margin-bottom: 15px;
}

.toc ul {
  list-style: none;
  padding-left: 0;
}

.toc li {
  padding: 8px 0;
}

.toc a {
  color: #667eea;
  text-decoration: none;
  transition: all 0.3s;
}

.toc a:hover {
  color: #764ba2;
  padding-left: 10px;
}

/* ===== 標記樣式 ===== */
.checkmark {
  color: #28a745;
  font-weight: bold;
}

.crossmark {
  color: #dc3545;
  font-weight: bold;
}

/* ===== 頁尾 ===== */
footer {
  text-align: center;
  padding: 30px 0;
  color: #666;
  margin-top: 50px;
}

/* ===== 滾動行為 ===== */
html {
  scroll-behavior: smooth;
}

/* ========================================
   響應式設計
   ======================================== */

/* 大螢幕 (1200px以上) */
@media (min-width: 1200px) {
  .container {
    max-width: 1400px;
  }
}

/* 平板 (768px - 1024px) */
@media (max-width: 1024px) {
  .sidebar {
    width: 240px;
  }

  .main-content {
    margin-left: 240px;
    width: calc(100% - 240px);
  }

  .container {
    padding: 15px;
  }

  header h1 {
    font-size: 2em;
  }

  .content-section {
    padding: 20px;
  }

  .doc-info-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .doc-info {
    padding: 12px;
  }
}

/* 平板直向 & 手機橫向 (768px以下) */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    width: 100%;
  }

  .menu-toggle {
    display: block;
  }

  .container {
    padding: 10px;
    padding-top: 70px;
  }

  header {
    padding: 30px 15px;
  }

  header h1 {
    font-size: 1.8em;
    line-height: 1.3;
  }

  header p {
    font-size: 1em !important;
  }

  .content-section {
    padding: 15px;
    margin: 15px 0;
  }

  h2 {
    font-size: 1.5em;
  }

  h3 {
    font-size: 1.2em;
  }

  h4 {
    font-size: 1.1em;
  }

  .doc-info-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .button-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .button-icon {
    font-size: 1.5em;
    padding: 8px;
  }

  .button-name {
    font-size: 1.2em;
  }

  .button-badge {
    display: block;
    margin-left: 0;
    margin-top: 8px;
    text-align: center;
  }

  /* 表格響應式處理 */
  table {
    font-size: 0.85em;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table thead {
    display: none;
  }

  table tr {
    display: block;
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  }

  table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
  }

  table td:last-child {
    border-bottom: none;
  }

  table td:before {
    content: attr(data-label);
    font-weight: bold;
    color: #667eea;
    flex: 0 0 40%;
    padding-right: 10px;
  }

  .code-block {
    font-size: 0.8em;
    padding: 15px;
    overflow-x: auto;
  }

  .flow-diagram {
    font-size: 0.85em;
    padding: 15px;
    overflow-x: auto;
  }

  ul, ol {
    padding-left: 20px;
  }
}

/* 小型手機 (480px以下) */
@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  .sidebar {
    width: 100%;
  }

  .menu-toggle {
    top: 15px;
    left: 15px;
    padding: 8px 12px;
    font-size: 1.1em;
  }

  header h1 {
    font-size: 1.5em;
  }

  header p {
    font-size: 0.9em !important;
  }

  .container {
    padding: 8px;
    padding-top: 60px;
  }

  .content-section {
    padding: 12px;
    margin: 12px 0;
  }

  h2 {
    font-size: 1.3em;
  }

  h3 {
    font-size: 1.1em;
    padding-left: 10px;
  }

  h4 {
    font-size: 1em;
  }

  .button-spec {
    padding: 15px;
  }

  .button-icon {
    font-size: 1.3em;
    padding: 6px;
  }

  .button-name {
    font-size: 1.1em;
  }

  .doc-info-item {
    padding: 8px;
  }

  .info-box,
  .warning-box,
  .success-box,
  .danger-box {
    padding: 12px;
    font-size: 0.9em;
  }

  table td {
    padding: 10px;
    font-size: 0.9em;
  }

  table td:before {
    flex: 0 0 35%;
  }

  .code-block {
    font-size: 0.75em;
    padding: 12px;
  }
}

/* 觸控裝置優化 */
@media (hover: none) and (pointer: coarse) {
  .sidebar-nav a {
    padding: 15px 25px;
    font-size: 1em;
  }

  .button-spec {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
  }

  .menu-toggle {
    padding: 12px 18px;
  }
}

/* 列印樣式 - 縮放優化版 */
@media print {
  /* 基礎設定 */
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  html, body {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    height: 100%;
    overflow: visible !important;
  }

  /* 隱藏不需要列印的元素 */
  .sidebar,
  .sidebar-overlay,
  .menu-toggle,
  .doc-info,
  .sidebar-nav,
  .breadcrumb-sidebar,
  .module-nav {
    display: none !important;
  }

  /* 主內容區 - 使用縮放 */
  .page-wrapper {
    display: block !important;
    width: 100% !important;
    height: auto !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: none !important;
    transform-origin: top left;
  }

  /* 列印時縮放內容以適應頁面 */
  .main-content.print-scaled {
    transform: scale(0.75);
    transform-origin: top left;
    width: 133.33% !important; /* 100 / 0.75 = 133.33 */
  }

  .container {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }

  /* 標題 */
  header {
    background: white !important;
    color: black !important;
    border-bottom: 2px solid #000 !important;
    padding: 15px 0 !important;
    margin: 0 0 20px 0 !important;
    page-break-after: avoid;
  }

  header h1 {
    font-size: 24px !important;
    margin: 0 !important;
    padding: 0 !important;
    page-break-after: avoid;
  }

  /* 章節 */
  .content-section {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    margin: 0 0 20px 0 !important;
    padding: 15px !important;
    page-break-inside: avoid;
    background: white !important;
  }

  .section-title {
    font-size: 18px !important;
    margin: 0 0 12px 0 !important;
    padding: 0 0 8px 0 !important;
    page-break-after: avoid;
    border-bottom: 2px solid #333 !important;
  }

  h2, h3, h4 {
    page-break-after: avoid;
    page-break-inside: avoid;
    margin: 15px 0 10px 0 !important;
    padding: 0 !important;
  }

  h2 {
    font-size: 18px !important;
  }

  h3 {
    font-size: 16px !important;
  }

  h4 {
    font-size: 14px !important;
  }

  /* 表格優化 - 恢復正常大小 */
  table {
    font-size: 11px !important;
    border-collapse: collapse !important;
    width: 100% !important;
    page-break-inside: auto;
    margin: 12px 0 !important;
    table-layout: auto !important;
  }

  table thead {
    display: table-header-group;
  }

  table tbody {
    display: table-row-group;
  }

  table tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  table th, table td {
    padding: 6px 8px !important;
    border: 1px solid #666 !important;
    font-size: 11px !important;
    line-height: 1.4 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    vertical-align: top !important;
  }

  table th {
    background-color: #e8e8e8 !important;
    font-weight: bold !important;
    text-align: center !important;
  }

  /* 表格內的文字處理 */
  table td strong {
    font-size: 11px !important;
    display: block;
    margin-bottom: 3px;
  }

  table td br {
    display: block !important;
    content: "" !important;
    margin: 2px 0 !important;
  }

  /* 程式碼區塊 */
  .code-block {
    border: 1px solid #999 !important;
    background: #f5f5f5 !important;
    padding: 10px !important;
    font-size: 10px !important;
    page-break-inside: avoid;
    overflow: visible !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    margin: 10px 0 !important;
  }

  pre {
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    overflow: visible !important;
    page-break-inside: avoid;
    font-size: 10px !important;
    margin: 0 !important;
    line-height: 1.4 !important;
  }

  code {
    font-size: 10px !important;
  }

  /* 按鈕樣式 */
  .btn, button {
    border: 1px solid #666 !important;
    background: white !important;
    color: black !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
  }

  /* 段落和列表 */
  p, li {
    orphans: 3;
    widows: 3;
    font-size: 12px !important;
    line-height: 1.5 !important;
    margin: 8px 0 !important;
  }

  /* 圖片 */
  img {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid;
  }

  .image-container {
    page-break-inside: avoid;
    margin: 15px 0 !important;
    text-align: center;
  }

  .image-container p {
    font-size: 11px !important;
    color: #666 !important;
    margin-top: 8px !important;
  }

  /* API 規格表 */
  .api-spec-table,
  .data-table {
    font-size: 11px !important;
  }

  /* 範例區塊 */
  .example-box,
  .note-box,
  .warning-box {
    border: 1px solid #999 !important;
    padding: 10px !important;
    margin: 10px 0 !important;
    page-break-inside: avoid;
    background: #fafafa !important;
    font-size: 11px !important;
  }

  /* 查詢表單 */
  .query-form-container {
    border: 1px solid #ccc !important;
    padding: 15px !important;
    page-break-inside: avoid;
    box-shadow: none !important;
    margin: 15px 0 !important;
  }

  .query-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 12px !important;
  }

  .query-field {
    margin-bottom: 0 !important;
    font-size: 11px !important;
  }

  .query-field label {
    font-weight: bold !important;
    display: block !important;
    margin-bottom: 5px !important;
    font-size: 11px !important;
  }

  .query-field input,
  .query-field select {
    border: 1px solid #999 !important;
    padding: 4px 6px !important;
    background: white !important;
    font-size: 11px !important;
    width: 100%;
  }

  .field-example {
    font-size: 10px !important;
    color: #666 !important;
    margin-top: 3px !important;
  }

  /* 連結 */
  a {
    color: #000 !important;
    text-decoration: none !important;
  }

  a[href]:after {
    content: none !important;
  }

  /* 列表 */
  ul, ol {
    margin: 10px 0 !important;
    padding-left: 20px !important;
  }

  li {
    margin: 5px 0 !important;
    font-size: 12px !important;
  }

  /* 強制分頁 */
  .page-break {
    page-break-before: always;
  }

  .no-page-break {
    page-break-inside: avoid;
  }

  /* 移除所有陰影效果 */
  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* 確保內容可見 */
  * {
    overflow: visible !important;
  }
}

/* ===== 查詢表單樣式 ===== */
:root {
  --primary-color: #2563eb;
  --success-color: #10b981;
  --bg-color: #ffffff;
  --input-bg: #f9fafb;
  --border-color: #e5e7eb;
  --label-color: #374151;
  --text-hint: #9ca3af;
}

.query-form-container {
  background: var(--bg-color);
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border-color);
  font-family: 'Consolas', 'Monaco', 'Courier New', 'Microsoft JhengHei', '微軟正黑體', monospace, sans-serif;
  max-width: 1200px;
  margin: 20px auto;
}

.query-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 20px;
  align-items: flex-end;
}

.query-row:last-child {
  margin-bottom: 0;
}

.query-field {
  display: flex;
  flex-direction: column;
}

.query-field label {
  font-size: 14px;
  font-weight: 600;
  color: var(--label-color);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

.query-field input, 
.query-field select {
  height: 42px;
  padding: 0 12px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--input-bg);
  color: #1f2937;
  font-size: 14px;
  transition: all 0.2s ease;
  width: 100%;
}

.query-field input:focus, 
.query-field select:focus {
  outline: none;
  border-color: var(--primary-color);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.query-field input::placeholder {
  color: var(--text-hint);
}

.query-field input:hover {
  border-color: #9ca3af;
}

.field-example {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: #0ea5e9;
  font-weight: 600;
  font-family: 'Consolas', 'Monaco', 'Courier New', 'Microsoft JhengHei', '微軟正黑體', monospace, sans-serif;
}

.required {
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
  margin-left: 4px;
  font-family: 'Consolas', 'Monaco', 'Courier New', 'Microsoft JhengHei', '微軟正黑體', monospace, sans-serif;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-range input {
  flex: 1;
  text-align: center;
}

.separator {
  color: #9ca3af;
  font-weight: bold;
}

.query-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn {
  height: 42px;
  padding: 0 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.btn-search {
  background-color: var(--primary-color);
  color: white;
  min-width: 100px;
  width: 100px;
}

.btn-search:hover {
  background-color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-add {
  background-color: #ecfdf5;
  color: var(--success-color);
  border: 1px solid #a7f3d0;
  min-width: 100px;
  width: 100px;
}

.btn-add:hover {
  background-color: var(--success-color);
  color: white;
}

/* 查詢範例區塊 */
.query-example-section {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 2px solid #e5e7eb;
}

.example-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.example-icon {
  font-size: 1.3em;
}

.example-header strong {
  color: #0369a1;
  font-size: 1.05em;
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.example-item {
  background: #f0f9ff;
  padding: 10px 15px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  border: 1px solid #bae6fd;
  transition: all 0.2s;
}

.example-item:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
  transform: translateX(2px);
}

.example-label {
  color: #475569;
  font-weight: 600;
  font-size: 0.9em;
  margin-right: 8px;
  min-width: fit-content;
}

.example-value {
  color: #0369a1;
  font-weight: 700;
  font-size: 1em;
  font-family: 'Courier New', monospace;
}

/* ===== 查詢結果表格樣式 ===== */
.result-table-container {
  background: var(--bg-color);
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border-color);
  font-family: 'Consolas', 'Monaco', 'Courier New', 'Microsoft JhengHei', '微軟正黑體', monospace, sans-serif;
  max-width: 1200px;
  margin: 20px auto;
  animation: fadeIn 0.3s ease-in;
}

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

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border-color);
}

.result-header h4 {
  margin: 0;
  color: var(--label-color);
  font-size: 18px;
  font-weight: 700;
}

.result-count {
  color: #6b7280;
  font-size: 14px;
}

.result-count strong {
  color: var(--primary-color);
  font-size: 16px;
}

.table-wrapper {
  overflow-x: auto;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.result-table thead {
  background: #87cefa;
}

.result-table th {
  padding: 12px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--label-color);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.result-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}

.result-table tbody tr {
  transition: background-color 0.2s;
}

/* 關聯欄位群組樣式 */
.group-red {
  border-left: 3px solid #FF6B6B;
  background-color: #FFF5F5;
}

.group-blue {
  border-left: 3px solid #4A90E2;
  background-color: #F0F7FF;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.status-unset {
  background-color: #fef3c7;
  color: #92400e;
}

.status-set {
  background-color: #d1fae5;
  color: #065f46;
}

.action-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.action-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-view {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.btn-view:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.btn-edit {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.btn-edit:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
}

.btn-delete {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.btn-delete:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

/* ===== 查詢表單與表格RWD ===== */
/* 平板模式 (≤1024px) */
@media (max-width: 1024px) {
  .query-form-container {
    padding: 20px;
  }

  .query-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .query-actions {
    grid-column: span 2;
    justify-content: flex-end;
  }

  .btn-search,
  .btn-add {
    min-width: 100px;
    width: 100px;
  }

  .result-table {
    font-size: 13px;
  }

  .result-table th,
  .result-table td {
    padding: 10px 8px;
  }
}

/* 手機模式 (≤768px) */
@media (max-width: 768px) {
  .query-form-container {
    padding: 15px;
  }

  .query-row {
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 15px;
  }

  .query-actions {
    grid-column: 1;
    justify-content: center;
  }

  .btn-search,
  .btn-add {
    min-width: 100px;
    width: 100px;
  }

  .date-range {
    flex-direction: column;
    gap: 8px;
  }

  .separator {
    display: none;
  }

  .example-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .example-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .example-label {
    margin-right: 0;
  }

  .result-table-container {
    padding: 15px;
  }

  .result-table {
    font-size: 12px;
  }

  .result-table th,
  .result-table td {
    padding: 8px 6px;
  }

  .action-buttons {
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
  }
}

/* 小型手機 (≤480px) */
@media (max-width: 480px) {
  .query-form-container {
    padding: 12px;
  }

  .query-field label {
    font-size: 13px;
  }

  .query-field input,
  .query-field select {
    height: 38px;
    font-size: 13px;
  }

  .btn {
    height: 38px;
    font-size: 13px;
  }

  .btn-search,
  .btn-add {
    min-width: 90px;
    width: 90px;
  }
}
