/* CSS Reset and Variables */
:root {
  --primary-color: #2563eb;
  --secondary-color: #1e40af;
  --background-color: #f8fafc;
  --card-background: #ffffff;
  --text-color: #1e293b;
  --border-color: #e2e8f0;
  --table-hover: #f1f5f9;
  --table-header: #f8fafc;
  --header-footer-bg: #ffffff;
  --header-height: 64px;
  --transition: all 0.3s ease;
  --modal-overlay: rgba(0, 0, 0, 0.5);
  --button-hover: #1d4ed8;
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --primary-color: #3b82f6;
  --secondary-color: #60a5fa;
  --background-color: #0f172a;
  --card-background: #1e293b;
  --text-color: #e2e8f0;
  --border-color: #334155;
  --table-hover: #2d3748;
  --table-header: #1e293b;
  --header-footer-bg: #1e293b;
  --modal-overlay: rgba(0, 0, 0, 0.7);
  --button-hover: #2563eb;
}

/* General styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--background-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Styles */
.main-header {
  background: var(--header-footer-bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  text-decoration: none;
  color: var(--text-color);
  font-weight: 500;
  transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary-color);
}

.mobile-menu {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-color);
  cursor: pointer;
}

/* Main Content Styles */
.main-content {
  margin-top: calc(var(--header-height) + 2rem);
  margin-bottom: 2rem;
  padding: 0 1rem;
  flex: 1;
}

.card {
  max-width: 1000px;
  margin: 0 auto;
  background: var(--card-background);
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.card-header {
  background: var(--primary-color);
  color: #fff;
  padding: 2rem;
  text-align: center;
}

.card-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

.card-subtitle {
  margin-top: 0.5rem;
  opacity: 0.9;
}

.card-content {
  padding: 2rem;
}

/* Search Section Styles */
.search-section {
  margin-bottom: 2rem;
}

.input-wrapper {
  position: relative;
  margin-bottom: 1rem;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
}

#search-input {
  width: 100%;
  padding: 1rem 1rem 1rem 2.5rem;
  font-size: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  transition: var(--transition);
}

#search-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Quick Filters */
.quick-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: none;
  color: var(--text-color);
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

/* Recent Searches */
.recent-searches {
  margin-bottom: 2rem;
}

.recent-searches h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.recent-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Table Styles */
.table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

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

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background: var(--table-header);
  font-weight: 600;
}

tbody tr:hover {
  background-color: var(--table-hover);
}

/* Load More Button */
.load-more-container {
  text-align: center;
  margin-top: 1rem;
  padding: 1rem;
}

.load-more-btn {
  background: var(--primary-color);
  color: #ffffff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

.load-more-btn:hover {
  background: var(--button-hover);
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--modal-overlay);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: var(--card-background);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  border-radius: 16px;
  position: relative;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.close-btn {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: var(--button-hover);
  transform: translateX(-2px);
}

.instruction-details {
  padding: 4rem 2.5rem 2.5rem;
}

.instruction-details h2 {
  color: var(--primary-color);
  font-size: 2rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

.instruction-details p {
  color: var(--text-color);
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.instruction-details strong {
  color: var(--primary-color);
  font-weight: 600;
}

.instruction-flowchart {
  background: var(--background-color);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
}

.instruction-flowchart h3 {
  color: var(--text-color);
  font-size: 1.2rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.instruction-flowchart pre {
  font-family: 'Consolas', monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-color);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.instruction-keypoints {
  margin: 2rem 0;
}

.instruction-keypoints h3 {
  color: var(--text-color);
  font-size: 1.2rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.instruction-keypoints ul {
  list-style: none;
  padding: 0;
}

.instruction-keypoints li {
  color: var(--text-color);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
  position: relative;
}

.instruction-keypoints li::before {
  content: '•';
  color: var(--primary-color);
  font-size: 1.2rem;
  position: absolute;
  left: 0;
  top: -1px;
}

.instruction-examples {
  background: var(--background-color);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 2rem;
  border: 1px solid var(--border-color);
}

.instruction-examples h3 {
  color: var(--text-color);
  font-size: 1.2rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.instruction-examples code {
  display: block;
  font-family: 'Consolas', monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-color);
  padding: 0.75rem;
  margin: 0.5rem 0;
  background: var(--card-background);
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
  .modal-content {
    max-width: 100%;
  }
  
  .instruction-details {
    padding: 4rem 1.5rem 1.5rem;
  }
  
  .instruction-details h2 {
    font-size: 1.5rem;
  }
  
  .close-btn {
    top: 1rem;
    left: 1rem;
    padding: 0.5rem 1rem;
  }
}

/* Footer Styles */
.main-footer {
  background: var(--header-footer-bg);
  border-top: 1px solid var(--border-color);
  padding: 2rem 1rem;
  margin-top: auto;
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.footer-section {
  text-align: center;
  padding: 1rem;
}

.footer-section h4 {
  color: var(--text-color);
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.social-links {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 1rem;
}

.social-links a {
  color: var(--text-color);
  font-size: 1.5rem;
  transition: var(--transition);
}

.social-links a:hover {
  color: var(--primary-color);
  transform: translateY(-2px);
}

.footer-credit {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.footer-credit p {
  color: var(--text-color);
  font-size: 1rem;
  font-weight: 500;
}

.credit-text {
  color: var(--primary-color);
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.5px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .mobile-menu {
    display: block;
  }

  .card-header {
    padding: 1.5rem;
  }

  .card-title {
    font-size: 1.5rem;
  }

  .card-content {
    padding: 1rem;
  }

  .quick-filters {
    gap: 0.5rem;
  }

  .filter-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
  }

  th, td {
    padding: 0.75rem;
    font-size: 0.875rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

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

/* Utility Classes */
.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}