// LLM UI Base Styles
// Provides foundational styles and resets

// CSS Reset and base styles
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  line-height: $line-height;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: $font-family;
  font-size: $font-size-base;
  line-height: $line-height;
  color: $text-color;
  background-color: $bg-color;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

// Typography
h1, h2, h3, h4, h5, h6 {
  font-family: $font-family;
  font-weight: $font-weight-semibold;
  line-height: 1.2;
  color: $heading-color;
  margin: 0 0 $spacing-md 0;
  
  &:last-child {
    margin-bottom: 0;
  }
}

h1 {
  font-size: $font-size-3xl;
  font-weight: $font-weight-bold;
}

h2 {
  font-size: $font-size-2xl;
  font-weight: $font-weight-bold;
}

h3 {
  font-size: $font-size-xl;
  font-weight: $font-weight-semibold;
}

h4 {
  font-size: $font-size-lg;
  font-weight: $font-weight-semibold;
}

h5 {
  font-size: $font-size-base;
  font-weight: $font-weight-medium;
}

h6 {
  font-size: $font-size-sm;
  font-weight: $font-weight-medium;
}

p {
  margin: 0 0 $spacing-md 0;
  line-height: $line-height;
  
  &:last-child {
    margin-bottom: 0;
  }
}

// Links
a {
  color: $primary-color;
  text-decoration: none;
  transition: $transition-base;
  
  &:hover {
    color: $primary-hover;
    text-decoration: underline;
  }
  
  &:focus {
    outline: 2px solid $primary-color;
    outline-offset: 2px;
  }
  
  &.llm-link--secondary {
    color: $secondary-color;
    
    &:hover {
      color: $secondary-hover;
    }
  }
  
  &.llm-link--muted {
    color: $muted-color;
    
    &:hover {
      color: $text-color;
    }
  }
}

// Lists
ul, ol {
  margin: 0 0 $spacing-md 0;
  padding-left: $spacing-lg;
  
  &:last-child {
    margin-bottom: 0;
  }
  
  li {
    margin-bottom: $spacing-xs;
    
    &:last-child {
      margin-bottom: 0;
    }
  }
}

// Images
img {
  max-width: 100%;
  height: auto;
  border-radius: $border-radius;
}

// Code
code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: $font-size-sm;
  background-color: $bg-alt;
  padding: $spacing-xs $spacing-sm;
  border-radius: $border-radius-sm;
  color: $text-color;
}

pre {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: $font-size-sm;
  background-color: $bg-alt;
  padding: $spacing-md;
  border-radius: $border-radius;
  overflow-x: auto;
  margin: 0 0 $spacing-md 0;
  
  &:last-child {
    margin-bottom: 0;
  }
  
  code {
    background: none;
    padding: 0;
    border-radius: 0;
  }
}

// Blockquotes
blockquote {
  margin: 0 0 $spacing-md 0;
  padding: $spacing-md;
  border-left: 4px solid $primary-color;
  background-color: $primary-light;
  border-radius: $border-radius;
  
  &:last-child {
    margin-bottom: 0;
  }
  
  p {
    margin: 0;
    font-style: italic;
  }
  
  cite {
    display: block;
    margin-top: $spacing-sm;
    font-size: $font-size-sm;
    color: $muted-color;
  }
}

// Horizontal rules
hr {
  border: none;
  border-top: 1px solid $border-color;
  margin: $spacing-lg 0;
}

// Tables
table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 $spacing-md 0;
  
  &:last-child {
    margin-bottom: 0;
  }
}

th, td {
  padding: $spacing-sm;
  text-align: left;
  border-bottom: 1px solid $border-color;
}

th {
  font-weight: $font-weight-semibold;
  background-color: $bg-alt;
}

// Form elements
input, textarea, select {
  font-family: $font-family;
  font-size: $font-size-base;
  line-height: $line-height;
}

// Focus styles
*:focus {
  outline: 2px solid $primary-color;
  outline-offset: 2px;
}

// Skip links for accessibility
.llm-skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: $primary-color;
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: $border-radius;
  z-index: $z-fixed;
  
  &:focus {
    top: 6px;
  }
}

// Print styles
@media print {
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  a, a:visited {
    text-decoration: underline;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
  }
  
  abbr[title]:after {
    content: " (" attr(title) ")";
  }
  
  pre, blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }
  
  thead {
    display: table-header-group;
  }
  
  tr, img {
    page-break-inside: avoid;
  }
  
  img {
    max-width: 100% !important;
  }
  
  p, h2, h3 {
    orphans: 3;
    widows: 3;
  }
  
  h2, h3 {
    page-break-after: avoid;
  }
} 