:root {
  --primary-color: #484b50;
  --primary-hover: #566179;
  --bg-color: #f0f2f5;
  --card-bg: #ffffff;
  --text-main: #202124;
  --text-secondary: #5f6368;
  --border-color: #dadce0;
  --input-bg: #f1f3f4;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --border-radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
  --header-height: 64px;
  --sidebar-width: 250px;
  --primary-dark: #3c4043;
  --primary-dark-text: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Google Sans', Roboto, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

/* Dashboard Layout */
.dashboard-body {
  display: flex;
  flex-direction: column;
}

.top-bar {
  height: var(--header-height);
  background-color: var(--primary-dark);
  color: var(--primary-dark-text);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--spacing-lg);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.header-logo {
  height: 32px;
  width: auto;
}

.app-name {
  font-size: 20px;
  font-weight: 500;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  cursor: pointer;
  position: relative;
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}


.google-auth-err {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: #fce8e6; /* light red background */
  color: #c5221f; /* dark red text */
  padding: 6px 12px;
  border-radius: 5px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #ffaaa3;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.google-auth-err:hover {
  background-color: #fad2cf;
  border-color: #f6b2af;
}

.google-auth-err .err-icon {
  font-size: 14px;
}

.google-auth-warn {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: #fffeb9; /* light red background */
  color: #c5541f; /* dark red text */
  padding: 6px 12px;
  border-radius: 5px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #ffc850;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.google-auth-warn:hover {
  background-color: #ffd16e;
  border-color: #ff9305;
}

.google-auth-warn .warn-icon {
  font-size: 14px;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
}

.avatar {
  width: 32px;
  height: 32px;
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: var(--spacing-sm) 0;
  display: none; /* Show with JS or :hover for now */
  min-width: 150px;
}

.user-menu:hover .dropdown-menu {
  display: block;
}

.dropdown-menu a {
  display: block;
  padding: var(--spacing-sm) var(--spacing-md);
  color: var(--text-main);
  text-decoration: none;
  font-size: 14px;
}

.dropdown-menu a:hover {
  background-color: var(--input-bg);
}

.dashboard-container {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

.sidebar {
  width: var(--sidebar-width);
  background-color: var(--card-bg);
  border-right: 1px solid #ababab;
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  overflow-y: auto;
}

.sidebar-nav ul {
  list-style: none;
  padding: var(--spacing-md) 0;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  padding: 10px var(--spacing-lg);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.2s, color 0.2s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  background-color: rgba(66, 133, 244, 0.1); /* Light blue tint */
  color: var(--primary-color);
}

.sidebar-nav .icon {
  margin-right: var(--spacing-md);
  font-style: normal;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  overflow-y: scroll;
  /*padding: var(--spacing-lg);*/
  width: calc(100% - var(--sidebar-width));
  position: relative;  
  height: calc(100vh - var(--header-height));

}

.main-header-section{
  padding: var(--spacing-lg);  
  border-bottom: 1px solid transparent;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.3s 0s ease-in-out;  
}

.main-padding{
  padding: var(--spacing-lg);
  padding-top: 0px;
}

.main-header-section > h1 {
  font-size: 28px;
  margin-bottom: var(--spacing-sm);
}

.main-header-section > p {
  font-size: 16px;
  margin-bottom: var(--spacing-sm);
}


.main-header-section.sticky-header{
  position: sticky;
  align-items: center;
  flex-direction: row;
  top: -40px;
  z-index: 50;
  background-color: var(--card-bg);
  border-bottom: 1px solid #ababab;
  padding: 10px var(--spacing-lg);
  -webkit-box-shadow: 0px 4px 8px 0px rgba(110, 110, 110, 0.12);
  box-shadow: 0px 4px 8px 0px rgba(110, 110, 110, 0.12);
}

.main-header-section.sticky-header > h1 {
  margin-bottom: 0px;
}

.main-header-section.sticky-header > p {
  margin-bottom: 0px;
  display: none;
  visibility: hidden;
}

.main-header-section.sticky-header > button{
  margin: 0px !important;
  width: fit-content;
}


/* Dashboard Page Content */
.dashboard-welcome h1 {
  font-size: 28px;
  margin-bottom: var(--spacing-sm);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-lg);
  margin-top: var(--spacing-lg);
}

.stat-card {
  background-color: var(--card-bg);
  padding: var(--spacing-lg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.stat-card h3 {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
  font-weight: 500;
}

.stat-value {
  font-size: 32px;
  font-weight: 500;
  color: var(--text-main);
}

/* Login Card Styles (keeping existing but ensuring compatibility) */
.app-container {
  width: 100%;
  max-width: 1200px;
  padding: var(--spacing-md);
  display: flex;
  justify-content: center;
  /* Centering for login page */
  margin: 0 auto; 
}

/* Ensure login page is still centered */
body:not(.dashboard-body) {
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-container {
  background-color: var(--card-bg);
  padding: 40px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-header {
  margin-bottom: 30px;
}

.login-header h1 {
  font-size: 24px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: var(--spacing-sm);
}

.login-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: var(--spacing-sm);
  color: var(--text-main);
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 16px;
  color: var(--text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(72, 75, 80, 0.2);
}

.form-actions {
  margin-top: 30px;
}

.btn {
  display: inline-block;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  width: 100%;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.form-footer {
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}

.form-footer a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.form-footer a:hover {
  text-decoration: underline;
}

.db-editor {
  display: flex;
  width: 100%;    
  align-items: stretch;
}

.db-editor-sidebar {
  width: 260px;
  background: var(--card-bg);
  border-right: 1px solid var(--border-color);
  padding: var(--spacing-md);
  overflow: auto;
}

.db-editor-title {
  font-size: 18px;
  margin-bottom: var(--spacing-md);
}

.db-table-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.db-table-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-main);
  padding: 8px 10px;
  cursor: pointer;
}

.db-table-item.active,
.db-table-item:hover {
  background: var(--input-bg);
  border-color: var(--primary-color);
}

.db-editor-main {
  flex: 1;
  min-width: 0;
}

.db-editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
}

.db-editor-toolbar h1 {
  font-size: 24px;
}

.db-editor-toolbar-actions {
  display: flex;
  gap: 8px;
}

.expand-icon-wrapper{
  margin: -4px 0px -10px 0px;
}

.db-btn {
  width: auto;
  min-width: 25px;
  padding: 8px 12px;
  font-size: 14px;
  margin: -8px 0px;
}

.db-btn-secondary {
  background: #fff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.db-btn-danger {
  background: #b93838;
  color: #fff;
}

.db-btn-edit {
  background: #4a6283;
  color: #fff;
}

.db-btn-danger:hover {
  background: #952c2c;
}

.db-editor-message {
  min-height: 20px;
  margin-bottom: var(--spacing-sm);
  color: var(--text-secondary);
}

.db-bulk-insert-panel {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.db-bulk-hidden {
  display: none;
}

.db-bulk-insert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-sm);
  position: sticky;
}

.db-bulk-column-order {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
}

.db-bulk-insert-textarea {
  width: 100%;
  min-height: 120px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  margin-bottom: var(--spacing-sm);
}

.db-bulk-insert-actions {
  display: flex;
  justify-content: flex-end;
}

.db-editor-grid-wrapper {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: auto;  
}

.db-grid-table {
  width: 100%;
  border-collapse: collapse;
}

.db-grid-table th,
.db-grid-table td {
  border-bottom: 1px solid var(--border-color);
  padding: 8px 10px;
  vertical-align: middle;
  text-align: left;
  white-space: nowrap;
}

.db-grid-table th {
  position: sticky;
  top: 0;
  background: #f8f9fb;
  z-index: 1;
}

.db-row-actions {
  display: flex;
  gap: 8px;
}

.db-input {
  width: 100%;
  min-width: 120px;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.db-editor-pagination {
  margin-top: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: 10px;
}

.db-grid-locked {
  pointer-events: auto;
}

.db-row-disabled {
  opacity: 0.45;
}

.db-row-disabled * {
  pointer-events: none;
}

.db-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.db-editor-empty {
  padding: var(--spacing-md);
  color: var(--text-secondary);
}

.table-view {
  width: 100%;
}

.table-view-header {
  margin-bottom: var(--spacing-md);
}

.table-view-title {
  font-size: 24px;
  margin-bottom: 4px;
}

.table-view-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

.table-view-grid {
  width: 100%;
}

.table-view-table {
  min-width: 100%;
}

.table-view-table tbody tr:nth-child(even) {
  background: rgba(72, 75, 80, 0.03);
}

.table-view-table tbody tr:hover {
  background: rgba(72, 75, 80, 0.07);
}

.table-view-column,
.table-view-cell {
  max-width: 320px;
}

.table-view-cell {
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-view-align-left {
  text-align: left;
}

.table-view-align-center {
  text-align: center;
}

.table-view-align-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-view-empty {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

/* Overview Card Partial Styles */
.overview-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.overview-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.overview-card-title {
  font-size: 18px;
  font-weight: 500;
  color: #1a73e8; /* Matches the blue in the reference image */
  margin: 0;
}

.overview-card-link {
  font-size: 13px;
  color: #1a73e8;
  text-decoration: none;
  font-weight: 500;
}

.overview-card-link:hover {
  text-decoration: underline;
}

.overview-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.overview-metric {
  flex: 1;
  min-width: 120px;
}

.overview-metric-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}

.overview-metric-value {
  font-size: 24px;
  font-weight: 400;
  color: var(--text-main);
}

.overview-progress-section {
  margin-top: var(--spacing-lg);
}

.overview-progress-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}

.overview-progress-value-text {
  font-size: 20px;
  font-weight: 400;
  color: var(--text-main);
  margin-bottom: 8px;
}

.overview-progress-bar-container {
  width: 100%;
  height: 12px;
  background-color: #dadce0; /* Gray background for track */
  border-radius: 2px;
  overflow: hidden;
  display: flex;
}

.overview-progress-bar-fill {
  height: 100%;
  background-color: #1a73e8; /* Default blue fill */
  transition: width 0.3s ease;
}

.animated-out-dahsboard-content {
  transition: margin 0.4s 0s ease;
  margin: 0% 100% 0% calc(var(--sidebar-width) - 100%) !important;
  z-index: -1;
}
.whitelisted-row {
    background: #c3e7cd !important;
}

/* AI Analytics Dashboard (List View) */
.ai-list-container {
  display: flex;
  flex-direction: column;
  gap: 0px;
  background: var(--card-bg);
}

.ai-list-row-wrapper {
  border-bottom: 1px solid var(--border-color);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.ai-list-row-wrapper:hover {

}

.ai-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
}

.ai-list-row.has-issues:hover {

}

.ai-row-info {
  flex: 2;
  display: flex;
  flex-direction: row;
  gap: 12px;
}

.ai-row-info h3 {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
  color: var(--text-main);
}

.ai-row-id {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--input-bg);
  padding: 2px 8px;
  border-radius: 12px;
  width: fit-content;
}

.ai-row-status {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: end;
}

.ai-row-actions {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.ai-status-badge {
  font-size: 14px;
  font-weight: 500;
}

.ai-status-badge.gray { color: var(--text-secondary); }
.ai-status-badge.green { color: #188038; }
.ai-status-badge.red { color: #c5221f; }

/* Spinner for Loading State */
.spinner-small {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-left-color: #1a73e8;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Toggle Switch Component */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
  margin: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 20px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #188038;
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 2px #188038;
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}