@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');
@import url('https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css');

/* ── SIGMAC CORP — BRAND IDENTITY ──────────────────────────── */
:root {
  --brand:        #059669;   /* Sigmac Emerald */
  --brand-lt:     #10b981;   /* Emerald 500 */
  --brand-glow:   rgba(5,150,105,0.15);
  --bg:           #0f172a;   /* Negro Onice */
  --surface:      #1e293b;   /* Gris Profundo */
  --surface-2:    #263349;
  --text:         #f1f5f9;
  --muted:        #94a3b8;
  --dim:          #64748b;
  --border:       rgba(71,85,105,0.35);
  --danger:       #ef4444;
  --warning:      #f59e0b;
  --success:      #10b981;
  --primary:      #059669;
  --primary-hover:#047857;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(15,23,42,0.4); }
::-webkit-scrollbar-thumb { background: rgba(71,85,105,0.6); border-radius: 3px; }

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

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  background: rgba(17,24,39,0.95);
  padding: 1.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  border-right: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 50;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  padding: 0 0.25rem;
}
.sidebar-logo img {
  height: 36px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}
.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
.sidebar-logo-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}
.sidebar-logo-sub {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--brand-lt);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Legacy .logo-icon kept for fallback */
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--brand-lt));
  color: white; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--brand-glow);
}

.nav-menu { display: flex; flex-direction: column; gap: 0.35rem; }

.nav-item {
  display: flex; align-items: center; gap: 0.875rem;
  padding: 0.75rem 1rem;
  color: var(--dim); text-decoration: none;
  border-radius: 10px;
  font-weight: 600; font-size: 0.875rem;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.nav-item i { font-size: 1.2rem; }
.nav-item:hover {
  background: rgba(5,150,105,0.08);
  color: var(--brand-lt);
  border-color: rgba(5,150,105,0.15);
}
.nav-item.active {
  background: rgba(5,150,105,0.12);
  color: var(--brand-lt);
  border-color: rgba(5,150,105,0.25);
}

.sidebar-divider {
  height: 1px; background: var(--border);
  margin: 1rem 0;
}

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 2rem 2.5rem;
  min-height: 100vh;
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.greeting h1 {
  font-size: 1.6rem; font-weight: 900;
  color: var(--text); margin-bottom: 0.35rem;
  letter-spacing: -0.5px;
}
.greeting p {
  color: var(--muted); font-size: 0.875rem;
  font-weight: 500; max-width: 420px;
}

.user-profile {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--surface);
  padding: 0.4rem 0.875rem 0.4rem 0.4rem;
  border-radius: 99px;
  border: 1px solid var(--border);
}
.user-profile img {
  width: 36px; height: 36px;
  border-radius: 50%; object-fit: cover;
}
.user-info { display: flex; flex-direction: column; }
.user-info span { font-weight: 700; font-size: 0.82rem; color: var(--text); }
.user-info small { color: var(--muted); font-size: 0.72rem; }

/* ── DASHBOARD GRID ──────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .main-content { margin-left: 0; padding: 1rem; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; }
}

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  border-radius: 20px;
  padding: 1.75rem;
  border: 1px solid var(--border);
}
.card-dark {
  background: var(--surface);
  color: var(--text);
}
.card-white {
  background: rgba(30,41,59,0.6);
  color: var(--text);
  backdrop-filter: blur(4px);
}
.card-title {
  font-size: 1rem; font-weight: 800;
  margin-bottom: 1.5rem;
  display: flex; justify-content: space-between; align-items: center;
  color: var(--text);
}
.card-title i { opacity: 0.7; font-size: 1.4rem; color: var(--brand-lt); }

/* ── UPLOAD FORM ─────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.1rem;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.form-group label {
  font-size: 0.72rem; font-weight: 700;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.form-group input {
  background: rgba(15,23,42,0.6);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.875rem 1rem;
  border-radius: 10px;
  font-family: inherit; font-size: 0.9rem;
  outline: none; transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--brand); }
.form-group input::placeholder { color: var(--dim); }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 2rem 1.5rem;
  text-align: center; cursor: pointer;
  transition: all 0.2s;
  background: rgba(15,23,42,0.3);
  margin-bottom: 1.25rem;
}
.drop-zone:hover {
  border-color: var(--brand);
  background: var(--brand-glow);
}
.drop-zone i { font-size: 2.25rem; margin-bottom: 0.5rem; color: var(--brand-lt); display: block; }
.drop-zone p { font-size: 0.875rem; color: var(--muted); margin-bottom: 0.2rem; }
.drop-zone small { font-size: 0.72rem; color: var(--dim); }
.file-name { color: var(--brand-lt); font-weight: 700; margin-top: 0.75rem; font-size: 0.82rem; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-lt));
  color: white; border: none;
  padding: 0.9rem 1.75rem;
  border-radius: 10px;
  font-family: inherit; font-weight: 800; font-size: 0.95rem;
  cursor: pointer; width: 100%;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  box-shadow: 0 4px 16px var(--brand-glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(5,150,105,0.3);
}
.btn-primary:disabled {
  opacity: 0.6; transform: none; cursor: not-allowed;
}

/* ── PIPELINE PHASES ─────────────────────────────────────── */
.phases { display: flex; flex-direction: column; gap: 0.75rem; }

.phase {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.875rem 1rem;
  border-radius: 14px;
  background: rgba(15,23,42,0.4);
  border: 1px solid var(--border);
  transition: all 0.3s;
}
.phase.active {
  background: rgba(5,150,105,0.06);
  border-color: rgba(5,150,105,0.3);
  box-shadow: 0 0 0 1px rgba(5,150,105,0.1);
}
.phase.done { opacity: 0.65; }

.phase-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(71,85,105,0.3);
  color: var(--dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; transition: all 0.3s; flex-shrink: 0;
}
.phase.active .phase-icon { background: var(--brand); color: white; box-shadow: 0 4px 12px var(--brand-glow); }
.phase.done .phase-icon { background: rgba(5,150,105,0.2); color: var(--brand-lt); }

.phase-info { flex: 1; min-width: 0; }
.phase-name { font-weight: 700; font-size: 0.88rem; margin-bottom: 0.15rem; color: var(--text); }
.phase-desc { font-size: 0.75rem; color: var(--muted); }
.phase-status { font-weight: 700; font-size: 0.75rem; color: var(--dim); flex-shrink: 0; }
.phase.active .phase-status { color: var(--brand-lt); }
.phase.done .phase-status { color: var(--brand); }

/* ── RESULT ACTIONS ──────────────────────────────────────── */
.result-actions { margin-top: 1.25rem; display: flex; gap: 0.75rem; }
.btn-action {
  flex: 1;
  background: rgba(5,150,105,0.08);
  border: 1px solid rgba(5,150,105,0.2);
  padding: 0.75rem;
  border-radius: 10px;
  font-family: inherit; font-weight: 700; font-size: 0.85rem;
  color: var(--brand-lt);
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.btn-action:hover {
  background: rgba(5,150,105,0.15);
  border-color: rgba(5,150,105,0.4);
  transform: translateY(-1px);
}
.btn-action i { font-size: 1.15rem; }

/* ── VIEW SECTIONS ───────────────────────────────────────── */
.view-section { display: none; }
.view-section.active { display: block; }

/* ── TOAST ───────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 2rem; right: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.875rem 1.5rem;
  border-radius: 12px;
  font-weight: 700; font-size: 0.875rem;
  transform: translateY(100px); opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999;
  box-shadow: 0 16px 40px rgba(0,0,0,0.4);
  max-width: 340px;
}
#toast.show { transform: translateY(0); opacity: 1; }
