/* Mode Styles CSS - Tap Macro v1.3.0 */
/* Mode-specific styles for tap, drill, milling, and ream modes */

/* ===== DRILL SIZES MODE STYLES ===== */

.drill-sizes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.drill-size-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  hover:shadow-md;
}

.drill-size-card:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.drill-size-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.drill-size-card .card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
}

.drill-size-card .card-category {
  font-size: 0.9rem;
  color: var(--muted-foreground);
  background: var(--accent);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
}

.drill-size-card .card-diameter {
  font-family: monospace;
  font-size: 1rem;
  color: var(--foreground);
  margin: 0.5rem 0;
}

.drill-size-card .card-details {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.drill-size-card .details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.drill-size-card .detail-item {
  margin-bottom: 0.5rem;
}

.drill-size-card .detail-label {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.drill-size-card .detail-value {
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--foreground);
}

.expand-arrow {
  transition: transform 0.2s ease;
}

.expand-arrow.rotate-180 {
  transform: rotate(180deg);
}

/* ===== THREE WIRE MODE STYLES ===== */

.three-wire-form {
  margin-bottom: 1.25rem;
}

.three-wire-image-container {
  text-align: center;
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.three-wire-image {
  max-width: 300px;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
  .three-wire-image {
    max-width: 300px;
  }
}

@media (max-width: 480px) {
  .three-wire-image {
    max-width: 250px;
  }
}

.thread-legend {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.thread-legend h4 {
  margin: 0 0 1rem 0;
  color: var(--foreground);
  font-size: 1.1rem;
  font-weight: 600;
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

.legend-text {
  color: var(--muted-foreground);
  font-weight: 500;
}

/* Thread type color coding */
.thread-metric {
  background: #3b82f6;
}

.thread-npt {
  background: #ef4444;
}

.thread-unc-unf {
  background: #10b981;
}

.thread-bspp-bspt {
  background: #f59e0b;
}

.thread-acme {
  background: #8b5cf6;
}

/* Three Wire Form Elements */
.three-wire-form .form-group {
  margin-bottom: 1.25rem;
}

.three-wire-form .form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--foreground);
  font-size: 0.875rem;
}

.three-wire-form .form-select,
.three-wire-form .form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--foreground);
  font-size: 0.875rem;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.three-wire-form .form-select:focus,
.three-wire-form .form-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(132, 83, 9, 0.1);
}

.three-wire-form .form-select:hover,
.three-wire-form .form-input:hover {
  border-color: var(--ring);
}

.three-wire-form .form-select option {
  background: var(--card);
  color: var(--foreground);
  padding: 0.5rem;
}

.three-wire-form .form-select {
  background: var(--card) !important;
}

/* Custom Select Styling */
.custom-select-container {
  position: relative;
  width: 100%;
}

.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--foreground);
  font-size: 0.875rem;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.custom-select-trigger:hover {
  border-color: var(--ring);
}

.custom-select-trigger:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(132, 83, 9, 0.1);
}

.custom-select-arrow {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.custom-select-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.custom-select-options.open {
  display: block;
}

.custom-select-option {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid var(--border);
}

.custom-select-option:last-child {
  border-bottom: none;
}

.custom-select-option:hover {
  background-color: var(--muted);
}

/* Thread type color coding for custom select */
.custom-select-option.thread-metric {
  border-left: 4px solid #3b82f6;
}

.custom-select-option.thread-npt {
  border-left: 4px solid #ef4444;
}

.custom-select-option.thread-unc-unf {
  border-left: 4px solid #10b981;
}

.custom-select-option.thread-bspp-bspt {
  border-left: 4px solid #f59e0b;
}

.custom-select-option.thread-acme {
  border-left: 4px solid #8b5cf6;
}

/* Thread Type Indicator */
.thread-type-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
}

.indicator-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.indicator-text {
  color: var(--foreground);
  font-weight: 500;
}

/* Three Wire Results Styling */
.three-wire-results .results-table {
  margin-bottom: 1.25rem;
}

.three-wire-results .highlighted-result {
  background: var(--accent);
  border-left: 4px solid var(--accent);
}

.three-wire-results .highlighted-result td {
  font-weight: 600;
  color: var(--accent-foreground);
}

.calculation-notes {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 1.25rem;
}

.calculation-notes h4 {
  margin: 0 0 1rem 0;
  color: var(--foreground);
  font-size: 1.1rem;
  font-weight: 600;
}

.calculation-notes .note {
  margin: 0.5rem 0;
  color: var(--muted-foreground);
  line-height: 1.5;
}

.calculation-notes .note strong {
  color: var(--foreground);
  font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .legend-items {
    flex-direction: column;
    gap: 0.75rem;
  }

  .three-wire-image {
    max-width: 90%;
  }
}

/* ===== ENHANCED TAP MODE STYLES ===== */

/* Enhanced Tap Header */
.tap-header.enhanced {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--accent-color)
  );
  color: white;
  padding: 1.5rem;
  border-radius: var(--border-radius-lg);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.tap-header.enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 70%
  );
  animation: shimmer 3s infinite;
}

.tap-header.enhanced .header-content {
  position: relative;
  z-index: 2;
}

.tap-header.enhanced h2 {
  font-size: 2.5rem;
  margin: 0 0 0.5rem 0;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tap-header.enhanced p {
  font-size: 1.1rem;
  margin: 0 0 1rem 0;
  opacity: 0.9;
  line-height: 1.5;
}

.header-features {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.feature-badge {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.header-icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.tap-icon-container {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.tap-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* ===== TORQUE SPECS MODE STYLES ===== */

.torque-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.torque-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.torque-title {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.torque-description {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.torque-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.torque-left,
.torque-right {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.input-card.enhanced,
.results-card.enhanced,
.info-card.enhanced {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-group.enhanced {
  margin-bottom: 1.25rem;
}

.input-label {
  display: block;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.label-icon {
  font-size: 1.1rem;
}

.input-field.enhanced {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.input-field.enhanced:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(132, 83, 9, 0.1);
}

.input-field.enhanced:hover {
  border-color: var(--ring);
}

.torque-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--ring);
  color: white;
  border-color: var(--ring);
}

.btn-primary:hover {
  background: var(--ring);
  opacity: 0.9;
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--ring);
}

.btn-secondary {
  background: var(--accent);
  color: var(--accent-foreground);
  border-color: var(--accent);
}

.btn-secondary:hover {
  background: var(--accent);
  opacity: 0.9;
}

.torque-results {
  min-height: 200px;
}

.torque-placeholder {
  text-align: center;
  color: var(--text-secondary);
  padding: 1.5rem;
}

.torque-result {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.result-row:last-child {
  border-bottom: none;
}

.result-final {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--success);
  border-top: 2px solid var(--success);
  border-bottom: none;
  padding-top: 1rem;
  margin-top: 0.5rem;
}

.result-divider {
  height: 2px;
  background: var(--border);
  margin: 1.5rem 0;
  border-radius: 1px;
}

.result-section {
  margin: 1.25rem 0;
}

.result-section h4 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-value.safe {
  color: var(--success);
}

.result-value.warning {
  color: var(--warning);
}

.result-value.danger {
  color: var(--destructive);
}

.result-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.result-value {
  color: var(--text-primary);
  font-weight: 600;
}

.result-note {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 0.5rem;
  border-left: 4px solid var(--warning);
}

.result-note p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.torque-error {
  text-align: center;
  color: var(--destructive);
  padding: 1.5rem;
}

.torque-recommendations {
  padding: 1rem;
}

.torque-recommendations h4 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.recommendation-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.recommendation-item:last-child {
  border-bottom: none;
}

.safety-margin-warning {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.warning-item {
  padding: 0.75rem;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.warning-item.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--destructive);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.warning-item.warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.warning-item.safe {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.torque-info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.torque-info p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.torque-info strong {
  color: var(--text-primary);
}

/* Responsive Design for Torque Specs */
@media (max-width: 768px) {
  .torque-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  
  .torque-actions {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ===== FORMULAS MODE STYLES ===== */

.formulas-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.formulas-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.formulas-header h2 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 2rem;
}

.formulas-description {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.6;
}

.search-controls-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.search-controls-card .card-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  border-radius: 0.75rem 0.75rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-controls-card .card-icon {
  font-size: 1.5rem;
}

.search-controls-card h3 {
  color: var(--text-primary);
  margin: 0;
  font-size: 1.25rem;
}

.search-controls-card .card-content {
  padding: 1.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.search-group {
  flex: 1;
}

/* Search input styling for Formulas mode */
.search-group .form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.search-group .form-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(132, 83, 9, 0.1);
}

.search-group .form-input:hover {
  border-color: var(--ring);
}

.search-group .form-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

/* Unit Preference dropdown styling for Formulas mode */
.form-row .form-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.form-row .form-select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(132, 83, 9, 0.1);
}

.form-row .form-select:hover {
  border-color: var(--ring);
}

.form-row .form-select option {
  background: var(--bg-input);
  color: var(--text-primary);
  padding: 0.5rem;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.action-buttons .btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.action-buttons .btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.action-buttons .btn-secondary:hover {
  background: var(--secondary-hover, #d4b17a);
  transform: translateY(-1px);
}

.formulas-list-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.formula-category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.formula-category-card .category-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.formula-category-card .category-toggle {
  width: 100%;
  background: none;
  border: none;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
}

.formula-category-card .category-toggle:hover {
  background: var(--bg-hover);
}

.formula-category-card .toggle-icon {
  transition: transform 0.2s ease;
}

.formula-category-card .category-title {
  flex: 1;
  text-align: left;
}

.formula-category-card .formula-count {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.formula-category-card .category-content {
  padding: 1.5rem;
}

.formula-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  transition: all 0.2s ease;
}

.formula-card:last-child {
  margin-bottom: 0;
}

.formula-card:hover {
  border-color: var(--ring);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.formula-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.formula-name {
  color: var(--text-primary);
  margin: 0;
  font-size: 1.25rem;
}

.bookmark-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.bookmark-btn:hover {
  color: var(--warning);
  transform: scale(1.1);
}

.bookmark-btn.bookmarked {
  color: var(--warning);
}

.formula-details {
  margin-bottom: 1.25rem;
}

.detail-row {
  display: flex;
  margin-bottom: 0.75rem;
  align-items: flex-start;
}

.detail-row:last-child {
  margin-bottom: 0;
}

.detail-label {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 120px;
  flex-shrink: 0;
}

.detail-value {
  color: var(--text-secondary);
  flex: 1;
}

.formula-text {
  font-family: 'Courier New', monospace;
  background: var(--bg-card);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid var(--border);
}

.calculator-section {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.calc-toggle-btn {
  width: 100%;
  margin-bottom: 1rem;
}

.calculator-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
}

.calc-inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.calc-inputs-grid .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.calc-inputs-grid .input-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.calc-inputs-grid .form-input,
.calc-inputs-grid .form-select {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.calc-inputs-grid .form-input:focus,
.calc-inputs-grid .form-select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(132, 83, 9, 0.1);
}

.calc-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.calc-result-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.result-icon {
  font-size: 1.2rem;
}

.result-value {
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  padding: 0.25rem;
  background: var(--bg-card);
  border-radius: 0.25rem;
  border: 1px solid var(--border);
}

.result-value.result-success {
  color: var(--success);
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.1);
}

.help-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.help-card .card-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  border-radius: 0.75rem 0.75rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.help-card h3 {
  color: var(--text-primary);
  margin: 0;
  font-size: 1.25rem;
}

.help-card .card-content {
  padding: 1.5rem;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.help-item {
  text-align: center;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.help-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  display: block;
}

.help-item h4 {
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
}

.help-item p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.4;
}

.categories-info h4 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.categories-info p {
  color: var(--text-secondary);
  margin: 0 0 0.5rem 0;
  font-size: 0.875rem;
  line-height: 1.4;
}

.categories-info strong {
  color: var(--text-primary);
  font-weight: 600;
}

.calc-error-message {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--destructive);
  color: var(--destructive-foreground);
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.error-icon {
  font-size: 1.2rem;
}

.error-text {
  font-weight: 500;
}

/* ===== ENHANCED DRILL MODE STYLES ===== */

/* Enhanced Drill Table */
.drill-table.enhanced {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--bg-card);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 2px solid var(--border-color);
}

.drill-table.enhanced th {
  color: white;
  padding: 14px 10px;
  text-align: left;
  font-weight: 700;
  font-size: 0.9rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  border-bottom: 2px solid var(--border-color);
}

.drill-table.enhanced td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  font-weight: 500;
  color: var(--text-primary);
}

.drill-table.enhanced td strong {
  color: var(--text-primary);
  font-weight: 600;
}

.drill-table.enhanced .engagement-bar {
  margin: 0 auto;
  max-width: 120px;
}

.drill-table.enhanced tr:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.drill-table.enhanced tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

.drill-table.enhanced tr:nth-child(even):hover {
  background: var(--bg-hover);
}

/* Optimal Drill Highlighting */
.optimal-drill {
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.15),
    rgba(52, 211, 153, 0.08)
  ) !important;
  border-left: 4px solid #10b981;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.1);
}

.optimal-drill:hover {
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.2),
    rgba(52, 211, 153, 0.12)
  ) !important;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.2);
}

.drill-size.optimal {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
  padding: 6px 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.85rem;
  border: 2px solid #34d399;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
}

/* Engagement Bar */
.engagement-bar {
  position: relative;
  width: 100%;
  height: 24px;
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-color);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.engagement-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, #059669, #10b981, #34d399);
  border-radius: 10px;
  transition: width 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.engagement-text {
  position: relative;
  z-index: 2;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8);
  padding: 2px 6px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

/* Quality Badges */
.quality-badge {
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
  text-align: center;
  min-width: 80px;
  display: inline-block;
  border: 2px solid transparent;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.quality-badge.quality-excellent {
  background: #059669;
  border-color: #10b981;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.4);
}

.quality-badge.quality-good {
  background: #2563eb;
  border-color: #3b82f6;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.4);
}

.quality-badge.quality-acceptable {
  background: #d97706;
  border-color: #f59e0b;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.4);
}

.quality-badge.quality-poor {
  background: #dc2626;
  border-color: #ef4444;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
}

/* Drill Summary */
.drill-summary {
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: var(--border-radius);
  margin: 1rem 0;
  border: 1px solid var(--border-color);
}

.drill-summary h4 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.drill-summary p {
  margin: 0.25rem 0;
  color: var(--text-secondary);
}

/* Enhanced Gauge Table */
.gauge-table.enhanced {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--bg-card);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.gauge-table.enhanced th {
  background: var(--accent-color);
  color: white;
  padding: 12px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ===== REAM MODE SPECIFIC STYLES ===== */

.ream-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

.ream-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 1.25rem;
  align-items: start;
}

.ream-left {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.ream-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.ream-header h3 {
  font-size: 2.5rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-weight: 600;
}

.ream-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

.ream-unit-toggle {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
}

.ream-unit-toggle .unit-option {
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--border);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--bg-card);
  color: var(--text-primary);
}

.ream-unit-toggle .unit-option:hover {
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

.ream-unit-toggle input[type='radio'] {
  display: none;
}

.ream-unit-toggle .unit-label {
  font-weight: 600;
  cursor: pointer;
}

.ream-input-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.ream-input-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.ream-card-title {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  font-weight: 600;
  text-align: center;
}

.ream-input-group {
  margin-bottom: 1.25rem;
}

.ream-input-group:last-child {
  margin-bottom: 0;
}

.ream-input-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-weight: 600;
}

.ream-input,
.ream-select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: all 0.3s ease;
  background: var(--bg-input);
  color: var(--text-primary);
}

.ream-input:focus,
.ream-select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ream-help {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  font-style: italic;
}

.ream-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.25rem;
}

.ream-btn {
  padding: 1rem 2rem;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ream-btn-primary {
  background: var(--accent-color);
  color: white;
}

.ream-btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

.ream-btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 2px solid var(--border);
}

.ream-btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent-color);
}

.ream-btn .btn-icon {
  font-size: 1.2rem;
}

.ream-btn .btn-text {
  font-weight: 600;
}

/* Ream Results */
.ream-results-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.ream-results-header h3 {
  font-size: 2rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.ream-results-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.ream-results-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.ream-placeholder {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}

.ream-placeholder-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.ream-placeholder-text {
  font-size: 1.2rem;
  font-weight: 500;
}

.ream-results-grid,
.ream-recommendations-grid,
.ream-strategy-grid,
.ream-process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.ream-result-item,
.ream-recommendation-item,
.ream-strategy-item,
.ream-process-item {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.ream-result-item:hover,
.ream-recommendation-item:hover,
.ream-strategy-item:hover,
.ream-process-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.ream-result-icon,
.ream-recommendation-icon,
.ream-strategy-icon,
.ream-process-icon {
  font-size: 2rem;
  color: var(--accent-color);
  margin-bottom: 1rem;
  text-align: center;
}

.ream-result-content,
.ream-recommendation-content,
.ream-strategy-content,
.ream-process-content {
  text-align: center;
}

.ream-result-label,
.ream-recommendation-label,
.ream-strategy-label,
.ream-process-label {
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 768px) {
  .ream-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .ream-unit-toggle {
    flex-direction: column;
    align-items: center;
  }

  .ream-actions {
    flex-direction: column;
  }

  .ream-results-grid,
  .ream-recommendations-grid,
  .ream-strategy-grid,
  .ream-process-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== TAP CARD LAYOUT ===== */
.tap-container {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  /* Override conflicting styles from main styles.css */
  margin-left: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

.tap-layout {
  display: grid;
  gap: 1.25rem;
}

/* Override the conflicting .tap-input-section styles from main styles.css */
.tap-container .tap-input-section {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
}

.tap-input-section h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.tap-input-section .description {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 1rem;
  line-height: 1.5;
}

/* ===== THREAD MILL CARD LAYOUT ===== */
.thread-mill-container {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  /* Override conflicting styles from main styles.css */
  margin-left: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

/* Thread Milling Form Consistency */
.thread-mill-form .form-group {
  margin-bottom: 1.25rem;
}

.thread-mill-form .form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--foreground);
  font-size: 0.875rem;
}

.thread-mill-form .form-select,
.thread-mill-form .input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--foreground);
  font-size: 0.875rem;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.thread-mill-form .form-select:focus,
.thread-mill-form .input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(132, 83, 9, 0.1);
}

.thread-mill-form .form-select:hover,
.thread-mill-form .input:hover {
  border-color: var(--ring);
}

.thread-mill-form .form-select option {
  background: var(--card);
  color: var(--foreground);
  padding: 0.5rem;
}

/* Ensure all form elements look consistent */
.thread-mill-form select,
.thread-mill-form input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 0.75rem !important;
  color: var(--foreground) !important;
  font-size: 0.875rem !important;
  transition: all 0.2s ease !important;
}

.thread-mill-form select:hover,
.thread-mill-form input:hover {
  border-color: var(--ring) !important;
}

.thread-mill-form select:focus,
.thread-mill-form input:focus {
  border-color: var(--ring) !important;
  box-shadow: 0 0 0 3px rgba(132, 83, 9, 0.1) !important;
}

.thread-mill-layout {
  display: grid;
  gap: 1.25rem;
}

/* Override the conflicting .thread-mill-input-section styles from main styles.css */
.thread-mill-container .thread-mill-input-section {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
}

.thread-mill-input-section h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.thread-mill-input-section .description {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 1rem;
  line-height: 1.5;
}

/* ===== FANUC GLOSSARY CARD LAYOUT ===== */
.fanuc-glossary-container {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  /* Override conflicting styles from main styles.css */
  margin-left: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

.fanuc-glossary-layout {
  display: grid;
  gap: 1.25rem;
}

/* Override the conflicting .fanuc-glossary-input-section styles from main styles.css */
.fanuc-glossary-container .fanuc-glossary-input-section {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
}

.fanuc-glossary-input-section h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.fanuc-glossary-input-section .description {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 1rem;
  line-height: 1.5;
}

/* ===== PIPE PRESSURE CARD LAYOUT ===== */
.pipe-pressure-container {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  /* Override conflicting styles from main styles.css */
  margin-left: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

.pipe-pressure-layout {
  display: grid;
  gap: 1.25rem;
}

/* Override the conflicting .pipe-pressure-input-section styles from main styles.css */
.pipe-pressure-container .pipe-pressure-input-section {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
}

.pipe-pressure-input-section h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.pipe-pressure-input-section .description {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 1rem;
  line-height: 1.5;
}

/* ===== O-RING CARD LAYOUT ===== */
.o-ring-container {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  /* Override conflicting styles from main styles.css */
  margin-left: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

/* O-Ring Cutter Form Styles */
.o-ring-form {
  margin-bottom: 1.25rem;
}

.o-ring-form .form-group {
  margin-bottom: 1.25rem;
}

.o-ring-form .form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--foreground);
  font-size: 0.875rem;
}

.o-ring-form .form-select,
.o-ring-form .input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--foreground);
  font-size: 0.875rem;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.o-ring-form .form-select:focus,
.o-ring-form .input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(132, 83, 9, 0.1);
}

.o-ring-form .form-select:hover,
.o-ring-form .input:hover {
  border-color: var(--ring);
}

.o-ring-form .form-select option {
  background: var(--card);
  color: var(--foreground);
  padding: 0.5rem;
}

/* O-Ring Standards Reference */
.o-ring-standards {
  margin: 1.5rem 0;
  padding: 1.5rem;
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.o-ring-standards h4 {
  margin: 0 0 1.5rem 0;
  color: var(--foreground);
  font-size: 1.2rem;
  font-weight: 600;
}

.standards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.standard-item {
  padding: 1rem;
  background: var(--muted);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.standard-item h5 {
  margin: 0 0 0.5rem 0;
  color: var(--foreground);
  font-size: 1rem;
  font-weight: 600;
}

.standard-item p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  line-height: 1.4;
}

/* O-Ring Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.result-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--space-block, 0.75rem);
}

.result-section h4 {
  margin: 0 0 0.5rem 0;
  color: var(--foreground);
  font-size: 1.1rem;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}

.o-ring-layout {
  display: grid;
  gap: 1.25rem;
}

/* Override the conflicting .o-ring-input-section styles from main styles.css */
.o-ring-container .o-ring-input-section {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
}

.o-ring-input-section h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.o-ring-input-section .description {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 1rem;
  line-height: 1.5;
}

.input-with-button {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.input-with-button .form-select {
  flex: 1;
}

.input-with-button .action-btn {
  white-space: nowrap;
}

/* ===== MATERIAL DATA CARD LAYOUT ===== */
.material-data-container {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  /* Override conflicting styles from main styles.css */
  margin-left: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

.material-data-layout {
  display: grid;
  gap: 1.25rem;
}

/* Override the conflicting .material-data-input-section styles from main styles.css */
.material-data-container .material-data-input-section {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
}

.material-data-input-section h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.material-data-input-section .description {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 1rem;
  line-height: 1.5;
}

.checkbox-group {
  display: flex;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-checkbox {
  width: 1.2rem;
  height: 1.2rem;
  cursor: pointer;
}

/* ===== SINE BAR CARD LAYOUT ===== */
.sine-bar-container {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  /* Override conflicting styles from main styles.css */
  margin-left: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

.sine-bar-layout {
  display: grid;
  gap: 1.25rem;
}

/* Override the conflicting .sine-bar-input-section styles from main styles.css */
.sine-bar-container .sine-bar-input-section {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
}

.sine-bar-input-section h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.sine-bar-input-section .description {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 1rem;
  line-height: 1.5;
}

/* ===== THERMAL EXPANSION CARD LAYOUT ===== */
.thermal-expansion-container {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  /* Override conflicting styles from main styles.css */
  margin-left: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

.thermal-expansion-layout {
  display: grid;
  gap: 1.25rem;
}

/* Override the conflicting .thermal-expansion-input-section styles from main styles.css */
.thermal-expansion-container .thermal-expansion-input-section {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
}

.thermal-expansion-input-section h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.thermal-expansion-input-section .description {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 1rem;
  line-height: 1.5;
}

.radio-group {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-radio {
  width: 1.2rem;
  height: 1.2rem;
  cursor: pointer;
}

/* ===== RADIO STATION MODE STYLES ===== */
.radio-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem;
  background: var(--surface);
  border-radius: 1rem;
  box-shadow: var(--shadow);
}

.radio-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.radio-header h3 {
  color: var(--text-primary);
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.radio-header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

.radio-controls {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.station-selector {
  margin-bottom: 1.25rem;
}

.filter-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: 0.75rem;
  border: 1px solid var(--border);
}

.filter-controls label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.category-dropdown,
.country-dropdown {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.category-dropdown:focus,
.country-dropdown:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha);
}

.station-selector label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.station-dropdown {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 1rem;
  margin-bottom: 1rem;
  transition: all 0.2s ease;
  /* Improve option rendering in dark mode across browsers */
  color-scheme: dark;
}

.station-dropdown:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha);
}

/* Improve dark mode contrast for dropdown menus and options */
body[data-theme='dark'] .station-dropdown,
body[data-theme='dark'] .category-dropdown,
body[data-theme='dark'] .country-dropdown {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
  color-scheme: dark;
}

body[data-theme='dark'] .station-dropdown option,
body[data-theme='dark'] .category-dropdown option,
body[data-theme='dark'] .country-dropdown option {
  background: var(--surface-elevated);
  color: var(--text-primary);
}

/* Highlight selected option clearly in dark mode */
body[data-theme='dark'] .station-dropdown option:checked,
body[data-theme='dark'] .category-dropdown option:checked,
body[data-theme='dark'] .country-dropdown option:checked {
  background: var(--primary);
  color: #ffffff;
}

.control-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.control-buttons .btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-secondary:hover {
  background: var(--secondary-dark);
  transform: translateY(-1px);
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-warning:hover {
  background: var(--warning-dark);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--destructive);
  color: white;
}

.btn-danger:hover {
  background: var(--destructive-dark);
  transform: translateY(-1px);
}

.playback-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.control-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
  min-width: 120px;
  font-weight: 600;
}

.play-btn {
  background: var(--success);
  color: white;
}

.play-btn:hover:not(:disabled) {
  background: var(--success-dark);
  transform: translateY(-1px);
}

.play-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.stop-btn {
  background: var(--destructive);
  color: white;
}

.stop-btn:hover:not(:disabled) {
  background: var(--destructive-dark);
  transform: translateY(-1px);
}

.stop-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.volume-control label {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 60px;
}

.volume-slider {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  outline: none;
  min-width: 100px;
  max-width: 150px;
}

.volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid var(--surface);
}

.volume-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid var(--surface);
}

#volumeValue {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 40px;
  text-align: center;
}

.radio-status {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.status-display {
  text-align: center;
  font-size: 1.2rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  border-radius: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 600;
}

.station-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.current-station,
.stream-info {
  padding: 1rem;
  background: var(--surface);
  border-radius: 0.75rem;
  text-align: center;
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 600;
}

.station-stats {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.stat-item {
  text-align: center;
  padding: 1rem;
  background: var(--surface);
  border-radius: 0.75rem;
  border: 1px solid var(--border);
}

.stat-label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.favorites-section {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.favorites-section h4 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.favorites-list {
  min-height: 100px;
}

.no-favorites {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  padding: 1.5rem;
}

.favorite-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.favorite-item:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.favorite-name {
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.favorite-category {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0 1rem;
  padding: 0.25rem 0.75rem;
  background: var(--secondary-alpha);
  border-radius: 0.5rem;
}

.remove-favorite-btn {
  background: var(--destructive);
  color: white;
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s ease;
}

.remove-favorite-btn:hover {
  background: var(--destructive-dark);
}

.radio-notes {
  background: var(--info-alpha);
  border: 1px solid var(--info);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-top: 1.25rem;
}

.radio-notes h4 {
  margin-top: 0;
  color: var(--info);
  margin-bottom: 1rem;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.radio-notes ul {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.radio-notes li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

@media (max-width: 768px) {
  .radio-container {
    padding: 1rem;
    margin: 0.5rem;
  }
  
  .filter-controls {
    grid-template-columns: 1fr;
  }
  
  .playback-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .volume-control {
    margin-left: 0;
    justify-content: center;
  }
  
  .station-info {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== FANUC ALARMS MODE STYLES ===== */
.fanuc-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.fanuc-section {
  margin-bottom: 30px;
}

.fanuc-title {
  color: var(--text-primary);
  margin-bottom: 15px;
  font-size: 2rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.fanuc-description {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 25px;
  line-height: 1.6;
}

.fanuc-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.filter-group {
  display: flex;
  flex-direction: column;
}

.filter-group label {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.fanuc-select,
.fanuc-input {
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.fanuc-select:focus,
.fanuc-input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.search-group {
  grid-column: span 2;
}

.fanuc-actions {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.fanuc-button {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 120px;
}

.fanuc-button.primary {
  background: var(--accent-color);
  color: white;
}

.fanuc-button.primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

.fanuc-button.secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.fanuc-button.secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-color);
}

.fanuc-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat-item {
  background: var(--bg-tertiary);
  padding: 10px 20px;
  border-radius: 6px;
  color: var(--text-primary);
  font-weight: 600;
  border: 1px solid var(--border-color);
}

.fanuc-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

.fanuc-table th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 15px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border-color);
  position: relative;
}

.fanuc-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.fanuc-table th.sortable:hover {
  background: var(--bg-secondary);
}

.fanuc-table th.active-sort {
  background: var(--accent-color);
  color: white;
}

.sort-icon {
  margin-left: 8px;
  font-size: 0.9rem;
  opacity: 0.7;
}

.fanuc-table td {
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: top;
}

.fanuc-table tr:hover {
  background: var(--bg-tertiary);
}

.description-cell,
.solution-cell {
  max-width: 300px;
  line-height: 1.5;
}

.severity-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.severity-low {
  background: var(--success-color);
  color: white;
}

.severity-medium {
  background: var(--warning-color);
  color: white;
}

.severity-high {
  background: var(--danger-color);
  color: white;
}

.actions-cell {
  text-align: center;
  min-width: 100px;
}

.action-btn {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0 2px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.action-btn:hover {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
  transform: translateY(-1px);
}

.action-btn.favorited {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.no-results {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.no-results p {
  margin-bottom: 10px;
  font-size: 1.1rem;
}

/* ===== FANUC GLOSSARY MODE STYLES ===== */
.fanuc-glossary-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.fanuc-glossary-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

.fanuc-glossary-input-section {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 25px;
  height: fit-content;
  position: sticky;
  top: 20px;
}

.fanuc-glossary-input-section h3 {
  color: var(--text-primary);
  margin-bottom: 15px;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.fanuc-glossary-input-section .description {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 25px;
  line-height: 1.5;
}

.input-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.form-input,
.form-select {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent-color);
}

.glossary-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 25px;
}

.glossary-button {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.glossary-button.primary {
  background: var(--accent-color);
  color: white;
}

.glossary-button.primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

.glossary-button.secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.glossary-button.secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-color);
}

.glossary-results-section {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 25px;
}

.glossary-results {
  min-height: 200px;
}

.glossary-results .code-section {
  margin-bottom: 30px;
}

.glossary-results .code-section h4 {
  color: var(--text-primary);
  margin-bottom: 20px;
  font-size: 1.5rem;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
}

.glossary-results .code-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
}

.glossary-results .code-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px;
  transition: all 0.3s ease;
  position: relative;
}

.glossary-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.code-section {
  margin-bottom: 30px;
}

.code-section h4 {
  color: var(--text-primary);
  margin-bottom: 20px;
  font-size: 1.5rem;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
}

.code-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
}

.code-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px;
  transition: all 0.3s ease;
  position: relative;
}

.code-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: var(--accent-color);
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.code-title {
  color: var(--text-primary);
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
}

.code-type-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.code-type-badge.g {
  background: var(--accent-color);
  color: white;
}

.code-type-badge.m {
  background: var(--success-color);
  color: white;
}

.code-content {
  margin-bottom: 20px;
}

.code-description {
  color: var(--text-primary);
  font-size: 1.1rem;
  margin-bottom: 15px;
  line-height: 1.5;
  font-weight: 500;
}

.code-syntax,
.code-group,
.code-machine,
.code-category {
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-size: 0.95rem;
  line-height: 1.4;
}

.code-notes {
  margin-top: 15px;
}

.code-notes summary {
  color: var(--accent-color);
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
  user-select: none;
}

.code-notes summary:hover {
  color: var(--accent-hover);
}

.notes-content {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 10px 0;
  border-top: 1px solid var(--border-color);
  margin-top: 10px;
}

.code-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.code-actions .action-btn {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.code-actions .action-btn:hover {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
  transform: translateY(-1px);
}

.code-actions .action-btn.favorited {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.favorite-icon {
  font-size: 1.1rem;
}

.copy-icon {
  font-size: 1rem;
}

/* Copy Feedback Animation */
@keyframes fadeInOut {
  0% { opacity: 0; transform: translateY(-20px); }
  20% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-20px); }
}

.copy-feedback {
  animation: fadeInOut 2s ease-in-out;
}

/* Responsive Design for Fanuc Modes */
@media (max-width: 1200px) {
  .fanuc-glossary-layout {
    grid-template-columns: 1fr;
  }
  
  .fanuc-glossary-input-section {
    position: static;
  }
  
  .code-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

@media (max-width: 768px) {
  .fanuc-container,
  .fanuc-glossary-container {
    padding: 15px;
  }
  
  .fanuc-filters {
    grid-template-columns: 1fr;
  }
  
  .search-group {
    grid-column: span 1;
  }
  
  .fanuc-actions {
    justify-content: center;
  }
  
  .fanuc-stats,
  .glossary-stats {
    flex-direction: column;
    text-align: center;
  }
  
  .code-grid {
    grid-template-columns: 1fr;
  }
  
  .code-actions {
    justify-content: center;
  }
  
  .fanuc-table {
    font-size: 0.9rem;
  }
  
  .fanuc-table th,
  .fanuc-table td {
    padding: 10px 8px;
  }
  
  .description-cell,
  .solution-cell {
    max-width: 200px;
  }
}

/* Quick Access Bar Styles */
.quick-access-bar {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.quick-access-container {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.quick-access-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--btn-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-color);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: fit-content;
  flex-shrink: 0;
}

.quick-access-btn:hover {
  background: var(--btn-hover-bg);
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.quick-access-btn:active {
  transform: translateY(0);
}

.quick-access-btn.dynamic-slot {
  background: var(--primary-color);
  color: var(--primary-text);
  border-color: var(--primary-color);
}

.quick-access-btn.dynamic-slot:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.quick-access-btn.more-btn {
  background: var(--muted);
  color: var(--text-muted);
  border-color: var(--border-color);
  font-style: italic;
}

.quick-access-btn.more-btn:hover {
  background: var(--muted-hover);
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Responsive adjustments (nav-tabs removed; navigation via sidebar only) */
@media (max-width: 768px) {
  .quick-access-container {
    gap: 0.5rem;
  }

  .quick-access-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 640px) {
  .quick-access-btn {
    padding: 0.5rem;
    font-size: 0.75rem;
  }

  .quick-access-btn span:not(:first-child) {
    display: none;
  }
}

/* App Title Styles */
.app-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  padding: 0.5rem 0;
}

/* Quick Tip Section Styles */
.quick-tip-section {
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.quick-tip-header {
  margin-bottom: 0.75rem;
}

.quick-tip-content {
  background: var(--muted);
  border-radius: 0.5rem;
  padding: 0.75rem;
  min-height: 3rem;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.quick-tip-content:hover {
  background: var(--muted-hover);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.quick-tip-content p {
  margin: 0;
  line-height: 1.4;
  color: var(--text-secondary);
}

.quick-tip-content p:empty::before {
  content: '💡 Start using the calculator to see helpful tips!';
  color: var(--text-muted);
  font-style: italic;
}

/* ===== TAP & DRILL CHART MODAL STYLES ===== */

.tap-drill-chart-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  box-sizing: border-box;
}

.tap-drill-chart-content {
  background: var(--background);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  width: 95%;
  max-width: 1200px;
  height: 90%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tap-drill-chart-header {
  background: var(--primary);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.tap-drill-chart-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.tap-drill-chart-header p {
  margin: 5px 0 0 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

.tap-drill-chart-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.tap-drill-chart-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.tap-drill-chart-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.chart-section {
  margin-bottom: 30px;
}

.chart-section h3 {
  margin: 0 0 15px 0;
  color: var(--foreground);
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 8px;
}

.tap-drill-chart-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.85rem;
  background: var(--card);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tap-drill-chart-table th {
  background: var(--primary);
  color: white;
  padding: 12px 8px;
  text-align: center;
  font-weight: 600;
  font-size: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tap-drill-chart-table td {
  padding: 8px;
  text-align: center;
  border: 1px solid var(--border);
  vertical-align: middle;
}

.tap-drill-chart-table tbody tr:nth-child(even) {
  background: var(--muted);
}

.tap-drill-chart-table tbody tr:hover {
  background: var(--accent);
}

.tap-size {
  text-align: left !important;
  font-weight: 500;
  color: var(--foreground);
}

.drill-size {
  font-weight: 500;
  color: var(--primary);
}

.decimal {
  font-family: 'Courier New', monospace;
  color: var(--muted-foreground);
}

.tap-drill-chart-footer {
  background: var(--muted);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.tap-drill-chart-footer button {
  margin: 0 5px;
}

/* Responsive design */
@media (max-width: 768px) {
  .tap-drill-chart-modal {
    padding: 10px;
  }
  
  .tap-drill-chart-content {
    width: 98%;
    height: 95%;
  }
  
  .tap-drill-chart-header {
    padding: 15px;
  }
  
  .tap-drill-chart-header h2 {
    font-size: 1.2rem;
  }
  
  .tap-drill-chart-body {
    padding: 15px;
  }
  
  .tap-drill-chart-table {
    font-size: 0.75rem;
  }
  
  .tap-drill-chart-table th,
  .tap-drill-chart-table td {
    padding: 6px 4px;
  }
}

/* ===== BROACH KEYWAY HELPER ===== */
.broach-keyway-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
}

.broach-note {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted-foreground);
}

.broach-status {
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.broach-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.broach-result-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.broach-result-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.broach-result-value {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.broach-torque-note {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.broach-discrepancy-note {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--warning, #b45309);
}

/* What-If Scenario Playground – SFM comparison status */
.scenario-playground-sfm-status {
  font-size: 0.85em;
  font-weight: 500;
}
.scenario-playground-sfm--target {
  color: var(--success-color, #22c55e);
}
.scenario-playground-sfm--over {
  color: var(--warning, #eab308);
}
.scenario-playground-sfm--under {
  color: var(--text-secondary, #64748b);
}

/* What-If Scenario Playground – chatter risk colors */
.scenario-playground-chatter--green {
  color: var(--success-color, #22c55e);
  font-weight: 600;
}
.scenario-playground-chatter--yellow {
  color: var(--warning, #eab308);
  font-weight: 600;
}
.scenario-playground-chatter--red {
  color: var(--error-color, #ef4444);
  font-weight: 600;
}

/* Scenario Playground form: tooltips on labels/inputs use title (native); short text so hover popup stays small and less likely to overlap the list */
.scenario-playground-form-grid .form-group {
  position: relative;
}
.scenario-playground-form-grid .form-label[title],
.scenario-playground-form-grid .input[title],
.scenario-playground-form-grid .select[title],
.scenario-playground-form-grid .input-range[title] {
  cursor: help;
}

/* Touch-friendly sliders: remove 300ms delay and make drag smooth on mobile */
.scenario-playground-form-grid .input-range {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Result metrics: hover tooltips, don't cover list */
.scenario-playground-results-grid .scenario-playground-result-item[title] {
  cursor: help;
}
.scenario-playground-risk-legend[title] {
  cursor: help;
}

.scenario-playground-warnings-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-secondary);
}
.scenario-playground-warning-item {
  margin-bottom: 0.25rem;
}
.scenario-playground-warnings-list .scenario-playground-warning-item:last-child {
  margin-bottom: 0;
}
.scenario-playground-tip {
  color: var(--success-color, #22c55e);
}

.scenario-playground-defl-pct {
  font-size: 0.85em;
  color: var(--text-secondary, #64748b);
}

.scenario-playground-breakage {
  font-weight: 600;
}
.scenario-playground-breakage--low {
  color: var(--success-color, #22c55e);
}
.scenario-playground-breakage--moderate {
  color: var(--warning, #eab308);
}
.scenario-playground-breakage--high {
  color: var(--error-color, #ef4444);
}

@media (max-width: 768px) {
  .scenario-playground-charts-grid {
    grid-template-columns: 1fr !important;
  }
}

/* What-If Scenario Playground – compact two-row button layout */
.scenario-playground-buttons {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.scenario-playground-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.scenario-playground-buttons-row .btn {
  width: auto;
  min-width: 0;
  flex: 0 0 auto;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  white-space: nowrap;
}

.scenario-playground-toast .notification-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Chart canvas background for dark mode contrast */
.scenario-playground-chart-wrap {
  border-radius: 8px;
  overflow: hidden;
}
[data-theme="dark"] .scenario-playground-chart-wrap {
  background: var(--bg-secondary, #2a2a2a);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
}


/* ===== JOB TIMER MODE STYLES ===== */
.job-timer-lap-item {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
}

.job-timer-lap-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.job-timer-lap-label small {
  color: var(--muted-foreground);
}

.job-timer-lap-note {
  width: 100%;
}

.job-timer-pulse {
  animation: jobTimerPulse 0.35s ease-out;
}

@keyframes jobTimerPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.35);
  }
  70% {
    transform: scale(1.02);
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: none;
  }
}

.job-timer-break-list {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.job-timer-break-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.35rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.job-timer-break-remove {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 999px;
  font-size: 0.75rem;
  line-height: 1;
}

.job-timer-break-remove:hover {
  background: var(--bg-hover);
  color: var(--destructive, #dc2626);
}

.job-timer-export-preview .card-header {
  border-bottom: 1px solid var(--border);
}

.job-timer-export-text {
  font-family: 'Courier New', monospace;
}

/* ===== TRIANGLE SOLVER MODE ===== */
.triangle-results-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  align-items: center;
  max-width: 360px;
}

.triangle-result-row {
  display: contents;
}

.triangle-result-row span:first-child {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.triangle-result-row span:last-child {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
}

.triangle-canvas-wrap {
  overflow: hidden;
}

/* Bar and on-canvas labels: always high-contrast on dark so readable in light mode */
.triangle-canvas-labels {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 0.75rem;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 0.8rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.25rem 1rem;
  border-radius: 0 0 0.5rem 0.5rem;
  pointer-events: none;
}

.triangle-canvas-labels .triangle-canvas-label-item {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.triangle-canvas-labels .triangle-canvas-label-name {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.triangle-canvas-labels .triangle-canvas-label-value {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: #fff;
}

/* On-canvas labels (sides and angles on the triangle) – bright text for visibility */
.triangle-canvas-figure-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.triangle-canvas-figure-labels .triangle-fig-label {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 0.15rem 0.35rem;
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  border-radius: 0.25rem;
  line-height: 1.2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}


