/* Enhanced UI Components CSS - Tap Macro v1.3.0 */
/* Alerts, notifications, badges, and progress indicators */

/* ===== FAVORITES SYSTEM ===== */

.favorites-section {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.favorites-header h3 {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0;
}

#favoritesCount {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  min-width: 1.5rem;
  text-align: center;
  transition: all 0.2s ease;
}

/* Theme-aware favorites count styling */
[data-theme="light"] #favoritesCount {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text-secondary);
}

[data-theme="dark"] #favoritesCount {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text-secondary);
}

/* Theme-aware manage favorites button styling */
[data-theme="light"] #manageFavorites {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text-secondary);
}

[data-theme="dark"] #manageFavorites {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text-secondary);
}

[data-theme="light"] #manageFavorites:hover {
  background: var(--bg-hover);
  border-color: var(--ring);
}

[data-theme="dark"] #manageFavorites:hover {
  background: var(--bg-hover);
  border-color: var(--ring);
}

.favorite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  box-shadow: var(--shadow-sm);
}

.favorite-item:hover {
  background: var(--bg-hover);
  border-color: var(--accent-color);
  transform: translateX(2px);
}

.favorite-item .favorite-icon {
  margin-right: 0.5rem;
  color: var(--accent-color);
  flex-shrink: 0;
}

.favorite-item .favorite-details {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.favorite-item .favorite-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.125rem;
}

.favorite-item .favorite-name {
  font-weight: 500;
  color: var(--text-primary);
}

.favorite-item .new-badge {
  background: var(--success);
  color: var(--success-foreground);
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.favorite-item .favorite-description {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.2;
}

.favorite-item .remove-favorite {
  opacity: 0;
  transition: opacity 0.2s ease;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
}

.favorite-item:hover .remove-favorite {
  opacity: 1;
}

.favorite-item .remove-favorite:hover {
  background: var(--bg-hover);
  color: var(--destructive);
}

.favorite-item {
  position: relative;
}

.favorite-item::after {
  content: 'Click to navigate';
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--text-secondary);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  white-space: nowrap;
  z-index: 100;
  border: 1px solid var(--border);
}

.favorite-item:hover::after {
  opacity: 1;
}

/* Favorites animations */
@keyframes favoriteAdd {
  0% {
    opacity: 0;
    transform: scale(0.8) translateX(-20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateX(0);
  }
}

@keyframes favoriteRemove {
  0% {
    opacity: 1;
    transform: scale(1) translateX(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.8) translateX(20px);
  }
}

.favorite-item.adding {
  animation: favoriteAdd 0.3s ease-out;
}

.favorite-item.removing {
  animation: favoriteRemove 0.3s ease-out;
}

/* Theme-aware favorites styling */
[data-theme="light"] .favorites-section {
  background: var(--card);
  border-color: var(--border);
}

[data-theme="dark"] .favorites-section {
  background: var(--card);
  border-color: var(--border);
}

[data-theme="light"] .favorite-item {
  background: var(--bg-secondary);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .favorite-item {
  background: var(--bg-secondary);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .favorite-item:hover {
  background: var(--bg-hover);
  border-color: var(--ring);
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .favorite-item:hover {
  background: var(--bg-hover);
  border-color: var(--ring);
  box-shadow: var(--shadow-md);
}

[data-theme="light"] .favorite-item .favorite-icon {
  color: var(--primary);
}

[data-theme="dark"] .favorite-item .favorite-icon {
  color: var(--primary);
}

[data-theme="light"] .favorite-item .remove-favorite:hover {
  background: var(--bg-hover);
  color: var(--destructive);
}

[data-theme="dark"] .favorite-item .remove-favorite:hover {
  background: var(--bg-hover);
  color: var(--destructive);
}

/* ===== CONTEXT MENU ===== */

.context-menu {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  min-width: 180px;
  padding: 0.5rem 0;
}

/* Theme-aware context menu styling */
[data-theme="light"] .context-menu {
  background: var(--card);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .context-menu {
  background: var(--card);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

.context-menu.hidden {
  display: none;
}

.context-menu-item {
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.context-menu-item:hover {
  background: var(--bg-hover);
}

.context-menu-item:first-child {
  border-radius: 0.5rem 0.5rem 0 0;
}

.context-menu-item:last-child {
  border-radius: 0 0 0.5rem 0.5rem;
}

.context-menu-item span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===== NOTIFICATIONS ===== */

.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  z-index: 10000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  max-width: 300px;
}

/* Theme-aware notification styling */
[data-theme="light"] .notification {
  background: var(--card);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .notification {
  background: var(--card);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

.notification.show {
  transform: translateX(0);
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.notification-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.notification-message {
  color: var(--text-primary);
  font-size: 0.875rem;
  line-height: 1.4;
}

/* Notification variants */
.notification-success {
  border-left: 4px solid var(--success);
}

.notification-error {
  border-left: 4px solid var(--destructive);
}

.notification-warning {
  border-left: 4px solid var(--warning);
}

.notification-info {
  border-left: 4px solid var(--info);
}

/* ===== MODAL ===== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-overlay .modal-content {
  background: var(--bg-card);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.favorite-item-modal {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

.favorite-item-modal .favorite-icon {
  color: var(--accent-color);
  font-size: 1.25rem;
}

.favorite-item-modal .favorite-name {
  flex: 1;
  color: var(--text-primary);
  font-weight: 500;
}

.favorite-item-modal .favorite-type {
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-transform: capitalize;
  background: var(--bg-hover);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

/* ===== ALERTS ===== */

.alert {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin: 1rem 0;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.alert::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-color);
  border-radius: 2px 0 0 2px;
}

.alert h2 {
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.alert p {
  color: var(--text-secondary);
  margin: 0.5rem 0;
  line-height: 1.6;
}

.alert p:last-child {
  margin-bottom: 0;
}

.alert strong {
  color: var(--text-primary);
  font-weight: 600;
}

.alert details {
  margin-top: 1rem;
}

.alert summary {
  color: var(--accent-color);
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem;
  border-radius: var(--border-radius);
  transition: background-color 0.2s ease;
}

.alert summary:hover {
  background: var(--bg-secondary);
}

.alert pre {
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: var(--border-radius);
  overflow-x: auto;
  margin: 1rem 0;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
}

/* Alert Variants */
.alert-error {
  border-color: #ef4444;
}

.alert-error::before {
  background: #ef4444;
}

.alert-error h2 {
  color: #ef4444;
}

.alert-error p {
  color: #dc2626;
}

/* ===== MATERIAL DATABASE MODAL ===== */

#materialModal {
  z-index: 9999;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

#materialModal .bg-surface {
  max-height: 90vh;
  max-width: calc(
    100vw - 2rem
  ); /* Ensure modal doesn't exceed viewport width minus padding */
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  transition: all 0.3s ease;
}

/* Ensure modal content respects sidebar boundaries on large screens */
@media (min-width: 1024px) {
  #materialModal {
    justify-content: flex-start !important;
    padding-left: 360px !important; /* Account for sidebar width */
    padding-right: 1rem !important;
  }

  #materialModal .bg-surface {
    max-width: calc(
      100vw - 360px - 2rem
    ) !important; /* Account for sidebar width plus padding */
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* Ensure modal is properly positioned on smaller screens */
@media (max-width: 1023px) {
  #materialModal {
    justify-content: center !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  #materialModal .bg-surface {
    margin: 0 auto !important;
  }
}

/* Modal Animation States */
#materialModal[style*='opacity: 0'] {
  opacity: 0 !important;
  transform: scale(0.95) !important;
}

#materialModal[style*='opacity: 1'] {
  opacity: 1 !important;
  transform: scale(1) !important;
}

/* Ensure modal container doesn't overflow */
#materialModal {
  overflow: hidden;
}

/* Ensure modal content is properly contained */
#materialModal .bg-surface {
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

#materialModal .bg-surface::-webkit-scrollbar {
  width: 8px;
}

#materialModal .bg-surface::-webkit-scrollbar-track {
  background: transparent;
}

#materialModal .bg-surface::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

#materialModal .bg-surface::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Material Database Cards */
.material-card {
  transition: all 0.2s ease-in-out;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.material-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: var(--accent-color);
}

.material-card .card-header {
  background: linear-gradient(
    135deg,
    var(--bg-secondary) 0%,
    var(--bg-card) 100%
  );
  border-bottom: 1px solid var(--border);
}

.material-card .card-content {
  background: var(--bg-card);
}

.material-card .card-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

/* Material Properties Grid */
.material-properties .grid > div {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.material-properties .grid > div:hover {
  background: var(--bg-card);
  border-color: var(--accent-color);
  transform: scale(1.02);
}

/* Cutting Data Sections */
.cutting-data > div {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.cutting-data > div:hover {
  background: var(--bg-card);
  border-color: var(--accent-color);
}

/* Material Notes */
.material-notes > div {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.material-notes > div:hover {
  background: var(--bg-card);
  border-color: var(--accent-color);
}

/* Modal Content Cards */
#materialModal .card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

#materialModal .card h3 {
  color: var(--text-primary);
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

#materialModal .card .bg-surface {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all 0.2s ease;
}

#materialModal .card .bg-surface:hover {
  border-color: var(--accent-color);
  transform: translateY(-1px);
}

/* Table Styling in Modal */
#materialModal table {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed; /* Prevent table from expanding beyond container */
}

#materialModal th {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
  text-align: left;
  padding: 12px;
  border-bottom: 2px solid var(--border);
  word-wrap: break-word; /* Allow long text to wrap */
}

#materialModal td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease;
  word-wrap: break-word; /* Allow long text to wrap */
  overflow-wrap: break-word; /* Modern browsers */
}

#materialModal tr:hover td {
  background: var(--bg-secondary);
}

/* Ensure modal content doesn't overflow */
#materialModal .card-content {
  max-width: 100%;
  overflow-x: hidden;
}

#materialModal .overflow-x-auto {
  max-width: 100%;
}

/* Responsive Design for Modal */
@media (max-width: 768px) {
  #materialModal .bg-surface {
    max-width: 95vw;
    margin: 0 10px;
  }

  #materialModal .card-content {
    padding: 1rem;
  }

  .material-properties .grid {
    grid-template-columns: 1fr;
  }

  #materialModal table {
    font-size: 0.875rem;
  }

  #materialModal th,
  #materialModal td {
    padding: 8px;
  }
}

/* ===== NOTIFICATIONS ===== */

.notification {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin: 0.5rem 0;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  transform: translateX(-100%);
  opacity: 0;
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

.notification.removing {
  transform: translateX(100%);
  opacity: 0;
}

.notification-container,
.notification-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  max-width: 400px;
  pointer-events: none;
}

.notification-container .notification,
.notification-stack .notification {
  pointer-events: auto;
  margin-bottom: 0.5rem;
}

/* Notification Variants */
.notification-success {
  border-left: 4px solid #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.notification-info {
  border-left: 4px solid #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.notification-warning {
  border-left: 4px solid #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.notification-error {
  border-left: 4px solid #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.notification-content {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.notification-icon {
  font-size: 1.2rem;
  margin-top: 0.125rem;
}

.notification-message {
  flex: 1;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ===== BADGES ===== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
  white-space: nowrap;
}

.badge-primary {
  background: var(--accent-color);
  color: white;
}

.badge-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.badge-success {
  background: #10b981;
  color: white;
}

.badge-warning {
  background: #f59e0b;
  color: white;
}

.badge-error {
  background: #ef4444;
  color: white;
}

.badge-info {
  background: #3b82f6;
  color: white;
}

/* ===== PROGRESS INDICATORS ===== */

.progress-ring {
  position: relative;
  display: inline-block;
}

.progress-ring-circle {
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.progress-ring-bg {
  fill: none;
  stroke: var(--bg-secondary);
  stroke-width: 8;
}

.progress-ring circle {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dasharray 0.3s ease;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--accent-color),
    var(--accent-color-light)
  );
  border-radius: 4px;
  transition: width 0.3s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 768px) {
  .notification-container,
  .notification-stack {
    right: 0.5rem;
    left: 0.5rem;
    max-width: none;
  }

  .alert {
    padding: 1rem;
    margin: 0.5rem 0;
  }

  .badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
  }
}

@media (max-width: 480px) {
  .alert h2 {
    font-size: 1.1rem;
  }

  .notification {
    padding: 0.75rem;
  }

  .progress-bar {
    height: 6px;
  }
}

/* ===== COMPACT MATERIAL CARDS ===== */

.material-card-compact {
  min-height: 120px;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
  background-color: var(--surface);
}

.material-card-compact:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

.category-section {
  border-radius: 0.5rem;
  overflow: hidden;
}

.category-header {
  transition: background-color 0.2s ease;
}

.category-header:hover {
  background-color: var(--surface-variant-hover, #f3f4f6);
}

.category-toggle {
  transition: transform 0.3s ease;
}

.category-materials {
  transition: all 0.3s ease;
}

.category-materials.hidden {
  display: none;
}

.category-indicator {
  flex-shrink: 0;
}

.material-count {
  font-weight: 500;
}

.category-badge-compact {
  flex-shrink: 0;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.property-compact {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Click to expand button styling */
.material-card-compact .click-to-expand {
  display: inline-block;
  background-color: var(--primary);
  color: var(--primary-foreground);
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.material-card-compact .click-to-expand:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.material-card-compact .click-to-expand:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Responsive grid adjustments */
@media (max-width: 640px) {
  .category-materials {
    grid-template-columns: repeat(1, 1fr);
  }
}

@media (min-width: 641px) and (max-width: 768px) {
  .category-materials {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .category-materials {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Drill Size Cards */
.drill-details {
  transition: all 0.2s ease-in-out;
}

.drill-details.hidden {
  display: none !important;
}

.expand-arrow {
  transition: transform 0.2s ease-in-out;
}

.expand-arrow.rotate-180 {
  transform: rotate(180deg);
}

/* Search Interface */
#drillSearchInput,
#searchTolerance {
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.2s ease-in-out;
  min-height: 2.5rem;
}

#drillSearchInput:focus,
#searchTolerance:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(132, 83, 9, 0.1);
}

#searchDrillsBtn {
  min-height: 2.5rem;
  white-space: nowrap;
}

#searchResults {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.75rem;
}

/* Drill Size Grid */
#drillSizesGrid .card {
  transition: all 0.2s ease-in-out;
}

#drillSizesGrid .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-header-clickable {
  cursor: pointer;
  user-select: none;
}

.card-header-clickable:hover {
  background-color: var(--bg-hover);
  border-radius: 0.375rem;
}

/* Global Results Container */
.global-results-container {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.global-results-container:empty {
  display: none;
}

.global-results-container h3,
.global-results-container h4 {
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.global-results-container .result-item {
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary-color);
}

.global-results-container .result-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color);
}

.global-results-container .result-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.global-results-container .result-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

/* Results Animation */
.global-results-container {
  animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* PWA Install Banner */
#pwaInstallBanner {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-lg);
  padding: 1rem 1.25rem;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 90vw;
  width: 540px;
}

#pwaInstallBanner.hidden {
  display: none;
}

#pwaInstallBanner .pwa-install-text {
  color: var(--text-primary);
  font-weight: 500;
}

#pwaInstallBanner .pwa-install-subtext {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

#pwaInstallBanner .pwa-install-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

@media (max-width: 640px) {
  #pwaInstallBanner {
    flex-direction: column;
    align-items: flex-start;
    width: calc(100vw - 2rem);
  }

  #pwaInstallBanner .pwa-install-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
