/**
 * Collections feature styles. Self-contained, design-system aligned
 * (cream page / white card / ink / green action; rounded-2xl cards; pills;
 * hairline borders). Enqueued for logged-in users by CollectionsProvider.
 *
 * Uses the theme's @theme color tokens (var(--color-rov-*)) directly so the
 * palette stays in lock-step with the rest of the site without needing the
 * pre-compiled Tailwind bundle to carry new utilities.
 */

:root {
  --rovc-radius: 16px;
  --rovc-radius-sm: 10px;
  --rovc-line: var(--color-rov-cream-alt, #efede7);
  --rovc-line-strong: #e2dfd6;
  --rovc-ink: var(--color-rov-ink, #1a1a1a);
  --rovc-muted: var(--color-rov-text-muted, #555);
  --rovc-green: var(--color-rov-green, #00754a);
  --rovc-green-hover: var(--color-rov-green-hover, #005a3a);
  --rovc-cream: var(--color-rov-cream, #f7f6f3);
  --rovc-shadow: 0 10px 40px -18px rgba(0, 0, 0, .35);
}

body.rovc-noscroll { overflow: hidden; }
[x-cloak] { display: none !important; }

/* ============================================================ Save control */
.rovc-save { position: relative; display: inline-block; }

.rovc-save-btn {
  display: inline-flex; flex-direction: column; align-items: center;
  gap: 2px; background: transparent; border: 0; cursor: pointer;
  color: #1f2937; padding: 8px; font: inherit; line-height: 1.2;
  transition: color .15s ease;
}
.rovc-save-btn:hover { color: var(--rovc-green); }
.rovc-save-btn.is-saved { color: var(--rovc-green); }
.rovc-save-btn i { font-size: 18px; height: 20px; }

.rovc-pop {
  /* Anchor to the button's right edge so a right-aligned Save button (the
     last item in the view-panel bar) opens the popover leftward and never
     overflows the viewport on narrow screens. */
  position: absolute; bottom: calc(100% + 10px); right: 0; left: auto;
  width: min(320px, calc(100vw - 32px));
  background: #fff; border: 1px solid var(--rovc-line-strong);
  border-radius: var(--rovc-radius); box-shadow: var(--rovc-shadow);
  z-index: 60; overflow: hidden;
}
.rovc-pop::after {
  content: ""; position: absolute; top: 100%; right: 16px; left: auto;
  border: 7px solid transparent; border-top-color: #fff;
}
.rovc-pop-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--rovc-line);
}
.rovc-pop-title {
  font: 800 11px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: .14em; text-transform: uppercase; color: var(--rovc-muted);
}
.rovc-pop-x { background: 0; border: 0; cursor: pointer; color: #9ca3af; font-size: 18px; line-height: 1; }
.rovc-pop-x:hover { color: var(--rovc-ink); }

.rovc-pop-list { max-height: 240px; overflow-y: auto; }
.rovc-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 16px; background: 0; border: 0; cursor: pointer;
  text-align: left; font: inherit; color: var(--rovc-ink);
  transition: background .12s ease;
}
.rovc-row:hover { background: var(--rovc-cream); }
.rovc-row-thumb {
  width: 40px; height: 40px; border-radius: var(--rovc-radius-sm);
  object-fit: cover; flex: 0 0 auto; background: var(--rovc-cream);
  border: 1px solid var(--rovc-line);
}
.rovc-row-thumb--empty { display: grid; place-items: center; color: #b9b4a6; }
.rovc-row-body { flex: 1 1 auto; min-width: 0; }
.rovc-row-name { display: block; font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rovc-row-meta { display: block; margin-top: 1px; font-size: 12px; color: var(--rovc-muted); }
.rovc-check {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 999px;
  border: 1.5px solid #cfcabb; display: grid; place-items: center;
  color: #fff; transition: all .15s ease;
}
.rovc-row.is-in .rovc-check { background: var(--rovc-green); border-color: var(--rovc-green); }
.rovc-check i { font-size: 11px; opacity: 0; transition: opacity .15s ease; }
.rovc-row.is-in .rovc-check i { opacity: 1; }

.rovc-create {
  display: flex; gap: 8px; align-items: center; padding: 12px 16px;
  border-top: 1px solid var(--rovc-line); background: #fff;
}
.rovc-create i { color: var(--rovc-green); }
.rovc-input {
  flex: 1 1 auto; min-width: 0; border: 1px solid var(--rovc-line-strong);
  border-radius: 999px; padding: 8px 14px; font-size: 14px; color: var(--rovc-ink);
  background: #fff; outline: 0;
}
.rovc-input:focus { border-color: var(--rovc-green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rovc-green) 18%, transparent); }
.rovc-btn {
  border: 0; cursor: pointer; border-radius: 999px; font-weight: 800;
  font-size: 13px; padding: 9px 16px; background: var(--rovc-green); color: #fff;
  transition: background .15s ease; white-space: nowrap;
}
.rovc-btn:hover { background: var(--rovc-green-hover); }
.rovc-btn:disabled { opacity: .55; cursor: not-allowed; }
.rovc-btn--ghost { background: #fff; color: var(--rovc-ink); border: 1px solid var(--rovc-line-strong); }
.rovc-btn--ghost:hover { background: var(--rovc-cream); border-color: #cfcabb; }
.rovc-btn--sm { padding: 6px 12px; font-size: 12px; }

.rovc-pop-foot { padding: 10px 16px; border-top: 1px solid var(--rovc-line); background: var(--rovc-cream); }
.rovc-manage-link {
  background: 0; border: 0; cursor: pointer; color: var(--rovc-green);
  font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 6px;
}
.rovc-manage-link:hover { color: var(--rovc-green-hover); }

/* Optimistic save-to-default: the default row renders added immediately with a
   spinner on its check, then settles into the checkmark on server reconcile.
   The row is non-interactive while the save is in flight. */
.rovc-row.is-pending { cursor: default; }
.rovc-row.is-pending:hover { background: 0; }
.rovc-row:disabled { cursor: default; }

.rovc-pop-error {
  padding: 10px 16px; font-size: 12.5px; color: #b54708;
  background: #fff7ed; border-top: 1px solid var(--rovc-line);
}

.rovc-empty { padding: 28px 16px; text-align: center; color: var(--rovc-muted); font-size: 14px; }
.rovc-spin { padding: 24px; text-align: center; color: var(--rovc-muted); }
.rovc-spin i { animation: rovc-rotate 1s linear infinite; }
@keyframes rovc-rotate { to { transform: rotate(360deg); } }

/* =================================================================== Modal */
.rovc-modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 18, 22, .55);
  backdrop-filter: blur(2px); z-index: 9998;
}
.rovc-modal {
  position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center;
  padding: 16px; pointer-events: none;
}
.rovc-modal-panel {
  pointer-events: auto; width: min(820px, 100%); max-height: min(86vh, 760px);
  background: var(--rovc-cream); border-radius: var(--rovc-radius);
  box-shadow: 0 30px 80px -24px rgba(0, 0, 0, .5); display: flex; flex-direction: column;
  overflow: hidden;
}
.rovc-modal-head {
  display: flex; align-items: center; gap: 12px; padding: 18px 22px;
  background: #fff; border-bottom: 1px solid var(--rovc-line);
}
.rovc-modal-head h2 { font-size: 20px; font-weight: 800; color: var(--rovc-ink); margin: 0; line-height: 1.1; }
.rovc-modal-x { margin-left: auto; background: 0; border: 0; cursor: pointer; color: #9ca3af; font-size: 24px; line-height: 1; }
.rovc-modal-x:hover { color: var(--rovc-ink); }
.rovc-back {
  background: 0; border: 0; cursor: pointer; color: var(--rovc-muted);
  font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 6px;
}
.rovc-back:hover { color: var(--rovc-ink); }

.rovc-body { padding: 20px 22px; overflow-y: auto; }

/* ============================================== Manager (shared dashboard) */
.rovc-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; }
.rovc-toolbar .rovc-input { max-width: 320px; }

.rovc-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}
.rovc-card {
  background: #fff; border: 1px solid var(--rovc-line); border-radius: var(--rovc-radius);
  overflow: hidden; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  display: flex; flex-direction: column;
}
.rovc-card:hover { transform: translateY(-2px); box-shadow: var(--rovc-shadow); border-color: #d8d3c6; }
.rovc-card-cover {
  aspect-ratio: 4 / 3; background: var(--rovc-cream); position: relative; overflow: hidden;
  display: grid; place-items: center; color: #cdc8ba;
}
.rovc-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rovc-card-cover i { font-size: 30px; }
.rovc-card-body { padding: 12px 14px; }
.rovc-card-name { font-weight: 700; font-size: 15px; color: var(--rovc-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rovc-card-meta { font-size: 12.5px; color: var(--rovc-muted); margin-top: 2px; }
.rovc-card-actions { display: flex; gap: 4px; padding: 0 10px 10px; }
.rovc-icon-btn {
  background: 0; border: 0; cursor: pointer; color: #9ca3af; padding: 6px;
  border-radius: 8px; font-size: 13px; transition: color .12s, background .12s;
}
.rovc-icon-btn:hover { color: var(--rovc-ink); background: var(--rovc-cream); }
.rovc-icon-btn.is-danger:hover { color: #b94a2d; }

.rovc-rename-row { display: flex; gap: 6px; padding: 0 10px 10px; }
.rovc-rename-row .rovc-input { font-size: 13.5px; padding: 6px 12px; }

.rovc-confirm {
  padding: 10px 12px; margin: 0 10px 10px; background: #fdf3ef;
  border: 1px solid #f0d4c8; border-radius: var(--rovc-radius-sm); font-size: 12.5px; color: #8a3b22;
}
.rovc-confirm-actions { display: flex; gap: 6px; margin-top: 8px; }

/* tabs — one per collection, active tab's views render below */
.rovc-tabs {
  display: flex; gap: 6px; overflow-x: auto; margin-bottom: 18px;
  border-bottom: 1px solid var(--rovc-line); scrollbar-width: thin;
}
.rovc-tab {
  display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto;
  background: 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  cursor: pointer; padding: 10px 6px; font: inherit; font-weight: 700; font-size: 14.5px;
  color: var(--rovc-muted); white-space: nowrap; transition: color .12s ease, border-color .12s ease;
}
.rovc-tab:hover { color: var(--rovc-ink); }
.rovc-tab.is-active { color: var(--rovc-green); border-bottom-color: var(--rovc-green); }
.rovc-tab-count {
  font-size: 11px; font-weight: 800; line-height: 1; padding: 3px 7px; border-radius: 999px;
  background: var(--rovc-cream); color: var(--rovc-muted);
}
.rovc-tab.is-active .rovc-tab-count {
  background: color-mix(in srgb, var(--rovc-green) 14%, transparent); color: var(--rovc-green);
}

/* active-collection panel */
.rovc-detail-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.rovc-detail-head h3 { font-size: 22px; font-weight: 800; color: var(--rovc-ink); margin: 0; }
.rovc-detail-count { font-size: 13px; color: var(--rovc-muted); }
.rovc-detail-actions { margin-left: auto; display: flex; gap: 2px; align-self: center; }
.rovc-view-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px;
}
.rovc-view {
  background: #fff; border: 1px solid var(--rovc-line); border-radius: var(--rovc-radius);
  overflow: hidden; position: relative; display: flex; flex-direction: column;
}
.rovc-view-cover { aspect-ratio: 4 / 3; background: var(--rovc-cream); display: grid; place-items: center; color: #cdc8ba; }
.rovc-view-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rovc-view-body { padding: 10px 12px; }
.rovc-view-title { font-weight: 600; font-size: 13.5px; color: var(--rovc-ink); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rovc-view-title a { color: inherit; text-decoration: none; }
.rovc-view-title a:hover { color: var(--rovc-green); }
.rovc-view-byline { font-size: 11.5px; color: var(--rovc-muted); margin-top: 3px; }
.rovc-view-remove {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px;
  border-radius: 999px; border: 0; cursor: pointer; background: rgba(15, 18, 22, .6);
  color: #fff; display: grid; place-items: center; font-size: 12px; opacity: 0;
  transition: opacity .15s ease, background .15s ease;
}
.rovc-view:hover .rovc-view-remove { opacity: 1; }
.rovc-view-remove:hover { background: #b94a2d; }

/* dashboard wrapper heading (matches the other profile tabs) */
.rovc-page-kicker {
  font: 800 11px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: .2em; text-transform: uppercase; color: var(--rovc-green); margin-bottom: 10px;
}
.rovc-page-title { font-size: clamp(28px, 4vw, 38px); font-weight: 800; color: var(--rovc-ink); line-height: 1.05; margin: 0 0 6px; }
.rovc-page-sub { font-size: 15px; color: var(--rovc-muted); margin: 0 0 24px; max-width: 60ch; }

/* ====================================================== Engagement nudge */
.rovc-nudge {
  pointer-events: auto; position: relative; width: min(440px, 100%);
  background: #fff; border-radius: var(--rovc-radius); padding: 32px 28px 24px;
  text-align: center; box-shadow: 0 30px 80px -24px rgba(0, 0, 0, .5);
}
.rovc-nudge-x { position: absolute; top: 12px; right: 14px; }
.rovc-nudge-badge {
  width: 56px; height: 56px; border-radius: 999px; background: var(--rovc-cream);
  color: var(--rovc-green); display: grid; place-items: center; margin: 0 auto 16px; font-size: 22px;
}
.rovc-nudge h2 { font-size: 24px; font-weight: 800; color: var(--rovc-ink); margin: 0 0 10px; line-height: 1.1; }
.rovc-nudge p { font-size: 15.5px; color: var(--rovc-muted); margin: 0 0 18px; line-height: 1.55; max-width: none; }
.rovc-nudge p b { color: var(--rovc-ink); }
.rovc-nudge-actions { display: flex; flex-direction: column; gap: 8px; }
.rovc-nudge-actions .rovc-btn { width: 100%; padding: 13px; font-size: 14.5px; }
.rovc-nudge p.rovc-nudge-fine { font-size: 12px; color: var(--rovc-muted); margin: 14px 0 0; }

@media (max-width: 600px) {
  .rovc-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .rovc-toolbar { flex-direction: column; align-items: stretch; }
  .rovc-toolbar .rovc-input { max-width: none; }
}
