/* Base CSS - Tap Macro */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Default CSS Variables (Light Theme) */
:root {
  /* Primary Colors */
  --primary: #845309;
  --primary-foreground: #ffffff;

  /* Secondary Colors */
  --secondary: #e4c090;
  --secondary-foreground: #57534e;

  /* Accent Colors */
  --accent: #f2daba;
  --accent-foreground: #57534e;

  /* Base Colors */
  --background: #fdfbf7;
  --foreground: #443833;

  /* Card Colors */
  --card: #f8f4ee;
  --card-foreground: #443833;

  /* Popover Colors */
  --popover: #f8f4ee;
  --popover-foreground: #443833;

  /* Border Colors */
  --border: #e4c090;
  --input: #ffffff;

  /* Ring Colors */
  --ring: #845309;
  --primary-alpha: rgba(132, 83, 9, 0.1);

  /* Muted Colors */
  --muted: #e4c090;
  --muted-foreground: #78716c;

  /* Destructive Colors */
  --destructive: #dc2626;
  --destructive-foreground: #fef2f2;

  /* Success Colors */
  --success: #059669;
  --success-foreground: #f0fdf4;

  /* Warning Colors */
  --warning: #d97706;
  --warning-foreground: #fffbeb;

  /* Info Colors */
  --info: #2563eb;
  --info-foreground: #eff6ff;

  /* Additional Colors for Favorites System */
  --bg-secondary: #f8f4ee;
  --bg-hover: #f2daba;
  --text-secondary: #78716c;
  --text-primary: #443833;
  --accent-color: #845309;
  --shadow-lg:
    0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Additional Colors for Components */
  --bg-card: var(--card);
  --bg-input: var(--input);
  --border-radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
    Arial, sans-serif;
  line-height: 1.6;
  transition: all 0.3s ease;
  background-color: var(--background);
  color: var(--foreground);
}

/* Layout */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

.header {
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.global-unit-toggle {
  min-width: 7rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.875rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--foreground);
}

.sidebar {
  width: 320px;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
  transition: all 0.3s ease;
}

.main-content {
  margin-left: 320px;
  padding: 1.25rem;
  min-height: 100vh;
}

/* Cards */
.card {
  background: var(--card);
  border-radius: 12px;
  padding: var(--space-card, 1rem);
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.card-header {
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
}

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

/* Dashboard Specific Styles */
.dashboard-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--primary-foreground);
}

.dashboard-header-inner {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  width: 100%;
  max-width: 280px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.1);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-card.ai-stat {
  background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
  color: var(--secondary-foreground);
}

.stat-number {
  font-size: 1.5rem;
  font-weight: bold;
  display: block;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.8125rem;
  opacity: 0.9;
}

.dashboard-section {
  margin-bottom: 1rem;
}

/* AI Insights Header with inline actions */
.ai-insights-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .ai-insights-header {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
  }
}

.ai-actions-inline {
  flex-shrink: 0;
}

/* AI Insights Styles */
.insight-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  transition: all 0.2s ease;
}

.insight-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.insight-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.insight-category {
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.insight-confidence {
  background: var(--success);
  color: var(--success-foreground);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.insight-title {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--foreground);
}

.insight-description {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.5;
}

.insight-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.insight-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.insight-tag {
  background: var(--muted);
  color: var(--muted-foreground);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* AI Assistant Styles */
.nlq-section {
  margin-top: 1rem;
}

.nlq-container {
  margin-bottom: 0.75rem;
}

.ai-response-area {
  min-height: 140px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: var(--background);
}

.ai-response {
  background: var(--card);
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid var(--border);
}

.ai-response-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.ai-avatar {
  font-size: 1.5rem;
}

.ai-status {
  font-weight: 600;
  color: var(--primary);
}

.ai-response-content {
  line-height: 1.6;
}

.ai-response-content ul {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.ai-response-content li {
  margin-bottom: 0.5rem;
}

.ai-response-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Quick Actions Styles */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.quick-action-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.quick-action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.quick-action-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  display: block;
}

.quick-action-title {
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9375rem;
  color: var(--foreground);
}

.quick-action-desc {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.35;
}

/* Recent Activity Styles */
.recent-activity-list {
  min-height: 200px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  background: var(--card);
  transition: all 0.2s ease;
}

.activity-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.activity-icon {
  font-size: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--muted);
  border-radius: 50%;
  color: var(--muted-foreground);
}

.activity-content {
  flex: 1;
}

.activity-description {
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 0.25rem;
}

.activity-time {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 40px;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--secondary);
}

.btn-secondary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-outline {
  background-color: transparent;
  color: var(--foreground);
  border-color: var(--border);
}

.btn-outline:hover {
  background-color: var(--muted);
  color: var(--muted-foreground);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  min-height: 32px;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  min-height: 48px;
}

/* Background utilities */
.bg-muted {
  background-color: var(--muted);
}

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

/* Forms */
.form-group {
  margin-bottom: var(--space-form-group, 0.75rem);
}

.form-label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 500;
  color: var(--foreground);
}

.form-label-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.form-label-row .form-label {
  margin-bottom: 0;
}

.focus-drill-analysis-btn {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input);
  color: var(--foreground);
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}

.focus-drill-analysis-btn:hover {
  background: var(--muted);
  border-color: var(--ring);
}

.focus-drill-analysis-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}

.input {
  width: 100%;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  background-color: var(--input);
  border: 1px solid var(--border);
  color: var(--foreground);
}

.input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(132, 83, 9, 0.2);
}

.select {
  width: 100%;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  background-color: var(--input);
  border: 1px solid var(--border);
  color: var(--foreground);
  cursor: pointer;
}

/* Grid */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, 1fr);
}
.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}
.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Navigation Items */
.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  border: none;
  background: none;
  color: var(--foreground);
  cursor: pointer;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  margin-bottom: 0.5rem;
}

.nav-item:hover {
  background-color: var(--muted);
}

.nav-item.active {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

/* Tab Content */
.tab-content {
  display: block;
}

.tab-content.hidden {
  display: none;
}

.calc-content {
  display: block;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  padding: var(--space-content, 1.5rem);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-top: 1rem;
}

.calc-content.hidden {
  display: none;
}

/* Utilities */
.text-center {
  text-align: center;
}
.text-left {
  text-align: left;
}
.text-right {
  text-align: right;
}

.font-bold {
  font-weight: 700;
}
.font-semibold {
  font-weight: 600;
}
.font-medium {
  font-weight: 500;
}

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

.text-sm {
  font-size: 0.875rem;
}
.text-base {
  font-size: 1rem;
}
.text-lg {
  font-size: 1.125rem;
}
.text-xl {
  font-size: 1.25rem;
}
.text-2xl {
  font-size: 1.5rem;
}
.text-3xl {
  font-size: 1.875rem;
}

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

.mb-1 {
  margin-bottom: 0.25rem;
}
.mb-2 {
  margin-bottom: 0.5rem;
}
.mb-4 {
  margin-bottom: 1rem;
}
.mb-3 {
  margin-bottom: 0.75rem;
}
.mb-4 {
  margin-bottom: 1rem;
}
.mb-6 {
  margin-bottom: 1.5rem;
}

.mt-1 {
  margin-top: 0.25rem;
}
.mt-2 {
  margin-top: 0.5rem;
}
.mt-3 {
  margin-top: 0.75rem;
}
.mt-4 {
  margin-top: 1rem;
}
.mt-6 {
  margin-top: 1.5rem;
}

.p-1 {
  padding: 0.25rem;
}
.p-2 {
  padding: 0.5rem;
}
.p-3 {
  padding: 0.75rem;
}
.p-4 {
  padding: 1rem;
}
.p-6 {
  padding: 1.5rem;
}

.px-2 {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.py-1 {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.w-full {
  width: 100%;
}

.ml-2 {
  margin-left: 0.5rem;
}

.flex {
  display: flex;
}

.flex-1 {
  flex: 1;
}

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

.justify-between {
  justify-content: space-between;
}

/* Border radius utilities */
.rounded-full {
  border-radius: 9999px;
}

.rounded-lg {
  border-radius: 0.5rem;
}

.justify-center {
  justify-content: center;
}

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

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

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

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--foreground);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: background-color 0.2s ease;
  z-index: 1001;
}

.mobile-menu-toggle:hover {
  background: var(--muted);
}

.mobile-menu-toggle svg {
  width: 24px;
  height: 24px;
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 98;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Responsive */
@media (max-width: 1024px) {
  .mobile-menu-toggle {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
    z-index: 100;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar.open {
    transform: translateX(0);
    z-index: 100;
  }
}

@media (max-width: 768px) {
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 0 0.5rem;
  }

  .main-content {
    padding: 1rem;
  }

  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== TAP MODE STYLES ===== */

.tap-container {
  padding: 1.5rem 0;
}

.tap-form {
  margin-bottom: 2rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-weight: 600;
  color: var(--foreground);
  font-size: 0.875rem;
}

.select,
.input {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input);
  color: var(--foreground);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.select:focus,
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha);
}

.tap-notes {
  background: var(--muted);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.tap-notes .note {
  margin: 0.5rem 0;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.thread-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.thread-legend span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.thread-legend span::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.thread-metric::before {
  background: #3b82f6;
}
.thread-npt::before {
  background: #ef4444;
}
.thread-unc-unf::before {
  background: #10b981;
}
.thread-bspp-bspt::before {
  background: #f59e0b;
}
.thread-acme::before {
  background: #8b5cf6;
}

.smart-suggestions-controls {
  margin-bottom: 1.5rem;
  text-align: center;
}

.smart-suggestions-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.suggestions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.suggestions-header h3 {
  margin: 0;
  color: var(--foreground);
}

.suggestions-list {
  margin-bottom: 1rem;
}

.suggestion-item {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.suggestion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.suggestion-header strong {
  color: var(--foreground);
  font-size: 0.875rem;
}

.confidence-badge {
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.suggestion-reason {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.suggestion-value {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.value-label {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.value-display {
  font-weight: 600;
  color: var(--foreground);
  background: var(--accent);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.suggestion-actions {
  display: flex;
  gap: 0.5rem;
}

.suggestions-controls {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.button-container {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
}

/* Results Styles */
.results-container {
  margin-top: 2rem;
}

.results-container h3 {
  color: var(--foreground);
  margin-bottom: 1.5rem;
  text-align: center;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-section, 1.25rem);
  margin-bottom: var(--space-section, 1.25rem);
}

.result-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--space-block, 0.75rem);
}

.result-section h4 {
  color: var(--foreground);
  color: var(--foreground);
  margin-bottom: 0.5rem;
  font-size: 1.125rem;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
}

.results-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.results-table td:first-child {
  font-weight: 600;
  color: var(--foreground);
}

.results-table td:last-child {
  text-align: right;
  font-family: monospace;
}

/* Drill Size Analysis Styles */
.drill-sizes-table {
  margin-top: 1rem;
  overflow-x: auto;
}

.drill-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.drill-table th {
  background: var(--muted);
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--foreground);
  border-bottom: 2px solid var(--border);
}

.drill-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.drill-row.excellent {
  background: rgba(34, 197, 94, 0.1);
}

.drill-row.good {
  background: rgba(59, 130, 246, 0.1);
}

.drill-row.acceptable {
  background: rgba(245, 158, 11, 0.1);
}

.drill-row.poor {
  background: rgba(239, 68, 68, 0.1);
}

/* Brief "look here" flare on the recommended drill row (e.g. after focus scroll) */
.drill-row-flare {
  animation: drill-row-flare 2s ease-out forwards;
}

@keyframes drill-row-flare {
  0% {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.85), 0 0 18px 4px rgba(34, 197, 94, 0.4);
    outline: 2px solid rgba(34, 197, 94, 0.9);
    outline-offset: 2px;
  }
  40% {
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.6), 0 0 10px 2px rgba(34, 197, 94, 0.25);
    outline: 2px solid rgba(34, 197, 94, 0.5);
    outline-offset: 2px;
  }
  100% {
    box-shadow: none;
    outline: 2px solid transparent;
    outline-offset: 2px;
  }
}

.engagement-bar {
  position: relative;
  width: 100%;
  height: 20px;
  background: var(--muted);
  border-radius: 10px;
  overflow: hidden;
}

.engagement-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  transition: width 0.3s ease;
}

.engagement-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-foreground);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.quality-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.quality-badge.excellent {
  background: #22c55e;
  color: white;
}

.quality-badge.good {
  background: #3b82f6;
  color: white;
}

.quality-badge.acceptable {
  background: #f59e0b;
  color: white;
}

.quality-badge.poor {
  background: #ef4444;
  color: white;
}

.drill-size {
  font-weight: 600;
  color: var(--primary);
}

/* Drill Sizes Detail View */
.drill-sizes-detail {
  padding: 1rem;
}

.drill-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.drill-header h3 {
  margin: 0;
  color: var(--foreground);
}

.drill-header .btn {
  flex-shrink: 0;
}

.drill-analysis h4 {
  color: var(--foreground);
  margin-bottom: 1rem;
}

.drill-summary {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--muted);
  border-radius: 8px;
}

.drill-summary h4 {
  color: var(--foreground);
  margin-bottom: 1rem;
}

.drill-summary p {
  margin: 0.5rem 0;
  color: var(--muted-foreground);
}

/* Special Thread Info */
.special-thread-info {
  background: var(--muted);
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
}

.special-thread-info h4 {
  color: var(--foreground);
  margin-bottom: 1rem;
}

.drill-result.recommended {
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 1rem;
  border-radius: 6px;
  margin: 1rem 0;
  font-weight: 600;
}

/* Notification Styles */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  max-width: 400px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.notification-success {
  border-left: 4px solid #22c55e;
}

.notification-warning {
  border-left: 4px solid #f59e0b;
}

.notification-error {
  border-left: 4px solid #ef4444;
}

.notification-info {
  border-left: 4px solid #3b82f6;
}

.notification-message {
  color: var(--foreground);
  font-size: 0.875rem;
}

.notification-close {
  background: none;
  border: none;
  color: var(--muted-foreground);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.notification-close:hover {
  background: var(--muted);
  color: var(--foreground);
}

/* No Suggestions */
.no-suggestions {
  text-align: center;
  padding: 2rem;
  color: var(--muted-foreground);
}

.no-suggestions p {
  margin: 0.5rem 0;
}

/* Loading Spinner */
.loading-spinner {
  font-size: 2rem;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

/* Responsive Design for Tap Mode */
@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .button-container {
    flex-direction: column;
    align-items: center;
  }

  .thread-legend {
    flex-direction: column;
    align-items: flex-start;
  }

  .drill-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Gauge Information Styles */
.gauge-info {
  background: var(--surface-color);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.gauge-info p {
  margin: 0.5rem 0;
  color: var(--text-color);
}

.gauge-diameters {
  margin: 1rem 0;
}

.gauge-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0;
  padding: 0.5rem;
  background: var(--primary-alpha);
  border-radius: 6px;
  border-left: 4px solid var(--primary-color);
}

.gauge-diameter {
  font-family: 'Courier New', monospace;
  font-weight: bold;
  color: var(--primary-color);
  background: var(--surface-color);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.gauge-note {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-style: italic;
}

.gauge-tolerance {
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--accent-alpha);
  border-radius: 6px;
  border: 1px solid var(--accent-color);
}

.gauge-tolerance p {
  margin: 0;
  color: var(--accent-color);
  font-weight: 500;
}

/* Random Tip Bar Styles */
.random-tip-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 56px;
  z-index: 1000;
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
  transform: translateY(0);
  opacity: 1;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.random-tip-bar.hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 1024px) {
  .sidebar.open ~ .random-tip-bar {
    display: none;
  }
}

.tip-bar-content {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  gap: 0.75rem;
}

.tip-category-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 4px;
  background: var(--primary);
  color: var(--primary-foreground);
  white-space: nowrap;
  flex-shrink: 0;
}

.tip-text {
  flex: 1;
  font-size: 0.875rem;
  color: var(--foreground);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.tip-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--muted-foreground);
  font-size: 1.25rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.tip-close-btn:hover {
  background: var(--muted);
  color: var(--foreground);
}

.tip-close-btn:active {
  transform: scale(0.95);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .random-tip-bar {
    height: 52px;
    padding: 0 0.75rem;
    /* Account for mobile safe area */
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .tip-bar-content {
    gap: 0.5rem;
  }

  .tip-category-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }

  .tip-text {
    font-size: 0.8125rem;
  }

  .tip-close-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .random-tip-bar {
    height: 48px;
    padding: 0 0.5rem;
  }

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

  .tip-category-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.35rem;
  }
}

/* Dark mode support */
[data-theme="dark"] .random-tip-bar {
  background: var(--card);
  border-top-color: var(--border);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.3);
}