/* NEXUS CRM - Sci-Fi Design System */
@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@200;300;400;500;600;700&family=Share+Tech+Mono&family=Orbitron:wght@400;500;700;900&display=swap');

:root {
  --bg-void: #020408;
  --bg-deep: #040912;
  --bg-card: #060d1a;
  --bg-card2: #0a1628;
  --bg-hover: #0f1f38;
  --cyan: #00d4ff;
  --cyan-dim: #004d66;
  --cyan-glow: rgba(0, 212, 255, 0.15);
  --electric: #7b61ff;
  --electric-dim: #2a1f66;
  --green: #00ff88;
  --green-dim: #003322;
  --amber: #ffd700;
  --red: #ff3366;
  --orange: #ff6b35;
  --text-primary: #e8f4ff;
  --text-secondary: #6a8aaa;
  --text-muted: #2a4060;
  --border: rgba(0, 212, 255, 0.12);
  --border-active: rgba(0, 212, 255, 0.5);
  --grid-line: rgba(0, 212, 255, 0.04);
  --shadow-cyan: 0 0 30px rgba(0, 212, 255, 0.12);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.6);
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Exo 2', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
  --radius: 4px;
  --radius-lg: 8px;
  --transition: 0.2s ease;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-void);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--cyan-dim); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--cyan); }

/* TYPOGRAPHY */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); letter-spacing: 0.05em; }
.mono { font-family: var(--font-mono); }

/* LAYOUT */
.app-layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-deep);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition);
}

.sidebar.collapsed { width: 64px; min-width: 64px; }

.sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px; height: 36px;
  background: var(--cyan);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  animation: pulse-logo 3s ease-in-out infinite;
}

@keyframes pulse-logo {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,212,255,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(0,212,255,0); }
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.2em;
  white-space: nowrap;
}

.logo-sub {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-secondary);
  letter-spacing: 0.3em;
}

.sidebar-nav { flex: 1; padding: 16px 8px; overflow-y: auto; }

.nav-section-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  padding: 8px 8px 4px;
  margin-top: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 400;
  transition: all var(--transition);
  border: 1px solid transparent;
  margin-bottom: 2px;
  cursor: pointer;
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--cyan);
  background: var(--cyan-glow);
  border-color: var(--border);
}

.nav-item.active {
  color: var(--cyan);
  background: var(--cyan-glow);
  border-color: var(--border-active);
}

.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

/* TOPBAR */
.topbar {
  height: 56px;
  background: rgba(4,9,18,0.95);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--text-primary);
  letter-spacing: 0.1em;
  flex: 1;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  width: 280px;
  transition: all var(--transition);
}

.search-bar:focus-within {
  border-color: var(--border-active);
  box-shadow: var(--shadow-cyan);
}

.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  width: 100%;
}

.search-bar input::placeholder { color: var(--text-muted); }

/* PAGE CONTENT */
.page-content { flex: 1; padding: 24px; }
.page-header { margin-bottom: 24px; }
.page-title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 500; color: var(--text-primary); }
.page-subtitle { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; letter-spacing: 0.1em; }

/* CARDS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--cyan);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: transparent;
  color: var(--cyan);
  border-color: var(--cyan);
}

.btn-primary:hover {
  background: var(--cyan-glow);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-ghost:hover { color: var(--cyan); border-color: var(--border-active); background: var(--cyan-glow); }

.btn-danger { color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: rgba(255,51,102,0.1); }
.btn-success { color: var(--green); border-color: var(--green); }
.btn-success:hover { background: rgba(0,255,136,0.1); }

.btn-icon {
  padding: 6px;
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-icon:hover { color: var(--cyan); border-color: var(--border-active); background: var(--cyan-glow); }

/* BADGES / TAGS */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.badge-client { background: rgba(0,212,255,0.1); color: var(--cyan); border: 1px solid rgba(0,212,255,0.3); }
.badge-employee { background: rgba(0,255,136,0.1); color: var(--green); border: 1px solid rgba(0,255,136,0.3); }
.badge-supplier { background: rgba(255,107,53,0.1); color: var(--orange); border: 1px solid rgba(255,107,53,0.3); }
.badge-subcontractor { background: rgba(123,97,255,0.1); color: var(--electric); border: 1px solid rgba(123,97,255,0.3); }
.badge-prospect { background: rgba(255,215,0,0.1); color: var(--amber); border: 1px solid rgba(255,215,0,0.3); }
.badge-friend { background: rgba(255,51,102,0.1); color: var(--red); border: 1px solid rgba(255,51,102,0.3); }
.badge-professional { background: rgba(106,138,170,0.1); color: var(--text-secondary); border: 1px solid rgba(106,138,170,0.3); }
.badge-co-contractor { background: rgba(0,212,255,0.08); color: #80e8ff; border: 1px solid rgba(0,212,255,0.2); }
.badge-partner { background: rgba(123,97,255,0.08); color: #b8a8ff; border: 1px solid rgba(123,97,255,0.2); }

.priority-low { color: var(--text-secondary); }
.priority-normal { color: var(--cyan); }
.priority-high { color: var(--amber); }
.priority-urgent { color: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.5; } }

/* FORMS */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-secondary);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  transition: all var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-active);
  background: var(--bg-hover);
  box-shadow: 0 0 12px rgba(0,212,255,0.1);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }
select.form-control option { background: var(--bg-card); }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* TABLE */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,212,255,0.04);
  font-size: 0.85rem;
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--bg-hover); }

/* AVATAR */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--cyan);
  background: var(--cyan-glow);
  flex-shrink: 0;
}

.avatar-lg { width: 64px; height: 64px; font-size: 1.2rem; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

/* STATS */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--cyan);
}
.stat-card.electric::before { background: var(--electric); }
.stat-card.amber::before { background: var(--amber); }
.stat-card.green::before { background: var(--green); }
.stat-value { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: var(--text-primary); }
.stat-label { font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-secondary); letter-spacing: 0.15em; text-transform: uppercase; margin-top: 4px; }

/* MODALS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2,4,8,0.85);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), var(--shadow-cyan);
  animation: slideUp 0.2s ease;
}
.modal-lg { max-width: 1100px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.modal-title { font-family: var(--font-display); font-size: 0.9rem; font-weight: 500; color: var(--cyan); letter-spacing: 0.1em; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* TABS */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 10px 18px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.tab:hover { color: var(--cyan); }
.tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }

/* KANBAN */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; min-height: 500px; align-items: flex-start; }

.kanban-col {
  min-width: 260px;
  max-width: 260px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
}

.kanban-col-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kanban-col-name { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-secondary); letter-spacing: 0.1em; flex: 1; }
.kanban-col-count {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--bg-card2);
  padding: 2px 6px;
  border-radius: 2px;
}

.kanban-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 100px; }

.kanban-card {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: grab;
  transition: all var(--transition);
  position: relative;
}
.kanban-card:hover { border-color: var(--border-active); background: var(--bg-hover); }
.kanban-card.dragging { opacity: 0.5; transform: rotate(2deg); }
.kanban-card-title { font-size: 0.82rem; color: var(--text-primary); margin-bottom: 6px; }
.kanban-card-meta { font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-secondary); }

/* GANTT */
.gantt-container { overflow-x: auto; }
.gantt-header { display: flex; border-bottom: 1px solid var(--border); }
.gantt-row { display: flex; border-bottom: 1px solid rgba(0,212,255,0.04); align-items: center; }
.gantt-row:hover { background: var(--bg-hover); }
.gantt-task-col { min-width: 220px; padding: 8px 12px; font-size: 0.82rem; }
.gantt-timeline { flex: 1; position: relative; height: 40px; }
.gantt-bar {
  position: absolute;
  height: 24px;
  top: 8px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--bg-void);
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
}

/* CONTACT DETAIL */
.contact-hero {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.contact-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--electric), transparent);
}

/* NOTIFICATIONS */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--cyan);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--cyan);
  box-shadow: var(--shadow-cyan);
  z-index: 9999;
  animation: slideInRight 0.3s ease;
}
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.toast.error { border-color: var(--red); color: var(--red); }
.toast.success { border-color: var(--green); color: var(--green); }

/* LOADING / SCANLINE EFFECT */
.scanline::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,212,255,0.02) 2px, rgba(0,212,255,0.02) 4px);
  pointer-events: none;
}

/* PASSWORD VAULT */
.password-item {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.password-dots { font-family: var(--font-mono); color: var(--text-muted); letter-spacing: 3px; }

/* DRAG OVER */
.drag-over { background: var(--cyan-glow) !important; border-color: var(--border-active) !important; }

/* UTILS */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.w-full { width: 100%; }
.text-muted { color: var(--text-secondary); }
.text-cyan { color: var(--cyan); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.7rem; font-family: var(--font-mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { width: 64px; }
  .main-content { margin-left: 64px; }
  .sidebar-logo .logo-text, .nav-item span, .nav-section-label { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .search-bar { width: 180px; }
}
