/**
 * URL Shortener — tool styles
 *
 * Page layout, the result block and the link-table typography. Cards, tables,
 * badges, pagination, input groups, modals and skeletons are frikwork's;
 * nothing here restyles one. Every class is `shortener-` prefixed so the tool
 * cannot bleed into another, and every value is a --fw-* token so both themes
 * work without a second rule.
 */

.shortener-layout {
  display: grid;
  grid-template-columns: minmax(300px, 400px) 1fr;
  gap: var(--fw-space-lg);
  align-items: start;
}

/* Grid children default to min-content width, which would let a long
   destination stretch the column instead of scrolling inside .fw-table-wrap. */
.shortener-side,
.shortener-list-panel { min-width: 0; }

/* --- Create form ---------------------------------------------------------- */

.shortener-optional {
  font-weight: 400;
  text-transform: none;
  color: var(--fw-text-muted);
}

/* --- Result --------------------------------------------------------------- */

.shortener-result {
  margin-top: var(--fw-space-lg);
  padding: var(--fw-space-md);
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius-md);
  background: var(--fw-bg-2);
}

.shortener-result__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fw-space-sm);
  margin-bottom: var(--fw-space-sm);
}

.shortener-result__url {
  font-family: var(--fw-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.9rem;
}

.shortener-result__open {
  display: inline-block;
  margin-top: var(--fw-space-sm);
}

/* --- Overview ------------------------------------------------------------- */

.shortener-stats { margin-bottom: var(--fw-space-md); }
.shortener-stats .app-stat { padding: var(--fw-space-md); }
.shortener-stats .app-stat__value { font-size: 1.4rem; }

.shortener-disabled-note { margin: 0 0 var(--fw-space-md); }

.shortener-popular__head {
  display: flex;
  align-items: center;
  gap: var(--fw-space-xs);
  margin: 0 0 var(--fw-space-sm);
}

.shortener-popular {
  list-style: none;
  margin: 0;
  padding: 0;
}

.shortener-popular__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fw-space-sm);
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--fw-border);
}
.shortener-popular__row:last-child { border-bottom: none; }

.shortener-popular__code {
  font-family: var(--fw-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Search --------------------------------------------------------------- */

/* Sits in the panel header beside the refresh button, so it needs a ceiling
   rather than the full width an input group would otherwise take. */
.shortener-search { width: min(260px, 100%); }
.shortener-search .fw-input { font-size: 0.85rem; }

/* --- Link table ----------------------------------------------------------- */

.shortener-table td { vertical-align: middle; }

.shortener-cell-code { white-space: nowrap; }

.shortener-code {
  font-family: var(--fw-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.85rem;
  color: var(--fw-brand-text);
}
.shortener-code__out { font-size: 0.65em; opacity: 0.7; }

/* The destination is the one column allowed to be long; cap it so the clicks
   and date columns keep their width instead of being squeezed to nothing. */
.shortener-cell-dest { max-width: 34ch; }

.shortener-dest {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  color: var(--fw-text-2);
}

.shortener-when { font-size: 0.8rem; color: var(--fw-text-muted); white-space: nowrap; }

.shortener-cell-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}
.shortener-cell-actions .fw-icon-btn + .fw-icon-btn { margin-left: var(--fw-space-xs); }

.shortener-danger:hover { border-color: var(--fw-danger); color: var(--fw-danger); }

/* --- Pagination ----------------------------------------------------------- */

.shortener-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--fw-space-sm);
  padding-top: var(--fw-space-md);
  margin-top: var(--fw-space-md);
  border-top: 1px solid var(--fw-border);
}

.shortener-pager__count { margin: 0; }

/* --- Modals --------------------------------------------------------------- */

.shortener-delete-target {
  margin: var(--fw-space-sm) 0 0;
  overflow-wrap: anywhere;
}

.shortener-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--fw-space-sm);
  margin-bottom: var(--fw-space-md);
}

.shortener-facts__row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: var(--fw-space-sm) var(--fw-space-md);
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius-md);
  background: var(--fw-bg-2);
}

.shortener-facts__value { font-size: 0.95rem; font-weight: 600; color: var(--fw-text); }

.shortener-facts__label { margin: 0 0 var(--fw-space-xs); }

.shortener-facts__dest {
  margin: 0;
  font-family: var(--fw-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.82rem;
  color: var(--fw-text-2);
  overflow-wrap: anywhere;
}

/* --- Loading -------------------------------------------------------------- */

.shortener-loading {
  display: flex;
  flex-direction: column;
  gap: var(--fw-space-sm);
  padding: var(--fw-space-md) 0;
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 1080px) {
  .shortener-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .shortener-search { width: 100%; }
  /* Below this width the ellipsis is doing more harm than the scroll would. */
  .shortener-cell-dest { max-width: 18ch; }
  .shortener-facts { grid-template-columns: 1fr; }
  .shortener-pager { justify-content: center; }
}
