/* CloseFlow asset picker (Wave 4, W4-11). Controller: static/js/asset-picker.js.
   Modal chrome comes from ds-modal.css; this file styles the picker tabs, search,
   and grid. Card dialect copied from the Assets library surface (assets.html
   .ax-card family), namespaced .cfap- so the mockup-locked page never drifts.
   Tokens only (tokens.css); app is light-only. */

.cfap { max-width: 720px; }

/* tabs */
.cfap-tabs {
  display: flex; gap: 18px;
  padding: 4px 20px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cfap-tab {
  appearance: none; background: none; border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 2px 10px; margin-bottom: -1px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--muted); cursor: pointer;
}
.cfap-tab:hover { color: var(--text); }
.cfap-tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.cfap-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cfap-tab[hidden] { display: none; }

/* optional context note (e.g. square-crop notice) */
.cfap-note {
  padding: 10px 20px 0;
  font-size: 12.5px; color: var(--muted); line-height: 1.5;
}
.cfap-note[hidden] { display: none; }

.cfap-body { min-height: 340px; }
/* Mobile sheet: the 340px floor would defeat ds-modal.css's min-height:0
   (same specificity, this file loads later), clipping the footer below the
   keyboard-pinned viewport. flex:1 already sizes the body. */
@media (max-width: 767px) { .cfap-body { min-height: 0; } }

/* library pane */
.cfap-search {
  width: 100%; height: 36px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 0 12px; margin-bottom: 14px;
  font-family: inherit; font-size: 13px;
  background: var(--card); color: var(--text);
}
.cfap-search::placeholder { color: var(--text-disabled); }
.cfap-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--cf-ring-soft);
}

.cfap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 12px;
}
@media (max-width: 560px) { .cfap-grid { grid-template-columns: repeat(2, 1fr); } }

.cfap-card {
  appearance: none; font-family: inherit; text-align: left; padding: 0;
  position: relative; display: block; width: 100%;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--card); cursor: pointer;
  transition: box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.cfap-card:hover { box-shadow: var(--shadow-md); }
.cfap-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cfap-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--cf-ring-soft); }

.cfap-thumb {
  position: relative; display: flex; aspect-ratio: 1;
  align-items: center; justify-content: center;
  background: var(--surface-sunken); overflow: hidden;
}
.cfap-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cfap-doc { flex-direction: column; gap: 8px; background: var(--cf-bg-warm); color: var(--accent); }
.cfap-ext {
  font-size: 9px; font-weight: 700; line-height: 1; letter-spacing: .04em;
  color: var(--cf-on-accent); background: var(--accent);
  padding: 4px 6px; border-radius: var(--radius-sm);
}

.cfap-check {
  position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px; border-radius: var(--radius-full);
  background: var(--accent); color: var(--cf-on-accent);
  display: none; align-items: center; justify-content: center;
}
.cfap-card.on .cfap-check { display: flex; }

.cfap-meta-wrap { display: block; padding: 9px 11px; }
.cfap-name {
  display: block; font-size: 12px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cfap-sub {
  display: block; margin-top: 3px;
  font-size: 10.5px; color: var(--text-disabled);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.cfap-empty {
  grid-column: 1 / -1;
  padding: 40px 12px; text-align: center;
  font-size: 13px; color: var(--muted); line-height: 1.5;
}

/* upload pane */
.cfap-drop {
  appearance: none; font-family: inherit; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 40px 20px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-xl);
  background: var(--cf-bg-warm); color: var(--muted); cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
.cfap-drop:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-tint); }
.cfap-drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cfap-drop:disabled { opacity: .6; cursor: default; }
.cfap-drop-ico {
  width: 44px; height: 44px; border-radius: var(--radius-full);
  border: 1.5px solid currentColor;
  display: flex; align-items: center; justify-content: center;
}
.cfap-drop-title { font-size: 14px; font-weight: 600; color: var(--text); }
.cfap-drop-sub { font-size: 12px; color: var(--text-disabled); }
.cfap-upload-status { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.cfap-upload-status[hidden] { display: none; }
