/* ==========================================================================
   CatInvoice Public Knowledge Base Stylesheet
   ========================================================================== */

/* Import Brand Typography */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Colors - Mirroring variables.css */
  --brand-primary: #5b50f0;
  --brand-primary-hover: #483ec7;
  --brand-primary-light: #7066f2;
  --brand-primary-muted: rgba(91, 80, 240, 0.06);
  --brand-accent: #d97706;
  --brand-accent-hover: #b45309;
  --brand-accent-muted: rgba(217, 119, 6, 0.1);
  --brand-on-primary: #ffffff;

  --surface-page: #f5f3ee;      /* Warm cream background of the editor */
  --surface-card: #ffffff;      /* Pure white elevated cards */
  --surface-nav: #ffffff;       /* Navigation bar background */
  --surface-subtle: #fafaf8;   /* Warm off-white */
  --surface-sidebar: #eae8e2;  /* Slightly darker cream container background */
  --border-subtle: rgba(0, 0, 0, 0.05);
  --border-medium: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
  
  --text-primary: #111111;     /* High contrast dark slate */
  --text-secondary: #4a4a46;   /* Soft slate gray */
  --text-muted: #8c8c82;       /* Light gray for helper text */
  --text-on-brand: #ffffff;

  /* Fonts */
  --font-sans: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Borders */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(28, 27, 24, 0.04);
  --shadow-md: 0 8px 24px rgba(28, 27, 24, 0.06);
  --shadow-lg: 0 16px 40px rgba(28, 27, 24, 0.08);
  --shadow-focus: 0 0 0 3px rgba(91, 80, 240, 0.15);

  /* Layout and Sizing */
  --header-height: 64px;
  --container-max: 1440px;
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-normal: 240ms;
}

/* Base resets & styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--surface-page);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin-bottom: 0.5em;
}

p {
  margin-bottom: 1.25rem;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
  transition: color var(--duration-normal) var(--ease-smooth);
}

a:hover {
  color: var(--brand-primary-hover);
}

ul, ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Header & Navigation */
.kb-header {
  background-color: var(--surface-nav);
  border-bottom: 1px solid var(--border-medium);
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 100;
}

.kb-header__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.kb-header__brand {
  display: flex;
  align-items: center;
}

.kb-header__logo {
  height: 32px;
  width: auto;
  display: block;
}

.kb-header__nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  transition: all var(--duration-normal) var(--ease-smooth);
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background-color: var(--brand-primary);
  color: var(--brand-on-primary);
}

.btn-primary:hover {
  background-color: var(--brand-primary-hover);
  color: var(--brand-on-primary);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: var(--border-strong);
}

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

/* Help Center Home Page */
.kb-hero {
  background: linear-gradient(135deg, #1c1b18 0%, #2d2b24 100%);
  color: #ffffff;
  padding: 4.5rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border-medium);
}

.kb-hero__gradient-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 75% 20%, rgba(91, 80, 240, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

.kb-hero__container {
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.kb-hero__eyebrow {
  display: inline-block;
  background-color: rgba(91, 80, 240, 0.2);
  color: #8c82ff;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 1.25rem;
}

.kb-hero h1 {
  color: #ffffff;
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  line-height: 1.15;
  margin-bottom: 1rem;
}

.kb-hero p {
  color: #b0afaa;
  font-size: clamp(1rem, 2vw, 1.18rem);
  font-weight: 400;
  margin-bottom: 2rem;
}

/* Home Category Grid */
.kb-grid-section {
  max-width: var(--container-max);
  margin: 3.5rem auto;
  padding: 0 1.5rem;
}

.kb-grid {
  display: grid;
  grid-template-cols: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.kb-card {
  background-color: var(--surface-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-smooth);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.kb-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand-primary-light);
  box-shadow: var(--shadow-md);
}

.kb-card__icon-wrapper {
  background-color: var(--brand-primary-muted);
  color: var(--brand-primary);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.kb-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.kb-card p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.kb-card__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
}

.kb-card__link svg {
  transition: transform var(--duration-normal) var(--ease-smooth);
}

.kb-card:hover .kb-card__link svg {
  transform: translateX(4px);
}

.kb-layout {
  display: flex;
  align-items: flex-start;
  gap: 3rem;
  max-width: var(--container-max);
  margin: 2.5rem auto 5rem;
  padding: 0 1.5rem;
}

/* Sidebar Navigation */
.kb-sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-height) + 2rem);
  max-height: calc(100vh - var(--header-height) - 4rem);
  overflow-y: auto;
  border-right: 1px solid var(--border-subtle);
  padding-right: 1.5rem;
}

.kb-sidebar__title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-left: 0.75rem;
}

.kb-sidebar__nav {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.kb-sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all var(--duration-normal) var(--ease-smooth);
}

.kb-sidebar__link:hover {
  background-color: rgba(91, 80, 240, 0.04);
  color: var(--text-primary);
}

.kb-sidebar__link--active {
  background-color: var(--brand-primary-muted);
  color: var(--brand-primary);
  font-weight: 600;
}

.kb-sidebar__link--active:hover {
  background-color: var(--brand-primary-muted);
  color: var(--brand-primary);
}

/* Main Content Column */
.kb-content {
  background-color: var(--surface-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 3rem;
  box-shadow: var(--shadow-sm);
  min-width: 0; /* Prevents flex/grid overflow items from blowing out container width */
}

/* Article Headers */
.kb-article__eyebrow {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--brand-primary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.kb-article h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin-bottom: 1.5rem;
}

.kb-article__meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-medium);
  padding-bottom: 1.5rem;
  margin-bottom: 2.25rem;
}

.kb-article h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.kb-article h3 {
  font-size: 1.2rem;
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
}

.kb-article p, .kb-article li {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* Bullet list custom styling */
.kb-article ul {
  list-style-type: none;
  padding-left: 0.5rem;
}

.kb-article ul li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.65rem;
}

.kb-article ul li::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 0.65rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--brand-primary);
}

/* Table Style */
.kb-table-container {
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
}

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

.kb-table th, .kb-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-medium);
}

.kb-table th {
  background-color: var(--surface-subtle);
  font-weight: 600;
  color: var(--text-primary);
}

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

/* Code Snippet Styles */
pre {
  background-color: var(--surface-page);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

code {
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;
  font-size: 0.875rem;
  color: var(--brand-accent-hover);
  background-color: var(--brand-accent-muted);
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

pre code {
  color: var(--text-primary);
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  line-height: 1.5;
}

/* Custom Callouts / Alerts */
.kb-alert {
  border-left: 4px solid;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  font-size: 0.9375rem;
}

.kb-alert__title {
  font-weight: 700;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
}

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

.kb-alert--note {
  background-color: rgba(91, 80, 240, 0.04);
  border-color: var(--brand-primary);
}

.kb-alert--note .kb-alert__title {
  color: var(--brand-primary);
}

.kb-alert--tip {
  background-color: rgba(22, 163, 74, 0.04);
  border-color: #16a34a;
}

.kb-alert--tip .kb-alert__title {
  color: #16a34a;
}

.kb-alert--important {
  background-color: rgba(217, 119, 6, 0.04);
  border-color: var(--brand-accent);
}

.kb-alert--important .kb-alert__title {
  color: var(--brand-accent);
}

.kb-alert--warning {
  background-color: rgba(220, 38, 38, 0.04);
  border-color: #dc2626;
}

.kb-alert--warning .kb-alert__title {
  color: #dc2626;
}

/* Footer Section */
.kb-footer {
  border-top: 1px solid var(--border-medium);
  padding: 3rem 1.5rem;
  text-align: center;
  background-color: var(--surface-nav);
  margin-top: auto;
}

.kb-footer__container {
  max-width: var(--container-max);
  margin: 0 auto;
}

.kb-footer__copyright {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Responsive Styles */
@media (max-width: 1024px) {
  .kb-layout {
    flex-direction: column;
    gap: 2rem;
    margin: 1.5rem auto 3rem;
  }
  
  .kb-sidebar {
    width: 100%;
    position: static;
    max-height: none;
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid var(--border-medium);
    padding-bottom: 1.5rem;
    margin-bottom: 0.5rem;
  }
  
  .kb-content {
    padding: 2rem;
  }
  
  .kb-hero {
    padding: 3.5rem 1.5rem;
  }
}

@media (max-width: 640px) {
  .kb-content {
    padding: 1.5rem;
  }
  
  .kb-hero {
    padding: 2.5rem 1rem;
  }
  
  .kb-header__container {
    padding: 0 1rem;
  }
}
