/*
 * Sierra Collective — Gear Bag page
 */

/* ── Gate / Auth ── */
.gate-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
  color: var(--muted);
}

/* ── Two-column layout ── */
.gear-layout {
  display: flex;
  height: calc(100vh - 64px);
  overflow: hidden;
}

/* ── Left Rail ── */
.bag-rail {
  width: 200px;
  min-width: 200px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px 0 24px;
  flex-shrink: 0;
}

.rail-section {
  padding: 0 12px;
}

.rail-heading {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 4px 8px;
}

.rail-divider {
  border-top: 1px solid var(--border);
  margin: 16px 12px;
}

.bag-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  gap: 4px;
  margin-bottom: 2px;
  transition: background 0.1s;
}
.bag-item:hover { background: var(--bg3); }
.bag-item.active { background: var(--bg3); border-left: 2px solid var(--amber); padding-left: 6px; }

.bag-item-name {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.bag-item.active .bag-item-name { color: var(--amber-bright); }

.bag-item-actions {
  display: none;
  gap: 2px;
  flex-shrink: 0;
}
.bag-item:hover .bag-item-actions,
.share-entry:hover .bag-item-actions { display: flex; }

.rail-add-btn {
  width: 100%;
  margin-top: 8px;
  padding: 6px 8px;
  background: transparent;
  border: 1px dashed var(--border2);
  border-radius: 4px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, color 0.15s;
}
.rail-add-btn:hover { border-color: var(--amber-dim); color: var(--amber); }

.rail-empty-hint {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 4px 8px;
}

/* ── Main column ── */
.bag-main {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 80px;
  min-width: 0;
}

.empty-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  color: var(--muted);
  font-size: 14px;
}

/* ── Bag header ── */
.bag-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}

.bag-header h2 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
}

.bag-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.filter-toggle input { cursor: pointer; accent-color: var(--amber); }

/* ── Add top-level item button ── */
.add-top-btn {
  display: inline-block;
  margin-bottom: 16px;
  padding: 6px 14px;
  background: transparent;
  border: 1px dashed var(--border2);
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.add-top-btn:hover { border-color: var(--amber-dim); color: var(--amber); }

/* ── Tree rows ── */
.tree-row {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.tree-row:hover { background: var(--bg2); }
.tree-row:last-child { border-bottom: none; }

.wishlist-row {
  border-left: 2px dashed var(--amber-dim);
  opacity: 0.85;
}
.wishlist-row:hover { opacity: 1; }

.rec-row { border-left: 2px solid var(--green); }

.row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
}

.row-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.caret-btn {
  width: 20px;
  height: 20px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.caret-btn:hover { color: var(--amber); }

.caret-placeholder {
  width: 20px;
  flex-shrink: 0;
  display: inline-block;
}

.row-name-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  padding: 0;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}
.row-name-btn:hover { color: var(--amber-bright); }

.wishlist-star {
  color: var(--amber-dim);
  font-size: 13px;
  flex-shrink: 0;
}

.kind-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  flex-shrink: 0;
}

.rec-label {
  font-size: 10px;
  color: var(--green);
  background: transparent;
  border: 1px solid var(--green);
  border-radius: 3px;
  padding: 1px 4px;
  flex-shrink: 0;
}

.item-meta-line {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  padding-left: 26px;
  font-family: 'IBM Plex Mono', monospace;
}

.row-actions {
  display: none;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.tree-row:hover .row-actions { display: flex; }

.tree-empty {
  text-align: center;
  padding: 48px 0;
  color: var(--muted);
  font-size: 14px;
}

/* ── Icon buttons (shared) ── */
.icon-btn {
  width: 24px;
  height: 24px;
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.1s, border-color 0.1s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border); }
.icon-btn-danger:hover { color: var(--red-bright); border-color: var(--red); }

/* ── Item Drawer ── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
}

.drawer {
  position: fixed;
  top: 64px;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 95vw;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  overflow: hidden;
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--amber);
}

.drawer-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.drawer-close:hover { color: var(--text); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.drawer-error {
  font-size: 12px;
  color: var(--red-bright);
  flex: 1;
}

/* ── Form rows (shared with drawer) ── */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-row label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="url"],
.form-row input[type="date"],
.form-row textarea,
.form-row select {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 4px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  border-color: var(--amber-dim);
}

.form-row textarea { resize: vertical; min-height: 68px; }

.form-row-toggle {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.form-row-toggle label { margin: 0; }
.form-row-toggle input[type="checkbox"] { accent-color: var(--amber); width: 15px; height: 15px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--amber);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 14px;
}

.modal-body p { line-height: 1.5; }
.modal-warning { color: var(--red-bright); font-size: 12px; }

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Radio group in modals ── */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.radio-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.radio-group input[type="radio"] { accent-color: var(--amber); }

/* ── Drawer tabs ── */
.drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-tab {
  flex: 1;
  padding: 9px 4px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.drawer-tab:hover { color: var(--text); }
.drawer-tab.active { color: var(--amber); border-bottom-color: var(--amber); }

/* ── Tab shared chrome ── */
.tab-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.tab-count {
  font-size: 11px;
  color: var(--muted);
}
.tab-empty {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 32px 0;
}
.tab-progress {
  font-size: 12px;
  color: var(--amber);
  text-align: center;
  padding: 8px 0;
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ── Photo grid ── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
}

.photo-del-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.65);
  border: none;
  border-radius: 3px;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.photo-thumb:hover .photo-del-btn { display: flex; }

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 2px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.lightbox-close:hover { color: #fff; }

/* ── Link list ── */
.link-add-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.link-add-form input {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 4px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.link-add-form input:focus { border-color: var(--amber-dim); }
.link-add-form .btn { align-self: flex-start; }

.link-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.link-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.link-yt-thumb {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  background: #000;
}

.link-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.link-label {
  font-size: 13px;
  color: var(--amber-bright);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.link-label:hover { text-decoration: underline; }

.link-type-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.link-row-actions { flex-shrink: 0; }

/* ── Move tree picker ── */
.move-tree-picker {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 4px;
  max-height: 240px;
  overflow-y: auto;
}

.move-tree-option {
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.move-tree-option:last-child { border-bottom: none; }
.move-tree-option:hover { background: var(--bg2); }
.move-tree-option.selected { background: var(--bg2); color: var(--amber-bright); border-left: 2px solid var(--amber); }

/* ── Shared-with-me rail entries ── */
.share-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  gap: 4px;
  margin-bottom: 2px;
  transition: background 0.1s;
}
.share-entry:hover { background: var(--bg3); }
.share-entry.active { background: var(--bg3); border-left: 2px solid var(--amber); padding-left: 6px; }

.share-entry-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.share-entry-name {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-entry.active .share-entry-name { color: var(--amber-bright); }

.share-entry-from {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Shared-by subtitle line ── */
.shared-by-line {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.shared-by-line strong { color: var(--amber-dim); }

/* ── Accept recommendation button ── */
.btn-accept { color: var(--green) !important; }
.btn-accept:hover { border-color: var(--green) !important; }

/* ── Modal hints ── */
.modal-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.form-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 10px;
  color: var(--muted);
}

/* ── Holder / container rows ── */
.holder-row {
  background: color-mix(in srgb, var(--amber) 4%, transparent);
}
.holder-icon {
  font-size: 13px;
  color: var(--amber-dim);
  width: 16px;
  display: inline-block;
  flex-shrink: 0;
}

/* ── Compacted row detail ── */
.caret-leaf {
  opacity: 0.3;
  font-size: 9px;
}
.caret-leaf:hover {
  opacity: 0.7;
}
.row-compact {
  padding: 3px 8px 6px;
  line-height: 1.5;
}
.compact-notes {
  font-size: 12px;
  color: var(--fg-muted);
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
}
.compact-meta {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  margin-top: 2px;
}

/* ── Tree drag-and-drop ── */
.tree-row[draggable="true"] { cursor: grab; }
.tree-row[draggable="true"]:active { cursor: grabbing; }
.tree-row.dragging { opacity: 0.35; }
.tree-row.drop-before { border-top: 2px solid var(--amber); }
.tree-row.drop-after { border-bottom: 2px solid var(--amber); }
.tree-row.drop-inside {
  outline: 1px solid var(--amber-dim);
  background: color-mix(in srgb, var(--amber) 6%, transparent);
}

/* ── Photo drag-reorder ── */
.photo-thumb[draggable="true"] { cursor: grab; }
.photo-thumb[draggable="true"]:active { cursor: grabbing; }
.photo-thumb.dragging { opacity: 0.35; }
.photo-thumb.drop-here { outline: 2px solid var(--amber); }

/* ── Manage shares modal ── */
.share-manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.share-manage-row:last-child { border-bottom: none; }
.share-manage-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.share-manage-who {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}
.share-manage-scope {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.share-note {
  font-size: 12px;
  color: var(--amber-dim);
  font-style: italic;
}
.btn-danger-ghost {
  color: var(--red-bright) !important;
  border-color: var(--red-bright) !important;
}
