/* ────────────────────────────────────────────────────────────
   OH-Previews — Admin styles
   ──────────────────────────────────────────────────────────── */

html, body { height: 100%; }
body { background: var(--bg); }
#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Login ──────────────────────────────────────────────────── */
.login-screen {
  flex: 1; display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg); position: relative; overflow: hidden;
}
.login-blob {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, var(--login-blob) 0%, transparent 70%);
  pointer-events: none;
}
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px 40px; width: 380px;
  box-shadow: var(--shadow-lg); position: relative; z-index: 1;
}
.login-logo    { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.login-brand   { font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.login-tagline { font-size: 13px; color: var(--text-muted); margin-top: 1px; }
.login-error   {
  background: var(--login-error-bg); color: var(--login-error-text); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 12px; margin-bottom: 14px;
}
.login-btn {
  width: 100%; height: 40px; margin-top: 20px;
  background: var(--accent); color: var(--accent-fg); border: none;
  border-radius: var(--radius-sm); font-family: inherit;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background var(--transition);
}
.login-btn:hover   { background: var(--accent-hover); }
.login-btn:active  { transform: scale(.98); }
.login-btn:disabled { opacity: .6; cursor: default; }

/* ── App shell ──────────────────────────────────────────────── */
.app-shell { display: flex; flex: 1; min-height: calc(100vh - 56px); }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--bg); border-right: 1px solid var(--border-light);
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
}
.sidebar-section {
  font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-faint); padding: 12px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 400; color: var(--text-muted);
  cursor: pointer; transition: all var(--transition);
  user-select: none;
}
.nav-item.active  { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: var(--shadow-sm); }
.nav-item:hover:not(.active) { background: var(--btn); color: var(--text); }
.nav-icon { width: 15px; height: 15px; flex-shrink: 0; opacity: .55; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto; font-size: 11px; color: var(--text-faint);
  background: var(--btn); padding: 1px 7px; border-radius: 100px;
}

/* ── Main content area ──────────────────────────────────────── */
.main-area { flex: 1; background: var(--bg); min-width: 0; overflow-x: hidden; }

/* ── Page header ────────────────────────────────────────────── */
.page-header {
  padding: 24px 28px 0;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}
.page-title { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.page-sub   { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ── Projects grid ──────────────────────────────────────────── */
.projects-grid {
  padding: 20px 28px 28px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.project-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  cursor: pointer; transition: box-shadow .2s, transform .2s;
}
.project-card:hover  { box-shadow: var(--shadow); transform: translateY(-2px); }
.project-thumb {
  aspect-ratio: 3 / 2; height: auto; background: var(--proj-thumb-bg);
  overflow: hidden; position: relative;
}
.project-thumb img   { width: 100%; height: 100%; object-fit: cover; }
.project-info        { padding: 12px 14px; }
.project-name        { font-size: 13px; font-weight: 600; }
.project-client      { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.project-meta        { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.project-stat        { font-size: 11px; color: var(--text-faint); display: flex; align-items: center; gap: 4px; }
.project-card-new {
  background: var(--bg); border: 1.5px dashed var(--border); border-radius: var(--radius);
  min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; cursor: pointer; color: var(--text-muted); font-size: 13px; font-weight: 500;
  transition: all var(--transition);
}
.project-card-new:hover { border-color: var(--text-muted); background: var(--surface); color: var(--text); }
.new-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--btn); display: flex; align-items: center; justify-content: center; font-size: 20px; line-height: 1; }

/* ── Project detail header ──────────────────────────────────── */
.detail-header {
  padding: 18px 28px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.detail-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Tab body ───────────────────────────────────────────────── */
.tab-body { padding: 24px 28px; }

/* ── Category chips (filter row) ────────────────────────────── */
.cat-filter-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 20px;
}
.cat-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12px; font-weight: 500; cursor: pointer; transition: all var(--transition);
}
.cat-chip.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.cat-chip:hover:not(.active) { background: var(--btn-hover); }

/* ── Photo grid ─────────────────────────────────────────────── */
.photo-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
  margin-top: 16px; min-height: 40px;
}
.photo-item {
  aspect-ratio: 1; border-radius: var(--radius-sm);
  background: var(--border-light); overflow: hidden;
  position: relative; cursor: pointer; transition: transform .15s;
}
.photo-item img       { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-item:hover     { transform: scale(1.02); }
.photo-item.dragging  { opacity: .35; }
.photo-item.drag-over { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-overlay {
  position: absolute; inset: 0; background: transparent; transition: background .15s;
  display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between;
  padding: 6px;
}
.photo-item:hover .photo-overlay { background: rgba(18,18,20,.3); }
.photo-del {
  width: 22px; height: 22px; border-radius: 6px;
  background: rgba(248,250,253,.92); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
  color: var(--text); opacity: 0; transition: opacity .15s;
}
.photo-item:hover .photo-del { opacity: 1; }
.photo-drag-handle {
  width: 20px; height: 20px; cursor: grab;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: rgba(255,255,255,.7); opacity: 0; transition: opacity .15s;
  margin-top: auto;
}
.photo-item:hover .photo-drag-handle { opacity: 1; }
.photo-status {
  position: absolute; bottom: 5px; left: 5px;
  width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.8);
}
.photo-status.selected { background: var(--selected); }
.photo-status.rejected { background: var(--text-faint); }
.photo-cat-badge {
  position: absolute; bottom: 5px; left: 5px; right: 5px;
  background: rgba(18,18,20,.65); backdrop-filter: blur(4px);
  color: #fff; font-size: 10px; font-weight: 500;
  padding: 2px 5px; border-radius: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.photo-cover-btn {
  position: absolute; top: 5px; left: 5px; z-index: 1;
  width: 22px; height: 22px; border-radius: 6px;
  background: rgba(248,250,253,.92); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text);
  opacity: 0; transition: opacity .15s;
}
.photo-item:hover .photo-cover-btn { opacity: 1; }
.photo-cover-btn.is-cover          { opacity: 1; background: #f59e0b; color: #000; }
.photo-item.is-cover               { box-shadow: inset 0 0 0 2px #f59e0b; }

/* ── Category list (Categories tab) ────────────────────────── */
.cat-list { display: flex; flex-direction: column; gap: 6px; }
.cat-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: box-shadow var(--transition);
}
.cat-row.dnd-dragging { opacity: .4; }
.cat-row.dnd-over     { box-shadow: 0 -2px 0 var(--accent); }
.cat-drag { font-size: 16px; opacity: .3; cursor: grab; flex-shrink: 0; }
.cat-row:active .cat-drag { cursor: grabbing; }
.cat-name-display { flex: 1; font-size: 13px; font-weight: 500; }
.cat-name-input {
  flex: 1; height: 28px; padding: 0 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; font-family: inherit; font-size: 13px; font-weight: 500;
  outline: none; transition: border var(--transition);
}
.cat-name-input:focus { border-color: var(--text); background: var(--surface); }
.cat-count { font-size: 12px; color: var(--text-faint); flex-shrink: 0; }
.cat-row-actions { display: flex; gap: 5px; }

/* ── Feedback list ──────────────────────────────────────────── */
.feedback-list { display: flex; flex-direction: column; gap: 10px; }
.feedback-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.feedback-photo-row {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 12px; margin-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.feedback-thumb {
  width: 60px; height: 44px; border-radius: 6px; overflow: hidden;
  background: var(--border-light); flex-shrink: 0;
}
.feedback-thumb img { width: 100%; height: 100%; object-fit: cover; }
.feedback-photo-name { font-size: 13px; font-weight: 500; }
.feedback-photo-cat  { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.feedback-comment {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 6px 0;
}
.feedback-pin {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--pin); color: #fff;
  font-size: 10px; font-weight: 700; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'DM Mono', monospace; margin-top: 1px;
}
.feedback-text   { font-size: 13px; color: var(--text); flex: 1; }
.feedback-author { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.feedback-edited-badge {
  display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: .03em;
  background: rgba(234,179,8,.15); color: #CA8A04; border: 1px solid rgba(234,179,8,.3);
  border-radius: 3px; padding: 1px 5px; vertical-align: middle; margin-left: 4px;
}
.feedback-hist-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--text-muted); background: none; border: none;
  cursor: pointer; padding: 3px 0; margin-top: 4px; font-family: inherit;
  transition: color .15s;
}
.feedback-hist-toggle:hover { color: var(--text); }
.feedback-hist-toggle.open::before { content: ''; }
.feedback-hist-toggle.open { color: var(--text); }
.feedback-hist-list {
  display: none; margin-top: 4px; border-left: 2px solid var(--border);
  padding-left: 10px;
}
.feedback-hist-list.open { display: block; }
.feedback-hist-item {
  font-size: 11px; color: var(--text-muted); padding: 3px 0;
  border-bottom: 1px solid var(--border-light);
}
.feedback-hist-item:last-child { border-bottom: none; }
.feedback-hist-time {
  display: inline-block; font-size: 10px; font-weight: 500; color: var(--text-faint);
  margin-right: 6px; white-space: nowrap;
}

/* ── Export tab ─────────────────────────────────────────────── */
.export-block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 14px;
}
.export-block h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.export-block p  { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }

/* ── Users table ────────────────────────────────────────────── */
.users-table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-top: 20px;
}
.users-table { width: 100%; border-collapse: collapse; }
.users-table th {
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--text-faint); letter-spacing: .06em; text-transform: uppercase;
  padding: 10px 16px; background: var(--bg);
  border-bottom: 1px solid var(--border-light);
}
.users-table td {
  padding: 12px 16px; font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.users-table tr:last-child td { border-bottom: none; }
.users-table tr:hover td { background: var(--bg); }
.users-table .td-name   { font-weight: 500; }
.users-table .td-email  { color: var(--text-muted); font-size: 12px; }
.users-table .td-actions { display: flex; gap: 6px; }
.inactive-row td { opacity: .5; }

/* ── Upload progress ────────────────────────────────────────── */
.upload-progress { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; }
.upload-file-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-muted);
}
.upload-file-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.upload-file-bar  { flex-shrink: 0; width: 100px; height: 4px; background: var(--border); border-radius: 99px; overflow: hidden; }
.upload-file-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.upload-file-status { flex-shrink: 0; font-size: 11px; }

/* ── DnD ghost ──────────────────────────────────────────────── */
.dnd-ghost-placeholder {
  background: var(--btn); border: 2px dashed var(--border);
  border-radius: var(--radius-sm); aspect-ratio: 1; pointer-events: none;
}

/* ── Inline edit state ──────────────────────────────────────── */
.editing .cat-name-display { display: none; }
.cat-name-input            { display: none; }
.editing .cat-name-input   { display: block; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .projects-grid   { grid-template-columns: repeat(2, 1fr); }
  .photo-grid      { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 820px) {
  .sidebar         { display: none; }
  .projects-grid   { grid-template-columns: 1fr 1fr; padding: 16px; }
  .tab-body        { padding: 16px; }
  .detail-header   { padding: 14px 16px; }
  .photo-grid      { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .projects-grid   { grid-template-columns: 1fr; }
}

/* ── Pin reply thread (feedback tab) ────────────────────── */
.fb-thread { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.fb-reply {
  padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 12px; line-height: 1.5;
}
.fb-reply.client { background: var(--btn); color: var(--text); }
.fb-reply.admin  {
  background: var(--badge-blue-bg); color: var(--badge-blue-text);
  border: 1px solid rgba(14,165,233,.2);
}
.fb-reply-meta { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.fb-reply-form { margin-top: 8px; display: flex; gap: 6px; align-items: flex-end; }
.fb-reply-ta {
  flex: 1; min-height: 32px; max-height: 100px; resize: vertical;
  padding: 6px 9px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 12px;
  color: var(--text); outline: none; transition: border var(--transition);
}
.fb-reply-ta:focus { border-color: var(--text); background: var(--surface); }
.fb-reply-send {
  height: 32px; padding: 0 12px;
  background: var(--accent); color: var(--accent-fg);
  border: none; border-radius: var(--radius-sm); font-family: inherit;
  font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background var(--transition);
}
.fb-reply-send:hover { background: var(--accent-hover); }
.fb-reply-send:disabled { opacity: .5; cursor: default; }

/* ── iOS zoom fix ────────────────────────────────────────────── */
/* font-size < 16px triggers auto-zoom on iOS Safari */
@media (max-width: 768px) {
  input, textarea, select { font-size: 16px !important; }
}
