/* ── Bin page ───────────────────────────────────────────────────────────────── */

.bin-page,
.bin-page * { font-family: "Roboto", "Segoe UI", Arial, sans-serif; }

.bin-page {
  max-width: none;
  margin: 0;
  padding: 0 0 40px;
}

#bin-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
@media (min-width: 900px) {
  #bin-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
  }
}
@media (min-width: 1400px) {
  #bin-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
#bin-list .bin-card { margin-bottom: 0; }
#bin-list .bin-skeleton { margin-bottom: 0; }

/* Header row */
.bin-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.bin-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bin-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--chip);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.bin-header-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

/* Search */
.bin-search-wrap {
  position: relative;
  margin-bottom: 16px;
}
.bin-search-input {
  width: 100%;
  padding: 9px 36px 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--panel);
  color: var(--text);
}
.bin-search-input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.bin-search-input::-ms-clear,
.bin-search-input::-ms-reveal { display: none; width: 0; height: 0; }
.bin-search-input::-webkit-search-cancel-button,
.bin-search-input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.bin-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.bin-search-clear:hover { transform: translateY(-50%); color: var(--text); }
.bin-search-clear.is-hidden { display: none; }

/* Bulk actions bar */
.bin-bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
}
.bin-bulk-bar[hidden] { display: none; }
.bin-bulk-count { font-size: 0.85rem; color: var(--muted); }
.bin-bulk-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

/* Paper card in bin */
.bin-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  transition: border-color 0.15s;
}
.bin-card:hover { border-color: var(--accent); }
.bin-card.is-selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }

.bin-card-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.bin-card-checkbox {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

/* Restore / delete icon buttons */
.bin-restore-btn,
.bin-delete-btn {
  position: relative;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  font-size: 0;
  overflow: hidden;
  border: 1px solid;
  cursor: pointer;
  flex-shrink: 0;
}
.bin-restore-btn {
  background: rgba(225, 240, 232, 0.7);
  color: rgba(28, 90, 55, 0.85);
  border-color: rgba(80, 150, 100, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.bin-restore-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13 3a9 9 0 0 0-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42A8.954 8.954 0 0 0 13 21a9 9 0 0 0 0-18z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13 3a9 9 0 0 0-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42A8.954 8.954 0 0 0 13 21a9 9 0 0 0 0-18z'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: 60% 60%;
  mask-size: 60% 60%;
}
.bin-restore-btn:hover {
  background: rgba(200, 228, 212, 0.9);
  border-color: rgba(80, 150, 100, 0.32);
}
.bin-delete-btn {
  background: var(--danger-bg);
  color: var(--danger-fg);
  border-color: color-mix(in srgb, var(--danger-fg) 20%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}
.bin-delete-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: 58% 58%;
  mask-size: 58% 58%;
}
.bin-delete-btn:hover {
  background: var(--danger-bg);
  border-color: color-mix(in srgb, var(--danger-fg) 30%, transparent);
  opacity: 0.92;
}
body.dark-mode .bin-restore-btn {
  background: rgba(30, 55, 40, 0.85);
  color: rgba(130, 210, 160, 0.9);
  border-color: rgba(80, 150, 100, 0.22);
}
body.dark-mode .bin-restore-btn:hover {
  background: rgba(40, 70, 52, 0.95);
}

.bin-card { overflow: hidden; }
.bin-card-body { flex: 1; min-width: 0; cursor: pointer; }
.bin-card-body:hover .bin-card-title { color: var(--accent); }

.bin-card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bin-card-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bin-card-deleted {
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0.75;
  margin: 6px 0 0;
}

/* Note/categories (read-only) */
.bin-card-note {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 6px 0 0;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bin-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0 0;
}
.bin-card-tag-chip {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--chip);
  color: var(--muted);
}


.bin-card mark {
  background: rgba(255, 200, 0, 0.38);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}
body.dark-mode .bin-card mark {
  background: rgba(255, 200, 0, 0.22);
}

/* Empty state */
.bin-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.bin-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.4;
}
.bin-empty-text { font-size: 0.9rem; }

/* Loading skeleton */
.bin-skeleton {
  height: 80px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  animation: bin-pulse 1.4s ease-in-out infinite;
}
@keyframes bin-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (max-width: 700px) {
  .bin-header { gap: 8px; }
  .bin-header-actions { gap: 6px; flex-wrap: wrap; }
}

/* ── Bin detail modal ──────────────────────────────────────────────────────── */
.bin-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
@media (min-width: 600px) {
  .bin-detail-modal { align-items: center; }
}
.bin-detail-modal.is-open { opacity: 1; }

.bin-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
}
.bin-detail-sheet {
  position: relative;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px 24px 32px;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.35);
  transform: translateY(20px);
  transition: transform 0.22s ease;
}
@media (min-width: 600px) {
  .bin-detail-sheet {
    border-radius: 20px;
    transform: translateY(12px);
    box-shadow: 0 8px 40px rgba(0,0,0,0.45);
  }
}
.bin-detail-modal.is-open .bin-detail-sheet { transform: translateY(0); }

.bin-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}
.bin-detail-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
}
.bin-detail-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--chip);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}
.bin-detail-close:hover { background: var(--line); color: var(--text); }

.bin-detail-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 6px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}
.bin-detail-row:last-child { border-bottom: none; }
.bin-detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-top: 2px;
}
.bin-detail-value {
  font-size: 0.9rem;
  color: var(--text);
  word-break: break-word;
  line-height: 1.5;
}
.bin-detail-value a { color: var(--accent); text-decoration: none; }
.bin-detail-value a:hover { text-decoration: underline; }
