/* ===== StatusEC B2B Portal — Shared Styles ===== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --navy:       #0d0b3e;
  --navy-deep:  #08062e;
  --navy-light: #1a1464;
  --green:      #7bc142;
  --green-hover:#6db538;
  --lime:       #c8f7a0;
  --white:      #ffffff;
  --gray-50:    #f8f9fc;
  --gray-100:   #f0f1f5;
  --gray-200:   #e2e4ea;
  --gray-400:   #9498a8;
  --gray-600:   #5a5e72;
  --gray-800:   #2d3044;
  --red:        #ef4444;
  --red-bg:     #fef2f2;
  --amber:      #f59e0b;
  --amber-bg:   #fffbeb;
  --blue:       #3b82f6;
  --blue-bg:    #eff6ff;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --shadow:     0 8px 30px rgba(13,11,62,0.1);
  --shadow-sm:  0 2px 8px rgba(13,11,62,0.06);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: var(--navy);
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 28px; border-radius: 50px; font-size: 0.9rem; font-weight: 600;
  border: none; cursor: pointer; transition: all 0.15s; white-space: nowrap;
  font-family: 'Inter', sans-serif;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--green); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--green-hover); }
.btn-secondary { background: var(--white); color: var(--navy); border: 1px solid var(--gray-200); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-50); border-color: var(--gray-400); }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-outline:hover:not(:disabled) { background: var(--navy); color: var(--white); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-sm { padding: 8px 18px; font-size: 0.8rem; }
.btn-xs { padding: 5px 12px; font-size: 0.75rem; }
.btn .spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Nav ===== */
.portal-nav {
  background: var(--navy-deep);
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 100;
}
.portal-nav .logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}
.portal-nav .logo-icon {
  width: 32px; height: 32px; border-radius: 8px; background: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; color: var(--white); font-size: 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.portal-nav .logo-img {
  height: 32px; object-fit: contain;
}
.portal-nav .logo-text {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800; font-size: 1.05rem; color: var(--white);
}
.portal-nav .logo-text span { color: var(--green); font-size: 0.7rem; font-weight: 600; display: block; margin-top: -2px; }
.nav-links {
  display: flex; align-items: center; gap: 4px;
}
.nav-links a {
  color: rgba(255,255,255,0.6); padding: 8px 14px; border-radius: 8px;
  font-size: 0.85rem; font-weight: 500; text-decoration: none; transition: all 0.15s;
}
.nav-links a:hover { color: var(--white); background: rgba(255,255,255,0.08); text-decoration: none; }
.nav-links a.active { color: var(--lime); background: rgba(255,255,255,0.08); }

/* Primary nav item — flagship product (Monitoreo) */
.nav-links a.nav-primary {
  background: rgba(123,193,66,0.14); color: var(--lime);
  padding: 8px 16px; font-weight: 600; font-size: 0.88rem;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(123,193,66,0.28);
}
.nav-links a.nav-primary:hover {
  background: rgba(123,193,66,0.22); color: var(--white);
  border-color: rgba(123,193,66,0.55);
}
.nav-links a.nav-primary.active {
  background: rgba(123,193,66,0.28); color: var(--white);
  border-color: rgba(123,193,66,0.7);
  box-shadow: 0 0 0 2px rgba(123,193,66,0.15);
}
.nav-links .nav-primary-icon { font-size: 0.7rem; line-height: 1; }
/* Visual divider between primary (monitoreo) and secondary items */
.nav-links .nav-divider {
  width: 1px; height: 20px; background: rgba(255,255,255,0.15);
  margin: 0 10px;
}
/* Small muted label for the secondary nav group */
.nav-links .nav-section-label {
  color: rgba(255,255,255,0.35); font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0 8px 0 4px;
}
.nav-right {
  display: flex; align-items: center; gap: 16px;
}
.credit-badge {
  display: flex; align-items: center; gap: 6px;
  background: rgba(123,193,66,0.15); color: var(--lime);
  padding: 6px 14px; border-radius: 50px; font-size: 0.8rem; font-weight: 600;
}
.credit-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.nav-logout {
  color: rgba(255,255,255,0.4); font-size: 0.78rem; cursor: pointer;
  background: none; border: none; font-family: inherit;
}
.nav-logout:hover { color: rgba(255,255,255,0.7); }

/* ===== Layout ===== */
.page-container { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.6rem; margin-bottom: 4px; }
.page-header p { color: var(--gray-600); font-size: 0.9rem; }

/* ===== Cards ===== */
.card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 24px;
}
.card-flat {
  background: var(--white); border-radius: var(--radius-md);
  border: 1px solid var(--gray-200); padding: 20px;
}

/* ===== Stat cards ===== */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--white); border-radius: var(--radius-md);
  padding: 20px; border: 1px solid var(--gray-200);
}
.stat-card .stat-label { font-size: 0.78rem; color: var(--gray-400); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; color: var(--navy); margin-top: 4px; font-family: 'Plus Jakarta Sans', sans-serif; }
.stat-card .stat-sub { font-size: 0.78rem; color: var(--gray-600); margin-top: 2px; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead th {
  text-align: left; padding: 12px 16px; color: var(--gray-400);
  font-weight: 600; font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.05em; border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
tbody td {
  padding: 14px 16px; border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
tbody tr:hover td { background: var(--gray-50); }
.mono { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: 0.82rem; }

/* ===== Badges ===== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 50px; font-size: 0.75rem; font-weight: 600;
}
.badge-green { background: rgba(123,193,66,0.12); color: #3d8b1c; }
.badge-blue { background: rgba(59,130,246,0.12); color: #1d4ed8; }
.badge-amber { background: rgba(245,158,11,0.12); color: #b45309; }
.badge-red { background: rgba(239,68,68,0.12); color: #dc2626; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge .pulse-dot {
  width: 6px; height: 6px; border-radius: 50%; animation: pulse 1.5s ease-in-out infinite;
}
.badge-blue .pulse-dot { background: #3b82f6; }
.badge-green .pulse-dot { background: #22c55e; }
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:0.4} }

/* ===== Progress bar ===== */
.progress-bar {
  height: 8px; background: var(--gray-200); border-radius: 50px; overflow: hidden;
  width: 100%;
}
.progress-bar .fill {
  height: 100%; border-radius: 50px; transition: width 0.5s ease;
}
.fill-green { background: var(--green); }
.fill-navy { background: var(--navy); }
.fill-amber { background: var(--amber); }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 0.82rem; font-weight: 600; color: var(--gray-800);
  margin-bottom: 6px;
}
.form-input {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm); font-size: 0.9rem; color: var(--gray-800);
  background: var(--white); outline: none; transition: border-color 0.15s;
  font-family: 'Inter', sans-serif;
}
.form-input:focus { border-color: var(--green); }
.form-input::placeholder { color: var(--gray-400); }
.form-error-msg {
  color: var(--red); font-size: 0.8rem; margin-top: 6px; display: none;
}
.form-error-msg.visible { display: block; }
textarea.form-input { resize: vertical; min-height: 120px; }

/* ===== Skeleton loader ===== */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0%{background-position:200% 0}100%{background-position:-200% 0} }
.skeleton-text { height: 14px; margin-bottom: 8px; width: 80%; }
.skeleton-title { height: 24px; margin-bottom: 12px; width: 50%; }
.skeleton-card { height: 100px; }

/* ===== Empty state ===== */
.empty-state {
  text-align: center; padding: 60px 20px;
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 1.1rem; color: var(--gray-800); margin-bottom: 8px; }
.empty-state p { color: var(--gray-400); font-size: 0.88rem; margin-bottom: 20px; }

/* ===== Toast ===== */
.toast-container { position: fixed; top: 72px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--white); border-radius: var(--radius-md); padding: 14px 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); font-size: 0.85rem; min-width: 280px;
  display: flex; align-items: center; gap: 10px; animation: slideIn 0.3s ease;
  border-left: 4px solid var(--green);
}
.toast.error { border-left-color: var(--red); }
@keyframes slideIn { from{transform:translateX(100%);opacity:0}to{transform:translateX(0);opacity:1} }

/* ===== Utility ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--gray-400); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-navy { color: var(--navy); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-container { padding: 20px 16px; }
}
@media (max-width: 640px) {
  .portal-nav { padding: 0 12px; }
  .nav-links { display: none; }
}
