/* ═══════════════════════════════════════════════════════════════════
   GSIS – Hybrid LiDAR Workflow Tool
   Custom Stylesheet v1.0
   ═══════════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────────── */
:root {
  --sidebar-width: 250px;
  --topbar-height: 60px;

  --color-bg:         #0d1117;
  --color-surface:    #161b22;
  --color-surface-2:  #1c2330;
  --color-border:     #30363d;
  --color-border-soft:#21262d;

  --color-primary:    #3b82f6;
  --color-primary-dk: #2563eb;
  --color-accent:     #06b6d4;
  --color-success:    #22c55e;
  --color-warning:    #f59e0b;
  --color-danger:     #ef4444;
  --color-info:       #38bdf8;
  --color-purple:     #a855f7;

  --text-primary:     #e6edf3;
  --text-secondary:   #8b949e;
  --text-muted:       #484f58;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.6);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --transition: 0.2s ease;
}

/* ── Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-accent); }

/* ── Layout ────────────────────────────────────────────────────── */
.gsis-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100%;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition);
}

.gsis-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

.gsis-topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: rgba(13,17,23,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 900;
}

.gsis-content {
  flex: 1;
  padding: 1.75rem 2rem;
  max-width: 1600px;
  width: 100%;
}

/* ── Sidebar Internals ─────────────────────────────────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  min-height: var(--topbar-height);
}

.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(59,130,246,.4);
}

.brand-text { flex: 1; overflow: hidden; }
.brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: .04em;
  display: block;
}
.brand-sub {
  font-size: .7rem;
  color: var(--text-secondary);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .75rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.sidebar-user-card {
  display: flex; align-items: center; gap: 10px;
  padding: .6rem 1.1rem;
  margin: .5rem .75rem;
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-soft);
}

.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--color-purple), var(--color-primary));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: #fff;
  text-transform: uppercase;
  flex-shrink: 0;
}

.user-name { font-size: .8rem; font-weight: 600; color: var(--text-primary); }

.role-badge {
  display: inline-block;
  font-size: .65rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.role-admin      { background: rgba(239,68,68,.18); color: #f87171; }
.role-supervisor { background: rgba(245,158,11,.18); color: #fbbf24; }
.role-operator   { background: rgba(59,130,246,.18); color: #60a5fa; }
.role-qc_reviewer{ background: rgba(34,197,94,.18);  color: #4ade80; }
.role-meta_qc    { background: rgba(168,85,247,.18); color: #c084fc; }

.sidebar-nav { padding: .5rem .75rem; }

.nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: .3rem .5rem .15rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: .52rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: .84rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
  margin-bottom: 2px;
  position: relative;
  line-height: 1;
}

.nav-item i {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 1.4rem;
  text-align: center;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-item span {
  line-height: 1;
  transform: translateY(1px);
}

.nav-item:hover {
  background: var(--color-surface-2);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(59,130,246,.14);
  color: var(--color-primary);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--color-primary);
  border-radius: 0 2px 2px 0;
}

.nav-badge {
  margin-left: auto;
  font-size: .6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  text-transform: uppercase;
}

.sidebar-footer {
  border-top: 1px solid var(--color-border);
  padding: .6rem .75rem;
}

.text-danger-soft { color: #f87171 !important; }
.text-danger-soft:hover { color: #ef4444 !important; background: rgba(239,68,68,.08) !important; }

/* ── Topbar ────────────────────────────────────────────────────── */
.topbar-left { display: flex; align-items: center; }

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: .3rem .5rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.btn-ghost:hover { background: var(--color-surface-2); color: var(--text-primary); }

.sidebar-toggle-btn {
  color: var(--text-secondary);
  background: transparent;
  border: none;
  padding: .3rem .5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-toggle-btn:hover { background: var(--color-surface-2); }

.breadcrumb { font-size: .8rem; }
.breadcrumb-item a { color: var(--text-secondary); }
.breadcrumb-item.active { color: var(--text-primary); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }

.avatar-sm {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--color-purple), var(--color-primary));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: #fff;
  text-transform: uppercase;
}

/* Notification badge */
.notif-dot {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  background: var(--color-danger);
  border-radius: 8px;
  font-size: .6rem;
  font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

/* ── Notification Dropdown ─────────────────────────────────────── */
.notif-dropdown { width: 340px; max-height: 480px; border-color: var(--color-border); }
.notif-header { border-bottom: 1px solid var(--color-border); font-size: .85rem; }
.notif-list { overflow-y: auto; max-height: 380px; }

.notif-item {
  display: flex; gap: 10px;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--color-border-soft);
  transition: background var(--transition);
  cursor: pointer;
  color: var(--text-secondary);
}

.notif-item:hover { background: var(--color-surface-2); color: var(--text-primary); }
.notif-item.unread { background: rgba(59,130,246,.06); }

.notif-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: .85rem;
}
.notif-info    { background: rgba(56,189,248,.15); color: var(--color-info); }
.notif-warning { background: rgba(245,158,11,.15); color: var(--color-warning); }
.notif-error   { background: rgba(239,68,68,.15);  color: var(--color-danger); }
.notif-sla_risk{ background: rgba(168,85,247,.15); color: var(--color-purple); }

.notif-title { font-size: .82rem; font-weight: 600; color: var(--text-primary); }
.notif-msg   { font-size: .75rem; color: var(--text-secondary); margin-top: 2px; }
.notif-time  { font-size: .7rem; color: var(--text-muted); margin-top: 3px; }

/* ── Flash Messages ────────────────────────────────────────────── */
.flash-container { margin-bottom: 1rem; }
.flash-container .alert { font-size: .85rem; line-height: 1.4; }
.flash-container .alert i { font-size: 1rem; line-height: 1; display: inline-flex; align-items: center; }

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-md) !important;
}

.card-header {
  background: var(--color-surface-2) !important;
  border-bottom: 1px solid var(--color-border) !important;
  font-weight: 600;
  font-size: .9rem;
}

/* ── Stat Cards ────────────────────────────────────────────────── */
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover { border-color: var(--color-primary); transform: translateY(-2px); }

.stat-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-icon.blue   { background: rgba(59,130,246,.15);  color: var(--color-primary); }
.stat-icon.green  { background: rgba(34,197,94,.15);   color: var(--color-success); }
.stat-icon.yellow { background: rgba(245,158,11,.15);  color: var(--color-warning); }
.stat-icon.cyan   { background: rgba(6,182,212,.15);   color: var(--color-accent);  }
.stat-icon.red    { background: rgba(239,68,68,.15);   color: var(--color-danger);  }
.stat-icon.purple { background: rgba(168,85,247,.15);  color: var(--color-purple);  }

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
}

.stat-label {
  font-size: .76rem;
  color: var(--text-secondary);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Page Header ───────────────────────────────────────────────── */
.page-header {
  margin-bottom: 1.75rem;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: .2rem;
}

.page-subtitle {
  font-size: .85rem;
  color: var(--text-secondary);
}

/* ── Tables ────────────────────────────────────────────────────── */
.table {
  color: var(--text-primary) !important;
}
.table thead th {
  background: var(--color-surface-2) !important;
  border-color: var(--color-border) !important;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary) !important;
  padding: .65rem 1rem;
  text-align: center;
  vertical-align: middle;
}
.table tbody td {
  border-color: var(--color-border-soft) !important;
  padding: .75rem 1rem;
  vertical-align: middle;
  font-size: .84rem;
  text-align: center;
}
.table tbody tr:hover { background: rgba(255,255,255,.025) !important; }

/* ── Status Badges ─────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.status-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.status-draft     { background: rgba(139,148,158,.12); color: #8b949e; }
.status-active    { background: rgba(34,197,94,.14);   color: #4ade80; }
.status-paused    { background: rgba(245,158,11,.14);  color: #fbbf24; }
.status-completed { background: rgba(59,130,246,.14);  color: #60a5fa; }
.status-archived  { background: rgba(139,148,158,.10); color: #6e7681; }

.status-pending   { background: rgba(245,158,11,.12);  color: #fbbf24; }
.status-running   { background: rgba(56,189,248,.12);  color: #38bdf8; }
.status-passed    { background: rgba(34,197,94,.14);   color: #4ade80; }
.status-failed    { background: rgba(239,68,68,.14);   color: #f87171; }
.status-escalated { background: rgba(168,85,247,.14);  color: #c084fc; }

.status-created    { background: rgba(139,148,158,.12); color: #8b949e; }
.status-in_progress{ background: rgba(56,189,248,.12);  color: #38bdf8; }
.status-submitted  { background: rgba(245,158,11,.12);  color: #fbbf24; }
.status-rework     { background: rgba(239,68,68,.14);   color: #f87171; }
.status-accepted   { background: rgba(34,197,94,.14);   color: #4ade80; }
.status-delivered  { background: rgba(59,130,246,.14);  color: #60a5fa; }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn-primary {
  background: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  font-weight: 600;
}
.btn-primary:hover { background: var(--color-primary-dk) !important; }

.btn-outline-primary {
  border-color: var(--color-primary) !important;
  color: var(--color-primary) !important;
}
.btn-outline-primary:hover {
  background: rgba(59,130,246,.12) !important;
}

/* ── Forms ─────────────────────────────────────────────────────── */
.form-control, .form-select {
  background: var(--color-surface-2) !important;
  border: 1px solid var(--color-border) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm) !important;
}
.form-control:focus, .form-select:focus {
  background: var(--color-surface-2) !important;
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,.2) !important;
  color: var(--text-primary) !important;
}
.form-control::placeholder { color: var(--text-muted) !important; }
.form-label { font-size: .83rem; font-weight: 500; color: var(--text-secondary); }

.form-check-input:checked {
  background-color: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
}

/* ── Project Card ──────────────────────────────────────────────── */
.project-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--color-border);
  transition: background var(--transition);
}

.project-card:hover { border-color: var(--color-primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.project-card:hover::before { background: var(--color-primary); }
.project-card.status-active::before { background: var(--color-success); }
.project-card.status-draft::before  { background: var(--color-warning); }

.project-card-code {
  font-size: .7rem;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .25rem;
}

.project-card-name {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: .3rem;
}

.project-card-client {
  font-size: .78rem;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 4px;
}

.project-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .75rem;
  font-size: .72rem;
  color: var(--text-muted);
}

.project-card-meta span {
  display: flex; align-items: center; gap: 3px;
}

/* ── Progress Bar ──────────────────────────────────────────────── */
.progress {
  background: var(--color-surface-2) !important;
  border: 1px solid var(--color-border) !important;
  height: 6px;
}

.progress-bar { background: linear-gradient(90deg, var(--color-primary), var(--color-accent)); }

/* ── Wizard Steps ──────────────────────────────────────────────── */
.wizard-steps {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: .25rem;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 1;
  min-width: 80px;
}

.wizard-step::before {
  content: '';
  position: absolute;
  top: 16px;
  left: calc(50% + 16px);
  right: calc(-50% + 16px);
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}

.wizard-step:last-child::before { display: none; }

.step-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-surface-2);
  border: 2px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-muted);
  position: relative; z-index: 1;
  transition: all var(--transition);
}

.wizard-step.completed .step-circle {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}

.wizard-step.active .step-circle {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(59,130,246,.2);
}

.wizard-step.completed::before { background: var(--color-success); }

.step-label {
  font-size: .68rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: .4rem;
  text-align: center;
  white-space: nowrap;
}

.wizard-step.active .step-label { color: var(--color-primary); font-weight: 600; }
.wizard-step.completed .step-label { color: var(--color-success); }

/* ── Checklist Activation ──────────────────────────────────────── */
.activation-checklist {
  list-style: none;
  padding: 0;
}

.activation-checklist li {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem 0;
  font-size: .83rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--color-border-soft);
}

.activation-checklist li:last-child { border-bottom: none; }

.check-icon { font-size: .9rem; }
.check-ok   { color: var(--color-success); }
.check-fail { color: var(--color-danger); }

/* ── Validation Report Cards ───────────────────────────────────── */
.check-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-sm);
  padding: .8rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}

.check-card-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.check-pass { background: rgba(34,197,94,.12); color: var(--color-success); }
.check-fail { background: rgba(239,68,68,.12); color: var(--color-danger); }
.check-warn { background: rgba(245,158,11,.12); color: var(--color-warning); }

/* ── Upload Drop Zone ──────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--color-primary);
  background: rgba(59,130,246,.05);
}

.upload-zone i {
  font-size: 2.5rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: .75rem;
}

.upload-zone-text { color: var(--text-secondary); font-size: .9rem; }

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* ── Misc ──────────────────────────────────────────────────────── */
.text-accent  { color: var(--color-accent) !important; }
.text-primary-gsis { color: var(--color-primary) !important; }
.text-muted-soft   { color: var(--text-secondary) !important; }

.divider { border-color: var(--color-border) !important; }

.bg-surface    { background: var(--color-surface) !important; }
.bg-surface-2  { background: var(--color-surface-2) !important; }

.border-gsis { border-color: var(--color-border) !important; }

.rounded-gsis { border-radius: var(--radius-md) !important; }

/* badge helpers */
.badge-module {
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(59,130,246,.15);
  color: var(--color-primary);
  text-transform: uppercase;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 992px) {
  .gsis-sidebar {
    transform: translateX(-100%);
  }
  .gsis-sidebar.show {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .gsis-main { margin-left: 0; }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 999;
  }
  .sidebar-overlay.show { display: block; }
}

@media (max-width: 576px) {
  .gsis-content { padding: 1rem; }
}

/* ── Utility Helpers ────────────────────────────────────────────── */
.avatar-xs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.bg-cyan {
  background-color: var(--color-accent) !important;
}

.btn-xs {
  font-size: .72rem;
  padding: 2px 10px;
  border-radius: 6px;
}
