/* Base theme variables */
:root {
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 222.2 84% 4.9%;
  --primary: 0 72% 51%; /* Red for Ninja theme */
  --primary-foreground: 0 0% 98%;
  --secondary: 220 14% 96%;
  --secondary-foreground: 222.2 47.4% 11.2%;
  --muted: 220 14% 96%;
  --muted-foreground: 220 8.9% 46.1%;
  --accent: 220 14% 96%;
  --accent-foreground: 222.2 47.4% 11.2%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --border: 220 13% 91%;
  --input: 220 13% 91%;
  --ring: 0 72% 51%; /* Red for Ninja theme */
  --radius: 0.5rem;
}

/* Dark theme variables */
.dark {
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;
  --card: 222.2 84% 4.9%;
  --card-foreground: 210 40% 98%;
  --popover: 222.2 84% 4.9%;
  --popover-foreground: 210 40% 98%;
  --primary: 0 72% 51%; /* Red for Ninja theme */
  --primary-foreground: 0 0% 98%;
  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 210 40% 98%;
  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 0 72% 51%; /* Red for Ninja theme */
}

/* Apply theme to the entire site */
html,
body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
}

body {
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Ensure all elements inherit theme colors properly */
* {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Ensure inputs and form elements respect the theme */
input,
textarea,
select,
button {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}

/* Ensure modals and popups respect the theme */
.modal,
.popup,
.dropdown {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}

/* Apply color variables */
.bg-background {
  background-color: hsl(var(--background));
}

.text-foreground {
  color: hsl(var(--foreground));
}

.bg-muted {
  background-color: hsl(var(--muted));
}

.text-muted-foreground {
  color: hsl(var(--muted-foreground));
}

.border-input {
  border-color: hsl(var(--input));
}

.text-primary {
  color: hsl(var(--primary));
}

.bg-primary {
  background-color: hsl(var(--primary));
}

/* Card styling */
.card {
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border-radius: var(--radius);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.card-header {
  padding: 1.5rem 1.5rem 0.5rem 1.5rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-description {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.card-content {
  padding: 1.5rem;
}

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

.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  background-color: transparent;
  color: hsl(var(--foreground));
  font-size: 0.875rem;
}

.textarea {
  min-height: 80px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: all 0.2s;
  cursor: pointer;
}

.button-primary {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.button-outline {
  background-color: transparent;
  border: 1px solid hsl(var(--input));
  color: hsl(var(--foreground));
}

.button-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

/* Tabs */
.tabs-list {
  display: grid;
  border-bottom: 1px solid hsl(var(--border));
}

/* Improved tab triggers with icons */
.tab-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  text-align: center;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-trigger.active {
  border-bottom-color: hsl(var(--primary));
  color: hsl(var(--primary));
}

.tab-trigger:hover:not(.active) {
  background-color: hsl(var(--muted) / 0.5);
}

@media (max-width: 768px) {
  .tab-trigger {
    padding: 0.5rem;
    font-size: 0.75rem;
  }

  .tab-trigger i {
    margin-right: 0.25rem !important;
    height: 0.875rem !important;
    width: 0.875rem !important;
  }
}

.tab-trigger.active {
  border-bottom-color: hsl(var(--primary));
  color: hsl(var(--primary));
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.alert-destructive {
  background-color: hsl(var(--destructive) / 0.1);
  color: hsl(var(--destructive));
}

.alert-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

/* Utility classes */
.space-y-2 > * + * {
  margin-top: 0.5rem;
}

.space-y-4 > * + * {
  margin-top: 1rem;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.font-mono {
  font-family: monospace;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.rounded-md {
  border-radius: 0.375rem;
}

.p-2 {
  padding: 0.5rem;
}

.p-3 {
  padding: 0.75rem;
}

.p-4 {
  padding: 1rem;
}

/* Special backgrounds */
.bg-green-50 {
  background-color: rgba(0, 128, 0, 0.1);
}

.dark .bg-green-50 {
  background-color: rgba(0, 128, 0, 0.2);
}

.bg-red-50 {
  background-color: rgba(220, 38, 38, 0.1);
}

.dark .bg-red-50 {
  background-color: rgba(220, 38, 38, 0.2);
}

.bg-blue-50 {
  background-color: rgba(59, 130, 246, 0.1);
}

.dark .bg-blue-50 {
  background-color: rgba(59, 130, 246, 0.2);
}

.bg-amber-50 {
  background-color: rgba(245, 158, 11, 0.1);
}

.dark .bg-amber-50 {
  background-color: rgba(245, 158, 11, 0.2);
}

/* Text colors */
.text-green-600 {
  color: rgb(22, 163, 74);
}

.dark .text-green-600 {
  color: rgb(74, 222, 128);
}

.text-red-600 {
  color: rgb(220, 38, 38);
}

.dark .text-red-600 {
  color: rgb(248, 113, 113);
}

.text-blue-600 {
  color: rgb(37, 99, 235);
}

.dark .text-blue-600 {
  color: rgb(96, 165, 250);
}

.text-amber-600 {
  color: rgb(217, 119, 6);
}

.dark .text-amber-600 {
  color: rgb(251, 191, 36);
}

/* Grid layouts */
.validator-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 768px) {
  .validator-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Card logo styles */
.card-logo {
  display: inline-block;
  vertical-align: middle;
  line-height: 0;
}

.card-logo svg {
  width: 100%;
  height: 100%;
}

/* Card brand badges */
.card-brand-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  gap: 0.25rem;
}

.card-brand-badge.visa {
  background-color: rgba(20, 52, 203, 0.1);
  color: #1434cb;
}

.dark .card-brand-badge.visa {
  background-color: rgba(20, 52, 203, 0.2);
  color: #4169e1;
}

.card-brand-badge.mastercard {
  background-color: rgba(255, 95, 0, 0.1);
  color: #ff5f00;
}

.dark .card-brand-badge.mastercard {
  background-color: rgba(255, 95, 0, 0.2);
  color: #ff7f32;
}

.card-brand-badge.amex {
  background-color: rgba(31, 114, 205, 0.1);
  color: #1f72cd;
}

.dark .card-brand-badge.amex {
  background-color: rgba(31, 114, 205, 0.2);
  color: #4f94cd;
}

.card-brand-badge.discover {
  background-color: rgba(255, 102, 0, 0.1);
  color: #ff6600;
}

.dark .card-brand-badge.discover {
  background-color: rgba(255, 102, 0, 0.2);
  color: #ff8533;
}

.card-brand-badge.unknown {
  background-color: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

/* Table styles */
table {
  width: 100%;
  border-collapse: collapse;
}

table th,
table td {
  padding: 0.5rem;
  text-align: left;
}

table th {
  font-weight: 600;
}

table tbody tr:hover {
  background-color: hsl(var(--secondary) / 0.5);
}

/* Checkbox styles */
.checkbox {
  appearance: none;
  width: 1rem;
  height: 1rem;
  border: 1px solid hsl(var(--input));
  border-radius: 0.25rem;
  background-color: transparent;
  display: inline-block;
  position: relative;
  cursor: pointer;
}

.checkbox:checked {
  background-color: hsl(var(--primary));
  border-color: hsl(var(--primary));
}

.checkbox:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 3px;
  height: 7px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Overflow handling */
.overflow-x-auto {
  overflow-x: auto;
}

.overflow-hidden {
  overflow: hidden;
}

/* Inline flex */
.inline-flex {
  display: inline-flex;
}

/* Responsive utility classes */
.container {
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 640px) {
  .container {
    max-width: 640px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 768px;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 1024px;
  }
}

@media (min-width: 1280px) {
  .container {
    max-width: 1280px;
  }
}

/* Improved responsive grid */
.grid {
  display: grid;
  gap: 1rem;
}

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

@media (min-width: 768px) {
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .md\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Responsive tabs */
.tabs-container {
  width: 100%;
  overflow: hidden;
}

.tabs-list {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  padding-bottom: 2px; /* Prevent cut-off of focus styles */
}

.tabs-list::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.tab-trigger {
  white-space: nowrap;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .tab-trigger {
    font-size: 1rem;
  }
}

/* Responsive spacing */
@media (max-width: 640px) {
  .space-y-4 > * + * {
    margin-top: 0.75rem;
  }

  .card-header {
    padding: 1rem 1rem 0.5rem 1rem;
  }

  .card-content {
    padding: 1rem;
  }

  .p-4 {
    padding: 0.75rem;
  }
}

/* Touch-friendly form elements */
@media (max-width: 640px) {
  .button,
  .input,
  .textarea,
  .select {
    min-height: 2.75rem;
  }

  .checkbox,
  .radio {
    min-width: 1.25rem;
    min-height: 1.25rem;
  }

  label {
    margin-bottom: 0.375rem;
  }
}

/* Responsive typography */
@media (max-width: 640px) {
  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  h3 {
    font-size: 1.125rem;
  }

  .card-title {
    font-size: 1.125rem;
  }
}

/* Responsive tables */
.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Improved flex utilities */
.flex-col {
  flex-direction: column;
}

.items-start {
  align-items: flex-start;
}

@media (min-width: 640px) {
  .sm\:flex-row {
    flex-direction: row;
  }

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

/* Fix for the validator grid on mobile */
@media (max-width: 767px) {
  .validator-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Improved card styles for mobile */
@media (max-width: 640px) {
  .card {
    border-radius: calc(var(--radius) - 2px);
  }
}

/* Mobile Responsive Styles */
@media (max-width: 640px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .card-header {
    padding: 1rem 1rem 0.5rem 1rem;
  }

  .card-content {
    padding: 1rem;
  }

  .tab-trigger {
    padding: 0.5rem;
    font-size: 0.875rem;
  }

  .tabs-list {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .button {
    min-height: 2.5rem; /* Ensure buttons are touch-friendly */
  }

  .input,
  .textarea,
  .select {
    min-height: 2.5rem; /* Ensure inputs are touch-friendly */
  }

  /* Improve table responsiveness */
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }

  /* Adjust font sizes for mobile */
  .text-lg {
    font-size: 1.125rem;
  }

  .text-xl {
    font-size: 1.25rem;
  }

  .text-2xl {
    font-size: 1.5rem;
  }
}

/* Improve table responsiveness */
table {
  min-width: 100%;
}

.overflow-x-auto {
  overflow-x: auto;
  max-width: 100%;
}

/* Touch-friendly form elements */
input[type="checkbox"],
input[type="radio"] {
  min-width: 1.25rem;
  min-height: 1.25rem;
}

/* Ensure proper spacing in grid layouts on mobile */
@media (max-width: 768px) {
  .grid {
    gap: 1rem;
  }

  .space-y-4 > * + * {
    margin-top: 0.75rem;
  }

  .card {
    margin-bottom: 1rem;
  }
}

/* Ensure theme toggle works well on mobile */
.theme-toggle-btn {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Add spinner for loading states */
.spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 0.25rem solid rgba(var(--foreground-rgb), 0.1);
  border-top-color: rgba(var(--foreground-rgb), 0.7);
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Add styles for progressive loading */
.progressive-item {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dark mode improvements */
.dark {
  color-scheme: dark;
}

/* Fix for light borders in dark mode */
.dark .sidebar,
.dark #main-content,
.dark footer,
.dark header,
.dark .card {
  border-color: rgba(30, 41, 59, 0.5) !important;
}

.dark table th,
.dark table td,
.dark hr,
.dark .border,
.dark .border-t,
.dark .border-r,
.dark .border-b,
.dark .border-l {
  border-color: rgba(30, 41, 59, 0.5) !important;
}

/* Improved dark mode colors */
.dark {
  --border-opacity: 0.15;
}

.dark .border {
  border-color: rgba(255, 255, 255, var(--border-opacity)) !important;
}

/* Improved dark mode shadows */
.dark .card,
.dark .sidebar {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

/* Improved dark mode focus states */
.dark .focus\:ring-2:focus {
  --tw-ring-opacity: 0.5;
}

/* Improved dark mode hover states */
.dark .hover\:bg-gray-700:hover {
  background-color: rgba(55, 65, 81, 0.5);
}

/* Improved dark mode active states */
.dark .active\:bg-gray-800:active {
  background-color: rgba(31, 41, 55, 0.8);
}

/* Improved dark mode selection */
.dark ::selection {
  background-color: rgba(59, 130, 246, 0.5);
  color: #fff;
}

/* Improved dark mode scrollbars */
.dark ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.dark ::-webkit-scrollbar-track {
  background: rgba(31, 41, 55, 0.1);
}

.dark ::-webkit-scrollbar-thumb {
  background: rgba(75, 85, 99, 0.5);
  border-radius: 5px;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 114, 128, 0.7);
}

/* Improved dark mode inputs */
.dark input,
.dark textarea,
.dark select {
  background-color: rgba(17, 24, 39, 0.8);
  border-color: rgba(55, 65, 81, 0.5);
}

.dark input:focus,
.dark textarea:focus,
.dark select:focus {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* Improved dark mode buttons */
.dark .button-primary {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.dark .button-outline {
  border-color: rgba(75, 85, 99, 0.5);
}

.dark .button-outline:hover {
  background-color: rgba(55, 65, 81, 0.2);
}

/* Improved dark mode cards */
.dark .card {
  background-color: rgba(17, 24, 39, 0.8);
}

/* Improved dark mode tables */
.dark table tbody tr:hover {
  background-color: rgba(55, 65, 81, 0.2);
}

/* Improved dark mode tabs */
.dark .tab-trigger:hover:not(.active) {
  background-color: rgba(55, 65, 81, 0.2);
}

/* Improved dark mode alerts */
.dark .alert {
  background-color: rgba(17, 24, 39, 0.5);
}

/* Improved dark mode badges */
.dark .badge {
  background-color: rgba(55, 65, 81, 0.3);
}

/* Improved dark mode tooltips */
.dark [data-tooltip]:after {
  background-color: rgba(31, 41, 55, 0.95);
  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.25);
}

/* Improved dark mode modals */
.dark .modal-content {
  background-color: rgba(17, 24, 39, 0.95);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Improved dark mode dropdowns */
.dark .dropdown-content {
  background-color: rgba(17, 24, 39, 0.95);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Improved dark mode code blocks */
.dark pre,
.dark code {
  background-color: rgba(31, 41, 55, 0.5);
}

/* Improved dark mode checkboxes and radios */
.dark .checkbox,
.dark .radio {
  border-color: rgba(75, 85, 99, 0.5);
}

.dark .checkbox:checked,
.dark .radio:checked {
  border-color: hsl(var(--primary));
  background-color: hsl(var(--primary));
}

/* Improved dark mode focus rings */
.dark *:focus-visible {
  outline-color: rgba(59, 130, 246, 0.5);
}

/* Improved dark mode placeholders */
.dark ::placeholder {
  color: rgba(156, 163, 175, 0.7);
}

/* Improved dark mode disabled elements */
.dark :disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Improved dark mode progress bars */
.dark progress {
  background-color: rgba(55, 65, 81, 0.3);
}

.dark progress::-webkit-progress-bar {
  background-color: rgba(55, 65, 81, 0.3);
}

.dark progress::-webkit-progress-value {
  background-color: hsl(var(--primary));
}

.dark progress::-moz-progress-bar {
  background-color: hsl(var(--primary));
}

/* Improved dark mode range inputs */
.dark input[type="range"] {
  background-color: rgba(55, 65, 81, 0.3);
}

.dark input[type="range"]::-webkit-slider-thumb {
  background-color: hsl(var(--primary));
}

.dark input[type="range"]::-moz-range-thumb {
  background-color: hsl(var(--primary));
}

/* Improved dark mode file inputs */
.dark input[type="file"]::file-selector-button {
  background-color: rgba(55, 65, 81, 0.3);
  color: rgba(209, 213, 219, 0.9);
  border-color: rgba(75, 85, 99, 0.5);
}

.dark input[type="file"]::file-selector-button:hover {
  background-color: rgba(75, 85, 99, 0.4);
}

/* Improved dark mode date inputs */
.dark input[type="date"],
.dark input[type="datetime-local"],
.dark input[type="month"],
.dark input[type="time"],
.dark input[type="week"] {
  background-color: rgba(17, 24, 39, 0.8);
  border-color: rgba(55, 65, 81, 0.5);
  color: rgba(209, 213, 219, 0.9);
}

/* Improved dark mode select dropdowns */
.dark select option {
  background-color: rgba(17, 24, 39, 0.95);
  color: rgba(209, 213, 219, 0.9);
}

/* Fix for the sidebar in dark mode */
.dark .sidebar {
  background-color: rgba(17, 24, 39, 1);
  border-right: none;
}

/* Fix for the header in dark mode */
.dark header {
  background-color: rgba(17, 24, 39, 1);
  border-bottom: none;
}

/* Fix for the footer in dark mode */
.dark footer {
  background-color: rgba(17, 24, 39, 1);
  border-top: none;
}

/* Improved dark mode for main content */
.dark #main-content {
  background-color: rgba(17, 24, 39, 1);
}

/* Add this at the end of the file */
.disable-transitions,
.disable-transitions * {
  transition: none !important;
}
