/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap');
@import url('https://cdn.jsdelivr.net/npm/primeicons@7.0.0/primeicons.css');

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

html {
  font-size: 16px;
  line-height: 1.5;
}

body {
  font-family: 'Lato', sans-serif;
  font-weight: 300;
  background-color: #fafafa;
  color: #0d1a3f;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

/* Dark mode styles */
body.dark-mode {
  background-color: #060d20;
  color: #ffffff;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Lato', sans-serif;
  font-weight: 300;
  line-height: 1.2;
}

h1 {
  font-size: 2.25rem;
}
h2 {
  font-size: 1.875rem;
}
h3 {
  font-size: 1.5rem;
}
h4 {
  font-size: 1.25rem;
}
h5 {
  font-size: 1.125rem;
}
h6 {
  font-size: 1rem;
}

p {
  font-family: 'Lato', sans-serif;
  font-weight: 400;
  margin-bottom: 1rem;
}

/* Link Styles - Excluding Navigation */
a:not(.nav-link):not(.side-nav a):not(.mobile-header a):not(.mobile-menu-btn):not(.btn) {
  color: var(--p-primary-500);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:not(.nav-link):not(.side-nav a):not(.mobile-header a):not(.mobile-menu-btn):not(.btn):hover {
  color: var(--p-primary-600);
  text-decoration: underline;
}

a:not(.nav-link):not(.side-nav a):not(.mobile-header a):not(.mobile-menu-btn):not(.btn):active {
  color: var(--p-primary-700);
}

a:not(.nav-link):not(.side-nav a):not(.mobile-header a):not(.mobile-menu-btn):not(.btn):visited {
  color: var(--p-primary-600);
}

body.dark-mode a:not(.nav-link):not(.side-nav a):not(.mobile-header a):not(.mobile-menu-btn):not(.btn) {
  color: var(--p-primary-400);
}

body.dark-mode a:not(.nav-link):not(.side-nav a):not(.mobile-header a):not(.mobile-menu-btn):not(.btn):hover {
  color: var(--p-primary-300);
}

body.dark-mode a:not(.nav-link):not(.side-nav a):not(.mobile-header a):not(.mobile-menu-btn):not(.btn):active {
  color: var(--p-primary-200);
}

body.dark-mode a:not(.nav-link):not(.side-nav a):not(.mobile-header a):not(.mobile-menu-btn):not(.btn):visited {
  color: var(--p-primary-500);
}

/* CSS Variables for Color Palette */
:root {
  /* Primary Palette */
  --p-primary-50: #eaf5ff;
  --p-primary-100: #cce8ff;
  --p-primary-200: #a6d9ff;
  --p-primary-300: #80caff;
  --p-primary-400: #40b9ff;
  --p-primary-500: #0194ff;
  --p-primary-600: #0079d1;
  --p-primary-700: #005ea3;
  --p-primary-800: #004375;
  --p-primary-900: #002847;
  --p-primary-950: #001c32;

  /* Surface Palette */
  --p-surface-0: #ffffff;
  --p-surface-50: #fafafa;
  --p-surface-100: #f0f0f0;
  --p-surface-200: #dddddd;
  --p-surface-300: #cccccc;
  --p-surface-400: #999999;
  --p-surface-500: #666666;
  --p-surface-600: #4a5e80;
  --p-surface-700: #3c567c;
  --p-surface-800: #2e4d77;
  --p-surface-900: #0d1a3f;
  --p-surface-950: #060d20;

  /* Utility Colors */
  --p-content-border-radius: 6px;
  --p-primary-color: var(--p-primary-500);
  --p-primary-contrast-color: var(--p-surface-0);
  --p-primary-hover-color: var(--p-primary-600);
  --p-primary-active-color: var(--p-primary-700);
  --p-content-border-color: var(--p-surface-200);
  --p-content-hover-background: var(--p-surface-100);
  --p-content-hover-color: var(--p-surface-700);
  --p-highlight-background: color-mix(in srgb, #00ccf9, transparent 84%);
  --p-highlight-color: var(--p-primary-700);
  --p-highlight-focus-background: color-mix(in srgb, #00ccf9, transparent 76%);
  --p-highlight-focus-color: var(--p-primary-800);
  --p-text-color: var(--p-surface-800);
  --p-text-hover-color: var(--p-surface-900);
  --p-text-muted-color: var(--p-surface-500);
  --p-text-hover-muted-color: var(--p-surface-600);
}

/* Dark Mode Variables */
body.dark-mode {
  --p-primary-color: var(--p-primary-400);
  --p-primary-contrast-color: var(--p-surface-950);
  --p-primary-hover-color: var(--p-primary-300);
  --p-primary-active-color: var(--p-primary-200);
  --p-content-border-color: var(--p-surface-700);
  --p-content-hover-background: var(--p-surface-800);
  --p-content-hover-color: var(--p-surface-0);
  --p-highlight-background: color-mix(in srgb, var(--p-primary-950), transparent 84%);
  --p-highlight-color: var(--p-surface-0);
  --p-highlight-focus-background: color-mix(in srgb, var(--p-primary-950), transparent 76%);
  --p-highlight-focus-color: var(--p-surface-0);
  --p-text-color: var(--p-surface-50);
  --p-text-hover-color: var(--p-surface-0);
  --p-text-muted-color: var(--p-surface-400);
  --p-text-hover-muted-color: var(--p-surface-300);
}

/* Layout Components */
.app-container {
  min-height: 100vh;
  display: flex;
  position: relative;
  background-color: var(--p-surface-50);
}

body.dark-mode .app-container {
  background-color: var(--p-surface-950);
}

/* Side Navigation */
.side-nav {
  width: 280px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  background-color: var(--p-surface-50);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

body.dark-mode .side-nav {
  background-color: var(--p-surface-950);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.side-nav.mobile-closed {
  transform: translateX(-100%);
}

.side-nav.mobile-open {
  transform: translateX(0);
}

.side-nav-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1rem;
  gap: 1rem;
}

.side-nav-logo {
  width: auto;
  height: 40px;
  max-height: 40px;
}

.side-nav-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer 10+ */
}

/* Hide scrollbar by default */
.side-nav-content::-webkit-scrollbar {
  width: 0px;
  background: transparent;
  transition: width 0.2s ease;
}

/* Show scrollbar only when scrolling */
.side-nav-content:hover::-webkit-scrollbar,
.side-nav-content:focus::-webkit-scrollbar {
  width: 6px;
}

.side-nav-content::-webkit-scrollbar-track {
  background: transparent;
}

.side-nav-content::-webkit-scrollbar-thumb {
  background-color: var(--p-surface-300);
  border-radius: 3px;
  border: 1px solid transparent;
  background-clip: content-box;
  transition: background-color 0.2s ease;
}

.side-nav-content::-webkit-scrollbar-thumb:hover {
  background-color: var(--p-surface-400);
}

body.dark-mode .side-nav-content::-webkit-scrollbar-thumb {
  background-color: var(--p-surface-600);
}

body.dark-mode .side-nav-content::-webkit-scrollbar-thumb:hover {
  background-color: var(--p-surface-500);
}

.nav-section {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-section-header {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  gap: 1rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--p-surface-900);
  border-bottom: 1px solid var(--p-surface-200);
  transition: color 0.15s ease;
}

body.dark-mode .nav-section-header {
  color: var(--p-surface-0);
  border-bottom-color: var(--p-surface-700);
}

.nav-item {
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.75rem;
  gap: 0.5rem;
  border-radius: 0.5rem;
  color: var(--p-surface-700);
  transition: all 0.15s ease;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
}

body.dark-mode .nav-link {
  color: var(--p-surface-200);
}

.nav-link:hover {
  background-color: var(--p-content-hover-background);
  color: var(--p-text-hover-color);
  border-color: var(--p-content-border-color);
}

body.dark-mode .nav-link:hover {
  background-color: var(--p-content-hover-background);
  color: var(--p-text-hover-color);
  border-color: var(--p-content-border-color);
}

.nav-link i {
  font-size: 1rem;
  color: var(--p-surface-500);
  transition: color 0.15s ease;
}

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

body.dark-mode .nav-link i {
  color: var(--p-surface-400);
}

body.dark-mode .nav-link:hover i {
  color: var(--p-text-hover-color);
}

.nav-divider {
  height: 1px;
  margin: 0.5rem 0;
  background-color: var(--p-surface-200);
}

body.dark-mode .nav-divider {
  background-color: var(--p-surface-700);
}

.side-nav-footer {
  padding: 0.5rem;
}

.side-nav-controls {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  padding: 0.75rem 0;
}

.control-icon {
  font-size: 1.25rem;
  color: var(--p-surface-500);
  cursor: pointer;
  transition: color 0.2s ease;
}

body.dark-mode .control-icon {
  color: var(--p-surface-400);
}

.control-icon:hover {
  color: var(--p-surface-700);
}

body.dark-mode .control-icon:hover {
  color: var(--p-surface-300);
}

.theme-toggle {
  color: var(--p-primary-500);
}

.theme-toggle.dark {
  color: #fbbf24;
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--p-surface-50);
  padding: 1.75rem 1.75rem;
}

body.dark-mode .main-content {
  background-color: var(--p-surface-950);
}

/* Header */
.app-header {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--p-surface-900);
}

body.dark-mode .breadcrumbs {
  color: var(--p-surface-0);
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  font-weight: 500;
}

.breadcrumb-link {
  color: var(--p-surface-500);
  cursor: pointer;
  transition: color 0.15s ease;
  text-decoration: none;
}

body.dark-mode .breadcrumb-link {
  color: var(--p-surface-300);
}

.breadcrumb-link:hover {
  color: var(--p-primary-500);
}

body.dark-mode .breadcrumb-link:hover {
  color: var(--p-primary-400);
}

.breadcrumb-separator {
  color: var(--p-surface-500);
  margin: 0 0.5rem;
}

body.dark-mode .breadcrumb-separator {
  color: var(--p-surface-300);
}

.breadcrumb-icon {
  width: 1rem;
  height: 1rem;
  margin-right: 0.25rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--p-surface-900);
}

body.dark-mode .header-actions {
  color: var(--p-surface-0);
}

.contact-button {
  background-color: transparent;
  border: 1px solid var(--p-primary-500);
  color: var(--p-primary-500);
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.875rem;
  transform: scale(0.9);
}

.contact-button:hover {
  background-color: var(--p-primary-500);
  color: var(--p-primary-contrast-color);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.user-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: var(--p-surface-300);
}

body.dark-mode .user-avatar {
  background-color: var(--p-surface-600);
}

.user-name {
  font-weight: 500;
  font-size: 1rem;
}

.user-dropdown-icon {
  font-size: 0.75rem;
  color: var(--p-surface-500);
}

body.dark-mode .user-dropdown-icon {
  color: var(--p-surface-400);
}

/* Content Container */
.content-container {
  position: relative;
  flex: 1;
}

.content-wrapper {
  background-color: var(--p-surface-0);
  border-radius: 0.75rem;
  padding: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--p-content-border-color);
  min-height: calc(100vh - 7rem);
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

body.dark-mode .content-wrapper {
  background-color: #111827;
  border-color: var(--p-content-border-color);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* Page Header */
.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--p-surface-900);
  margin-bottom: 0.5rem;
}

body.dark-mode .page-title {
  color: var(--p-surface-0);
}

.page-subtitle {
  color: var(--p-surface-600);
  font-size: 1.125rem;
}

body.dark-mode .page-subtitle {
  color: var(--p-surface-400);
}

/* Content Sections */
.content-section {
  background-color: var(--p-surface-50);
  border: 1px solid var(--p-surface-200);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

body.dark-mode .content-section {
  background-color: var(--p-surface-950);
  border-color: var(--p-surface-700);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--p-surface-900);
  margin-bottom: 1rem;
}

body.dark-mode .section-title {
  color: var(--p-surface-0);
}

.section-subtitle {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--p-surface-900);
  margin-bottom: 0.75rem;
}

body.dark-mode .section-subtitle {
  color: var(--p-surface-0);
}

/* Grid Layouts */
.grid-1 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

/* Tables Grid - Flexbox Layout */
.tables-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: flex-start;
  max-width: 100%;
  overflow: hidden;
}

.table-card {
  flex: 1 1 280px;
  min-height: 140px;
  max-width: calc(33.333% - 1rem);
  background-color: var(--p-surface-0);
  border: 1px solid var(--p-surface-200);
  border-radius: 0.75rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  transition: all 0.15s ease;
  overflow: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
  box-sizing: border-box;
}

body.dark-mode .table-card {
  background-color: #111827;
  border-color: var(--p-surface-700);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
}

.table-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border-color: var(--p-primary-500);
}

body.dark-mode .table-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.table-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--p-surface-900);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.dark-mode .table-header h3 {
  color: var(--p-surface-0);
}

.table-rows {
  font-size: 0.875rem;
  color: var(--p-surface-600);
  font-weight: 500;
}

body.dark-mode .table-rows {
  color: var(--p-surface-400);
}

.table-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--p-surface-600);
}

body.dark-mode .meta-item {
  color: var(--p-surface-400);
}

.meta-item i {
  color: var(--p-surface-500);
  font-size: 0.75rem;
}

body.dark-mode .meta-item i {
  color: var(--p-surface-400);
}

.table-description {
  margin-bottom: 0.5rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.table-comment {
  font-size: 0.75rem;
  color: var(--p-surface-600);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-height: 2.4em;
  word-wrap: break-word;
  overflow-wrap: break-word;
  min-width: 0;
}

body.dark-mode .table-comment {
  color: var(--p-surface-400);
}

.table-comment i {
  color: var(--p-surface-500);
  font-size: 0.75rem;
  margin-top: 0.125rem;
}

body.dark-mode .table-comment i {
  color: var(--p-surface-400);
}

.table-actions-main {
  margin-top: auto;
  flex-shrink: 0;
}

.table-actions-main .btn {
  width: 100%;
  justify-content: center;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

.description-text {
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--p-surface-600);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  max-width: 100%;
  overflow-wrap: break-word;
}

body.dark-mode .description-text {
  color: var(--p-surface-400);
}

.table-actions {
  margin-top: auto;
}

.table-actions .btn {
  width: 100%;
  justify-content: center;
}

/* Queries Grid - Flexbox Layout */
.queries-grid {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 1.5rem !important;
  justify-content: flex-start !important;
  width: 100% !important;
}

.query-card {
  flex: 0 0 calc(33.333% - 1rem) !important;
  min-height: 200px;
  aspect-ratio: 1;
  background-color: var(--p-surface-0);
  border: 1px solid var(--p-surface-200);
  border-radius: 0.75rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  transition: all 0.15s ease;
}

body.dark-mode .query-card {
  background-color: #111827;
  border-color: var(--p-surface-700);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
}

.query-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border-color: var(--p-primary-500);
}

body.dark-mode .query-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.query-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.query-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--p-surface-900);
  margin: 0;
  flex: 1;
}

body.dark-mode .query-header h3 {
  color: var(--p-surface-0);
}

.query-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.query-description {
  margin-bottom: 1rem;
  flex: 1;
}

.query-description p {
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--p-surface-600);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.dark-mode .query-description p {
  color: var(--p-surface-400);
}

.query-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  font-size: 0.75rem;
  color: var(--p-surface-500);
}

body.dark-mode .query-meta {
  color: var(--p-surface-400);
}

.query-id {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.query-category {
  background-color: var(--p-surface-100);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-weight: 500;
}

body.dark-mode .query-category {
  background-color: var(--p-surface-800);
}

/* Form Elements */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--p-surface-600);
  margin-bottom: 0.25rem;
}

body.dark-mode .form-label {
  color: var(--p-surface-400);
}

.form-value {
  color: var(--p-surface-900);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

body.dark-mode .form-value {
  color: var(--p-surface-0);
}

/* Status Indicators */
.status-active {
  color: #059669;
  font-weight: 500;
}

body.dark-mode .status-active {
  color: #34d399;
}

.status-dismissed {
  color: #dc2626;
  font-weight: 500;
}

body.dark-mode .status-dismissed {
  color: #f87171;
}

.status-valid {
  color: #059669;
  font-weight: 500;
}

body.dark-mode .status-valid {
  color: #34d399;
}

.status-suspicious {
  color: #dc2626;
  font-weight: 500;
}

body.dark-mode .status-suspicious {
  color: #f87171;
}

/* Risk Score Colors */
.risk-high {
  color: #dc2626;
  font-weight: 500;
  font-size: 1.125rem;
}

body.dark-mode .risk-high {
  color: #f87171;
}

.risk-medium {
  color: #d97706;
  font-weight: 500;
  font-size: 1.125rem;
}

body.dark-mode .risk-medium {
  color: #fbbf24;
}

.risk-low {
  color: #059669;
  font-weight: 500;
  font-size: 1.125rem;
}

body.dark-mode .risk-low {
  color: #34d399;
}

/* Tags and Badges */
.tag {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background-color: #fef2f2;
  color: #991b1b;
  font-size: 0.75rem;
  border-radius: 0.25rem;
  margin: 0.125rem;
}

body.dark-mode .tag {
  background-color: #7f1d1d;
  color: #fecaca;
}

/* Timeline */
.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.timeline-dot {
  width: 0.5rem;
  height: 0.5rem;
  background-color: var(--p-primary-500);
  border-radius: 50%;
  margin-top: 0.5rem;
  flex-shrink: 0;
}

.timeline-content h4 {
  font-weight: 500;
  color: var(--p-surface-900);
  margin-bottom: 0.25rem;
}

body.dark-mode .timeline-content h4 {
  color: var(--p-surface-0);
}

.timeline-meta {
  font-size: 0.75rem;
  color: var(--p-surface-500);
}

body.dark-mode .timeline-meta {
  color: var(--p-surface-400);
}

/* Changes */
.change-item {
  padding: 0.75rem;
  background-color: var(--p-surface-100);
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
}

body.dark-mode .change-item {
  background-color: var(--p-surface-800);
}

.change-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.change-field {
  font-weight: 500;
  color: var(--p-surface-900);
}

body.dark-mode .change-field {
  color: var(--p-surface-0);
}

.change-date {
  font-size: 0.75rem;
  color: var(--p-surface-500);
}

body.dark-mode .change-date {
  color: var(--p-surface-400);
}

.change-values {
  font-size: 0.875rem;
}

.change-old {
  color: #dc2626;
}

body.dark-mode .change-old {
  color: #f87171;
}

.change-arrow {
  margin: 0 0.5rem;
  color: var(--p-surface-500);
}

body.dark-mode .change-arrow {
  color: var(--p-surface-400);
}

.change-new {
  color: #059669;
}

body.dark-mode .change-new {
  color: #34d399;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-outlined {
  background-color: transparent;
  border: 1px solid var(--p-primary-500);
  color: var(--p-primary-500);
}

.btn-outlined:hover {
  background-color: var(--p-primary-500);
  color: var(--p-primary-contrast-color);
}

.btn-primary {
  background-color: var(--p-primary-500);
  color: var(--p-primary-contrast-color);
}

.btn-primary:hover {
  background-color: var(--p-primary-600);
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
  .side-nav {
    transform: translateX(-100%);
  }

  .side-nav.mobile-open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 0 1rem;
  }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background-color: var(--p-surface-50);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
  }

  body.dark-mode .mobile-header {
    background-color: var(--p-surface-950);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
  }

  .mobile-menu-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--p-surface-900);
    cursor: pointer;
  }

  body.dark-mode .mobile-menu-btn {
    color: var(--p-surface-400);
  }

  .content-wrapper {
    margin-top: 4rem;
    padding: 1rem;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  /* Responsive grid layouts */
  .tables-grid .table-card,
  .queries-grid .query-card {
    flex: 1 1 250px;
    max-width: calc(50% - 0.5rem);
  }

  /* Adjust gap for medium screens */
  .tables-grid,
  .queries-grid {
    gap: 1rem;
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .content-section {
    padding: 1rem;
  }

  /* Single column layout for mobile */
  .tables-grid .table-card,
  .queries-grid .query-card {
    flex: 1 1 100%;
    max-width: 100%;
  }

  /* Adjust gap and padding for mobile */
  .tables-grid,
  .queries-grid {
    gap: 0.75rem;
  }

  .table-card,
  .query-card {
    padding: 0.75rem;
    min-height: 120px;
  }
}

/* Overlay for mobile sidebar */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 30;
  display: none;
}

.mobile-overlay.active {
  display: block;
}

/* Table View Styles */
.data-table-container {
  width: calc(100vw - 356px);
  max-width: calc(100vw - 356px);
  overflow-x: auto;
}

#data-table {
  /* No width constraints - let Tabulator expand naturally */
}

/* Tabulator Customization */
.tabulator {
  /* No width constraints - let Tabulator expand naturally */
}

.tabulator-tableholder {
  /* No width constraints - let Tabulator expand naturally */
}

.tabulator-table {
  /* No width constraints - let Tabulator expand naturally */
}

/* Force all Tabulator elements to respect width */
.tabulator * {
  max-width: 100vw !important;
  box-sizing: border-box !important;
}

.tabulator-header {
  background-color: var(--p-surface-100);
  border-bottom: 1px solid var(--p-surface-200);
}

body.dark-mode .tabulator-header {
  background-color: var(--p-surface-800);
  border-bottom-color: var(--p-surface-700);
}

.tabulator-col {
  background-color: var(--p-surface-100);
  border-right: 1px solid var(--p-surface-200);
  color: var(--p-surface-900);
  font-weight: 600;
}

body.dark-mode .tabulator-col {
  background-color: var(--p-surface-800);
  border-right-color: var(--p-surface-700);
  color: var(--p-surface-0);
}

.tabulator-cell {
  border-right: 1px solid var(--p-surface-200);
  padding: 0.5rem;
}

body.dark-mode .tabulator-cell {
  border-right-color: var(--p-surface-700);
}

.tabulator-row {
  border-bottom: 1px solid var(--p-surface-200);
}

body.dark-mode .tabulator-row {
  border-bottom-color: var(--p-surface-700);
}

.tabulator-row:hover {
  background-color: var(--p-content-hover-background);
}

/* Data Type Formatting */
.null-value {
  color: var(--p-surface-500);
  font-style: italic;
}

.boolean-true {
  color: #059669;
  font-weight: 600;
}

.boolean-false {
  color: #dc2626;
  font-weight: 600;
}

.number-value {
  color: var(--p-primary-600);
  font-weight: 500;
}

.text-value {
  color: var(--p-surface-800);
}

.long-text {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.text-content {
  flex: 1;
  word-break: break-word;
}

.expand-text-btn {
  background: none;
  border: none;
  color: var(--p-primary-500);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.expand-text-btn:hover {
  background-color: var(--p-primary-50);
  color: var(--p-primary-600);
}

body.dark-mode .expand-text-btn {
  color: var(--p-primary-400);
}

body.dark-mode .expand-text-btn:hover {
  background-color: var(--p-primary-900);
  color: var(--p-primary-300);
}

/* Row expansion styles */
.expandable-row {
  transition: all 0.3s ease;
}

.expandable-row.row-expanded {
  background-color: var(--p-surface-50);
  border-left: 4px solid var(--p-primary-500);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

body.dark-mode .expandable-row.row-expanded {
  background-color: var(--p-surface-800);
  border-left-color: var(--p-primary-400);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.expandable-row.row-expanded .tabulator-cell {
  white-space: pre-wrap !important;
  word-break: break-word !important;
  max-width: none !important;
  overflow: visible !important;
  height: auto !important;
  vertical-align: top !important;
  padding: 1rem !important;
  width: 100% !important;
  min-width: 0 !important;
}

.expandable-row.row-expanded .text-content {
  white-space: pre-wrap !important;
  word-break: break-word !important;
  max-width: none !important;
  line-height: 1.5 !important;
  display: block !important;
  width: 100% !important;
  overflow: visible !important;
}

/* Ensure Tabulator doesn't override our height */
.tabulator .tabulator-row.row-expanded {
  height: auto !important;
  min-height: auto !important;
}

.tabulator .tabulator-row.row-expanded .tabulator-cell {
  height: auto !important;
  min-height: auto !important;
}

/* Ensure the table can accommodate expanded rows */
.tabulator .tabulator-tableholder {
  overflow: auto !important;
}

.tabulator .tabulator-table {
  overflow: visible !important;
}

body.dark-mode .text-value {
  color: var(--p-surface-100);
}

.long-text {
  color: var(--p-surface-700);
}

body.dark-mode .long-text {
  color: var(--p-surface-300);
}

.expand-text-btn {
  background: none;
  border: none;
  color: var(--p-primary-500);
  cursor: pointer;
  padding: 0.25rem;
  margin-left: 0.5rem;
  border-radius: 0.25rem;
  transition: background-color 0.15s ease;
}

.expand-text-btn:hover {
  background-color: var(--p-surface-200);
}

body.dark-mode .expand-text-btn:hover {
  background-color: var(--p-surface-700);
}

.row-number {
  color: var(--p-surface-500);
  font-size: 0.75rem;
  margin-right: 0.5rem;
  font-weight: 500;
}

/* Search Controls Row - Two Cards Side by Side */
.search-controls-row {
  display: flex;
  gap: 1rem;
  margin: 2rem 0;
}

.search-controls-row .table-card {
  flex: 1;
  min-width: 0;
}

/* Search Results Grid - Simple Flexbox */
.search-results-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 2rem 0;
}

.search-result-card {
  width: 300px;
  min-height: 200px;
  background-color: var(--p-surface-0);
  border: 1px solid var(--p-surface-200);
  border-radius: 0.75rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  transition: all 0.15s ease;
}

body.dark-mode .search-result-card {
  background-color: #111827;
  border-color: var(--p-surface-700);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
}

.search-result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border-color: var(--p-primary-500);
}

body.dark-mode .search-result-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* Pagination Flexbox */
.pagination-flexbox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 2rem 0;
  padding: 1rem;
  background-color: var(--p-surface-0);
  border: 1px solid var(--p-surface-200);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

body.dark-mode .pagination-flexbox {
  background-color: #111827;
  border-color: var(--p-surface-700);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--p-surface-600);
  white-space: nowrap;
}

body.dark-mode .pagination-info {
  color: var(--p-surface-400);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-numbers {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.page-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--p-surface-200);
  border-radius: 0.375rem;
  background-color: var(--p-surface-0);
  color: var(--p-surface-700);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

body.dark-mode .page-number {
  border-color: var(--p-surface-700);
  background-color: #111827;
  color: var(--p-surface-200);
}

.page-number:hover {
  background-color: var(--p-primary-500);
  color: var(--p-primary-contrast-color);
  border-color: var(--p-primary-500);
}

.page-number.active {
  background-color: var(--p-primary-500);
  color: var(--p-primary-contrast-color);
  border-color: var(--p-primary-500);
}

.page-ellipsis {
  padding: 0.25rem 0.5rem;
  color: var(--p-surface-500);
  font-size: 0.875rem;
}

body.dark-mode .page-ellipsis {
  color: var(--p-surface-400);
}

.pagination-summary {
  font-size: 0.875rem;
  color: var(--p-surface-600);
  white-space: nowrap;
}

body.dark-mode .pagination-summary {
  color: var(--p-surface-400);
}

/* Utility Classes */
.hidden {
  display: none;
}

.flex {
  display: flex;
}

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

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

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

.justify-center {
  justify-content: center;
}

.gap-1 {
  gap: 0.25rem;
}
.gap-2 {
  gap: 0.5rem;
}
.gap-3 {
  gap: 0.75rem;
}
.gap-4 {
  gap: 1rem;
}
.gap-6 {
  gap: 1.5rem;
}
.gap-8 {
  gap: 2rem;
}

.mb-1 {
  margin-bottom: 0.25rem;
}
.mb-2 {
  margin-bottom: 0.5rem;
}
.mb-3 {
  margin-bottom: 0.75rem;
}
.mb-4 {
  margin-bottom: 1rem;
}
.mb-6 {
  margin-bottom: 1.5rem;
}
.mb-8 {
  margin-bottom: 2rem;
}

.mt-1 {
  margin-top: 0.25rem;
}
.mt-2 {
  margin-top: 0.5rem;
}
.mt-4 {
  margin-top: 1rem;
}
.mt-8 {
  margin-top: 2rem;
}

.p-1 {
  padding: 0.25rem;
}
.p-2 {
  padding: 0.5rem;
}
.p-3 {
  padding: 0.75rem;
}
.p-4 {
  padding: 1rem;
}
.p-6 {
  padding: 1.5rem;
}
.p-8 {
  padding: 2rem;
}

.rounded {
  border-radius: 0.25rem;
}
.rounded-lg {
  border-radius: 0.5rem;
}
.rounded-xl {
  border-radius: 0.75rem;
}

.shadow {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}
.shadow-sm {
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.shadow-md {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.w-full {
  width: 100%;
}
.h-full {
  height: 100%;
}
.h-screen {
  height: 100vh;
}

.text-sm {
  font-size: 0.875rem;
}
.text-base {
  font-size: 1rem;
}
.text-lg {
  font-size: 1.125rem;
}
.text-xl {
  font-size: 1.25rem;
}
.text-2xl {
  font-size: 1.5rem;
}
.text-3xl {
  font-size: 1.875rem;
}

.font-medium {
  font-weight: 500;
}
.font-semibold {
  font-weight: 600;
}
.font-bold {
  font-weight: 700;
}

.cursor-pointer {
  cursor: pointer;
}