/* Kaavadoc Styles - Converted from Next.js/Tailwind */

/* ============================================
   CSS Variables
   ============================================ */
:root {
  /* Colors */
  --background: #ffffff;
  --foreground: #171717;
  --colors-background: #ffffff;
  --colors-border: #dee2e6;

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

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

@media (prefers-color-scheme: dark) {
  :root {
    --background: #f8f9fa;
    --foreground: #212529;
  }
}

/* ============================================
   Reset & Base Styles
   ============================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--background);
  color: var(--foreground);
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ============================================
   Grid System (12-column)
   ============================================ */
.grid {
  display: grid;
  gap: 0;
}

.grid-cols-12 {
  grid-template-columns: repeat(12, 1fr);
}

.col-span-2 {
  grid-column: span 2 / span 2;
}

.col-span-3 {
  grid-column: span 3 / span 3;
}

.col-span-6 {
  grid-column: span 6 / span 6;
}

.col-span-8 {
  grid-column: span 8 / span 8;
}

/* Responsive Grid */
@media (min-width: 1024px) {
  .lg\\:col-span-3 {
    grid-column: span 3 / span 3;
  }

  .lg\\:col-span-6 {
    grid-column: span 6 / span 6;
  }
}

/* ============================================
   Utility Classes
   ============================================ */
.bg-white {
  background-color: #ffffff;
}

.bg-zinc-50 {
  background-color: #fafafa;
}

.font-sans {
  font-family: Arial, Helvetica, sans-serif;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm {
  gap: var(--spacing-sm);
}

.gap-md {
  gap: var(--spacing-md);
}

.gap-lg {
  gap: var(--spacing-lg);
}

/* ============================================
   Typography
   ============================================ */
.typography-h3 {
  color: #212529;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
}

.typography-h4 {
  color: #495057;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  padding-bottom: var(--spacing-xs);
  border-bottom: 2px solid var(--colors-border);
}

.typography-p1 {
  font-weight: 500;
  color: #212529;
  font-size: 1rem;
}

.typography-p2 {
  color: #495057;
  font-size: 0.875rem;
}

.link {
  cursor: pointer;
  transition: opacity 0.2s;
}

.link:hover {
  opacity: 0.8;
}

/* ============================================
   Header Styles
   ============================================ */
header {
  background-color: #f8f9fa;
  color: #333333;
  padding: 12px 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid #dee2e6;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.header-logo-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo {
  display: block;
}

.header-title {
  font-weight: normal;
  color: #212529;
  font-size: 1.25rem;
}

.header-nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

.nav-link {
  color: #212529;
  font-size: 16px;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s;
}

.nav-link:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* ============================================
   Footer Styles
   ============================================ */
footer {
  background-color: #1e3a8a;
  color: #ffffff;
  margin-top: auto;
  padding: 20px 24px;
  border-top: 1px solid #1d4ed8;
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 24px;
  font-size: 16px;
  margin-left: 32px;
  flex-wrap: wrap;
}

.footer-text {
  color: #ffffff;
  font-size: 16px;
}

.footer-link {
  font-size: 16px;
  color: #ffffff;
  text-decoration: none;
  transition: opacity 0.2s;
}

.footer-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* ============================================
   Page Layout
   ============================================ */
.page-grid {
  background-color: #fafafa;
  font-family: Arial, Helvetica, sans-serif;
}

.page-content {
  background-color: #ffffff;
  padding: var(--spacing-lg);
}

/* ============================================
   Document Listing Styles
   ============================================ */
.documents-grid {
  display: grid;
  gap: var(--spacing-lg);
}

.kaava-section {
  border: 1px solid var(--colors-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  background-color: var(--colors-background);
}

.kaava-heading {
  color: #212529;
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: var(--spacing-xs);
  text-decoration: none;
  display: inline-block;
}

.kaava-heading:hover {
  text-decoration: underline;
}

.kaava-title {
  color: #212529;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
  display: block;
}

.kaava-dates {
  color: #495057;
  font-size: 0.875rem;
  margin-bottom: var(--spacing-md);
  display: block;
}

.type-groups {
  margin-top: 32px;
}

.type-group {
  margin-bottom: var(--spacing-lg);
}

.type-heading {
  color: #495057;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  padding-bottom: var(--spacing-xs);
  border-bottom: 2px solid var(--colors-border);
}

.file-list {
  list-style: none;
  padding: 0;
  margin-top: var(--spacing-md);
}

.file-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--colors-border);
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.file-name {
  flex: 1 1 auto;
  min-width: 200px;
}

.file-name-text {
  font-weight: 500;
  color: #212529;
  font-size: 1rem;
}

.file-download {
  flex: 0 0 auto;
}

/* ============================================
   Button Styles
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  white-space: nowrap;
  border: none;
  font-family: inherit;
}

.btn-outlined {
  background-color: transparent;
  border: 1px solid #212529;
  color: #212529;
}

.btn-outlined:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.btn-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
}

/* ============================================
   Download Icon
   ============================================ */
.download-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'%3E%3C/path%3E%3Cpolyline points='7 10 12 15 17 10'%3E%3C/polyline%3E%3Cline x1='12' y1='15' x2='12' y2='3'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* ============================================
   Document Link (Treds Design System)
   ============================================ */
.document-link {
  color: var(--core-states-default);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 1rem;
  font-weight: 400;
  transition: color 0.2s ease;
}

.document-link:hover {
  color: var(--core-states-hover);
  text-decoration: underline;
}

.document-link:focus {
  color: var(--core-states-focus);
  outline: 2px solid var(--core-states-focus);
  outline-offset: 2px;
}

.document-link:active {
  color: var(--core-states-active);
}

.document-link:visited {
  color: var(--core-states-visited);
}

/* ============================================
   Error Message
   ============================================ */
.error-message {
  color: #495057;
  font-size: 0.875rem;
  margin-bottom: var(--spacing-md);
  display: block;
}

/* ============================================
   No Results Message
   ============================================ */
.no-results {
  color: #6c757d;
  font-size: 1rem;
}

/* Message for types with no files */
.type-message {
  color: var(--core-neutral-70);
  font-size: var(--treds-typography-p1-size);
  font-style: italic;
  margin: var(--spacing-md) 0;
  padding: var(--spacing-md);
  background-color: var(--core-neutral-5);
  border-left: 4px solid var(--core-neutral-30);
}

/* ============================================
   Responsive Utilities
   ============================================ */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-links {
    margin-left: 0;
    flex-direction: column;
    gap: 12px;
  }

  .file-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .file-download {
    width: 100%;
  }

  .btn {
    width: 100%;
  }
}
