/* ==========================================================================
   Cost Monitor Documentation Site — Design System & Styles
   Tokens: §1.2 | Aesthetic: Clean, quiet, technical vendor docs
   ========================================================================== */

:root {
  --accent:        #29B5E8;  /* Snowflake blue — links, active states, rules */
  --accent-dark:   #1A7FA8;  /* hover */
  --text:          #1B1F24;  /* body + headings */
  --text-muted:    #5B6570;  /* secondary, nav idle, footer */
  --border:        #E3E8EE;
  --surface:       #FFFFFF;  /* page */
  --surface-alt:   #F7F9FB;  /* code blocks, table header, callouts */
  --callout-warn:  #FFF8E6;  /* border-left #E8A33D */
  --callout-info:  #EFF8FC;  /* border-left var(--accent) */
  --radius:        6px;
  --shadow:        none;     /* borders, not shadows */

  --font-sans:     Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:     "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  
  --nav-height:    64px;
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  background-color: var(--surface);
  color: var(--text);
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Links */
a {
  color: var(--accent-dark);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent);
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Headings */
h1, h2, h3, h4 {
  color: var(--text);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  position: relative;
}

h1 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

h2 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  margin-bottom: 16px;
}

h3 {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 24px;
  margin-bottom: 10px;
}

p {
  margin-bottom: 16px;
}

p:last-child {
  margin-bottom: 0;
}

/* Heading Anchors */
.heading-anchor {
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.85em;
  opacity: 0;
  padding: 0 4px;
  transition: opacity 0.15s ease, color 0.15s ease;
  text-decoration: none !important;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor,
.heading-anchor:focus {
  opacity: 0.8;
  color: var(--accent);
}

/* Top Navigation Bar */
.site-nav-container {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
}

.site-nav-inner {
  max-width: 1140px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none !important;
  color: inherit;
}

.brand-logo-icon {
  width: 32px;
  height: 32px;
  background-color: var(--accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

.brand-link:hover .brand-logo-icon {
  background-color: var(--accent-dark);
}

.brand-logo-icon svg {
  width: 18px;
  height: 18px;
  stroke: #FFFFFF;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

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

.brand-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.2;
  margin-top: 2px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  height: 100%;
}

.nav-item {
  height: 100%;
  display: flex;
  align-items: center;
}

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  height: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  position: relative;
  text-decoration: none !important;
  transition: color 0.15s ease;
  padding: 0 2px;
}

.nav-link .nav-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
  transition: transform 0.15s ease;
}

.nav-link:hover .nav-icon {
  transform: translateY(-1px);
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.active {
  color: var(--accent);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--accent);
}

/* Hamburger button */
.mobile-nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text);
}

.mobile-nav-toggle:hover {
  background-color: var(--surface-alt);
}

.hamburger-icon {
  display: block;
  width: 20px;
  height: 2px;
  background-color: var(--text);
  position: relative;
  transition: background-color 0.2s;
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--text);
  transition: transform 0.2s;
}

.hamburger-icon::before {
  top: -6px;
}

.hamburger-icon::after {
  bottom: -6px;
}

.mobile-nav-drawer {
  display: none;
  position: absolute;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.mobile-nav-drawer.open {
  display: block;
}

.mobile-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-nav-link {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  text-decoration: none !important;
}

.mobile-nav-link .nav-icon {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  flex-shrink: 0;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  color: var(--accent);
}

/* Page Layout */
body {
  background-color: #F5F6F8;
}

.site-nav-container {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

#main-layout,
.layout-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 32px;
  align-items: start;
  flex: 1;
}

#page-content,
.content-column {
  max-width: 100%;
  width: 100%;
  padding: 0;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.page-body {
  padding: 44px 48px 56px;
}

/* Hero & Header on pages */
.page-hero {
  margin-bottom: 32px;
}

.hero-app-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-dark);
  margin-bottom: 6px;
}

.hero-tagline {
  font-size: 17px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 8px;
  margin-bottom: 12px;
  line-height: 1.5;
  font-style: italic;
}

.hero-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* TOC Sidebar matching Login Monitor */
#toc-sidebar,
.right-rail {
  width: 100%;
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
  padding-top: 0;
}

.toc-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.toc-label,
.toc-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-left: 6px;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: none;
  padding-left: 0;
}

.toc-item {
  line-height: 1.4;
}

.toc-item a,
.toc-link {
  display: block;
  font-size: 12.5px;
  color: #4A5568;
  padding: 6px 10px;
  border-radius: 6px;
  line-height: 1.4;
  text-decoration: none !important;
  transition: all 0.15s ease;
}

.toc-item a:hover,
.toc-link:hover {
  background: var(--callout-info);
  color: var(--accent-dark);
}

.toc-item.active a,
.toc-link.active {
  background: var(--callout-info);
  color: var(--accent-dark);
  font-weight: 600;
}

.toc-item.h3 a,
.toc-subitem .toc-link {
  padding-left: 20px;
  font-size: 12px;
  color: #718096;
}

.toc-item.h3.active a {
  color: var(--accent-dark);
  font-weight: 600;
}

/* Components: Tables */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 20px 0 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
  background-color: var(--surface);
}

th {
  background-color: #F0F4F9;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
  line-height: 1.5;
}

tbody tr:hover {
  background-color: #FAFBFC;
}

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

/* Components: Code Blocks & Inline Code */
code {
  font-family: var(--font-mono);
  font-size: 13.5px;
  background-color: var(--surface-alt);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text);
}

.code-block-wrapper {
  position: relative;
  margin: 18px 0 22px;
}

pre {
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: inherit;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.code-block-wrapper:hover .copy-btn,
.copy-btn:focus-visible {
  opacity: 1;
}

.copy-btn:hover {
  background-color: var(--surface-alt);
  color: var(--text);
}

.copy-btn.copied {
  color: #0E8A16;
  border-color: #0E8A16;
  opacity: 1;
}

/* Components: Callouts */
.callout {
  padding: 14px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.6;
}

.callout-info {
  background-color: var(--callout-info);
  border-left: 3px solid var(--accent);
}

.callout-warn {
  background-color: var(--callout-warn);
  border-left: 3px solid #E8A33D;
}

.callout-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  display: block;
}

.callout-info .callout-label {
  color: var(--accent-dark);
}

.callout-warn .callout-label {
  color: #B26A00;
}

.callout p {
  margin-bottom: 8px;
}

.callout p:last-child {
  margin-bottom: 0;
}

/* Components: Bullet & Numbered Lists */
ul.doc-list {
  list-style: none;
  padding-left: 0;
  margin: 16px 0;
}

ul.doc-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  font-size: 15px;
  line-height: 1.7;
}

ul.doc-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 9px;
  width: 6px;
  height: 6px;
  background-color: var(--accent);
  border-radius: 1px;
}

ol.doc-steps {
  padding-left: 22px;
  margin: 16px 0;
}

ol.doc-steps li {
  margin-bottom: 12px;
  font-size: 15px;
  line-height: 1.7;
}

ol.doc-steps li::marker {
  font-weight: 600;
  color: var(--accent-dark);
}

/* FAQ section */
.faq-block {
  margin-bottom: 24px;
}

.faq-block h3 {
  margin-bottom: 8px;
}

/* Support Contact Info Block */
.info-block {
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px 0 24px;
}

.info-block-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.info-block ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.info-block li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  padding: 3px 0;
}

.info-block-arrow {
  color: var(--text-muted);
  font-weight: 400;
}

.info-block-label {
  font-weight: 600;
  color: var(--text);
  margin-right: 6px;
}

/* Cross links banner */
.cross-links-box {
  margin-top: 36px;
  padding: 16px 18px;
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.cross-links-box h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

/* Footer */
.site-footer {
  width: 100%;
  border-top: 1px solid var(--border);
  background-color: var(--surface);
  padding: 24px 0;
  margin-top: auto;
}

.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-copy {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.footer-link {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none !important;
  transition: color 0.15s ease;
}

.footer-link:hover {
  color: var(--text);
}

.footer-link.active {
  color: var(--accent);
  font-weight: 500;
}

/* Responsive Media Queries */
@media (max-width: 1099px) {
  .right-rail {
    display: none;
  }
  .layout-container {
    justify-content: center;
    gap: 0;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  .mobile-nav-toggle {
    display: block;
  }
  .layout-container {
    padding: 0 20px;
  }
  .content-column {
    padding-top: 32px;
    padding-bottom: 64px;
  }
  h1 {
    font-size: 26px;
  }
  h2 {
    font-size: 19px;
    margin-top: 24px;
    padding-top: 18px;
  }
  .heading-anchor {
    display: none; /* Hide hover anchors on touch */
  }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 0 20px;
  }
  .footer-links {
    flex-wrap: wrap;
    gap: 16px;
  }
}
