/* Variáveis do tema tweakcn */
:root {
  --background: oklch(1.0000 0 0);
  --foreground: oklch(0.2686 0 0);
  --card: oklch(1.0000 0 0);
  --card-foreground: oklch(0.2686 0 0);
  --popover: oklch(1.0000 0 0);
  --popover-foreground: oklch(0.2686 0 0);
  --primary: oklch(0.7686 0.1647 70.0804);
  --primary-foreground: oklch(0 0 0);
  --secondary: oklch(0.9670 0.0029 264.5419);
  --secondary-foreground: oklch(0.4461 0.0263 256.8018);
  --muted: oklch(0.9846 0.0017 247.8389);
  --muted-foreground: oklch(0.5510 0.0234 264.3637);
  --accent: oklch(0.9869 0.0214 95.2774);
  --accent-foreground: oklch(0.4732 0.1247 46.2007);
  --destructive: oklch(0.6368 0.2078 25.3313);
  --destructive-foreground: oklch(1.0000 0 0);
  --border: oklch(0.9276 0.0058 264.5313);
  --input: oklch(0.9276 0.0058 264.5313);
  --ring: oklch(0.7686 0.1647 70.0804);
  --chart-1: oklch(0.7686 0.1647 70.0804);
  --chart-2: oklch(0.6658 0.1574 58.3183);
  --chart-3: oklch(0.5553 0.1455 48.9975);
  --chart-4: oklch(0.4732 0.1247 46.2007);
  --chart-5: oklch(0.4137 0.1054 45.9038);
  --sidebar: oklch(0.9846 0.0017 247.8389);
  --sidebar-foreground: oklch(0.2686 0 0);
  --sidebar-primary: oklch(0.7686 0.1647 70.0804);
  --sidebar-primary-foreground: oklch(1.0000 0 0);
  --sidebar-accent: oklch(0.9869 0.0214 95.2774);
  --sidebar-accent-foreground: oklch(0.4732 0.1247 46.2007);
  --sidebar-border: oklch(0.9276 0.0058 264.5313);
  --sidebar-ring: oklch(0.7686 0.1647 70.0804);
  --font-sans: Inter, sans-serif;
  --font-serif: Source Serif 4, serif;
  --font-mono: JetBrains Mono, monospace;
  --radius: 0.375rem;
  --shadow-x: 0px;
  --shadow-y: 4px;
  --shadow-blur: 8px;
  --shadow-spread: -1px;
  --shadow-opacity: 0.1;
  --shadow-color: hsl(0 0% 0%);
  --shadow-2xs: 0px 4px 8px -1px hsl(0 0% 0% / 0.05);
  --shadow-xs: 0px 4px 8px -1px hsl(0 0% 0% / 0.05);
  --shadow-sm: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 1px 2px -2px hsl(0 0% 0% / 0.10);
  --shadow: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 1px 2px -2px hsl(0 0% 0% / 0.10);
  --shadow-md: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 2px 4px -2px hsl(0 0% 0% / 0.10);
  --shadow-lg: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 4px 6px -2px hsl(0 0% 0% / 0.10);
  --shadow-xl: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 8px 10px -2px hsl(0 0% 0% / 0.10);
  --shadow-2xl: 0px 4px 8px -1px hsl(0 0% 0% / 0.25);
  --tracking-normal: 0em;
  --spacing: 0.25rem;
}

.dark {
  --background: oklch(0.2046 0 0);
  --foreground: oklch(0.9219 0 0);
  --card: oklch(0.2686 0 0);
  --card-foreground: oklch(0.9219 0 0);
  --popover: oklch(0.2686 0 0);
  --popover-foreground: oklch(0.9219 0 0);
  --primary: oklch(0.7686 0.1647 70.0804);
  --primary-foreground: oklch(0 0 0);
  --secondary: oklch(0.2686 0 0);
  --secondary-foreground: oklch(0.9219 0 0);
  --muted: oklch(0.2393 0 0);
  --muted-foreground: oklch(0.7155 0 0);
  --accent: oklch(0.4732 0.1247 46.2007);
  --accent-foreground: oklch(0.9243 0.1151 95.7459);
  --destructive: oklch(0.6368 0.2078 25.3313);
  --destructive-foreground: oklch(1.0000 0 0);
  --border: oklch(0.3715 0 0);
  --input: oklch(0.3715 0 0);
  --ring: oklch(0.7686 0.1647 70.0804);
  --chart-1: oklch(0.8369 0.1644 84.4286);
  --chart-2: oklch(0.6658 0.1574 58.3183);
  --chart-3: oklch(0.4732 0.1247 46.2007);
  --chart-4: oklch(0.5553 0.1455 48.9975);
  --chart-5: oklch(0.4732 0.1247 46.2007);
  --sidebar: oklch(0.1684 0 0);
  --sidebar-foreground: oklch(0.9219 0 0);
  --sidebar-primary: oklch(0.7686 0.1647 70.0804);
  --sidebar-primary-foreground: oklch(1.0000 0 0);
  --sidebar-accent: oklch(0.4732 0.1247 46.2007);
  --sidebar-accent-foreground: oklch(0.9243 0.1151 95.7459);
  --sidebar-border: oklch(0.3715 0 0);
  --sidebar-ring: oklch(0.7686 0.1647 70.0804);
  --font-sans: Inter, sans-serif;
  --font-serif: Source Serif 4, serif;
  --font-mono: JetBrains Mono, monospace;
  --radius: 0.375rem;
  --shadow-x: 0px;
  --shadow-y: 4px;
  --shadow-blur: 8px;
  --shadow-spread: -1px;
  --shadow-opacity: 0.1;
  --shadow-color: hsl(0 0% 0%);
  --shadow-2xs: 0px 4px 8px -1px hsl(0 0% 0% / 0.05);
  --shadow-xs: 0px 4px 8px -1px hsl(0 0% 0% / 0.05);
  --shadow-sm: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 1px 2px -2px hsl(0 0% 0% / 0.10);
  --shadow: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 1px 2px -2px hsl(0 0% 0% / 0.10);
  --shadow-md: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 2px 4px -2px hsl(0 0% 0% / 0.10);
  --shadow-lg: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 4px 6px -2px hsl(0 0% 0% / 0.10);
  --shadow-xl: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 8px 10px -2px hsl(0 0% 0% / 0.10);
  --shadow-2xl: 0px 4px 8px -1px hsl(0 0% 0% / 0.25);
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  margin: 0;
  padding: 0;
  font-size: 16px;
  background-color: var(--background);
  color: var(--foreground);
}

.container {
  width: 100%;
  margin: 0;
  background-color: var(--card);
  padding: 20px;
  border-radius: 0;
  box-shadow: none;
  min-height: 100vh;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  position: relative;
}

h1 {
  text-align: center;
  margin-bottom: 0;
  color: var(--foreground);
  font-size: 1.8em;
  flex: 1;
}

.favorites-icon-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: var(--card);
  border: 2px solid var(--primary);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  padding: 0;
}

.favorites-icon-btn:hover {
  background: var(--accent);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-50%) scale(1.05);
}

.favorites-icon-btn.active {
  background: var(--primary);
  border-color: var(--primary);
}

.favorites-icon-btn.active .favorites-icon {
  filter: brightness(0) invert(1);
}

.favorites-icon {
  font-size: 1.2em;
  line-height: 1;
  margin-bottom: 2px;
}

.favorites-count {
  font-size: 0.7em;
  font-weight: bold;
  color: var(--primary);
  line-height: 1;
}

.favorites-icon-btn.active .favorites-count {
  color: var(--primary-foreground);
}

.search-box {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 30px;
  position: relative;
  width: 100%;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.search-box input[type="text"] {
  width: 100%;
  padding: 12px 45px 12px 15px;
  font-size: 1em;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.3s;
  background-color: var(--card);
  color: var(--foreground);
}

.search-box input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.search-box button.clear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 1.5em;
  color: var(--muted-foreground);
  border: none;
  background: none;
  display: none;
  padding: 0;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  transition: color 0.2s;
}

.search-box button.clear-btn:hover {
  color: var(--foreground);
}

.search-box button.clear-btn.show {
  display: block;
}

.stats {
  text-align: center;
  margin-bottom: 20px;
  color: var(--muted-foreground);
  font-size: 0.9em;
}

.section {
  margin-bottom: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background-color: var(--card);
  transition: box-shadow 0.2s;
}

.section:hover {
  box-shadow: var(--shadow-md);
}

.section h2 {
  padding: 12px 50px 12px 15px;
  border-left: 4px solid var(--border);
  font-size: 0.95em;
  display: flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  font-weight: 400;
  margin: 0;
  background-color: var(--muted);
  transition: all 0.2s;
  color: var(--foreground);
}

.section h2 .icon {
  margin-right: 10px;
  font-weight: normal;
  font-size: 1.1em;
  min-width: 20px;
  flex-shrink: 0;
}

.section h2 > span:not(.icon):not(.favorite-star):not(.article-favorite-btn *) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  word-wrap: break-word;
  padding-right: 5px;
}

.section h2:hover {
  background-color: var(--secondary);
}

.section h2.open {
  border-left-color: var(--primary);
  background-color: var(--accent);
}

.article-favorite-btn {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.3em;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0.5;
  z-index: 10;
}

.section h2:hover .article-favorite-btn {
  opacity: 1;
}

.article-favorite-btn:hover {
  transform: translateY(-50%) scale(1.2);
  opacity: 1;
}

.article-favorite-btn.favorited {
  opacity: 1;
}

.article-favorite-btn.favorited .favorite-star {
  filter: none;
  color: var(--primary);
}

.favorite-star {
  display: inline-block;
  transition: transform 0.2s ease;
}

.article-favorite-btn:hover .favorite-star {
  transform: scale(1.2);
}

.content {
  display: none;
  padding: 15px;
  background-color: var(--card);
}

.active .content {
  display: block;
}

.infraction-header {
  background-color: var(--muted);
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 15px;
  font-size: 0.9em;
}

.infraction-header .field {
  display: flex;
  margin-bottom: 8px;
  line-height: 1.5;
}

.infraction-header .field:last-child {
  margin-bottom: 0;
}

.infraction-header .field-label {
  font-weight: 700;
  min-width: 180px;
  color: var(--foreground);
}

.infraction-header .field-value {
  color: var(--muted-foreground);
  flex: 1;
}

.info-section {
  margin-bottom: 20px;
}

.info-section:last-child {
  margin-bottom: 0;
}

.info-title {
  font-size: 0.9em;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--foreground);
  padding-bottom: 5px;
  border-bottom: 2px solid var(--border);
}

.info-content {
  font-size: 0.85em;
  line-height: 1.6;
  text-align: justify;
  color: var(--muted-foreground);
}

.info-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.info-list li {
  padding: 8px 0;
  padding-left: 20px;
  position: relative;
  font-size: 0.85em;
  line-height: 1.6;
  color: var(--muted-foreground);
}

.info-list li:before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: bold;
  font-size: 1.2em;
}

.example-box {
  background-color: var(--muted);
  border-left: 3px solid var(--primary);
  padding: 12px;
  margin-top: 10px;
  border-radius: var(--radius);
  font-size: 0.85em;
  line-height: 1.6;
}

.example-box .example-item {
  margin-bottom: 8px;
  padding-left: 15px;
  position: relative;
}

.example-box .example-item:before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--primary);
}

.example-box .example-item:last-child {
  margin-bottom: 0;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: var(--radius);
  font-size: 0.75em;
  font-weight: 600;
  margin-left: 8px;
}

.badge-crime {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
}

.badge-gravidade {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

.badge-penalidade {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
}

.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted-foreground);
  font-size: 1.1em;
}

.no-results-icon {
  font-size: 3em;
  margin-bottom: 15px;
  opacity: 0.5;
}

.highlight {
  background-color: var(--accent);
  padding: 2px 4px;
  border-radius: var(--radius);
  font-weight: 600;
}

.citation-link {
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
  transition: color 0.2s;
}

.citation-link:hover {
  color: var(--ring);
  text-decoration: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  overflow-y: auto;
}

.modal-overlay.open {
  display: flex;
}

.modal-container {
  background: var(--card);
  padding: 0;
  border-radius: var(--radius);
  max-width: 90vw;
  max-height: 90vh;
  width: 800px;
  box-shadow: var(--shadow-2xl);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1em;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.8em;
  cursor: pointer;
  color: var(--primary-foreground);
  padding: 0;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  border-radius: var(--radius);
  transition: background-color 0.2s;
}

.modal-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(90vh - 60px);
  color: var(--foreground);
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  body {
    margin: 0;
    padding: 0;
  }

  .container {
    padding: 15px;
  }
  
  .header-container {
    flex-wrap: wrap;
  }
  
  h1 {
    font-size: 1.4em;
    margin-bottom: 10px;
  }
  
  .favorites-icon-btn {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    width: 45px;
    height: 45px;
    margin-left: auto;
  }
  
  .favorites-icon {
    font-size: 1em;
  }
  
  .favorites-count {
    font-size: 0.65em;
  }
  
  .section h2 {
    padding-right: 45px;
  }
  
  .article-favorite-btn {
    opacity: 0.7;
    font-size: 1.2em;
    right: 10px;
    width: 30px;
    height: 30px;
    padding: 3px;
  }

  .infraction-header .field {
    flex-direction: column;
  }

  .infraction-header .field-label {
    min-width: auto;
    margin-bottom: 5px;
  }
}
