/* ==========================================================================
   KIẾN TRÚC PHẦN MỀM - UNIFIED DESIGN SYSTEM
   Source of truth for all note pages, hub, and styleguide
   ========================================================================== */

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

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  
  /* Disciplined Color Palette (Tối Giản, Tránh Đa Sắc) */
  --color-primary: #1e40af;          /* Deep Cobalt Blue - Màu thương hiệu chính duy nhất */
  --color-primary-hover: #1d4ed8;
  --color-primary-subtle: #eff6ff;   /* Nền nhấn nhẹ */
  --color-primary-border: #bfdbfe;
  
  /* Neutrals (Tông màu xám Slate hiện đại làm chủ đạo) */
  --bg-page: #f8fafc;                /* Slate 50 */
  --bg-surface: #ffffff;             /* Pure White */
  --bg-subtle: #f1f5f9;              /* Slate 100 */
  --bg-muted: #e2e8f0;               /* Slate 200 */
  
  --border-light: #e2e8f0;           /* Slate 200 */
  --border-medium: #cbd5e1;          /* Slate 300 */
  
  --text-primary: #0f172a;           /* Slate 900 */
  --text-secondary: #334155;         /* Slate 700 */
  --text-muted: #64748b;             /* Slate 500 */
  --text-caption: #94a3b8;           /* Slate 400 */
  
  /* Semantic Alerts (Chỉ dùng khi có cảnh báo/lưu ý kỹ thuật cụ thể) */
  --alert-info-bg: #f8fafc;
  --alert-info-border: #3b82f6;
  --alert-info-text: #1e3a8a;
  
  --alert-warning-bg: #fffbeb;
  --alert-warning-border: #f59e0b;
  --alert-warning-text: #92400e;
  
  /* Radii & Shadows */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 10px 15px -3px rgba(15, 23, 42, 0.06), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Lavish Layout Safety */
*, *::before, *::after {
  box-sizing: border-box;
}

:where(.grid, .flex, .layout-grid, .layout-flex) > *,
:where([style*="display: grid"], [style*="display:grid"], [style*="display: flex"], [style*="display:flex"]) > * {
  min-width: 0;
}

:where(p, h1, h2, h3, h4, h5, h6, li, dd, blockquote, figcaption, td, th, .badge, .label) {
  overflow-wrap: anywhere;
}

:where(img, svg, video, canvas, iframe) {
  max-width: 100%;
  height: auto;
}

/* Typography Scale */
code, pre, kbd {
  font-family: var(--font-mono);
}

:not(pre) > code {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.85em;
  font-weight: 500;
  border: 1px solid var(--border-light);
}

/* Unified Card Component */
.arch-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.arch-card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

/* Disciplined Badges (Tông màu Slate & Blue chủ đạo) */
.arch-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  transition: all 0.15s ease;
}

.arch-tag-primary {
  background-color: var(--color-primary-subtle);
  color: var(--color-primary);
  border-color: var(--color-primary-border);
  font-weight: 600;
}

/* Unified Buttons */
.arch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.15s ease;
  cursor: pointer;
  text-decoration: none;
}

.arch-btn-primary {
  background-color: var(--color-primary);
  color: #ffffff;
  border: 1px solid transparent;
}

.arch-btn-primary:hover {
  background-color: var(--color-primary-hover);
  color: #ffffff;
}

.arch-btn-outline {
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.arch-btn-outline:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* Callout Alerts (Kiểu dáng sạch sẽ, không lòe loẹt) */
.arch-callout {
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  border-left-width: 4px;
}

.arch-callout-info {
  background-color: var(--color-primary-subtle);
  border-color: var(--color-primary);
  color: var(--alert-info-text);
}

.arch-callout-warning {
  background-color: var(--alert-warning-bg);
  border-color: var(--alert-warning-border);
  color: var(--alert-warning-text);
}

/* Table Design System */
.arch-table-container {
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.arch-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.arch-table th {
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.arch-table td {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-secondary);
  vertical-align: top;
}

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

.arch-table tr:hover td {
  background-color: #f8fafc;
}

/* Navigation System */
.arch-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background-color: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border-light);
}

/* Table of Contents Sticky Sidebar */
.toc-nav {
  position: sticky;
  top: 5.5rem;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
}

.toc-link {
  display: block;
  padding: 0.4rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.15s ease;
  line-height: 1.4;
}

.toc-link:hover {
  color: var(--color-primary);
  background-color: var(--color-primary-subtle);
}

/* Swatch Card in Styleguide */
.swatch-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
}
.swatch-color {
  height: 4rem;
  width: 100%;
}
.swatch-meta {
  padding: 0.75rem;
}

/* ==========================================================================
   STANDARDIZED ICON SYSTEM (24x24 viewBox, stroke-width: 2)
   ========================================================================== */
.arch-icon {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin="round";
  fill: none;
}

.arch-icon-xs {
  width: 0.875rem;
  height: 0.875rem;
}

.arch-icon-sm {
  width: 1rem;
  height: 1rem;
}

.arch-icon-md {
  width: 1.25rem;
  height: 1.25rem;
}

.arch-icon-lg {
  width: 1.5rem;
  height: 1.5rem;
}

