/**
 * Product Selector Custom Styles
 * Additional styles for the Nordic Semiconductor Product Selector
 */

/* Custom scrollbar for table */
.overflow-x-auto::-webkit-scrollbar {
  height: 8px;
}

.overflow-x-auto::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.overflow-x-auto::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Range slider customization */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: #00A7CC; /* nordic-blue from tailwind.config.js */
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: #0033A0; /* nordic-blueslate from tailwind.config.js */
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #00A7CC; /* nordic-blue from tailwind.config.js */
  border-radius: 50%;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}

input[type="range"]::-moz-range-thumb:hover {
  background: #0033A0; /* nordic-blueslate from tailwind.config.js */
}

/* Checkbox customization */
.product-checkbox {
  accent-color: #00A7CC; /* nordic-blue from tailwind.config.js */
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Table row hover effects */
#products-table tbody tr:hover {
  background-color: #f9fafb;
  transition: background-color 0.2s ease;
}

/* Grid card hover effects */
#grid-container .bg-white {
  transition: all 0.2s ease;
}

#grid-container .bg-white:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Status badge animations */
.px-2.py-1.text-xs.rounded-full {
  transition: all 0.2s ease;
}

.px-2.py-1.text-xs.rounded-full:hover {
  transform: scale(1.05);
}

/* Loading animation */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Filter panel transitions */
#filter-panel {
  transition: all 0.3s ease;
  display: none; /* Hidden by default */
}

#filter-panel.show {
  display: block; /* Show when 'show' class is present */
}

#advanced-filters {
  transition: all 0.3s ease;
}

/* View toggle button states */
#view-table, #view-grid, #view-compare {
  transition: all 0.2s ease;
}

/* Active button styling - ensure rounded corners match container */
#view-table.bg-nordic-blue,
#view-grid.bg-nordic-blue,
#view-compare.bg-nordic-blue {
  border-radius: 0.375rem; /* rounded-md equivalent */
}

/* First button in group - left rounded corners */
#view-table.bg-nordic-blue {
  border-top-left-radius: 0.375rem;
  border-bottom-left-radius: 0.375rem;
}

/* Last button in group - right rounded corners */
#view-compare.bg-nordic-blue {
  border-top-right-radius: 0.375rem;
  border-bottom-right-radius: 0.375rem;
}

/* Only apply hover to inactive buttons */
#view-table:not(.bg-nordic-blue):hover, 
#view-grid:not(.bg-nordic-blue):hover, 
#view-compare:not(.bg-nordic-blue):hover {
  background-color: #f3f4f6;
}

/* Active button hover - keep the same Nordic blue color */
#view-table.bg-nordic-blue:hover,
#view-grid.bg-nordic-blue:hover,
#view-compare.bg-nordic-blue:hover {
  background-color: #00A7CC !important; /* nordic-blue - same as active state */
}

/* Export button states */
#export-btn {
  transition: all 0.2s ease;
}

#export-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Filter button states */
#filter-toggle {
  transition: all 0.2s ease;
}

#export-btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Mobile optimizations */
@media (max-width: 768px) {
  /* Stack filter controls on mobile */
  .flex.flex-col.sm\\:flex-row {
    flex-direction: column;
  }
  
  /* Adjust table for mobile */
  #products-table {
    font-size: 0.875rem;
  }
  
  #products-table th,
  #products-table td {
    padding: 0.5rem;
  }
  
  /* Grid adjustments for mobile */
  #grid-container {
    grid-template-columns: 1fr;
  }
  
  /* Filter panel styling - works on all screen sizes */
  #filter-panel {
    padding: 1rem;
  }
  
  #filter-panel .grid {
    grid-template-columns: 1fr;
  }
}

/* Focus states for accessibility - removed blue outlines */
input:focus,
select:focus,
button:focus,
.product-checkbox:focus,
.product-selector *:focus {
  outline: none !important;
  box-shadow: none !important;
  ring: none !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .border-gray-200 {
    border-color: #000;
  }
  
  .bg-gray-50 {
    background-color: #f0f0f0;
  }
  
  .text-nordic-middlegrey {
    color: #333;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .animate-spin {
    animation: none;
  }
  
  #grid-container .bg-white:hover {
    transform: none;
  }
  
  #export-btn:not(:disabled):hover {
    transform: none;
  }
}

/* Search loading state */
#search-input.searching {
  border-color: #00A7CC;
  box-shadow: 0 0 0 1px #00A7CC;
}

#search-input.searching::placeholder {
  color: #00A7CC;
  opacity: 0.7;
}

/* Print styles */
@media print {
  #filter-panel,
  #view-table,
  #view-grid,
  #view-compare,
  #export-btn,
  #select-all-checkbox-filter,
  #select-all-checkbox {
    display: none !important;
  }
  
  #product-selector {
    box-shadow: none;
    border: 1px solid #000;
  }
  
  #products-table {
    border-collapse: collapse;
  }
  
  #products-table th,
  #products-table td {
    border: 1px solid #000;
    padding: 0.5rem;
  }
}

/* Custom utility classes - Using Tailwind's built-in Nordic colors */
/* These classes are now handled by Tailwind's nordic color palette */
/* from tailwind.config.js: nordic.blue: #00A7CC, nordic.blueslate: #0033A0, etc. */

/* Responsive text sizing */
@media (max-width: 640px) {
  .text-4xl {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }
  
  .text-lg {
    font-size: 1rem;
    line-height: 1.5rem;
  }
}



/* Custom animations for smooth transitions */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

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

/* Loading skeleton animation */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Consistent button heights for all screen sizes */
#filter-toggle,
#view-table,
#view-grid,
#view-compare,
#export-btn {
  height: 36px !important; /* h-9 equivalent */
  min-height: 36px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Ensure view toggle container maintains height */
.flex.border.border-gray-300.rounded-md {
  height: 36px !important;
} 