/* =========================
   Project Viewer (scoped)
   =========================
   - Uses Bootstrap 5 variables and your brand gold.
   - No global element overrides.
   - No inline styles; CSP-safe.
*/

/* ---- Tokens / fallbacks ---- */
:root {
  --brand-gold: #b08a48; /* fallback; your global can still override earlier in the cascade */
  --pv-radius: .5rem;
  --pv-shadow: 0 1px 2px rgba(0,0,0,.06);
  --pv-shadow-lg: 0 2px 10px rgba(0,0,0,.08);
  --pv-bg: var(--fg-bg, #fff);
  --pv-text: var(--fg-text, var(--bs-body-color, #212529));
  --pv-muted: var(--fg-muted, var(--bs-secondary-color, #6c757d));
  --pv-border: rgba(0,0,0,.08);
}

/* Utility (local only) */
.u-hidden { display: none !important; }
.u-m-0 { margin: 0 !important; }

/* =========================
   Layout targets in hub.html
   ========================= */
#rightColumn #projectList.project-list:not(.rc-rail-grid) {
  background-color: var(--pv-bg);
  border: 1px solid var(--brand-gold);
  border-radius: var(--pv-radius);
  box-shadow: var(--pv-shadow);
  padding: .75rem;
  max-height: min(70vh, 900px);
  overflow: auto;
}

/* When the rail is a brick grid, flatten the container — no box, no scroll */
#rightColumn #projectList.project-list.rc-rail-grid {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  max-height: none;
  overflow: visible;
}



/* =========================
   Left header: title + New Project
   ========================= */
.pv-left-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between; /* ghost div keeps left group left-aligned */
  gap: .75rem;
  background-color: var(--pv-bg);
  border: 1px solid var(--brand-gold);
  border-radius: var(--pv-radius);
  padding: .75rem .9rem;
  box-shadow: var(--pv-shadow);
  margin-bottom: .75rem;
}

.pv-left-hdr__left {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.pv-left-hdr__title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.25;
  color: var(--pv-text);
  font-weight: 600;
}

.pv-left-hdr__ghost { width: 2px; height: 2px; }

/* =========================
   Buttons (not Bootstrap “pills”)
   ========================= */
.pv-btn {
  --btn-bg: #f8f9fa;
  --btn-border: var(--brand-gold);
  --btn-text: var(--pv-text);
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .4rem .7rem;
  font-size: .925rem;
  line-height: 1.25;
  font-weight: 600;
  border-radius: .45rem;               /* NOT pill */
  border: 1px solid var(--btn-border);
  color: var(--btn-text);
  background-color: var(--btn-bg);
  cursor: pointer;
  text-decoration: none;
  user-select: none;
}

.pv-btn:hover,
.pv-btn:focus-visible {
  border-color: var(--brand-gold);
  box-shadow: 0 0 0 2px rgba(176,138,72,.18);
  outline: none;
}

.pv-btn--sm { padding: .28rem .55rem; font-size: .76rem; }
.pv-btn--primary {
  --btn-bg: var(--brand-gold);
  --btn-border: var(--brand-gold);
  --btn-text: #fff;
}
.pv-btn--danger {
  --btn-bg: #dc3545;
  --btn-border: #dc3545;
  --btn-text: #fff;
}
/* =========================
   Gold borders: specific controls
   ========================= */

/* (a) Add Tags: any control used to add/manage tags */
.pv-tags button,
.pv-tags .btn,
.pv-tags a,
.pv-tags label {
  border: 1px solid var(--brand-gold) !important;
}

/* (b) Upload Photos: visible triggers (buttons/labels/links) */
.pv-files__controls button,
.pv-files__controls .btn,
.pv-files__controls a,
.pv-files__controls label {
  border: 1px solid var(--brand-gold) !important;
}

/* (c) Start Recorder in Notes toolbar */
.pv-notes__controls button,
.pv-notes__controls .btn,
.pv-notes__controls a,
.pv-notes__controls label {
  border: 1px solid var(--brand-gold) !important;
}

/* (d) Save / Close / Start Recording in the detail header actions */
.pv-detail__actions button,
.pv-detail__actions .btn,
.pv-detail__actions a,
.pv-detail__actions label {
  border: 1px solid var(--brand-gold) !important;
}

/* =========================
   Right list: items
   ========================= */
.pv-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .6rem;
  justify-content: space-between;
  text-align: left;
  background-color: #fff;
  border: 1px solid var(--brand-gold);
  border-radius: .45rem;               /* NOT pill */
  padding: .55rem .7rem;
  margin: 0 0 .5rem 0;
  cursor: pointer;
  box-shadow: 0 1px 1px rgba(0,0,0,.03);
}

/* When Project Viewer items are bricks in the right-rail grid, the grid rules win */
/* Intentionally empty: let right-rail-brick.css own all brick styles */

.pv-item:hover,
.pv-item:focus-visible {
  border-color: var(--brand-gold);
  box-shadow: 0 0 0 2px rgba(176,138,72,.15);
  outline: none;
}

.pv-item__date {
  color: var(--pv-muted);
  font-size: .82rem;
  min-width: 6.5rem;
}

.pv-item__title {
  flex: 1 1 auto;
  font-weight: 400;
  color: var(--pv-text);
  /* Allow multiple words / lines inside the masonry brick */
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}


/* =========================
   Left detail panel
   ========================= */
.pv-panel {
  background-color: var(--pv-bg);
  border: 1px solid var(--brand-gold);
  border-radius: var(--pv-radius);
  padding: 1rem;
  box-shadow: var(--pv-shadow-lg);
}

.pv-detail__hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .75rem;
}

.pv-detail__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.pv-detail__actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* =========================
   Blocks, labels, inputs
   ========================= */
.pv-block {
  display: block;
  margin-bottom: .85rem;
}

.pv-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  color: var(--pv-muted);
  font-size: .9rem;
  margin-bottom: .35rem;
}

.pv-textarea,
.pv-input,
.pv-input[type="text"],
.pv-input[type="date"] {
  display: block;
  width: 100%;
  border-radius: .45rem;
  border: 1px solid var(--brand-gold);
  padding: .5rem .6rem;
  font-size: .95rem;
  color: var(--pv-text);
  background: #fff;
}

.pv-input--sm { padding: .35rem .5rem; font-size: .9rem; }

.pv-textarea:focus,
.pv-input:focus,
.pv-input[type="text"]:focus,
.pv-input[type="date"]:focus {
  border-color: var(--brand-gold);
  outline: none;
  box-shadow: 0 0 0 2px rgba(176,138,72,.18);
}

.pv-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: .6rem;
  margin-bottom: .85rem;
}
.pv-dates label {
  display: grid;
  gap: .35rem;
  font-size: .9rem;
  color: var(--pv-muted);
}
.pv-dates input[type="date"] {
  display: block;
  width: 100%;
  border-radius: .45rem;
  border: 1px solid var(--brand-gold);
  padding: .5rem .6rem;
  font-size: .95rem;
  color: var(--pv-text);
  background: #fff;
}

/* =========================
   Tags (chips)
   ========================= */
.pv-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
  margin-bottom: .9rem;
}

.pv-tag {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid var(--brand-gold);
  border-radius: .45rem;                 /* NOT pill */
  padding: .2rem .5rem;
  font-size: .85rem;
  color: var(--pv-text);
  background: #fff;
  cursor: pointer;
}
.pv-tag b { font-weight: 700; }

/* =========================
   Files grid (thumbnails)
   ========================= */
.pv-files { margin-bottom: 1rem; }

.pv-files__controls {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .5rem;
}

.pv-file-input { display: none; }

.pv-files__grid {
  --min: 120px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--min), 1fr));
  gap: .6rem;
}

.pv-thumb {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--brand-gold);
  border-radius: .45rem;                 /* NOT pill */
  background: #fff;
  overflow: hidden;
  box-shadow: var(--pv-shadow);
}

.pv-thumb:hover,
.pv-thumb:focus-visible {
  border-color: var(--brand-gold);
  outline: none;
  box-shadow: 0 0 0 2px rgba(176,138,72,.15);
}

.pv-thumb__img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.pv-thumb__label {
  display: block;
  padding: .45rem .55rem;
  font-size: .85rem;
  color: var(--pv-text);
  border-top: 1px solid var(--pv-border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================
   Notes
   ========================= */
.pv-notes { margin-top: .75rem; }
.pv-notes__title { margin: 0 0 .35rem 0; font-size: 1rem; font-weight: 700; }
.pv-notes__controls { display: flex; align-items: center; gap: .5rem; margin-top: .4rem; margin-bottom: .6rem; }
.pv-notes__textarea {
  width: 100%;
  min-height: 84px;
  border-radius: .45rem;
  border: 1px solid var(--brand-gold);
  padding: .5rem .6rem;
  font-size: .95rem;
  resize: vertical;
}
.pv-notes__textarea:focus {
  border-color: var(--brand-gold);
  outline: none;
  box-shadow: 0 0 0 2px rgba(176,138,72,.18);
}

.pv-notes__list { display: grid; gap: .5rem; }

.pv-note {
  border: 1px solid var(--pv-border);
  border-radius: .45rem;                 /* NOT pill */
  background: #fff;
  padding: .55rem .6rem;
  box-shadow: var(--pv-shadow);
}

.pv-prewrap { white-space: pre-wrap; word-wrap: break-word; }

.pv-note__meta,
.pv-note .pv-note__meta {
  margin-top: .4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

/* =========================
   Responsive tweaks
   ========================= */
@media (max-width: 767.98px) {
  #rightColumn #projectList.project-list {
    max-height: unset;
  }
  .pv-dates { grid-template-columns: 1fr; }
  .pv-files__grid { --min: 140px; }
}
/* Neutralize PV card chrome when the rail is in brick mode */
#rightColumn #projectList.rc-rail-grid .pv-item {
  background: transparent !important;
  box-shadow: none !important;
  margin: 0 !important;
}
