/* ==========================================================================
   COMPONENTS.CSS — Reusable UI Components
   ========================================================================== */

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: var(--space-3) var(--space-6);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}

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

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary — green, main action ("Probe") */
.btn-primary {
  background-color: var(--accent-green);
  color: #ffffff;
  border-color: var(--accent-green);
}

.btn-primary:hover {
  background-color: var(--accent-green-dim);
  border-color: var(--accent-green-dim);
  transform: scale(1.02);
}

.btn-primary:active {
  transform: scale(0.98);
}

/* Secondary — outlined blue */
.btn-secondary {
  background-color: transparent;
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.btn-secondary:hover {
  background-color: var(--accent-blue);
  color: #ffffff;
}

.btn-secondary:active {
  transform: scale(0.98);
}

/* Ghost — text only, subtle hover */
.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

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

/* Small variant */
.btn-sm {
  min-height: 36px;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

/* Icon-only button (square, needs aria-label) */
.btn-icon {
  min-height: 40px;
  width: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
  min-height: 32px;
  width: 32px;
}

/* Loading state */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: btn-spin 600ms linear infinite;
}

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

/* ==========================================================================
   Input Fields
   ========================================================================== */

.input-field {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  line-height: 1.5;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-field::placeholder {
  color: var(--text-tertiary);
}

.input-field:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-field:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Textarea variant */
textarea.input-field {
  min-height: 120px;
  resize: vertical;
}

/* Input group: input + button side by side */
.input-group {
  display: flex;
  gap: 0;
}

.input-group .input-field {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
  flex: 1;
}

.input-group .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  flex-shrink: 0;
}

/* Input with clear button */
.input-wrapper {
  position: relative;
}

.input-clear {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 50%;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.input-clear:hover {
  background: var(--text-tertiary);
  color: var(--text-primary);
}

.input-wrapper.has-value .input-clear {
  display: flex;
}

.input-wrapper.has-value .input-field {
  padding-right: var(--space-10);
}

/* ==========================================================================
   Select Field
   ========================================================================== */

.select-field {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: var(--space-3) var(--space-10) var(--space-3) var(--space-4);
  background-color: var(--bg-secondary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 4.5L6 8L9.5 4.5' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  background-size: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.select-field:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.select-field option {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-base);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-blue);
}

.card-header {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.card-body {
  flex: 1;
}

.card-footer {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Tool Cards (Homepage Grid)
   ========================================================================== */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  color: inherit;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-blue);
}

.tool-card:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.tool-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background-color: var(--bg-tertiary);
  color: var(--accent-blue);
  font-size: var(--text-xl);
  flex-shrink: 0;
}

.tool-card-name {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.tool-card-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}

.tool-card-badge {
  margin-top: auto;
}

/* ==========================================================================
   Data Tables
   ========================================================================== */

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table thead th {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-3) var(--space-4);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table thead th:first-child {
  border-top-left-radius: var(--radius-lg);
}

.data-table thead th:last-child {
  border-top-right-radius: var(--radius-lg);
}

.data-table tbody tr {
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:nth-child(odd) {
  background-color: var(--bg-secondary);
}

.data-table tbody tr:nth-child(even) {
  background-color: var(--bg-primary);
}

.data-table tbody tr:hover {
  background-color: var(--bg-tertiary);
}

.data-table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  vertical-align: top;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: var(--radius-lg);
}

.data-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: var(--radius-lg);
}

/* Table cell with label text (non-monospace) */
.data-table td.td-label {
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text-secondary);
}

/* ==========================================================================
   Results Panel
   ========================================================================== */

.results-panel {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-top: var(--space-6);
}

.results-panel:empty {
  display: none;
}

.results-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.results-meta .query-time {
  font-family: var(--font-mono);
  color: var(--accent-green);
}

.results-meta .results-actions {
  display: flex;
  gap: var(--space-2);
  margin-left: auto;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
  max-width: 400px;
  width: calc(100% - var(--space-8));
}

.toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-blue);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in var(--transition-slow) ease forwards;
  overflow: hidden;
}

.toast-success {
  border-left-color: var(--accent-green);
}

.toast-info {
  border-left-color: var(--accent-blue);
}

.toast-warning {
  border-left-color: var(--accent-amber);
}

.toast-error {
  border-left-color: var(--accent-red);
}

.toast-icon {
  flex-shrink: 0;
  font-size: var(--text-lg);
}

.toast-success .toast-icon { color: var(--accent-green); }
.toast-info .toast-icon { color: var(--accent-blue); }
.toast-warning .toast-icon { color: var(--accent-amber); }
.toast-error .toast-icon { color: var(--accent-red); }

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.toast-message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

.toast-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.toast-close:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Toast progress bar — auto-dismiss timer */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background-color: var(--accent-blue);
  border-radius: 0 0 0 var(--radius-md);
  animation: toast-progress 4s linear forwards;
}

.toast-success .toast-progress { background-color: var(--accent-green); }
.toast-info .toast-progress { background-color: var(--accent-blue); }
.toast-warning .toast-progress { background-color: var(--accent-amber); }
.toast-error .toast-progress { background-color: var(--accent-red); }

.toast.toast-out {
  animation: toast-out var(--transition-base) ease forwards;
}

@keyframes toast-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

@keyframes toast-progress {
  from { width: 100%; }
  to { width: 0%; }
}

/* ==========================================================================
   Tooltips
   ========================================================================== */

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: var(--space-2) var(--space-3);
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  max-width: 280px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: 100;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Tooltip below variant */
[data-tooltip-position="bottom"]::after {
  bottom: auto;
  top: calc(100% + 8px);
}

/* ==========================================================================
   Badges / Tags
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
  line-height: 1.4;
  white-space: nowrap;
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
}

.badge-green {
  background-color: rgba(34, 197, 94, 0.12);
  color: var(--accent-green);
}

.badge-blue {
  background-color: rgba(59, 130, 246, 0.12);
  color: var(--accent-blue);
}

.badge-amber {
  background-color: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
}

.badge-red {
  background-color: rgba(239, 68, 68, 0.12);
  color: var(--accent-red);
}

/* ==========================================================================
   Category Section Headers (Homepage)
   ========================================================================== */

.category-section {
  margin-top: var(--space-10);
}

.category-heading {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
}

.category-heading-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.category-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--border-subtle);
  margin-left: var(--space-3);
}

/* ==========================================================================
   Quick Option Pills (Tool Pages)
   ========================================================================== */

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.pill:hover {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--text-tertiary);
}

.pill-active,
.pill.active {
  background-color: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
}

.pill-active:hover,
.pill.active:hover {
  background-color: var(--accent-blue-dim);
  border-color: var(--accent-blue-dim);
}

/* ==========================================================================
   Loading / Skeleton
   ========================================================================== */

.skeleton {
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.04) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s ease infinite;
}

[data-theme="light"] .skeleton::after {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.6) 50%,
    transparent 100%
  );
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-heading {
  height: 1.5em;
  width: 40%;
  margin-bottom: var(--space-4);
}

.skeleton-card {
  height: 180px;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ==========================================================================
   SEO Content Block
   ========================================================================== */

.seo-content {
  margin-top: var(--space-12);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border-subtle);
}

.seo-content h2 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-4);
}

.seo-content h3 {
  font-size: var(--text-xl);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
}

.seo-content p {
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 72ch;
  margin-bottom: var(--space-4);
}

.seo-content ul,
.seo-content ol {
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 72ch;
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
}

.seo-content ul {
  list-style-type: disc;
}

.seo-content ol {
  list-style-type: decimal;
}

.seo-content li {
  margin-bottom: var(--space-2);
}

.seo-content a {
  color: var(--accent-blue);
  transition: color var(--transition-fast);
}

.seo-content a:hover {
  color: var(--accent-blue-dim);
}

/* ==========================================================================
   Related Tools
   ========================================================================== */

.related-tools {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  padding-bottom: var(--space-3);
  -webkit-overflow-scrolling: touch;
}

.related-tools::-webkit-scrollbar {
  height: 4px;
}

.related-tools::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 2px;
}

.related-tool-card {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  min-width: 200px;
  transition: all var(--transition-fast);
}

.related-tool-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.related-tool-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.related-tool-category {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   Copy Button
   ========================================================================== */

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.copy-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.copy-btn.copied {
  color: var(--accent-green);
}

/* ==========================================================================
   Info Grid — Standardized label/value pair layout for results
   ========================================================================== */

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.info-grid-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  min-width: 0;
}

.info-grid-item.full-width {
  grid-column: 1 / -1;
}

.info-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

.info-value {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.info-value .copy-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition-fast);
}

.info-grid-item:hover .copy-icon {
  opacity: 1;
}

.info-value .copy-icon:hover {
  color: var(--accent-green);
  border-color: var(--accent-green);
  background-color: rgba(34, 197, 94, 0.08);
}

.info-value .copy-icon.copied {
  color: var(--accent-green);
  border-color: var(--accent-green);
  opacity: 1;
}

/* Highlighted primary value in info-grid */
.info-grid-item.primary {
  background-color: var(--bg-tertiary);
  border-color: var(--accent-blue);
}

.info-grid-item.primary .info-value {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--accent-green);
}

@media (max-width: 640px) {
  .info-grid {
    grid-template-columns: 1fr;
  }

  .info-value .copy-icon {
    opacity: 1;
  }
}

/* ==========================================================================
   Code Output Block — Standardized code/text output display
   ========================================================================== */

.code-output-block {
  position: relative;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.code-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-secondary);
}

.code-output-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

.code-output-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.code-output-meta .meta-item {
  font-family: var(--font-mono);
}

.code-output-body {
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--accent-green);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  max-height: 500px;
  overflow-y: auto;
}

.code-output-body.no-color {
  color: var(--text-primary);
}

/* ==========================================================================
   Result Section — Group results with optional title
   ========================================================================== */

.result-section {
  margin-bottom: var(--space-6);
}

.result-section:last-child {
  margin-bottom: 0;
}

.result-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}

/* ==========================================================================
   Status Banner — Success/warning/error status at top of results
   ========================================================================== */

.status-banner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
}

.status-banner.status-success {
  background-color: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: var(--accent-green);
}

.status-banner.status-warning {
  background-color: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--accent-amber);
}

.status-banner.status-error {
  background-color: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--accent-red);
}

.status-banner-icon {
  flex-shrink: 0;
}

.status-banner-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.status-banner-title {
  font-size: var(--text-lg);
  font-weight: 700;
}

.status-banner-detail {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

@media (max-width: 640px) {
  .status-banner {
    flex-direction: column;
    text-align: center;
    padding: var(--space-4);
  }
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-4);
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--text-tertiary);
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state-description {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  max-width: 400px;
}

/* ==========================================================================
   Error State
   ========================================================================== */

.error-message {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background-color: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  color: var(--accent-red);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* ==========================================================================
   Responsive: Components
   ========================================================================== */

@media (max-width: 1024px) {
  .tool-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .input-group {
    flex-direction: column;
  }

  .input-group .input-field {
    border-radius: var(--radius-md);
    border-right: 1px solid var(--border-subtle);
  }

  .input-group .btn {
    border-radius: var(--radius-md);
    width: 100%;
  }

  .toast-container {
    top: auto;
    bottom: var(--space-4);
    right: var(--space-3);
    left: var(--space-3);
    max-width: none;
    width: auto;
  }

  @keyframes toast-in {
    from {
      transform: translateY(100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  @keyframes toast-out {
    from {
      transform: translateY(0);
      opacity: 1;
    }
    to {
      transform: translateY(100%);
      opacity: 0;
    }
  }
}
