/* ForensicSaaS — Main Stylesheet (clean, deduplicated) */

:root {
  --primary:   #2563eb;
  --primary-d: #1d4ed8;
  --success:   #16a34a;
  --danger:    #dc2626;
  --warning:   #d97706;
  --info:      #0891b2;
  --dark:      #1e293b;
  --sidebar-w: 240px;
  --topbar-h:  60px;
  --radius:    8px;
  --shadow:    0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 14px; background: #f1f5f9; color: #1e293b; }

/* ── Auth ──────────────────────────────────────────────────────────── */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); }
.auth-container { width: 100%; max-width: 400px; padding: 20px; }
.auth-card { background: #fff; border-radius: 12px; padding: 40px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.auth-logo { font-size: 48px; text-align: center; margin-bottom: 8px; }
.auth-title { font-size: 24px; font-weight: 700; text-align: center; color: var(--dark); }
.auth-subtitle { color: #64748b; text-align: center; margin-bottom: 28px; font-size: 13px; }
.auth-notice { font-size: 11px; color: #94a3b8; text-align: center; margin-top: 16px; }

/* ── Layout ────────────────────────────────────────────────────────── */
.sidebar { position: fixed; top: 0; left: 0; height: 100vh; width: var(--sidebar-w); background: var(--dark); display: flex; flex-direction: column; transition: width .2s; z-index: 100; overflow: hidden; }
.sidebar.collapsed { width: 56px; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .user-details,
.sidebar.collapsed .logout-btn,
.sidebar.collapsed .logo { display: none; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid #334155; }
.logo { color: #fff; font-weight: 700; font-size: 16px; white-space: nowrap; }
.sidebar-toggle { background: none; border: none; color: #94a3b8; font-size: 18px; cursor: pointer; padding: 4px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: #94a3b8; text-decoration: none; transition: background .15s, color .15s; white-space: nowrap; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.08); color: #fff; }
.nav-icon { font-size: 18px; flex-shrink: 0; width: 24px; text-align: center; }
.sidebar-footer { border-top: 1px solid #334155; padding: 12px; }
.user-info { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.user-name { color: #fff; font-size: 13px; font-weight: 500; white-space: nowrap; }
.user-role { color: #64748b; font-size: 11px; }
.logout-btn { display: block; text-align: center; padding: 6px; color: #94a3b8; text-decoration: none; border-radius: var(--radius); font-size: 12px; }
.logout-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.main-content { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .2s; }
.main-content.expanded { margin-left: 56px; }
.topbar { height: var(--topbar-h); background: #fff; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 50; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.page-title { font-size: 18px; font-weight: 600; color: var(--dark); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.datetime { font-size: 12px; color: #64748b; }
.content-body { padding: 24px; flex: 1; }

/* ── Cards ──────────────────────────────────────────────────────────── */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #f1f5f9; flex-wrap: wrap; gap: 8px; }
.card-title { font-size: 16px; font-weight: 600; color: var(--dark); }
.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }

/* ── Stats ──────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; }
.stat-icon { font-size: 36px; }
.stat-label { font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--dark); }

/* ── Table ──────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th { background: #f8fafc; padding: 10px 16px; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: #64748b; border-bottom: 1px solid #e2e8f0; }
.table td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f8fafc; }
.loading-row { color: #94a3b8; }

/* ── Forms ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: #374151; }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: var(--radius); font-size: 14px; background: #fff; transition: border-color .15s; outline: none; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500; cursor: pointer; border: none; text-decoration: none; transition: all .15s; }
.btn-primary   { background: var(--primary);  color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-outline   { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger    { background: var(--danger);   color: #fff; }
.btn-warning   { background: var(--warning);  color: #fff; }
.btn-success   { background: var(--success);  color: #fff; }
.btn-secondary { background: #64748b;          color: #fff; }
.btn-sm   { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; padding: 11px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Badges ─────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.badge-primary   { background: #dbeafe; color: #1d4ed8; }
.badge-success   { background: #dcfce7; color: #166534; }
.badge-danger    { background: #fee2e2; color: #991b1b; }
.badge-warning   { background: #fef9c3; color: #854d0e; }
.badge-info      { background: #e0f2fe; color: #0369a1; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* ── Alerts ─────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.alert-info    { background: #e0f2fe; color: #0c4a6e; border: 1px solid #7dd3fc; }

/* ── Tabs ───────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; background: #f1f5f9; border-radius: var(--radius); padding: 4px; flex-wrap: wrap; }
.tab { background: transparent; border: none; padding: 8px 14px; border-radius: 6px; font-size: 13px; font-weight: 500; color: #64748b; cursor: pointer; transition: all .15s; white-space: nowrap; }
.tab:hover, .tab.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Detail list ────────────────────────────────────────────────────── */
.detail-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.detail-list dt { font-weight: 600; color: #64748b; text-transform: uppercase; font-size: 12px; padding-top: 2px; }
.detail-list dd { color: var(--dark); }

/* ── Grid & helpers ─────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.text-center { text-align: center; }
.text-muted  { color: #94a3b8; }
.text-danger { color: var(--danger); }

/* ── Toolbar ────────────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-left { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar-left .form-control { width: 200px; }

/* ── Pagination ─────────────────────────────────────────────────────── */
.pagination-bar { display: flex; gap: 4px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }

/* ── Progress bar ───────────────────────────────────────────────────── */
.progress-bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; margin: 12px 0; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 4px; width: 0; transition: width .3s; }

/* ── Toast ──────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--dark); color: #fff; padding: 12px 20px; border-radius: var(--radius); font-size: 13px; opacity: 0; transform: translateY(10px); transition: all .25s; pointer-events: none; max-width: 340px; z-index: 9999; }
.toast.show    { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast-success { background: var(--success); }
.toast-danger  { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info    { background: var(--info); }

/* ── Risk display ───────────────────────────────────────────────────── */
.risk-summary { text-align: center; margin-bottom: 20px; }
.risk-score { font-size: 56px; font-weight: 900; line-height: 1; }
.risk-label { font-size: 20px; font-weight: 700; letter-spacing: 2px; margin-top: 4px; }
.findings-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.finding-item { padding: 12px 16px; border-radius: var(--radius); border-left: 4px solid #e2e8f0; background: #f8fafc; }
.finding-item.critical, .finding-critical { border-left-color: var(--danger);  background: #fff5f5; }
.finding-item.high,     .finding-high     { border-left-color: var(--warning); background: #fffbeb; }
.finding-item.medium,   .finding-medium   { border-left-color: var(--info);    background: #f0fdff; }
.finding-item.low,      .finding-low      { border-left-color: var(--success); background: #f0fdf4; }
.finding-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-weight: 600; font-size: 13px; }
.finding-body { color: #475569; font-size: 13px; }
.finding-card.CRITICAL { border-left-color: var(--danger);  background: #fff5f5; }
.finding-card.HIGH     { border-left-color: var(--warning); background: #fffbeb; }
.finding-card.MEDIUM   { border-left-color: var(--info);    background: #f0fdff; }
.finding-card.LOW      { border-left-color: var(--success); background: #f0fdf4; }

/* ── Case / Device / Artifact components ────────────────────────────── */
.case-header { padding: 16px 20px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 8px; }
.case-title  { font-size: 20px; font-weight: 700; color: var(--dark); margin-bottom: 8px; }
.case-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.device-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: var(--radius); padding: 12px; margin-bottom: 8px; font-size: 13px; }
.artifact-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.artifact-chip { background: #eff6ff; color: #1d4ed8; border-radius: 20px; padding: 5px 12px; font-size: 12px; }
.risk-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius); background: #fff5f5; margin-bottom: 6px; font-size: 13px; }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 12px; font-family: 'Courier New', monospace; }

/* ── Mobile forensic tool styles ────────────────────────────────────── */
.mf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.mf-tool-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border-left: 4px solid var(--primary); text-decoration: none; color: inherit; display: block; transition: box-shadow .15s, transform .15s; }
.mf-tool-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.mf-tool-icon { font-size: 32px; margin-bottom: 8px; }
.mf-tool-title { font-size: 15px; font-weight: 700; color: var(--dark); margin-bottom: 4px; }
.mf-tool-desc { font-size: 12px; color: #64748b; line-height: 1.5; }
.wizard-steps { display: flex; gap: 0; margin-bottom: 24px; overflow-x: auto; }
.wizard-step { flex: 1; text-align: center; padding: 10px 8px; font-size: 11px; font-weight: 600; color: #94a3b8; border-bottom: 3px solid #e2e8f0; position: relative; min-width: 70px; white-space: nowrap; }
.wizard-step.active { color: var(--primary); border-bottom-color: var(--primary); }
.wizard-step.done   { color: var(--success); border-bottom-color: var(--success); }
.artifact-matrix { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.artifact-toggle { border: 2px solid #e2e8f0; border-radius: var(--radius); padding: 8px; text-align: center; cursor: pointer; font-size: 12px; transition: all .15s; }
.artifact-toggle.selected { border-color: var(--primary); background: #eff6ff; color: var(--primary); font-weight: 600; }
.result-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.result-stat { background: #f8fafc; border-radius: var(--radius); padding: 12px; text-align: center; }
.result-stat-num { font-size: 22px; font-weight: 700; }
.result-stat-lbl { font-size: 11px; color: #64748b; text-transform: uppercase; }
.finding-grid { display: grid; gap: 10px; }
.finding-card { background: #f8fafc; border-radius: var(--radius); padding: 12px 16px; border-left: 4px solid #e2e8f0; }

/* ── Mobile sidebar toggle ──────────────────────────────────────────── */
.sidebar-toggle-mobile { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--dark); padding: 4px; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; width: var(--sidebar-w) !important; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .sidebar-toggle-mobile { display: block; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .table { font-size: 12px; }
  .table th, .table td { padding: 8px 10px; }
  .content-body { padding: 12px; }
  .topbar { padding: 0 12px; }
  .card-header { padding: 12px 14px; }
  .card-body { padding: 14px; }
  .wizard-step { min-width: 80px; font-size: 10px; padding: 8px 4px; }
  .artifact-matrix { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .finding-grid { grid-template-columns: 1fr; }
  .mf-grid { grid-template-columns: 1fr; }
  .toolbar-left .form-control { width: 150px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .result-summary { grid-template-columns: 1fr 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-left { flex-wrap: wrap; }
  .toolbar-left .form-control { width: 100%; }
}
