/* ============================================================
   CyberEvidence — Main Stylesheet
   ============================================================ */

:root {
  --navy:        #0B1426;
  --navy2:       #111d35;
  --steel:       #1E3A5F;
  --steel2:      #254d82;
  --cyan:        #00b4d8;
  --cyan-dark:   #0077a8;
  --amber:       #e08c00;
  --success:     #006d3b;
  --success-bg:  #d4edda;
  --danger:      #b91c1c;
  --danger-bg:   #fee2e2;
  --warning-bg:  #fff3cd;
  --warning:     #856404;
  --slate:       #5a7aa8;
  --text:        #1a2340;
  --text-dim:    #5a6a8a;
  --border:      #d0d9e8;
  --bg:          #f4f7fb;
  --bg-card:     #ffffff;
  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-sm:   0 1px 3px rgba(0,0,0,.07);
  --sidebar-w:   240px;
  --topbar-h:    60px;
  --font:        'Inter', system-ui, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.5; }
a { color: var(--cyan-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Layout ── */
.app-wrapper  { display: flex; min-height: 100vh; }
.sidebar      { width: var(--sidebar-w); background: var(--navy); color: #c8d6f0; display: flex; flex-direction: column; flex-shrink: 0; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 100; }
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar       { height: var(--topbar-h); background: var(--bg-card); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; gap: 12px; position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow-sm); }
.page-content { flex: 1; padding: 24px; }

/* ── Sidebar ── */
.sidebar-brand { padding: 20px 16px 16px; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.sidebar-brand .icon { width: 34px; height: 34px; background: var(--cyan-dark); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-brand .icon i { color: #fff; font-size: 18px; }
.brand-name   { font-size: 14px; font-weight: 600; color: #fff; }
.brand-sub    { font-size: 11px; color: rgba(255,255,255,.45); }
.sidebar-nav  { flex: 1; padding: 12px 8px; }
.nav-section  { font-size: 10px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: rgba(255,255,255,.3); padding: 12px 10px 5px; }
.nav-item     { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--radius); cursor: pointer; font-size: 13px; color: rgba(255,255,255,.65); transition: background .15s, color .15s; margin-bottom: 1px; text-decoration: none; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--cyan-dark); color: #fff; }
.nav-item i   { font-size: 17px; width: 18px; flex-shrink: 0; }
.nav-badge    { margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 600; }
.sidebar-footer { padding: 12px 8px; border-top: 1px solid rgba(255,255,255,.08); }
.user-pill    { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--radius); cursor: pointer; }
.user-pill:hover { background: rgba(255,255,255,.07); }
.user-avatar  { width: 32px; height: 32px; border-radius: 50%; background: var(--steel2); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; }
.user-name    { font-size: 13px; font-weight: 500; color: #fff; }
.user-role    { font-size: 11px; color: rgba(255,255,255,.45); }

/* ── Topbar ── */
.page-title   { font-size: 16px; font-weight: 600; color: var(--text); flex: 1; }
.topbar-actions { display: flex; gap: 8px; }

/* ── Buttons ── */
.btn          { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-card); color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s; text-decoration: none; }
.btn:hover    { background: var(--bg); text-decoration: none; }
.btn i        { font-size: 16px; }
.btn-primary  { background: var(--steel); color: #fff; border-color: var(--steel); }
.btn-primary:hover { background: var(--steel2); border-color: var(--steel2); color: #fff; }
.btn-success  { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #991b1b; color: #fff; }
.btn-sm       { padding: 4px 10px; font-size: 12px; }
.btn-icon     { padding: 6px; width: 32px; height: 32px; justify-content: center; }

/* ── Cards ── */
.card         { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-header  { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; border-bottom: 1px solid var(--border); }
.card-title   { font-size: 14px; font-weight: 600; color: var(--text); }
.card-body    { padding: 20px; }
.card-action  { font-size: 12px; color: var(--cyan-dark); cursor: pointer; }

/* ── Stats grid ── */
.stats-grid   { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card    { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat-label   { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.stat-label i { font-size: 15px; }
.stat-value   { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-delta   { font-size: 11px; color: var(--success); margin-top: 6px; }
.stat-danger  { color: var(--danger); }

/* ── Tables ── */
.table-responsive { overflow-x: auto; }
table.data-table  { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th    { text-align: left; padding: 10px 14px; font-weight: 600; font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid var(--border); background: #f8fafc; white-space: nowrap; }
.data-table td    { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #f4f7fb; }
.data-table .mono { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }

/* ── Badges ── */
.badge        { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-open        { background: #dbeafe; color: #1d4ed8; }
.badge-pending     { background: #fff3cd; color: #856404; }
.badge-closed      { background: #e5e7eb; color: #6b7280; }
.badge-active      { background: #d4edda; color: var(--success); }
.badge-suspended   { background: var(--danger-bg); color: var(--danger); }
.badge-admin       { background: #ede9fe; color: #5b21b6; }
.badge-investigator{ background: #dbeafe; color: #1d4ed8; }
.badge-submitter   { background: #f0fdf4; color: #166534; }
.badge-verified    { background: #d4edda; color: var(--success); }
.badge-altered     { background: var(--danger-bg); color: var(--danger); }
.badge-pending-int { background: #fff3cd; color: #856404; }
.badge-email       { background: #dbeafe; color: #1d4ed8; }
.badge-malware     { background: var(--danger-bg); color: var(--danger); }
.badge-financial   { background: #fff3cd; color: #856404; }
.badge-screenshot  { background: #f3e8ff; color: #6b21a8; }
.badge-chat        { background: #d4edda; color: var(--success); }
.badge-document    { background: #e5e7eb; color: #374151; }
.badge-log         { background: #fef3c7; color: #92400e; }
.badge-network     { background: #cffafe; color: #155e75; }
.badge-other       { background: #f3f4f6; color: #6b7280; }
.badge-pdf         { background: var(--danger-bg); color: var(--danger); }
.badge-csv         { background: #d4edda; color: var(--success); }

/* ── Forms ── */
.form-group   { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-label   { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.form-control { padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); color: var(--text); font-size: 13px; font-family: var(--font); width: 100%; transition: border-color .15s, box-shadow .15s; }
.form-control:focus { outline: none; border-color: var(--cyan-dark); box-shadow: 0 0 0 3px rgba(0,119,168,.12); }
.form-control.is-invalid { border-color: var(--danger); }
.invalid-feedback { font-size: 11px; color: var(--danger); margin-top: 3px; }
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Search bar ── */
.search-bar   { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.search-bar .form-control { flex: 1; min-width: 200px; }
.search-bar select { min-width: 140px; }

/* ── Pagination ── */
.pagination   { display: flex; align-items: center; gap: 4px; padding: 14px 20px; border-top: 1px solid var(--border); }
.pagination .page-info { font-size: 12px; color: var(--text-dim); margin-right: auto; }
.pg-btn       { padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); color: var(--text); font-size: 12px; cursor: pointer; }
.pg-btn:hover, .pg-btn.active { background: var(--steel); color: #fff; border-color: var(--steel); }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Modals ── */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200; align-items: center; justify-content: center; }
.modal-backdrop.show { display: flex; }
.modal        { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(0,0,0,.2); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-lg     { max-width: 720px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.modal-title  { font-size: 15px; font-weight: 600; }
.modal-body   { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.btn-close    { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--text-dim); padding: 2px; line-height: 1; }

/* ── Toasts ── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast        { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-lg); font-size: 13px; font-weight: 500; box-shadow: var(--shadow); min-width: 260px; animation: slideUp .2s ease; }
.toast-success { background: #d4edda; color: var(--success); border: 1px solid #a3cfbb; }
.toast-error   { background: var(--danger-bg); color: var(--danger); border: 1px solid #f5c6cb; }
.toast-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.toast i { font-size: 18px; }
@keyframes slideUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }

/* ── Upload zone ── */
.upload-zone  { border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 36px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--cyan-dark); background: #f0f9ff; }
.upload-zone i { font-size: 36px; color: var(--text-dim); margin-bottom: 10px; display: block; }
.upload-zone .upload-title { font-size: 14px; font-weight: 600; color: var(--text); }
.upload-zone .upload-sub   { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* ── Progress ── */
.progress     { background: var(--bg); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--cyan-dark); border-radius: 4px; transition: width .3s; }

/* ── Alert ── */
.alert        { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; margin-bottom: 14px; display: flex; align-items: flex-start; gap: 10px; }
.alert i      { font-size: 17px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #d4edda; color: var(--success); border: 1px solid #a3cfbb; }
.alert-danger  { background: var(--danger-bg); color: var(--danger); border: 1px solid #f5c6cb; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #ffc107; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ── Hash display ── */
.hash-display { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); word-break: break-all; background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; }

/* ── Custody timeline ── */
.custody-timeline { display: flex; flex-direction: column; }
.custody-event    { display: flex; gap: 14px; }
.custody-line-col { display: flex; flex-direction: column; align-items: center; width: 20px; flex-shrink: 0; }
.custody-dot      { width: 12px; height: 12px; border-radius: 50%; border: 2px solid; flex-shrink: 0; margin-top: 3px; }
.custody-dot.uploaded            { border-color: var(--success); background: var(--success); }
.custody-dot.viewed              { border-color: var(--amber); background: var(--amber); }
.custody-dot.downloaded          { border-color: var(--slate); background: var(--slate); }
.custody-dot.metadata_edited     { border-color: var(--cyan-dark); background: var(--cyan-dark); }
.custody-dot.integrity_verified  { border-color: var(--success); background: #fff; }
.custody-dot.integrity_failed    { border-color: var(--danger); background: var(--danger); }
.custody-dot.ownership_transferred { border-color: #6d28d9; background: #6d28d9; }
.custody-connector { flex: 1; width: 2px; background: var(--border); min-height: 18px; margin: 2px 0; }
.custody-body     { flex: 1; padding-bottom: 18px; }
.custody-action   { font-size: 13px; font-weight: 600; color: var(--text); }
.custody-meta     { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.custody-ip       { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); margin-top: 1px; }

/* ── Verify panel ── */
.verify-result    { border-radius: var(--radius-lg); padding: 18px; margin-top: 16px; display: none; }
.verify-result.verified { background: #d4edda; border: 1px solid #a3cfbb; }
.verify-result.altered  { background: var(--danger-bg); border: 1px solid #f5c6cb; }
.verify-result-title    { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.verify-result.verified .verify-result-title { color: var(--success); }
.verify-result.altered  .verify-result-title { color: var(--danger); }
.verify-result-detail   { font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); white-space: pre-wrap; line-height: 1.7; }

/* ── Bar chart ── */
.bar-chart    { display: flex; flex-direction: column; gap: 10px; }
.bar-row      { display: flex; align-items: center; gap: 10px; }
.bar-label    { font-size: 12px; color: var(--text-dim); width: 110px; flex-shrink: 0; }
.bar-track    { flex: 1; background: var(--bg); border-radius: 4px; height: 8px; overflow: hidden; }
.bar-fill     { height: 100%; border-radius: 4px; background: var(--steel); transition: width .4s; }
.bar-val      { font-size: 12px; color: var(--text-dim); width: 28px; text-align: right; }

/* ── Info rows ── */
.info-list    { display: flex; flex-direction: column; }
.info-row     { display: flex; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.info-row:last-child { border: none; }
.info-label   { color: var(--text-dim); width: 140px; flex-shrink: 0; font-size: 12px; padding-top: 1px; }
.info-value   { color: var(--text); flex: 1; word-break: break-all; }

/* ── Login page ── */
.login-page   { min-height: 100vh; background: var(--navy); display: flex; align-items: center; justify-content: center; }
.login-card   { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(0,0,0,.3); width: 100%; max-width: 420px; padding: 36px; }
.login-brand  { text-align: center; margin-bottom: 28px; }
.login-brand .logo { width: 52px; height: 52px; background: var(--steel); border-radius: 14px; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.login-brand .logo i { font-size: 26px; color: #fff; }
.login-brand h1 { font-size: 20px; font-weight: 700; color: var(--text); }
.login-brand p  { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* ── Report cards ── */
.report-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 24px; }
.report-card  { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; display: flex; gap: 14px; cursor: pointer; transition: box-shadow .15s, transform .1s; }
.report-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.report-card-icon { width: 42px; height: 42px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.report-card-icon i { font-size: 22px; }
.report-card-name { font-size: 14px; font-weight: 600; color: var(--text); }
.report-card-desc { font-size: 12px; color: var(--text-dim); margin-top: 3px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .report-cards { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

/* ── Utility ── */
.text-muted    { color: var(--text-dim); }
.text-danger   { color: var(--danger); }
.text-success  { color: var(--success); }
.text-center   { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.flex-1 { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-dim); }
.empty-state i { font-size: 40px; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 13px; }
.loading { opacity: .5; pointer-events: none; }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
