/* ============================================================
   Website Changes Tracker — style.css
   Design: dark command-centre palette, sharp monospaced accents
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --bg0:        #0d0f14;   /* deepest background                */
  --bg1:        #141720;   /* panels                            */
  --bg2:        #1c2030;   /* cards, inputs                     */
  --bg3:        #252a3a;   /* hover surfaces                    */
  --border:     #2e3448;   /* subtle borders                    */
  --border-hi:  #3d445e;   /* focused borders                   */

  --ink0:       #e4e8f5;   /* primary text                      */
  --ink1:       #8b92b3;   /* muted text                        */
  --ink2:       #545b7a;   /* disabled / placeholder            */

  --accent:     #6366f1;   /* indigo — primary action           */
  --accent-hi:  #818cf8;   /* hover                             */
  --accent-dim: rgba(99,102,241,.15);

  --green:      #22c55e;
  --amber:      #f59e0b;
  --red:        #ef4444;
  --sky:        #38bdf8;

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;

  --shadow:     0 4px 24px rgba(0,0,0,.5);
  --shadow-lg:  0 8px 48px rgba(0,0,0,.7);

  --font-sans:  'Inter', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;
  --transition: 150ms ease;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg0);
  color: var(--ink0);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-hi); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
img, video { display: block; max-width: 100%; }

/* ── Scrollbars ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg1); }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 99px; }

/* ── Auth screen ─────────────────────────────────────────────── */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99,102,241,.18) 0%, transparent 70%),
    var(--bg0);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}
.auth-logo svg { color: var(--accent); }
.auth-logo span {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--ink0);
}
.auth-logo small {
  display: block;
  font-size: 11px;
  color: var(--ink2);
  letter-spacing: .5px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

/* ── Form elements ───────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink1); letter-spacing: .5px; text-transform: uppercase; }
.field input, .field textarea, .field select {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink0);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.field textarea { resize: vertical; min-height: 80px; }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b92b3' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hi); }
.btn-ghost   { background: transparent; border-color: var(--border); color: var(--ink1); }
.btn-ghost:hover { background: var(--bg3); border-color: var(--border-hi); color: var(--ink0); }
.btn-danger  { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,.12); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .4; pointer-events: none; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink1);
  transition: all var(--transition);
  padding: 0;
}
.btn-icon:hover { background: var(--bg3); color: var(--ink0); border-color: var(--border); }
.btn-icon.danger:hover { color: var(--red); border-color: var(--red); background: rgba(239,68,68,.1); }

/* ── App shell ───────────────────────────────────────────────── */
#app {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 56px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── Topbar ──────────────────────────────────────────────────── */
#topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.logo-mark { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; letter-spacing: -.3px; }
.logo-mark svg { color: var(--accent); }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink2);
  font-family: var(--font-mono);
}
.breadcrumb .sep { color: var(--border-hi); }
.breadcrumb .crumb { color: var(--ink1); }
.breadcrumb .crumb.active { color: var(--ink0); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}
.user-chip:hover { border-color: var(--border-hi); }

/* ── Sidebar ─────────────────────────────────────────────────── */
#sidebar {
  background: var(--bg1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-section { padding: 16px 12px 8px; }
.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink2);
  padding: 0 8px;
  margin-bottom: 6px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink1);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  border: 1px solid transparent;
}
.sidebar-link:hover { background: var(--bg3); color: var(--ink0); }
.sidebar-link.active { background: var(--accent-dim); color: var(--accent-hi); border-color: rgba(99,102,241,.3); }
.sidebar-link svg { flex-shrink: 0; }
.sidebar-projects { flex: 1; overflow-y: auto; padding: 0 12px 12px; }

.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  gap: 8px;
}
.project-item:hover { background: var(--bg3); }
.project-item.active { background: var(--accent-dim); }
.project-name { font-size: 13px; font-weight: 500; color: var(--ink0); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-count {
  font-size: 10px;
  font-family: var(--font-mono);
  background: var(--bg3);
  color: var(--ink2);
  padding: 2px 6px;
  border-radius: 99px;
  flex-shrink: 0;
}

/* ── Main content ────────────────────────────────────────────── */
#main {
  overflow-y: auto;
  background: var(--bg0);
  display: flex;
  flex-direction: column;
}
.view { padding: 28px 32px; flex: 1; }
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.view-title { font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.view-subtitle { font-size: 13px; color: var(--ink1); margin-top: 2px; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card + .card { margin-top: 12px; }

/* ── Status badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: .3px;
  white-space: nowrap;
}
.badge-pending    { background: rgba(245,158,11,.15);  color: var(--amber); }
.badge-in_progress{ background: rgba(56,189,248,.15); color: var(--sky); }
.badge-review     { background: rgba(99,102,241,.2);   color: var(--accent-hi); }
.badge-done       { background: rgba(34,197,94,.15);   color: var(--green); }

.role-badge { padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; font-family: var(--font-mono); }
.role-admin  { background: rgba(239,68,68,.15); color: var(--red); }
.role-editor { background: rgba(99,102,241,.15); color: var(--accent-hi); }
.role-viewer { background: rgba(139,146,179,.15); color: var(--ink1); }

/* ── Changes list ────────────────────────────────────────────── */
.change-card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 10px;
}
.change-card:hover { border-color: var(--border-hi); background: var(--bg2); }
.change-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.change-title { font-size: 15px; font-weight: 600; color: var(--ink0); }
.change-desc { font-size: 13px; color: var(--ink1); margin-top: 4px; line-height: 1.5; }
.change-meta { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.change-meta-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink2); font-family: var(--font-mono); }

/* ── Avatar ──────────────────────────────────────────────────── */
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.avatar-lg { width: 36px; height: 36px; font-size: 14px; }

/* ── Detail panel ────────────────────────────────────────────── */
#detail-view { display: grid; grid-template-columns: 1fr 320px; height: 100%; overflow: hidden; }
.detail-main { overflow-y: auto; padding: 28px 28px 28px 32px; }
.detail-sidebar { border-left: 1px solid var(--border); overflow-y: auto; padding: 20px; background: var(--bg1); }

/* ── Media grid ──────────────────────────────────────────────── */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 16px; }
.media-thumb {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  aspect-ratio: 16/10;
}
.media-thumb:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-thumb .media-type-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(13,15,20,.8);
  backdrop-filter: blur(6px);
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink0);
}
.media-thumb .media-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  opacity: 0;
  transition: opacity var(--transition);
}
.media-thumb:hover .media-delete { opacity: 1; }

/* ── Upload zone ─────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--ink2);
  margin-top: 12px;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent-hi);
}
.upload-zone svg { margin: 0 auto 10px; }
.upload-zone p { font-size: 13px; }
.upload-zone small { font-size: 11px; font-family: var(--font-mono); }

/* ── Annotation canvas wrapper ───────────────────────────────── */
#annotation-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
}
.anno-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.anno-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}
.anno-tool {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--ink1);
  transition: all var(--transition);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}
.anno-tool:hover { border-color: var(--border-hi); color: var(--ink0); }
.anno-tool.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-hi); }

.anno-canvas-wrap {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}
#anno-canvas {
  box-shadow: var(--shadow-lg);
  cursor: crosshair;
  max-width: 100%;
  display: block;
}
.anno-color-picker { display: flex; gap: 6px; align-items: center; }
.color-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
}
.color-dot.active { border-color: #fff; transform: scale(1.2); }

/* ── Comments ────────────────────────────────────────────────── */
.comment-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.comment-item { display: flex; gap: 10px; }
.comment-body-wrap { flex: 1; }
.comment-meta { font-size: 11px; color: var(--ink2); margin-bottom: 4px; font-family: var(--font-mono); }
.comment-meta strong { color: var(--ink1); }
.comment-text { font-size: 13px; color: var(--ink0); line-height: 1.6; background: var(--bg2); border-radius: var(--radius-sm); padding: 10px 12px; border: 1px solid var(--border); }
.comment-input-row { display: flex; gap: 8px; margin-top: 14px; }
.comment-input-row input { flex: 1; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--ink0); padding: 9px 12px; font-size: 13px; outline: none; }
.comment-input-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

/* ── Users table ─────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--ink2); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid rgba(46,52,72,.5); font-size: 13px; color: var(--ink0); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg2); }

/* ── Activity feed ───────────────────────────────────────────── */
.activity-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid rgba(46,52,72,.4); }
.activity-item:last-child { border-bottom: none; }
.activity-text { font-size: 13px; color: var(--ink1); line-height: 1.5; }
.activity-text strong { color: var(--ink0); font-weight: 600; }
.activity-time { font-size: 11px; color: var(--ink2); font-family: var(--font-mono); margin-top: 2px; }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ── Stats grid ──────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat-card { background: var(--bg1); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--ink2); font-weight: 700; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 800; font-family: var(--font-mono); letter-spacing: -1px; color: var(--ink0); }
.stat-sub { font-size: 11px; color: var(--ink2); margin-top: 4px; }

/* ── Progress bar ────────────────────────────────────────────── */
.progress-bar { height: 4px; background: var(--bg3); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .6s ease; }

/* ── Toasts ──────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 13px;
  color: var(--ink0);
  box-shadow: var(--shadow);
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in .2s ease;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--accent); }
@keyframes toast-in { from { opacity:0; transform: translateX(16px); } to { opacity:1; transform: none; } }

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--ink2); }
.empty-state svg { margin: 0 auto 16px; opacity: .4; }
.empty-state h3 { font-size: 16px; color: var(--ink1); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; }

/* ── Divider ─────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── Search ──────────────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink2); pointer-events: none; }
.search-wrap input { padding-left: 34px; }

/* ── Upload progress ─────────────────────────────────────────── */
.upload-progress { padding: 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 10px; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink1); font-family: var(--font-mono); }

/* ── Responsive tweaks ───────────────────────────────────────── */
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  #sidebar { display: none; }
  #detail-view { grid-template-columns: 1fr; }
  .detail-sidebar { border-left: none; border-top: 1px solid var(--border); }
}

/* ── Selection handles (annotation) ─────────────────────────── */
.anno-canvas-wrap canvas { border-radius: var(--radius-sm); }
