/* TMS Native — 需求規格文件 v26.05 */
/* Brand: Ai Network */
/* Style Reference: Cisco Momentum Design System */

:root {
  /* Brand Colors */
  --primary-blue: #2563EB;
  --primary-blue-light: #3B82F6;
  --primary-blue-dark: #1D4ED8;
  --primary-blue-50: #EFF6FF;
  --primary-blue-100: #DBEAFE;
  --accent-red: #DC2626;
  --accent-red-light: #EF4444;
  --accent-red-50: #FEF2F2;

  /* Backgrounds */
  --bg-white: #FFFFFF;
  --bg-light: #F8FAFC;
  --bg-gray: #F1F5F9;
  --bg-dark: #1E293B;

  /* Text */
  --text-navy: #0F172A;
  --text-dark: #1E293B;
  --text-gray: #475569;
  --text-light: #64748B;
  --text-muted: #94A3B8;

  /* Borders */
  --border-light: #E2E8F0;
  --border-medium: #CBD5E1;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);

  /* Spacing */
  --radius: 8px;
  --radius-lg: 12px;
  --header-height: 64px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  font-family: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-dark);
  background: var(--bg-light);
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-navy);
  font-weight: 700;
  line-height: 1.3;
}

h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
h4 { font-size: 1.1rem; margin-bottom: 0.5rem; }

p { margin-bottom: 0.75rem; }

a {
  color: var(--primary-blue);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover { color: var(--primary-blue-dark); }

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-navy);
  text-decoration: none;
  flex-shrink: 0;
}

.header-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 16px;
  position: relative;
}

.header-logo .logo-icon::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 5px;
  background: var(--accent-red);
  border-radius: 50%;
  top: 8px;
  right: 10px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 48px;
  flex: 1;
}

.header-nav a {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-gray);
  transition: all 0.2s;
  white-space: nowrap;
}

.header-nav a:hover {
  background: var(--primary-blue-50);
  color: var(--primary-blue);
}

.header-nav a.active {
  background: var(--primary-blue-50);
  color: var(--primary-blue);
  font-weight: 600;
}

.header-version {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-gray);
  padding: 4px 10px;
  border-radius: 12px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Main Layout */
.main-content {
  margin-top: var(--header-height);
  padding: 32px 24px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

/* Page Title */
.page-title {
  margin-bottom: 32px;
}

.page-title h1 {
  font-size: 1.75rem;
  color: var(--text-navy);
}

.page-title p {
  color: var(--text-gray);
  font-size: 15px;
  margin-top: 4px;
}

/* Cards */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.card-icon.blue { background: var(--primary-blue-50); color: var(--primary-blue); }
.card-icon.red { background: var(--accent-red-50); color: var(--accent-red); }
.card-icon.green { background: #F0FDF4; color: #16A34A; }
.card-icon.purple { background: #FAF5FF; color: #9333EA; }
.card-icon.orange { background: #FFF7ED; color: #EA580C; }
.card-icon.teal { background: #F0FDFA; color: #0D9488; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* Module Cards */
.module-card {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.module-card .module-layer-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.module-card .module-layer-badge.core {
  background: var(--primary-blue-50);
  color: var(--primary-blue);
}

.module-card .module-layer-badge.ops {
  background: #F0FDF4;
  color: #16A34A;
}

.module-card .module-layer-badge.ext {
  background: #FFF7ED;
  color: #EA580C;
}

.module-card h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.module-card .module-id {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-blue);
  margin-bottom: 8px;
}

.module-card .module-desc {
  font-size: 13px;
  color: var(--text-gray);
  line-height: 1.5;
}

.module-card .module-details {
  display: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  font-size: 13px;
}

.module-card.expanded .module-details {
  display: block;
}

.module-card .module-details dt {
  font-weight: 600;
  color: var(--text-navy);
  margin-top: 8px;
}

.module-card .module-details dd {
  color: var(--text-gray);
  margin-left: 0;
  margin-top: 2px;
}

/* Layer Sections */
.layer-section {
  margin-bottom: 40px;
}

.layer-section h2 {
  font-size: 1.1rem;
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.layer-section h2 .layer-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.layer-dot.core { background: var(--primary-blue); }
.layer-dot.ops { background: #16A34A; }
.layer-dot.ext { background: #EA580C; }

/* Two-column layout */
.two-col-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  min-height: calc(100vh - var(--header-height) - 64px);
}

/* Sidebar Navigation */
.sidebar-nav {
  position: sticky;
  top: calc(var(--header-height) + 32px);
  max-height: calc(100vh - var(--header-height) - 64px);
  overflow-y: auto;
  padding-right: 16px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 2px;
}

.sidebar-nav .nav-group {
  margin-bottom: 20px;
}

.sidebar-nav .nav-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 4px 12px;
  margin-bottom: 4px;
}

.sidebar-nav .nav-item {
  display: block;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-gray);
  border-radius: 6px;
  transition: all 0.15s;
  line-height: 1.4;
}

.sidebar-nav .nav-item:hover {
  background: var(--primary-blue-50);
  color: var(--primary-blue);
}

.sidebar-nav .nav-item.active {
  background: var(--primary-blue-50);
  color: var(--primary-blue);
  font-weight: 600;
}

/* Search */
.search-box {
  position: relative;
  margin-bottom: 20px;
}

.search-box input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-white);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

/* Requirement Detail */
.req-detail {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.req-detail .req-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.req-detail .req-number {
  background: var(--primary-blue);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  flex-shrink: 0;
}

.req-detail .req-module-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-gray);
  color: var(--text-gray);
  flex-shrink: 0;
}

.req-detail .user-story {
  background: var(--bg-light);
  border-left: 3px solid var(--primary-blue);
  padding: 12px 16px;
  margin-bottom: 20px;
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  color: var(--text-gray);
  font-style: italic;
}

.req-detail .criteria-list {
  list-style: none;
  counter-reset: criteria;
}

.req-detail .criteria-list li {
  counter-increment: criteria;
  padding: 8px 0 8px 32px;
  position: relative;
  font-size: 14px;
  line-height: 1.6;
  border-bottom: 1px solid var(--bg-gray);
}

.req-detail .criteria-list li:last-child {
  border-bottom: none;
}

.req-detail .criteria-list li::before {
  content: counter(criteria);
  position: absolute;
  left: 0;
  top: 8px;
  width: 22px;
  height: 22px;
  background: var(--primary-blue-50);
  color: var(--primary-blue);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Principle Cards */
.principle-card {
  border-left: 4px solid var(--primary-blue);
}

.principle-card h3 {
  color: var(--primary-blue);
}

.principle-card .principle-desc {
  font-size: 14px;
  color: var(--text-gray);
  margin: 12px 0;
  line-height: 1.7;
}

.principle-card .related-reqs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.principle-card .related-reqs .tag {
  font-size: 12px;
  padding: 3px 8px;
  background: var(--primary-blue-50);
  color: var(--primary-blue);
  border-radius: 4px;
  font-weight: 500;
}

/* Architecture */
.arch-section {
  margin-bottom: 32px;
}

.arch-section h3 {
  margin-bottom: 16px;
}

.mermaid-container {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  overflow-x: auto;
}

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

.tech-table th, .tech-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.tech-table th {
  background: var(--bg-gray);
  font-weight: 600;
  color: var(--text-navy);
  font-size: 13px;
}

.tech-table tr:hover td {
  background: var(--primary-blue-50);
}

/* Code Block */
.code-block {
  background: var(--bg-dark);
  color: #E2E8F0;
  padding: 20px;
  border-radius: var(--radius);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}

/* Glossary */
.glossary-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  gap: 16px;
}

.glossary-item:last-child {
  border-bottom: none;
}

.glossary-term {
  font-weight: 700;
  color: var(--text-navy);
  min-width: 200px;
  font-size: 14px;
  flex-shrink: 0;
}

.glossary-def {
  color: var(--text-gray);
  font-size: 14px;
}

/* Data Flow */
.dataflow-container {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 32px;
  margin-top: 32px;
  overflow-x: auto;
}

.dataflow-container h3 {
  text-align: center;
  margin-bottom: 24px;
}

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

/* Responsive */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .two-col-layout { grid-template-columns: 240px 1fr; }
}

@media (max-width: 768px) {
  .site-header {
    padding: 0 16px;
  }

  .header-nav {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .main-content {
    padding: 20px 16px;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .two-col-layout {
    grid-template-columns: 1fr;
  }

  .sidebar-nav {
    position: static;
    max-height: none;
    margin-bottom: 24px;
    padding-right: 0;
  }

  .glossary-item {
    flex-direction: column;
    gap: 4px;
  }

  .glossary-term {
    min-width: auto;
  }
}

/* Mobile menu button */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  margin-left: auto;
}

.mobile-menu-btn:hover {
  background: var(--bg-gray);
}

/* Mobile nav overlay */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-white);
  z-index: 999;
  padding: 24px;
}

.mobile-nav-overlay.show {
  display: block;
}

.mobile-nav-overlay a {
  display: block;
  padding: 12px 16px;
  font-size: 16px;
  color: var(--text-dark);
  border-radius: 8px;
}

.mobile-nav-overlay a:hover,
.mobile-nav-overlay a.active {
  background: var(--primary-blue-50);
  color: var(--primary-blue);
}

/* Utility */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }

/* Badge */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.badge-blue { background: var(--primary-blue-50); color: var(--primary-blue); }
.badge-green { background: #F0FDF4; color: #16A34A; }
.badge-orange { background: #FFF7ED; color: #EA580C; }
.badge-red { background: var(--accent-red-50); color: var(--accent-red); }
.badge-purple { background: #FAF5FF; color: #9333EA; }

/* Tabs */
.tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 24px;
}

.tab-bar button {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-gray);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  font-family: inherit;
}

.tab-bar button:hover {
  color: var(--primary-blue);
}

.tab-bar button.active {
  color: var(--primary-blue);
  border-bottom-color: var(--primary-blue);
  font-weight: 600;
}
