/* page/static/css/face-tagging.css — face boxes + naming drawer for the custom lightbox
 * Consolidating styles under DeHart design system tokens
 */

/* ===== On-image face boxes ===== */
.ftag-overlay { position: absolute; inset: 0; pointer-events: none; }
.ftag-box { position: absolute; box-sizing: border-box; cursor: pointer; pointer-events: auto;
  border-radius: var(--radius-sm); transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast); }
.ftag-box.untagged { border: 2px solid rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.1); }
.ftag-box.tagged   { border: 2px solid rgba(255, 255, 255, 0.85); background: transparent; }
.ftag-box.pending  { border: 2px dashed var(--primary-color, #da291c); background: rgba(218, 41, 28, 0.15); }
.ftag-box.active   { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9); }
.ftag-box:hover    { border-color: var(--white); }

.ftag-name-pill { position: absolute; left: 50%; bottom: -30px; transform: translateX(-50%);
  background: rgba(29, 29, 31, 0.92); color: #ffffff; font: 700 14px/1.3 'Source Sans 3', sans-serif; padding: 5px 11px;
  border-radius: var(--radius-sm); white-space: nowrap; pointer-events: none; max-width: 220px; overflow: hidden;
  text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.01em; }
.ftag-box.pending .ftag-name-pill { background: var(--primary-color); }
.ftag-name-pill::before { content: ''; position: absolute; top: -5px; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-bottom-color: rgba(29, 29, 31, 0.92); border-top: 0; }
.ftag-box.pending .ftag-name-pill::before { border-bottom-color: var(--primary-color); }

/* ===== "Tag People" / "Show Names" buttons in the lightbox ===== */
.plb-tagbtn, .plb-namesbtn { padding: 10px 22px; border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px; background: rgba(255, 255, 255, 0.10); color: var(--white);
  font: 600 .95rem/1 'Source Sans 3', sans-serif; cursor: pointer; min-height: 44px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease; }
.plb-tagbtn:hover, .plb-namesbtn:hover { background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.45); }
.plb-tagbtn { border-color: var(--rainbow-red); box-shadow: 0 0 0 1px rgba(218, 41, 28, 0.2); }
.plb-tagbtn:hover { border-color: var(--rainbow-red); box-shadow: 0 0 8px rgba(218, 41, 28, 0.35); }
.plb-namesbtn { border-color: var(--rainbow-blue); box-shadow: 0 0 0 1px rgba(25, 118, 210, 0.2); }
.plb-namesbtn:hover { border-color: var(--rainbow-blue); box-shadow: 0 0 8px rgba(25, 118, 210, 0.35); }

/* ===== Drawer ===== */
.ftag-drawer { position: fixed; left: 0; right: 0; bottom: 0; max-height: 62vh; overflow-y: auto;
  background: var(--white); color: var(--text-color); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-overlay);
  transform: translateY(100%); transition: transform var(--transition-fast) ease; display: none; z-index: 100002;
  border-top: 1px solid var(--border-color); }
.ftag-drawer.open { display: block; transform: translateY(0); }
.ftag-drawer-header { position: sticky; top: 0; background: var(--white); padding: 16px 20px; font-weight: 700;
  font-size: 1.15rem; display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border-color); }
.ftag-close { border: 0; background: none; font-size: 30px; line-height: 1; color: var(--text-light); cursor: pointer;
  width: 44px; height: 44px; }
.ftag-body { padding-bottom: 12px; }
.ftag-progress { padding: 12px 20px; color: var(--text-light); font-size: 1rem; }

.ftag-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border-color);
  min-height: 64px; cursor: pointer; transition: background var(--transition-fast); }
.ftag-row.active { background: var(--bg-surface); }
.ftag-facecrop { width: 56px; height: 56px; border-radius: var(--radius-sm); flex-shrink: 0; background-repeat: no-repeat;
  background-color: var(--bg-surface); border: 1px solid var(--border-color); }
.ftag-name { flex: 1; min-width: 0; font-size: 1.05rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ftag-q { display: block; width: 100%; font-size: .95rem; color: var(--text-light); }
.ftag-row select { min-height: 44px; font-size: 1rem; width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border-color); }
.ftag-notthem { border: 0; background: none; color: var(--rainbow-red); font-size: .95rem; padding: 8px 6px;
  min-height: 44px; cursor: pointer; font-weight: 500; }
.ftag-badge { font-size: .8rem; font-weight: 700; padding: 3px 8px; border-radius: var(--radius-sm); }
.ftag-badge.saved { background: oklch(95% 0.04 142); color: oklch(40% 0.12 142); }
.ftag-badge.pending { background: rgba(218, 41, 28, 0.08); color: var(--primary-color, #da291c); }

.ftag-nudge { font-size: 0.85rem; color: var(--text-light); line-height: 1.4; }
.ftag-nudge a { color: var(--rainbow-red); text-decoration: underline; }

/* Select2 above the drawer */
.select2-container--open { z-index: 100003 !important; }

/* Desktop: dock the drawer on the right */
@media (min-width: 768px) {
  .ftag-drawer { left: auto; top: 0; bottom: 0; width: 380px; max-height: none; border-radius: 0;
    transform: translateX(100%); border-left: 1px solid var(--border-color); border-top: none; }
  .ftag-drawer.open { transform: translateX(0); }
}

/* ===== Tag-once confirmation modal ===== */
#ftag-modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 100000; display: none; align-items: center; justify-content: center; }
#ftag-modal-overlay.visible { display: flex; }
#ftag-modal { background: var(--white); border-radius: var(--radius-md); max-width: 560px; width: 92%; max-height: 85vh; display: flex; flex-direction: column; border: 1px solid var(--border-color); }
#ftag-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-color); }
#ftag-modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-light); }
#ftag-modal-body { padding: 1rem; overflow-y: auto; }
.ftag-modal-intro { font-size: 0.9rem; margin: 0 0 0.75rem; color: var(--text-color); }
.ftag-modal-group { font-weight: 600; font-size: 0.8rem; color: var(--text-light); margin: 0.5rem 0 0.25rem; }
.ftag-modal-grid { display: grid; grid-template-columns: repeat(auto-fill, 90px); gap: 0.5rem; }
.ftag-modal-tile { position: relative; cursor: pointer; }
.ftag-modal-thumb { width: 90px; height: 90px; background-repeat: no-repeat; border-radius: var(--radius-sm); background-color: var(--bg-surface); border: 1px solid var(--border-color); }
.ftag-modal-tile input { position: absolute; top: 4px; left: 4px; }
.ftag-modal-sim { position: absolute; bottom: 2px; right: 4px; font-size: 0.7rem; background: rgba(29,29,31,0.75); color: var(--white); padding: 0 3px; border-radius: 3px; }
.ftag-modal-tile input:not(:checked) ~ .ftag-modal-thumb { opacity: 0.35; }
#ftag-modal-footer { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.75rem 1rem; border-top: 1px solid var(--border-color); }
#ftag-modal-footer button { padding: 0.4rem 0.9rem; border-radius: var(--radius-sm); border: 1px solid var(--border-color); cursor: pointer; transition: background var(--transition-fast); background: var(--bg-surface); color: var(--text-color); }
#ftag-modal-footer button:hover { background: var(--border-color); }
#ftag-modal-confirm { background: var(--primary-color, #da291c) !important; color: var(--white) !important; border-color: var(--primary-color, #da291c) !important; }
#ftag-modal-confirm:hover { filter: brightness(0.9); }

/* ===== Glassmorphism overrides for cinema-dark theme ===== */
.theme-cinema-dark .ftag-drawer {
  background: rgba(24, 24, 24, 0.75) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-color);
  border-color: rgba(255, 255, 255, 0.08);
}

.theme-cinema-dark .ftag-drawer-header {
  background: transparent !important;
  color: var(--text-color);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.theme-cinema-dark .ftag-row {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.theme-cinema-dark .ftag-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.theme-cinema-dark #ftag-modal-overlay {
  background: rgba(0, 0, 0, 0.75) !important;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.theme-cinema-dark #ftag-modal {
  background: rgba(24, 24, 24, 0.8) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-color: rgba(255, 255, 255, 0.08);
}

.theme-cinema-dark #ftag-modal-header,
.theme-cinema-dark #ftag-modal-footer {
  border-color: rgba(255, 255, 255, 0.08);
}

.theme-cinema-dark #ftag-modal-footer button {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.theme-cinema-dark #ftag-modal-footer button:hover {
  background: rgba(255, 255, 255, 0.15);
}
