/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  font-size: 1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
  text-decoration: none;
}

.btn:focus {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  color: #fff;
}

.btn-secondary {
  background-color: var(--secondary);
  color: #fff;
}

.btn-secondary:hover {
  background-color: #000;
}

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

.btn-outline:hover {
  background-color: var(--bg-secondary);
  border-color: var(--text-muted);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background-color: var(--bg-secondary);
  color: var(--text);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

.btn-icon {
  padding: 0.5rem;
  border-radius: var(--radius);
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

/* Tool Cards */
.tool-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.tool-card .icon-area {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background-color: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--primary);
}

.tool-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.tool-card-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

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

.card-featured {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 1px var(--primary-light), var(--shadow-md);
}

/* ==========================================================================
   Forms
   ========================================================================== */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-size: 0.875rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.form-error {
  color: #ef4444;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: block;
}

/* ==========================================================================
   Badges / Pills
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  line-height: 1;
}

.badge-primary { background-color: rgba(30, 64, 175, 0.1); color: var(--primary); }
.badge-success { background-color: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.badge-warning { background-color: rgba(245, 158, 11, 0.1); color: #d97706; }
.badge-danger { background-color: rgba(239, 68, 68, 0.1); color: #dc2626; }
.badge-info { background-color: rgba(6, 182, 212, 0.1); color: var(--accent); }
.badge-popular { background-color: rgba(139, 92, 246, 0.1); color: var(--accent-purple); }

/* ==========================================================================
   Alerts / Notifications
   ========================================================================== */
.alert {
  display: flex;
  align-items: flex-start;
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  background-color: var(--surface);
}

.alert-success { border-color: var(--accent-green); background-color: rgba(16, 185, 129, 0.05); }
.alert-warning { border-color: #f59e0b; background-color: rgba(245, 158, 11, 0.05); }
.alert-error { border-color: #ef4444; background-color: rgba(239, 68, 68, 0.05); }
.alert-info { border-color: var(--primary-light); background-color: rgba(59, 130, 246, 0.05); }

/* ==========================================================================
   Breadcrumbs
   ========================================================================== */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  padding: 0;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.breadcrumb li {
  display: flex;
  align-items: center;
}

.breadcrumb li:not(:last-child)::after {
  content: '›';
  margin: 0 0.5rem;
  font-size: 1.2rem;
  line-height: 1;
}

.breadcrumb a {
  color: var(--text-secondary);
}

.breadcrumb a:hover {
  color: var(--primary);
}

/* ==========================================================================
   Search Bar
   ========================================================================== */
.search-bar {
  position: relative;
  display: flex;
  width: 100%;
}

.search-bar input {
  padding-left: 2.5rem;
  border-radius: var(--radius-lg);
}

.search-bar .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.5rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: none;
}

/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs {
  margin-bottom: 1.5rem;
}

.tab-list {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 1.5rem;
  overflow-x: auto;
}

.tab {
  padding: 0.75rem 0;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-selected="true"] {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-panel {
  display: none;
  padding: 1.5rem 0;
}

.tab-panel[aria-hidden="false"] {
  display: block;
}

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background-color: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

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

.modal-title {
  font-weight: 600;
  font-size: 1.25rem;
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* ==========================================================================
   Loading States
   ========================================================================== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text { height: 1rem; margin-bottom: 0.5rem; width: 100%; }
.skeleton-card { height: 200px; width: 100%; }

.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--primary-light);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   Progress Bar
   ========================================================================== */
.progress {
  height: 0.5rem;
  background-color: var(--bg-secondary);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: var(--primary);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* ==========================================================================
   Tool Result Panel
   ========================================================================== */
.result-panel {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.result-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  background-color: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.result-body {
  padding: 1.5rem;
}

.score-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  border: 4px solid var(--primary-light);
  color: var(--primary-light);
}

.result-item {
  display: flex;
  align-items: flex-start;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  gap: 1rem;
}

.result-item-pass { border-left: 4px solid var(--accent-green); }
.result-item-warn { border-left: 4px solid #f59e0b; }
.result-item-fail { border-left: 4px solid #ef4444; }

/* ==========================================================================
   Misc Components
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  padding: 1.5rem;
  text-align: center;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.section { padding: 4rem 0; }
.section-header { text-align: center; margin-bottom: 3rem; max-width: 600px; margin-inline: auto; }
.section-title { font-size: 2.25rem; margin-bottom: 1rem; }

.faq-list { display: flex; flex-direction: column; gap: 1rem; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--surface);
}
.faq-question {
  width: 100%;
  text-align: left;
  padding: 1.25rem 1.5rem;
  background: transparent;
  border: none;
  font-weight: 600;
  font-size: 1.125rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
}
.faq-answer {
  padding: 0 1.5rem 1.25rem;
  color: var(--text-secondary);
  display: none;
}

.hero { padding: 6rem 0; text-align: center; background-color: var(--bg-secondary); border-bottom: 1px solid var(--border); }
.hero-title { font-size: 3.5rem; font-weight: 800; margin-bottom: 1.5rem; color: var(--text); line-height: 1.1; }
.hero-subtitle { font-size: 1.25rem; color: var(--text-secondary); max-width: 800px; margin: 0 auto 2rem; }
.hero-search { max-width: 600px; margin: 0 auto 2rem; }

.pagination { display: flex; list-style: none; gap: 0.25rem; justify-content: center; }
.page-link { padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); }
.page-link:hover, .page-item.active .page-link { background-color: var(--primary); color: #fff; border-color: var(--primary); }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag { padding: 0.25rem 0.75rem; background-color: var(--bg-secondary); border-radius: 999px; font-size: 0.875rem; color: var(--text-secondary); }

.divider { height: 1px; background-color: var(--border); margin: 2rem 0; position: relative; }
.divider-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: var(--bg); padding: 0 1rem; color: var(--text-muted); font-size: 0.875rem; }

.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-secondary); background-color: var(--bg-secondary); }

.copy-btn { position: relative; }
.copy-btn.copied::after { content: 'Copied!'; position: absolute; top: -30px; left: 50%; transform: translateX(-50%); background: #000; color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 12px; }

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero-title { font-size: 2.5rem; }
  .section { padding: 3rem 0; }
  .section-title { font-size: 1.75rem; }
  .modal { max-width: calc(100% - 2rem); }
}
