/**
 * Enterno.io Shared CSS Components
 *
 * Standardized components used across tool pages.
 * BEM naming: .ent-{component}, .ent-{component}__{element}, .ent-{component}--{modifier}
 * Use alongside per-page CSS for tool-specific overrides.
 */

/* ── Data Table ─────────────────────────────────────────── */
.ent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: var(--mono, monospace);
}
.ent-table th {
  text-align: left;
  padding: 10px 14px;
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.ent-table td {
  padding: 10px 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  word-break: break-all;
}
.ent-table tr:last-child td { border-bottom: none; }
.ent-table tbody tr:nth-child(even) td { background: rgba(255,255,255,0.02); }
.ent-table--sans { font-family: var(--sans, system-ui); }
.ent-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
}
@media (max-width: 640px) {
  .ent-table th, .ent-table td { padding: 8px 10px; font-size: 12px; }
}

/* ── Tabs ───────────────────────────────────────────────── */
.ent-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ent-tabs::-webkit-scrollbar { display: none; }
.ent-tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}
.ent-tab:hover { color: var(--text); }
.ent-tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.ent-tab__count {
  font-size: 11px;
  background: var(--border);
  color: var(--muted);
  padding: 1px 6px;
  border-radius: 100px;
  margin-left: 6px;
}
.ent-tab--active .ent-tab__count {
  background: rgba(89,168,255,0.15);
  color: var(--accent);
}
.ent-panel { display: none; }
.ent-panel--active { display: block; }

/* ── Collapsible / Details ──────────────────────────────── */
.ent-collapse {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  margin-bottom: 8px;
  overflow: hidden;
}
.ent-collapse summary,
.ent-collapse__header {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  transition: background 0.15s;
  list-style: none;
}
.ent-collapse summary::-webkit-details-marker { display: none; }
.ent-collapse summary::before,
.ent-collapse__header::before {
  content: '\25B6';
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.2s;
}
.ent-collapse[open] summary::before { transform: rotate(90deg); }
.ent-collapse summary:hover,
.ent-collapse__header:hover { background: var(--surface3); }
.ent-collapse__body {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

/* ── Status Badge (already in ent-toolkit.css, extended here) */
.ent-badge--skip {
  background: rgba(132,148,174,0.12);
  color: var(--muted);
}
.ent-badge--lg {
  font-size: var(--fs-sm, 0.875rem);
  padding: 4px 14px;
}

/* ── Check List (pass/warn/fail items) ──────────────────── */
.ent-checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ent-checklist__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.ent-checklist__item:last-child { border-bottom: none; }
.ent-checklist__icon { flex-shrink: 0; font-size: 16px; line-height: 1.4; }
.ent-checklist__text { flex: 1; min-width: 0; }
.ent-checklist__name { font-weight: 600; font-size: 14px; color: var(--text); }
.ent-checklist__detail { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ent-checklist__pts {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-family: var(--mono, monospace);
  white-space: nowrap;
}

/* ── Category Card (grouped score section) ──────────────── */
.ent-cat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  margin-bottom: 16px;
  overflow: hidden;
}
.ent-cat-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--surface2);
}
.ent-cat-card__name { font-weight: 700; font-size: 15px; color: var(--text); }
.ent-cat-card__score { font-weight: 700; font-size: 15px; font-family: var(--mono, monospace); }

/* ── Progress Bar ───────────────────────────────────────── */
.ent-bar {
  height: 6px;
  background: var(--surface3);
  border-radius: 100px;
  overflow: hidden;
}
.ent-bar__fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.6s var(--ease-out, cubic-bezier(0.16,1,0.3,1));
}

/* ── Summary Strip (score hero at top of results) ───────── */
.ent-summary {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  margin-bottom: 24px;
}
.ent-summary__score { flex-shrink: 0; }
.ent-summary__info { flex: 1; min-width: 0; }
.ent-summary__grade {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 100px;
  font-weight: 700;
  font-size: 14px;
}
.ent-summary__meta { font-size: 13px; color: var(--muted); margin-top: 6px; }
@media (max-width: 480px) {
  .ent-summary { flex-direction: column; text-align: center; gap: 14px; }
}

/* ── Empty State ────────────────────────────────────────── */
.ent-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.ent-empty__icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.ent-empty__title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.ent-empty__text { font-size: 14px; max-width: 400px; margin: 0 auto; }

/* ── Result Animations ──────────────────────────────────── */
@keyframes ent-fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ent-fadein {
  animation: ent-fadeIn 0.35s var(--ease-out, cubic-bezier(0.16,1,0.3,1)) both;
}
.ent-fadein-1 { animation-delay: 0s; }
.ent-fadein-2 { animation-delay: 0.06s; }
.ent-fadein-3 { animation-delay: 0.12s; }
.ent-fadein-4 { animation-delay: 0.18s; }
.ent-fadein-5 { animation-delay: 0.24s; }

/* ── Scrollable table shadows (mobile) ──────────────────── */
.ent-table-wrap {
  position: relative;
}
.ent-table-wrap::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 24px;
  background: linear-gradient(to left, var(--surface), transparent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.ent-table-wrap--scrollable::after { opacity: 1; }

/* ── Mobile UX Improvements ─────────────────────────────── */

/* Touch targets: minimum 44px */
@media (max-width: 768px) {
  .ent-tab { min-height: 44px; padding: 10px 14px; }
  .ent-collapse summary { min-height: 44px; }
  .ent-checklist__item { padding: 12px 10px; }
  .export-btn, .share-btn { min-height: 44px; min-width: 44px; }
  .check-btn, .btn-primary { min-height: 48px; font-size: 16px; }
  .input { min-height: 48px; font-size: 16px; }
}

/* Scrollable tables with snap */
@media (max-width: 640px) {
  .ent-table-wrap { margin: 0 -16px; padding: 0 16px; }
}

/* Swipeable tabs */
.ent-tabs {
  scroll-snap-type: x mandatory;
}
.ent-tab {
  scroll-snap-align: start;
}

/* Auto-scroll to results */
.tool-results-target {
  scroll-margin-top: 16px;
}

/* Input modes for better mobile keyboards */
/* Applied via HTML: inputmode="url" on URL inputs */

/* Bottom safe area for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
  .site-footer { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* Sticky submit on long forms (mobile) */
@media (max-width: 640px) {
  .ent-form--sticky-submit {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--bg);
    padding: 12px 0;
    border-top: 1px solid var(--border);
  }
}

/* ── Accessibility ──────────────────────────────────────── */

/* Focus indicators */
:focus-visible {
  outline: 2px solid var(--accent, #59a8ff);
  outline-offset: 2px;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--white);
  border-radius: var(--radius-sm, 8px);
  z-index: 9999;
  font-weight: 600;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 8px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms \!important;
    animation-iteration-count: 1 \!important;
    transition-duration: 0.01ms \!important;
  }
}

/* Screen reader only */
.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;
}

/* ── Error Pages (404, 500) ─────────────────────────────── */
.error-page-code {
  font-size: clamp(48px, 10vw, 80px);
  font-weight: 700;
  color: var(--accent);
  font-family: var(--mono);
  line-height: 1;
  margin-bottom: 8px;
}
.error-page-title { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.error-page-desc { color: var(--muted2); margin-bottom: 24px; max-width: 460px; margin-left: auto; margin-right: auto; }
.error-page-suggest { margin-bottom: 20px; }
.error-page-popular { margin-bottom: 28px; }
.error-page-suggest-title { font-size: 13px; color: var(--muted); margin-bottom: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.error-page-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.error-page-link {
  padding: 6px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  transition: all 0.15s;
}
.error-page-link:hover { color: var(--accent); border-color: rgba(89,168,255,.3); background: rgba(89,168,255,.06); }
.error-page-btn { margin-top: 8px; }
.tool-hero .card { text-align: center; }
