/*
 * VECTRA Preset Library — frontend stylesheet.
 *
 * Scoped to .vps-library to avoid bleeding into theme styles.
 * Derived from docs/kits/a1-004-web-preset-library/13_ART_DIRECTION/
 *   02_DESIGN_TOKENS/vectra-web-design-tokens.css
 *   05_FRONTEND_CSS/vectra-preset-library-css-starter.css
 */

.vps-library {
  color-scheme: dark;
  --bg: #05070b;
  --panel: rgba(8, 12, 18, 0.78);
  --panel-2: rgba(10, 15, 22, 0.92);
  --panel-3: rgba(15, 21, 30, 0.94);
  --line: rgba(101, 132, 167, 0.18);
  --line-soft: rgba(255, 255, 255, 0.07);
  --text: #edf2f8;
  --muted: #97a8bc;
  --muted-2: #718197;
  --orange: #ff9b43;
  --orange-2: #df6f09;
  --orange-soft: rgba(255, 155, 67, 0.35);
  --cyan: #39d5ff;
  --cyan-soft: rgba(57, 213, 255, 0.34);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
  --radius: 28px;
  --clip-lg: polygon(20px 0, calc(100% - 20px) 0, 100% 20px, 100% calc(100% - 20px), calc(100% - 20px) 100%, 20px 100%, 0 calc(100% - 20px), 0 20px);
  --clip-sm: polygon(9px 0, calc(100% - 9px) 0, 100% 9px, 100% calc(100% - 9px), calc(100% - 9px) 100%, 9px 100%, 0 calc(100% - 9px), 0 9px);
  --vps-card: rgba(8, 12, 18, 0.86);
  --vps-card-hover: rgba(12, 18, 27, 0.94);
  --vps-free: #87ffb0;
  --vps-standard: #39d5ff;
  --vps-deluxe: #ff9b43;
  --vps-community: #b991ff;

  position: relative;
  isolation: isolate;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(32px, 5vw, 72px) 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-sizing: border-box;
}

.vps-library *,
.vps-library *::before,
.vps-library *::after { box-sizing: border-box; }

.vps-library::before {
  content: "";
  position: absolute;
  inset: -40px -20px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 10%, rgba(9, 44, 88, 0.42), transparent 30%),
    radial-gradient(circle at 8% 42%, rgba(255, 155, 67, 0.10), transparent 20%),
    radial-gradient(circle at 92% 42%, rgba(57, 213, 255, 0.10), transparent 20%);
  filter: blur(1px);
}

.vps-library .screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  -webkit-clip-path: inset(50%);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

/* ---------- Hero ---------- */
.vps-hero {
  text-align: center;
  max-width: 920px;
  margin: 0 auto 32px;
}

.vps-eyebrow {
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 760;
  margin-bottom: 10px;
}

.vps-title {
  margin: 0;
  color: #fff;
  font-size: clamp(2.25rem, 5vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: 0.02em;
  font-weight: 500;
}

.vps-title-accent {
  width: 220px;
  height: 3px;
  margin: 22px auto 24px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  box-shadow: 0 0 28px rgba(57, 213, 255, 0.34);
}

.vps-subtitle {
  max-width: 720px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.55;
}

/* ---------- Panels ---------- */
.vps-status-panel,
.vps-filter-panel {
  background: linear-gradient(180deg, rgba(9, 13, 20, 0.92), rgba(6, 10, 16, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025), 0 18px 50px rgba(0, 0, 0, 0.22);
  clip-path: var(--clip-lg);
}

.vps-status-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 32px 0;
  overflow: hidden;
}

.vps-stat {
  padding: 24px 28px;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.vps-stat:first-child { border-left: 0; }

.vps-stat-label {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 760;
}

.vps-stat-value {
  margin-top: 6px;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 720;
}

/* ---------- Filter bar ---------- */
.vps-filter-panel {
  padding: 22px;
  margin-bottom: 28px;
}

.vps-search {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.1);
  clip-path: var(--clip-sm);
  outline: none;
  font: inherit;
}

.vps-search::placeholder { color: var(--muted-2); }

.vps-search:focus {
  border-color: rgba(57, 213, 255, 0.45);
  box-shadow: 0 0 28px rgba(57, 213, 255, 0.1);
}

.vps-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  align-items: flex-end;
}

.vps-filter-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.vps-filter-cell-label {
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 720;
}

.vps-filter,
.vps-button {
  min-height: 40px;
  padding: 0 13px;
  color: #d7e3ee;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.1);
  clip-path: var(--clip-sm);
  text-transform: uppercase;
  letter-spacing: 0.065em;
  font-size: 0.72rem;
  font-weight: 740;
  cursor: pointer;
  font-family: inherit;
}

.vps-filter {
  -webkit-appearance: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.vps-filter:focus,
.vps-button:focus,
.vps-search:focus { outline: 2px solid rgba(57, 213, 255, 0.55); outline-offset: 2px; }

.vps-button:hover { background: rgba(57, 213, 255, 0.07); border-color: rgba(57, 213, 255, 0.3); color: #fff; }

.vps-button--primary {
  color: #071018;
  background: linear-gradient(180deg, #ffb36a, var(--orange-2));
  border-color: rgba(255, 185, 118, 0.84);
  box-shadow: 0 0 28px rgba(255, 155, 67, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.vps-button--primary:hover {
  background: linear-gradient(180deg, #ffc079, var(--orange));
  color: #050708;
}

.vps-button--ghost { background: transparent; }

/* ---------- Result bar ---------- */
.vps-result-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.vps-result-count {
  color: var(--muted);
  font-size: 0.9rem;
}

.vps-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.vps-active-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #d2f5ff;
  border: 1px solid rgba(57, 213, 255, 0.3);
  background: rgba(57, 213, 255, 0.06);
  clip-path: var(--clip-sm);
}

.vps-active-filter-remove {
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
}

/* ---------- States ---------- */
.vps-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  margin-bottom: 24px;
}

.vps-state--error {
  color: var(--orange);
  border-color: rgba(255, 155, 67, 0.32);
  background: rgba(255, 155, 67, 0.04);
}

.vps-loading-pulse {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 18px var(--cyan-soft);
  animation: vps-pulse 1.1s ease-in-out infinite;
}

@keyframes vps-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50%      { opacity: 1;   transform: scale(1.15); }
}

/* ---------- Grid + Cards ---------- */
.vps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.vps-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 250px;
  padding: 22px;
  background: linear-gradient(180deg, var(--vps-card), rgba(4, 6, 10, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 16px 44px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.vps-card::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.72;
}

.vps-card--deluxe::after  { background: linear-gradient(90deg, transparent, var(--orange), transparent); }
.vps-card--free::after    { background: linear-gradient(90deg, transparent, var(--vps-free), transparent); }
.vps-card--standard::after { background: linear-gradient(90deg, transparent, var(--cyan), transparent); }

.vps-card:hover,
.vps-card:focus-within {
  transform: translateY(-2px);
  border-color: rgba(57, 213, 255, 0.25);
  background: linear-gradient(180deg, var(--vps-card-hover), rgba(4, 6, 10, 0.96));
}

.vps-card--deluxe:hover,
.vps-card--deluxe:focus-within { border-color: rgba(255, 155, 67, 0.32); }

.vps-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.vps-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.035);
  clip-path: var(--clip-sm);
  color: #dfeaf5;
  font-size: 0.66rem;
  font-weight: 780;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.vps-badge--deluxe {
  color: var(--orange);
  border-color: rgba(255, 155, 67, 0.28);
  background: rgba(255, 155, 67, 0.045);
}

.vps-badge--standard {
  color: var(--cyan);
  border-color: rgba(57, 213, 255, 0.26);
  background: rgba(57, 213, 255, 0.04);
}

.vps-badge--free {
  color: var(--vps-free);
  border-color: rgba(135, 255, 176, 0.24);
  background: rgba(135, 255, 176, 0.035);
}

.vps-badge--community {
  color: var(--vps-community);
  border-color: rgba(185, 145, 255, 0.32);
  background: rgba(185, 145, 255, 0.06);
}

.vps-badge--muted {
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.08);
}

.vps-card-title {
  margin: 0;
  color: #fff;
  font-size: 1.22rem;
  line-height: 1.16;
  letter-spacing: -0.015em;
  font-weight: 720;
}

.vps-card-meta,
.vps-card-tags,
.vps-preview-state {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.vps-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.vps-tag {
  color: #d2f5ff;
  border: 1px solid rgba(57, 213, 255, 0.14);
  background: rgba(57, 213, 255, 0.035);
  padding: 4px 8px;
  clip-path: var(--clip-sm);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

.vps-preview-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.vps-preview-state::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: linear-gradient(135deg, rgba(57, 213, 255, 0.45), rgba(57, 213, 255, 0));
  border: 1px solid rgba(57, 213, 255, 0.35);
}

.vps-card-spacer { flex: 1; }

.vps-card-action {
  margin-top: 18px;
  align-self: flex-start;
  min-height: 40px;
  padding: 0 16px;
}

/* ---------- Pagination ---------- */
.vps-pagination {
  display: flex;
  justify-content: center;
  margin: 32px 0 16px;
}

/* ---------- Community CTA ---------- */
.vps-community {
  margin-top: 24px;
  padding: 22px;
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  clip-path: var(--clip-lg);
}

.vps-community-title {
  margin: 0 0 8px;
  color: #fff;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.vps-community-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

/* ---------- Detail Modal ---------- */
.vps-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.vps-modal[hidden] { display: none; }

.vps-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 8, 0.78);
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.vps-modal-panel {
  position: relative;
  width: min(720px, 100%);
  max-height: 88vh;
  overflow: auto;
  padding: 28px;
  background: linear-gradient(180deg, rgba(11, 16, 24, 0.98), rgba(6, 9, 14, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
}

.vps-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.vps-modal-close:hover { background: rgba(57, 213, 255, 0.1); border-color: rgba(57, 213, 255, 0.3); }

.vps-modal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.vps-modal-title {
  margin: 0 0 4px;
  font-size: 1.6rem;
  letter-spacing: -0.015em;
}

.vps-modal-creator {
  margin: 0 0 18px;
  color: var(--muted);
}

.vps-modal-section {
  margin-top: 18px;
}

.vps-modal-section-label {
  margin: 0 0 8px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.vps-modal-section p,
.vps-modal-section ul {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

.vps-modal-section ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.vps-modal-section ul li { display: inline-flex; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .vps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vps-status-panel { grid-template-columns: 1fr; }
  .vps-stat { border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.06); }
  .vps-stat:first-child { border-top: 0; }
  .vps-filter-row { gap: 12px; }
  .vps-filter-cell { flex: 1 1 calc(50% - 12px); }
}

@media (max-width: 620px) {
  .vps-library { width: min(100% - 24px, 1240px); }
  .vps-grid { grid-template-columns: 1fr; }
  .vps-title { font-size: clamp(2rem, 12vw, 3.4rem); }
  .vps-filter-cell { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .vps-card,
  .vps-button,
  .vps-loading-pulse { transition: none; animation: none; }
}

/* ---------- C1 web upload pad ---------- */
.vps-upload {
  color: #f5fbff;
  font-family: inherit;
}

.vps-upload__shell {
  border: 1px solid rgba(99, 230, 255, 0.24);
  border-radius: 24px;
  padding: clamp(24px, 4vw, 44px);
  background: radial-gradient(circle at top left, rgba(0, 220, 255, 0.16), transparent 36%), linear-gradient(135deg, rgba(6, 12, 22, 0.98), rgba(3, 5, 10, 0.98));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

.vps-upload__title {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
}

.vps-upload__subtitle {
  margin: 0 0 24px;
  max-width: 760px;
  color: rgba(226, 244, 255, 0.78);
}

.vps-upload__notice {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.vps-upload__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.vps-upload__field,
.vps-upload__rights {
  display: grid;
  gap: 8px;
  color: rgba(238, 249, 255, 0.92);
  font-size: 14px;
}

.vps-upload__field--wide {
  grid-column: 1 / -1;
}

.vps-upload__field input,
.vps-upload__field textarea {
  width: 100%;
  border: 1px solid rgba(151, 231, 255, 0.22);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.28);
  color: #f5fbff;
  outline: none;
}

.vps-upload__field input:focus,
.vps-upload__field textarea:focus {
  border-color: rgba(99, 230, 255, 0.68);
  box-shadow: 0 0 0 3px rgba(99, 230, 255, 0.12);
}

.vps-upload__rights {
  grid-template-columns: auto 1fr;
  align-items: start;
  margin: 18px 0;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.vps-upload__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.vps-upload__hint {
  margin: 0;
  color: rgba(226, 244, 255, 0.64);
  font-size: 13px;
}

.vps-upload__message {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
}

.vps-upload__message[data-kind="success"] {
  border-color: rgba(113, 255, 196, 0.45);
}

.vps-upload__message[data-kind="error"] {
  border-color: rgba(255, 109, 109, 0.5);
}

.vps-upload button[aria-busy="true"] {
  opacity: 0.7;
  cursor: progress;
}

@media (max-width: 820px) {
  .vps-upload__grid {
    grid-template-columns: 1fr;
  }
}
