/* ============================================================================
   Etchant Selector Page Styles
   ============================================================================ */

.etchant-selector-page {
  padding: 60px 20px;
  padding-top: 8rem;
  min-height: 80vh;
  font-family: 'Inter', 'Roboto', Arial, sans-serif;
}

@media (min-width: 768px) {
  .etchant-selector-page {
    padding-top: 9rem;
  }
}

@media (min-width: 1024px) {
  .etchant-selector-page {
    padding-top: 10rem;
  }
}

.max-w-5xl {
  max-width: 64rem;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

/* Header */
.selector-header {
  margin-bottom: 2rem;
  text-align: left;
}

.selector-header h1 {
  font-size: 2.5em;
  font-weight: 700;
  color: #292929;
  margin-bottom: 0.5rem;
  letter-spacing: 1px;
}

.selector-intro {
  font-size: 1.125em;
  color: #333;
  line-height: 1.8;
  text-align: justify;
}

/* Selector Cards */
.selector-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 40px 30px;
  margin-bottom: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  animation: fadeInUp 0.4s ease-out;
}

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

.selector-card:focus-within {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  border-color: #cbd5e1;
}

@media (min-width: 768px) {
  .selector-card {
    padding: 2rem;
  }
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #2d5a87, #2d3c4e);
  color: #fff;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(45, 90, 135, 0.2);
}

.card-header h2 {
  font-size: 1.75em;
  font-weight: 600;
  color: #292929;
  margin: 0;
  flex: 1;
  border-bottom: 2px solid #292929;
  padding-bottom: 10px;
}

.optional-label {
  font-size: 0.875rem;
  font-weight: 400;
  color: #6b7280;
}

.reset-btn,
.clear-filters-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: #6b7280;
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.reset-btn:hover,
.clear-filters-btn:hover {
  color: #374151;
  border-color: #d1d5db;
  background: #f9fafb;
  transform: scale(1.05);
}

.reset-btn:active,
.clear-filters-btn:active {
  transform: scale(0.98);
}

.reset-btn:focus,
.clear-filters-btn:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Common Materials */
.common-materials {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.common-materials-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.75rem;
}

.common-materials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .common-materials-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.common-material-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
  gap: 0.25rem;
}

.common-material-btn:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2);
}

.common-material-btn:active {
  transform: translateY(0);
}

.common-material-icon {
  width: 1.5rem;
  height: 1.5rem;
  margin-bottom: 0.25rem;
  color: #2d5a87;
  flex-shrink: 0;
}

.common-material-icon svg {
  width: 100%;
  height: 100%;
}

.common-material-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #374151;
  text-align: center;
}

/* Material Search */
.material-search-wrapper {
  position: relative;
  margin-bottom: 1rem;
}

.search-input-wrapper {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  color: #6b7280;
  pointer-events: none;
  z-index: 1;
  flex-shrink: 0;
}

.material-search-input {
  width: 100% !important;
  padding-left: 3.5rem !important; /* 1rem (icon left) + 1.25rem (icon width) + 1.25rem (gap) = 3.5rem */
  padding-right: 1rem !important;
  padding-top: 0.75rem !important;
  padding-bottom: 0.75rem !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 0.5rem !important;
  font-size: 1rem !important;
  color: #111827 !important;
  background-color: #fff !important;
  transition: all 0.2s;
  outline: none;
}

.material-search-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.material-search-input::placeholder {
  color: #9ca3af;
  opacity: 1;
}

.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.5rem;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  max-height: 20rem;
  overflow-y: auto;
  z-index: 50;
  display: none;
  animation: slideDown 0.2s ease-out;
}

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

.search-results-dropdown::-webkit-scrollbar {
  width: 8px;
}

.search-results-dropdown::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 0 0.75rem 0.75rem 0;
}

.search-results-dropdown::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.search-results-dropdown::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.search-result-item {
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  border: none;
  border-bottom: 1px solid #f3f4f6;
  background: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

.search-result-item:hover {
  background: #eff6ff;
  transform: translateX(4px);
}

.search-result-item {
  transition: all 0.2s ease;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-name {
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.25rem;
}

.search-result-details {
  font-size: 0.875rem;
  color: #6b7280;
}

.search-result-empty {
  padding: 1rem;
  text-align: center;
  color: #6b7280;
}

/* Selected Material Display */
.selected-material-display {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: linear-gradient(to right, #eff6ff, #dbeafe);
  border: 2px solid #93c5fd;
  border-radius: 0.75rem;
}

.selected-material-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.selected-material-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.selected-material-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
  flex: 1;
}

.featured-badge {
  padding: 0.25rem 0.75rem;
  background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
  color: #2d5a87;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border: 1px solid rgba(45, 90, 135, 0.1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.featured-badge svg {
  width: 0.875rem;
  height: 0.875rem;
  color: #2d5a87;
}

.clear-material-btn {
  padding: 0.5rem;
  color: #6b7280;
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.clear-material-btn:hover {
  color: #374151;
  background: #fff;
}

.selected-material-details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #374151;
}

@media (min-width: 640px) {
  .selected-material-details {
    grid-template-columns: repeat(2, 1fr);
  }
}

.hardness-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
}

/* Purpose and Context Grids */
.purpose-grid,
.context-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .purpose-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .context-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .purpose-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.purpose-btn,
.context-btn {
  position: relative;
  text-align: left;
  padding: 1rem;
  border: 2px solid #d1d5db;
  border-radius: 0.75rem;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
}

.purpose-btn:hover,
.context-btn:hover {
  border-color: #93c5fd;
  background: #f9fafb;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.15);
}

.purpose-btn:active,
.context-btn:active {
  transform: translateY(0);
}

.purpose-btn.active,
.context-btn.active {
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.purpose-indicator,
.context-indicator {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 0.5rem;
  height: 0.5rem;
  background: #3b82f6;
  border-radius: 50%;
}

.purpose-icon,
.context-icon {
  width: 1.5rem;
  height: 1.5rem;
  margin-bottom: 0.5rem;
  color: #2d5a87;
  flex-shrink: 0;
}

.purpose-icon svg,
.context-icon svg {
  width: 100%;
  height: 100%;
}

.purpose-content,
.context-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.purpose-label,
.context-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: #111827;
}

.purpose-description,
.context-description {
  font-size: 0.75rem;
  color: #6b7280;
}

/* Etchant Matches */
.etchant-matches {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.etchant-match-card {
  position: relative;
  display: block;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 30px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.etchant-match-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #2d5a87, #2d3c4e);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.etchant-match-card:hover {
  border-color: #2d5a87;
  box-shadow: 0 12px 32px rgba(45, 90, 135, 0.15), 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px);
}

.etchant-match-card:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.etchant-match-card:hover::before {
  transform: scaleX(1);
}

.match-score-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0.25rem;
  border-radius: 0.75rem 0.75rem 0 0;
}

.score-green {
  background: #10b981;
}

.score-blue {
  background: #3b82f6;
}

.score-yellow {
  background: #f59e0b;
}

.score-gray {
  background: #9ca3af;
}

.match-card-content {
  padding-top: 0.5rem;
}

.match-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.rank-badge {
  padding: 0.25rem 0.75rem;
  background: #3b82f6;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 9999px;
}

.available-badge {
  padding: 0.25rem 0.75rem;
  background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
  color: #2d5a87;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border: 1px solid rgba(45, 90, 135, 0.1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.available-badge svg {
  width: 0.875rem;
  height: 0.875rem;
  color: #2d5a87;
}

.match-main {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 1rem;
  gap: 1rem;
}

.match-name {
  font-size: 1.5em;
  font-weight: 600;
  color: #292929;
  margin: 0;
  flex: 1;
  transition: color 0.3s ease;
}

.etchant-match-card:hover .match-name {
  color: #2d5a87;
}

.match-score-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
}

.match-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.reason-badge {
  padding: 0.25rem 0.5rem;
  background: #f8f9fa;
  color: #333;
  font-size: 0.95em;
  font-weight: 500;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.expert-tips {
  padding: 12px 16px;
  background: #f8f9fa;
  border-left: 3px solid #2d5a87;
  border-radius: 4px;
  margin-bottom: 20px;
}

.tips-header {
  font-size: 1em;
  font-weight: 600;
  color: #2d5a87;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.tips-header svg {
  width: 0.875rem;
  height: 0.875rem;
  color: #2d5a87;
}

.tip-text {
  font-size: 1em;
  color: #333;
  margin-bottom: 10px;
  line-height: 1.8;
}

.tip-text:last-child {
  margin-bottom: 0;
}

.warnings {
  padding: 12px 16px;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  margin-bottom: 20px;
}

.warnings-header {
  font-size: 1em;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.warnings-header svg {
  width: 0.875rem;
  height: 0.875rem;
  color: #f59e0b;
}

.warning-text {
  font-size: 1em;
  color: #333;
  margin-bottom: 10px;
  line-height: 1.8;
}

.warning-text:last-child {
  margin-bottom: 0;
}

.match-details {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 1.125em;
  color: #333;
  margin-bottom: 20px;
  line-height: 1.8;
}

.match-reveals {
  font-size: 1.125em;
  color: #333;
  margin-bottom: 20px;
  line-height: 1.8;
}

.match-footer {
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
}

.view-details {
  font-size: 0.875rem;
  font-weight: 600;
  color: #3b82f6;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.results-count {
  font-size: 0.875rem;
  font-weight: 400;
  color: #6b7280;
  margin-left: 0.5rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-icon {
  color: #9ca3af;
  margin: 0 auto 1rem;
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: #6b7280;
  margin-bottom: 1.5rem;
}

.empty-state-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: #3b82f6;
  color: #fff;
}

.btn-primary:hover {
  background: #2563eb;
  color: #fff;
}

.btn-secondary {
  background: #e5e7eb;
  color: #374151;
}

.btn-secondary:hover {
  background: #d1d5db;
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 3rem 1rem;
}

.spinner {
  width: 4rem;
  height: 4rem;
  border: 4px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.loading-state p {
  font-size: 1.125rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.loading-subtext {
  font-size: 0.875rem;
  color: #9ca3af;
}

/* Progressive Etching Section */
.progressive-etching-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #f3e8ff;
  border: 1px solid #c084fc;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.sequence-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: #9333ea;
  color: #fff;
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.sequence-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: #6b21a8;
}

.progressive-etching-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: linear-gradient(to right, #f3e8ff, #e9d5ff);
  border: 2px solid #c084fc;
  border-radius: 0.75rem;
}

.progressive-header {
  display: flex;
  align-items: start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.progressive-icon {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  color: #2d5a87;
}

.progressive-icon svg {
  width: 100%;
  height: 100%;
}

.progressive-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.5rem 0;
}

.progressive-description {
  font-size: 0.875rem;
  color: #374151;
  margin: 0;
  line-height: 1.6;
}

.progressive-sequence {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.progressive-step {
  display: flex;
  align-items: start;
  gap: 1rem;
  padding: 1rem;
  background: #fff;
  border-radius: 0.5rem;
  border: 1px solid #c084fc;
}

.step-number-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: #9333ea;
  color: #fff;
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
}

.step-etchant-name {
  display: block;
  font-weight: 600;
  font-size: 1rem;
  color: #111827;
  margin-bottom: 0.5rem;
  text-decoration: none;
}

.step-etchant-name:hover {
  color: #9333ea;
  text-decoration: underline;
}

.step-reveals {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.step-tip {
  font-size: 0.75rem;
  color: #3b82f6;
  font-style: italic;
  margin-top: 0.5rem;
}

.progressive-note {
  padding: 0.75rem;
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  border-radius: 0 0.5rem 0.5rem 0;
}

.note-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.note-header svg {
  width: 0.875rem;
  height: 0.875rem;
  color: #f59e0b;
}

.note-text {
  font-size: 0.75rem;
  color: #78350f;
  line-height: 1.5;
}

.match-typical-results {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}
