/* assets/css/vault.css - Archival Vault & Face-Tagging System */

.vault-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

.vault-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.vault-title-group h1 {
  font-size: 2rem;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.vault-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Category Filter Bar */
.vault-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  max-width: 100%;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  line-height: 1.2;
}

.filter-pill:hover, .filter-pill.active {
  background: rgba(217, 119, 6, 0.15);
  border-color: var(--border-gold);
  color: var(--text-gold);
}

.vault-search-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.vault-search-input {
  width: 220px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.vault-search-btn {
  white-space: nowrap;
}

/* Vault Grid */
.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.vault-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.vault-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg), var(--shadow-gold);
  border-color: var(--border-gold);
}

.vault-card-thumb-wrapper {
  position: relative;
  width: 100%;
  height: 220px;
  background: #000;
  overflow: hidden;
  cursor: pointer;
}

.vault-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-smooth);
}

.vault-card:hover .vault-card-thumb {
  transform: scale(1.05);
}

.vault-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-gold);
  color: var(--text-gold);
}

.vault-tag-count {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  background: rgba(15, 23, 42, 0.85);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.vault-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.vault-card-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.45rem;
  line-height: 1.3;
}

.vault-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
  flex: 1;
}

.vault-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* =========================================
   Interactive Face Tagging Modal & Inspector
   ========================================= */
.face-tagger-modal {
  max-width: 1100px;
  width: 95vw;
}

.face-tagger-layout {
  display: flex;
  gap: 1.5rem;
  min-height: 520px;
}

.face-tagger-stage-wrap {
  flex: 1;
  background: #000;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.face-tagger-img-container {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 550px;
}

.face-tagger-target-img {
  display: block;
  max-width: 100%;
  max-height: 550px;
  width: auto;
  height: auto;
  border-radius: var(--radius-sm);
}

/* Crosshair mode */
.face-tagger-img-container.tagging-active {
  cursor: crosshair;
}

/* Face Tag Overlay Box */
.face-tag-box {
  position: absolute;
  border: 2px solid var(--accent-gold);
  background: rgba(217, 119, 6, 0.15);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 10;
}

.face-tag-box:hover, .face-tag-box.highlighted {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.25);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.6);
  z-index: 20;
}

.face-tag-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  color: #fff;
  font-size: 0.78rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.face-tag-box:hover .face-tag-tooltip {
  opacity: 1;
}

/* Active Dragging Rectangle */
.face-drag-rect {
  position: absolute;
  border: 2px dashed #fbbf24;
  background: rgba(251, 191, 36, 0.2);
  pointer-events: none;
  z-index: 30;
  display: none;
}

/* Autocomplete Picker on image */
.face-picker-popup {
  position: absolute;
  z-index: 50;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  box-shadow: var(--shadow-lg);
  width: 250px;
  display: none;
}

/* Tag List Sidebar */
.face-tagger-sidebar {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.face-tag-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 380px;
  overflow-y: auto;
}

.face-tag-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.face-tag-item:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-gold);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 768px) {

  /* Vault container */
  .vault-container {
    padding: 1.25rem 0.9rem;
  }

  /* Vault header: tighten */
  .vault-title-group h1 {
    font-size: 1.5rem;
  }

  .vault-header {
    margin-bottom: 1.25rem;
  }

  /* Filter bar: stack pills above search */
  .vault-filter-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }

  /* Pills: horizontal smooth scroll container, no wrap */
  .filter-pills {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 0.25rem;
    padding-top: 0.1rem;
    gap: 0.45rem;
    width: 100%;
  }

  .filter-pills::-webkit-scrollbar {
    display: none;
  }

  /* Each pill: no word break, touch friendly */
  .filter-pill {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    padding: 0.45rem 0.8rem;
    font-size: 0.82rem;
  }

  /* Search form: full width with flexible input */
  .vault-search-form,
  .vault-filter-bar form {
    width: 100% !important;
    display: flex !important;
    gap: 0.4rem;
  }

  .vault-search-input,
  .vault-filter-bar form .form-control {
    width: 100% !important;
    flex: 1 1 auto;
    font-size: 0.9rem;
    padding: 0.45rem 0.75rem;
  }

  .vault-search-btn,
  .vault-filter-bar form button {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.45rem 0.9rem;
  }

  /* Vault grid: smaller min card */
  .vault-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
  }

  /* Card thumb height: reduce */
  .vault-card-thumb-wrapper {
    height: 180px;
  }

  /* Face tagger: stack vertically */
  .face-tagger-layout {
    flex-direction: column;
    min-height: auto;
    gap: 1rem;
  }

  .face-tagger-stage-wrap {
    min-height: 240px;
  }

  .face-tagger-sidebar {
    width: 100%;
  }

  .face-tag-list {
    max-height: 220px;
  }

  /* Face picker popup: full width on mobile */
  .face-picker-popup {
    width: calc(100vw - 2rem);
    left: 0 !important;
    right: auto;
  }

  /* Face tagger modal: larger viewport usage */
  .face-tagger-modal {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 480px) {

  /* Single column vault grid */
  .vault-grid {
    grid-template-columns: 1fr;
  }

  .vault-card-thumb-wrapper {
    height: 200px;
  }
}
