/* ==========================================================================
   TOOLPULSE REUSABLE COMPONENTS & UTILITIES
   ========================================================================== */

/* 1. BUTTON PRIMITIVES */
.btn, .button, button.btn {
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  gap: 8px;
  min-height: 44px; 
  padding: 10px 20px; 
  border: 1px solid transparent; 
  border-radius: var(--radius-sm);
  background: var(--color-primary); 
  color: #ffffff; 
  font-weight: 700; 
  text-decoration: none;
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.btn:hover, .button:hover { 
  background: var(--color-primary-hover); 
  color: #ffffff; 
  text-decoration: none; 
  transform: translateY(-1px); 
}

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

.btn-secondary:hover { 
  background: var(--color-surface-2); 
  color: var(--color-text); 
}

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

.btn-small { 
  min-height: 36px; 
  padding: 7px 14px; 
  font-size: .9rem; 
}

.btn-light {
  background: #ffffff;
  color: #172033;
}
.btn-light:hover {
  background: var(--color-surface-2);
  color: #172033;
}

/* 2. CARD WRAPPERS & GRIDS */
.grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); 
  gap: 24px; 
}

.card, .content-card { 
  background: var(--color-surface); 
  border: 1px solid var(--color-border); 
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 24px; 
}

/* Category Grid Display Contexts */
.category-card, .tool-mini-card { 
  display: flex; 
  flex-direction: column; 
  gap: 14px; 
  padding: 24px; 
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  color: inherit; 
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; 
}

.category-card:hover, .tool-mini-card:hover { 
  transform: translateY(-4px); 
  border-color: var(--color-primary); 
  box-shadow: var(--shadow-md); 
  text-decoration: none; 
}

.category-card h3, .tool-mini-card h3 { 
  margin: 0; 
  color: var(--color-text); 
  font-size: 1.25rem; 
}

.category-card p, .tool-mini-card p { 
  margin: 0; 
  color: var(--color-muted); 
  font-size: .95rem; 
  line-height: 1.5;
}

.card-link {
  margin-top: auto;
  font-weight: 600;
  font-size: 0.95rem;
}

/* Mini Cards Structural Internal Adjustments */
.mini-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tool-icon, .card-icon { 
  display: grid; 
  place-items: center; 
  width: 44px; 
  height: 44px; 
  border-radius: var(--radius-sm); 
  background: var(--color-primary-soft); 
  color: var(--color-primary); 
  font-size: 1.25rem; 
  font-weight: normal;
}

/* 3. HERO & HOMEPAGE ELEMENTS */
.hero-section {
  padding-block: 80px 64px;
  text-align: center;
  background: linear-gradient(180deg, var(--color-surface-2) 0%, transparent 100%);
}

.hero-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

.hero-badge {
  display: inline-block;
  padding: 6px 12px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  border-radius: 999px;
  margin-bottom: 16px;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--color-muted);
  margin-bottom: 32px;
}

/* 4. FORM AND SEARCH ARCHITECTURE */
.search-container {
  position: relative;
  max-width: 580px;
  margin: 0 auto;
}

#global-search-form {
  display: flex;
  gap: 8px;
}

.form-group { 
  display: grid; 
  gap: 7px; 
  margin-bottom: 18px; 
}

label { 
  font-weight: 700; 
  font-size: .92rem; 
}

input, textarea, select {
  width: 100%; 
  min-height: 46px; 
  padding: 11px 16px; 
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); 
  background: var(--color-surface); 
  color: var(--color-text);
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea { 
  min-height: 130px; 
  resize: vertical; 
}

input::placeholder, textarea::placeholder { 
  color: var(--color-muted); 
  opacity: .8; 
}

input:focus, textarea:focus, select:focus { 
  border-color: var(--color-primary); 
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent); 
}

/* Search Results UI Component Dropdown */
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 100;
  max-height: 320px;
  overflow-y: auto;
  text-align: left;
}

/* 5. METRICS, ALERTS & UTILITIES */
.badge, .tag { 
  display: inline-flex; 
  align-items: center; 
  width: fit-content; 
  padding: 4px 10px; 
  border-radius: 999px; 
  background: var(--color-primary-soft); 
  color: var(--color-primary); 
  font-size: .78rem; 
  font-weight: 700; 
}

.result-box { 
  margin-top: 18px; 
  padding: 18px; 
  border: 1px solid var(--color-border); 
  border-radius: var(--radius-md); 
  background: var(--color-surface-2); 
}

.result-value { 
  color: var(--color-primary); 
  font-size: clamp(1.5rem, 4vw, 2.2rem); 
  font-weight: 800; 
  overflow-wrap: anywhere; 
}

.alert { 
  padding: 14px 16px; 
  border-radius: var(--radius-sm); 
  background: var(--color-primary-soft); 
  color: var(--color-text); 
}

.alert-error { 
  background: color-mix(in srgb, var(--color-danger) 8%, var(--color-surface)); 
  border: 1px solid var(--color-danger); 
}

.alert-success { 
  background: color-mix(in srgb, var(--color-success) 8%, var(--color-surface)); 
}

.copy-button { 
  display: inline-flex; 
  align-items: center; 
  gap: 7px; 
  padding: 8px 14px; 
  border: 1px solid var(--color-border); 
  border-radius: var(--radius-sm); 
  background: var(--color-surface); 
  color: var(--color-text); 
  font-weight: 700; 
}

.copy-button:hover { 
  border-color: var(--color-primary); 
}

.center-cta {
  text-align: center;
  margin-top: 40px;
}

.callout-box {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  color: #ffffff;
  padding: 48px 32px;
  border-radius: var(--radius-lg);
  text-align: center;
}
.callout-box h2 { color: #ffffff; margin-top: 0; }
.callout-box p { color: rgba(255, 255, 255, 0.9); margin-bottom: 24px; }

.empty-state { 
  padding: 32px; 
  text-align: center; 
  color: var(--color-muted); 
}

/* 6. RESPONSIVE MEDIA ADAPTATION */
@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
  }
  #global-search-form {
    flex-direction: column;
  }
}
