/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2563eb;
  --secondary-color: #1e40af;
  --text-color: #1f2937;
  --text-light: #6b7280;
  --bg-color: #ffffff;
  --bg-light: #f9fafb;
  --border-color: #e5e7eb;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-light);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header and Navigation */
header {
  background-color: var(--bg-color);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-links a {
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.3s;
  position: relative;
  padding: 0.25rem 0;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary-color);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--primary-color);
}

/* Focus management for keyboard users */
.nav-links a:focus {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Main Content */
main {
  padding: 2rem 0;
  min-height: calc(100vh - 200px);
}

.page-title {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--text-color);
  font-weight: 700;
  position: relative;
  padding-bottom: 0.5rem;
}

.page-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background: var(--primary-color);
  border-radius: 3px;
}

.page-subtitle {
  font-size: 1.1rem;
  color: var(--text-light);
  margin-bottom: 2rem;
}

/* Cards */
.card {
  background: var(--bg-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s;
  border: 1px solid var(--border-color);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.card-content {
  color: var(--text-light);
}

/* Grid Layout */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
  min-height: 44px; /* For better touch targets on mobile */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:hover {
  background-color: var(--secondary-color);
}

.btn:focus {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

.btn-secondary {
  background-color: var(--text-light);
}

.btn-secondary:hover {
  background-color: var(--text-color);
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s;
  min-height: 44px; /* Better touch target for mobile */
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-input.error {
  border-color: var(--error-color);
  background-color: #fef2f2;
}

.form-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  background-color: var(--bg-color);
  min-height: 44px; /* Better touch target for mobile */
}

/* Error Message */
.error-message {
  background-color: #fee2e2;
  color: #dc2626;
  padding: 1rem;
  border-radius: 6px;
  margin: 1rem 0;
  border-left: 4px solid #dc2626;
}

/* Results Display */
.result-box {
  background: var(--bg-color);
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.result-label {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.result-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary-color);
}

/* Search Elements */
.search-box {
  margin-bottom: 2rem;
}

.search-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  min-height: 44px; /* Better touch target for mobile */
}

.terms-list {
  list-style: none;
}

.term-item {
  background: var(--bg-color);
  border-left: 4px solid var(--primary-color);
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 4px;
}

.term-name {
  font-size: 1.25rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.term-category {
  display: inline-block;
  background: var(--bg-light);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.term-description {
  color: var(--text-light);
  line-height: 1.8;
}

/* Footer */
footer {
  background-color: #1f2937;
  color: white;
  padding: 2.5rem 0 1.5rem;
  margin-top: 4rem;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2rem;
}

.footer-section h3 {
  margin-bottom: 1rem;
  color: #d1d5db;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-section a {
  color: #d1d5db;
  text-decoration: none;
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  transition: color 0.2s;
  padding: 0.5rem 0; /* Extra padding for touch targets */
}

.footer-section a:hover {
  color: white;
}

.footer-bottom {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  color: #9ca3af;
  font-size: 0.8rem;
  font-style: italic;
}

/* Disclaimers */
.disclaimer {
  background: #fef2f2;
  border-left: 4px solid var(--error-color);
  padding: 1.25rem;
  margin: 2rem 0;
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.disclaimer-title {
  font-weight: bold;
  margin-bottom: 0.75rem;
  color: #b91c1c;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
}

.disclaimer-title::before {
  content: "⚠️ ";
  margin-right: 0.5rem;
}

.disclaimer-text {
  font-size: 0.875rem;
  color: #7f1d1d;
  line-height: 1.7;
  padding-left: 1.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }
  
  .nav-links {
    flex-direction: column;
    gap: 1rem;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .footer-content {
    flex-direction: column;
  }
  
  /* Mobile-specific styles for better UX */
  .page-title {
    font-size: 1.75rem;
  }
  
  .card {
    padding: 1.25rem;
  }
  
  /* Improve spacing on mobile */
  main {
    padding: 1.5rem 0;
  }
}

/* Touch target enhancements for mobile devices */
@media (hover: none) and (pointer: coarse) {
  .btn {
    padding: 0.875rem 1.5rem;
    font-size: 1.1rem;
  }
  
  .nav-links a {
    padding: 0.75rem 0;
  }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
  .card {
    margin-bottom: 1rem;
  }
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table th,
.table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  background: var(--bg-light);
  font-weight: 600;
  color: var(--text-color);
}

.table tr:hover {
  background: var(--bg-light);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
}

.badge-primary {
  background: #dbeafe;
  color: var(--primary-color);
}

.badge-success {
  background: #d1fae5;
  color: var(--success-color);
}

.badge-warning {
  background: #fef3c7;
  color: var(--warning-color);
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus management for keyboard users */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

/* High contrast support */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
  }
  
  .card {
    border: 2px solid var(--border-color);
  }
  
  .form-input {
    border: 2px solid var(--border-color);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}