/* CBP Desk — shared portal styles
   Tools do NOT import this file in Phase 1 (migrate unchanged).
   Phase 2: add `<link rel="stylesheet" href="/assets/cbp.css">` to each tool header. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --teal:        #1D8FA9;
  --teal-dark:   #166f84;
  --teal-light:  #e4f4f8;
  --bg:          #f2f4f7;
  --surface:     #ffffff;
  --border:      #dde1e7;
  --text:        #1a1d21;
  --text-muted:  #6b7280;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:   0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --radius:      8px;
  --header-h:    56px;
}

html { font-size: 16px; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Browser warning ─────────────────────────────────────────── */
#browser-warning {
  display: none;
  background: #fef3c7;
  border-bottom: 1px solid #f59e0b;
  padding: 10px 20px;
  font-size: .875rem;
  color: #78350f;
  text-align: center;
}
#browser-warning.visible { display: block; }

/* ── Header ──────────────────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: #1a1d21;
  display: flex;
  align-items: center;
  padding: 0 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.logo-img {
  height: 28px;
  width: auto;
}

/* ── What's New banner ───────────────────────────────────────── */
#whats-new-bar {
  display: none;
  background: var(--teal);
  color: #fff;
  font-size: .875rem;
  padding: 10px 24px;
  align-items: center;
  gap: 12px;
}
#whats-new-bar.visible { display: flex; }

#whats-new-bar strong { font-weight: 600; margin-right: 6px; }

#whats-new-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255,255,255,.8);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}
#whats-new-dismiss:hover { color: #fff; }

/* ── Search ──────────────────────────────────────────────────── */
.search-wrap {
  padding: 28px 24px 8px;
  max-width: 560px;
}

#search {
  width: 100%;
  padding: 10px 16px 10px 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 14px center;
  font-size: .9375rem;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
#search:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(29,143,169,.15);
}
#search::placeholder { color: var(--text-muted); }

/* ── Main content ────────────────────────────────────────────── */
main {
  padding: 0 24px 80px;
}

/* ── Category section ────────────────────────────────────────── */
.category-section { margin-top: 36px; }
.category-section.hidden { display: none; }

.category-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.category-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Tool grid ───────────────────────────────────────────────── */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* ── Tool tile ───────────────────────────────────────────────── */
.tool-tile {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s, border-left-color .15s;
  cursor: pointer;
}
.tool-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-left-color: var(--teal-dark);
}
.tool-tile:active { transform: translateY(0); }

.tool-icon {
  width: 40px;
  height: 40px;
  background: var(--teal-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  flex-shrink: 0;
}
.tool-icon svg {
  width: 22px;
  height: 22px;
  color: var(--teal);
  stroke: var(--teal);
}

.tool-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.3;
}

.tool-desc {
  font-size: .8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Featured (first/largest) tile */
.tool-tile.featured {
  grid-column: span 2;
  flex-direction: row;
  align-items: flex-start;
  gap: 18px;
  padding: 24px;
}
.tool-tile.featured .tool-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 0;
  flex-shrink: 0;
}
.tool-tile.featured .tool-icon svg { width: 28px; height: 28px; }
.tool-tile.featured .tool-name { font-size: 1.125rem; }

/* ── No-results ──────────────────────────────────────────────── */
#no-results {
  display: none;
  padding: 60px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: .9375rem;
}
#no-results.visible { display: block; }

/* ── Version stamp ───────────────────────────────────────────── */
#version-stamp {
  position: fixed;
  bottom: 12px;
  right: 16px;
  font-size: .6875rem;
  color: var(--text-muted);
  opacity: .6;
  pointer-events: none;
  letter-spacing: .02em;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  header { padding: 0 16px; }
  .search-wrap { padding: 20px 16px 4px; }
  main { padding: 0 16px 60px; }

  .tool-tile.featured {
    grid-column: span 1;
    flex-direction: column;
  }
  .tool-tile.featured .tool-icon { margin-bottom: 14px; }
}

@media (min-width: 900px) {
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .tool-tile { transition: none; }
}
