
/* =========================================================
   ClientFlow CRM - Global Styles
   ========================================================= */

/* ---------- Base ---------- */
body {
  font-family: 'Inter', sans-serif;
  background: #05070d;
  min-height: 100vh;
  overflow-x: hidden;
}

html, body {
  max-width: 100%;
}

/* ---------- Animated background glow ---------- */
.bg-orbs::before,
.bg-orbs::after {
  content: "";
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
  z-index: -1;
  pointer-events: none;
  animation: float 14s ease-in-out infinite;
}
.bg-orbs::before { background: #10b981; top: -150px; left: -120px; }
.bg-orbs::after  { background: #06b6d4; bottom: -180px; right: -120px; animation-delay: -6s; }

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(40px, 30px); }
}

/* ---------- Glass surface ---------- */
.glass {
  background: linear-gradient(145deg, rgba(15,23,42,0.75), rgba(15,23,42,0.35));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(148,163,184,0.12);
  box-shadow: 0 8px 32px -12px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.04);
}

/* ---------- 3D tilt card ---------- */
.tilt {
  transform-style: preserve-3d;
  transition: transform 0.15s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
  overflow: hidden;
}
.tilt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), rgba(16,185,129,0.14), transparent 40%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.tilt:hover::after { opacity: 1; }
.tilt:hover {
  border-color: rgba(16,185,129,0.4);
  box-shadow: 0 20px 50px -15px rgba(16,185,129,0.25);
}

/* ---------- Text ---------- */
.glow-text {
  background: linear-gradient(135deg, #34d399, #10b981, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- Sidebar ---------- */
#sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 16rem;
  height: 100vh;
  z-index: 90;
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.3s ease, visibility 0.3s;
}
#sidebar.open {
  transform: translateX(0);
  visibility: visible;
}

#sidebarOverlay {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: none;
  background: rgba(2,6,23,0.7);
  backdrop-filter: blur(4px);
}
#sidebarOverlay.show { display: block; }

.nav-item { transition: all 0.2s ease; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(16,185,129,0.20), rgba(16,185,129,0.02));
  color: #34d399;
  box-shadow: inset 3px 0 0 #10b981;
}

/* Desktop: sidebar always visible */
@media (min-width: 768px) {
  #sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    transform: none;
    visibility: visible;
    flex-shrink: 0;
  }
  #closeSidebar { display: none; }
  #sidebarOverlay { display: none !important; }
}

/* ---------- Buttons ---------- */
.btn-primary {
  background: linear-gradient(135deg, #34d399, #10b981);
  color: #022c22;
  box-shadow: 0 8px 24px -8px rgba(16,185,129,0.6);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn-primary:active { transform: translateY(0) scale(0.98); }

.header-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
  color: #cbd5e1;
  cursor: pointer;
  background: transparent;
  border: 0;
}
.header-btn:hover { background: rgba(30,41,59,0.8); }
.header-btn svg { width: 20px; height: 20px; }

.header-search { flex: 1 1 auto; min-width: 0; max-width: 28rem; position: relative; }
.header-search input { width: 100%; }

/* ---------- Inputs ---------- */
.input {
  background: rgba(2,6,23,0.6);
  border: 1px solid rgba(51,65,85,0.8);
  color: #e2e8f0;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}
select.input option { background: #0f172a; }

/* Toggle switch */
.toggle { position: relative; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span {
  position: absolute;
  inset: 0;
  cursor: pointer;
  border-radius: 999px;
  background: #1e293b;
  border: 1px solid #334155;
  transition: 0.2s;
}
.toggle span::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: #94a3b8;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle input:checked + span { background: #10b981; border-color: #10b981; }
.toggle input:checked + span::before { transform: translateX(20px); background: #022c22; }

/* ---------- Status badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-lead      { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-active    { background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-completed { background: rgba(99,102,241,0.12); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.3); }
.badge-paid      { background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-pending   { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-overdue   { background: rgba(244,63,94,0.12); color: #fb7185; border: 1px solid rgba(244,63,94,0.3); }

/* ---------- Table ---------- */
.table-row { transition: background 0.2s; }
.table-row:hover { background: rgba(16,185,129,0.04); }

/* ---------- Modals & toasts ---------- */
.modal-backdrop { background: rgba(2,6,23,0.7); backdrop-filter: blur(6px); }
.modal-panel { animation: pop 0.25s ease; }
@keyframes pop {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.toast { animation: slideIn 0.3s ease; }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---------- Entrance animation ---------- */
.fade-up { animation: fadeUp 0.5s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Print: only the invoice paper ---------- */
@media print {
  body { background: #fff !important; }
  body * { visibility: hidden !important; }
  #invoicePaper, #invoicePaper * { visibility: visible !important; }
  #invoicePaper {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    box-shadow: none !important;
    margin: 0;
    padding: 40px !important;
  }
  .no-print { display: none !important; }
}
