/* =============================================
   NexoERP - Enterprise Design System
   ============================================= */

:root {
  color-scheme: dark;
  --brand: #2dd4bf;
  --brand-dim: rgba(45,212,191,.15);
  --surface: rgba(15,15,20,.82);
  --border: rgba(255,255,255,.06);
  --border-hover: rgba(255,255,255,.10);
  --text: #e4e4e7;
  --text-dim: #a1a1aa;
  --text-muted: #71717a;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  min-height: 100vh; margin: 0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(ellipse 80% 60% at 20% 5%, rgba(45,212,191,.06), transparent),
    radial-gradient(ellipse 60% 50% at 80% 0%, rgba(99,102,241,.05), transparent),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(244,63,94,.04), transparent),
    #09090b;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.10); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.18); }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.10) transparent; }

/* --- GLASS CARDS --- */
.glass {
  background: linear-gradient(135deg, rgba(24,24,27,.88), rgba(15,15,20,.92));
  border: 1px solid var(--border);
  box-shadow:
    0 1px 0 rgba(255,255,255,.03) inset,
    0 4px 24px rgba(0,0,0,.30),
    0 1px 3px rgba(0,0,0,.40);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  animation: fadeSlideIn .35s cubic-bezier(.16,1,.3,1);
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- SIDEBAR NAV --- */
.nav-item {
  color: var(--text-dim);
  transition: all .18s cubic-bezier(.4,0,.2,1);
  cursor: pointer;
  user-select: none;
}
.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,.05);
}
.nav-item.active {
  color: #fff;
  background: rgba(45,212,191,.12);
  box-shadow: inset 3px 0 0 var(--brand);
}

/* --- HEADER --- */
header.glass {
  border-bottom: 1px solid rgba(45,212,191,.08);
}

/* --- KPIs --- */
.kpi-cyan    { border-left: 3px solid #22d3ee; }
.kpi-emerald { border-left: 3px solid #34d399; }
.kpi-rose    { border-left: 3px solid #f43f5e; }
.kpi-amber   { border-left: 3px solid #f59e0b; }

/* --- FORMS --- */
input, textarea, select {
  font-family: inherit;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(45,212,191,.10) !important;
  outline: none;
  background: rgba(255,255,255,.06) !important;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
select option { background: #18181b; color: #e4e4e7; }

/* --- BUTTONS --- */
button {
  cursor: pointer;
  transition: all .18s cubic-bezier(.4,0,.2,1);
  font-family: inherit;
}
button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(135deg, #14b8a6, #0d9488);
  color: #fff; font-weight: 600; border: none;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-danger  { color: #fca5a5; }
.btn-danger:hover { background: rgba(239,68,68,.15); }

/* --- TABLES --- */
table {
  border-collapse: separate;
  border-spacing: 0;
}
thead th {
  position: sticky; top: 0;
  background: rgba(15,15,20,.95);
  backdrop-filter: blur(8px);
}
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(255,255,255,.025); }
tbody td { border-bottom: 1px solid rgba(255,255,255,.04); }
tr:last-child td { border-bottom: none; }

/* --- STATUS BADGES --- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 9999px;
  font-size: 11px; font-weight: 600;
  letter-spacing: .01em; white-space: nowrap;
}
.badge-success  { background: rgba(52,211,153,.12); color: #34d399; border: 1px solid rgba(52,211,153,.20); }
.badge-warning  { background: rgba(251,191,36,.12); color: #fbbf24; border: 1px solid rgba(251,191,36,.20); }
.badge-danger   { background: rgba(244,63,94,.12);  color: #f87171; border: 1px solid rgba(244,63,94,.20);  }
.badge-info     { background: rgba(34,211,238,.12); color: #22d3ee; border: 1px solid rgba(34,211,238,.20); }
.badge-purple   { background: rgba(167,139,250,.12); color: #c4b5fd; border: 1px solid rgba(167,139,250,.20); }
.badge-neutral  { background: rgba(255,255,255,.06); color: #a1a1aa; border: 1px solid rgba(255,255,255,.08); }

/* --- PROGRESS BAR --- */
.progress-track { background: rgba(255,255,255,.06); }
.progress-fill  { background: linear-gradient(90deg, var(--brand), #0d9488); border-radius: 9999px; transition: width .6s cubic-bezier(.16,1,.3,1); }

/* --- NOTIFICATION DOT --- */
.notif-dot {
  width: 7px; height: 7px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(45,212,191,.5);
}

/* --- MODAL --- */
.modal-backdrop { animation: backdropIn .2s ease; }
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }

/* --- SKELETON LOADING --- */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.08) 50%, rgba(255,255,255,.04) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.6s infinite;
  border-radius: 6px;
}

/* --- THREE.JS --- */
#metric3d { height: 280px; width: 100%; overflow: hidden; border-radius: 12px; }
#metric3d canvas { display: block; }

/* --- SEARCH --- */
input[type="search"]::-webkit-search-cancel-button { filter: invert(.4); cursor: pointer; }

/* --- FOCUS --- */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* --- MOBILE --- */
* { -webkit-tap-highlight-color: transparent; }

/* --- PRINT --- */
@media print {
  body { background: #fff; color: #000; }
  .glass { box-shadow: none; border: 1px solid #ddd; background: #fff; }
  .nav-item, header button { display: none; }
}
