/**
 * GoTech Cloud — Design System
 *
 * Tokens y primitivos extraídos de public/landing/style.css (v3.46.0).
 * Importar en cualquier HTML del cliente para consistencia visual:
 *   <link rel="stylesheet" href="/css/design-system.css">
 *
 * Filosofía:
 *  - Paleta oscura sobria #0a0e1a. Cian/magenta usados con moderación.
 *  - Tipografía Inter (body) + JetBrains Mono (técnico).
 *  - Sin glow excesivo, sin gradients de texto, sin emoji decorativo.
 *  - Microinteracciones 150ms. Hover sutil.
 *  - Mobile-first responsive.
 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg: #0a0e1a;
  --bg-elev: #0f1424;
  --bg-card: #131a2c;
  --bg-input: #0c1120;

  /* Lines */
  --border: #1c2438;
  --border-strong: #2a3450;
  --border-focus: #00d4ff;

  /* Text */
  --text: #e8ecf5;
  --text-muted: #8a93a8;
  --text-dim: #5d6478;
  --text-on-cyan: #00171f;

  /* Accents */
  --cyan: #00d4ff;
  --cyan-hover: #2de0ff;
  --magenta: #ff00e5;
  --green: #00e676;
  --warn: #ffb648;
  --error: #ff5d6c;

  /* Aliases for theme parity with legacy code */
  --bg-primary: #0a0e1a;
  --bg-secondary: #0f1424;
  --bg-tertiary: #131a2c;
  --text-primary: #e8ecf5;
  --text-secondary: #c7cdd9;
  --border-color: #1c2438;
  --accent: #00d4ff;
  --accent-primary: #00d4ff;
  --accent-secondary: #ff00e5;
  --accent-gradient: linear-gradient(135deg, #00d4ff 0%, #ff00e5 100%);
  --success: #00e676;
  --warning: #ffb648;
  --info: #00d4ff;
  --shadow-color: rgba(0, 212, 255, 0.08);

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  /* Spacing scale (4px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 16px;
  --fs-xl: 18px;
  --fs-2xl: 22px;
  --fs-3xl: 28px;
  --fs-4xl: 36px;
  --fs-5xl: 48px;

  /* Motion */
  --t-fast: 100ms ease;
  --t-base: 150ms ease;
  --t-slow: 250ms ease;

  /* Shadows (sutiles) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .25);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .3);
  --shadow-glow: 0 0 0 1px rgba(0, 212, 255, .15), 0 12px 32px rgba(0, 212, 255, .06);

  /* Z-index */
  --z-base: 1;
  --z-sticky: 50;
  --z-modal: 1000;
  --z-toast: 3000;
}

/* ── Reset + Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: var(--fs-lg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; transition: color var(--t-base); }
a:hover { color: var(--cyan); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ── Layout primitives ──────────────────────────────────────────────────── */
.ds-container { max-width: 1160px; margin: 0 auto; padding: 0 var(--sp-6); }
.ds-container-sm { max-width: 720px; margin: 0 auto; padding: 0 var(--sp-6); }
.ds-stack > * + * { margin-top: var(--sp-4); }
.ds-stack-sm > * + * { margin-top: var(--sp-2); }
.ds-stack-lg > * + * { margin-top: var(--sp-6); }
.ds-row { display: flex; align-items: center; gap: var(--sp-3); }
.ds-row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.ds-grid { display: grid; gap: var(--sp-4); }
.ds-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
.ds-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.ds-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }
.ds-grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-4); }

/* ── Typography ─────────────────────────────────────────────────────────── */
.ds-h1 { font-size: clamp(36px, 5vw, var(--fs-5xl)); font-weight: 800; line-height: 1.05; letter-spacing: -.025em; color: var(--text); }
.ds-h2 { font-size: clamp(28px, 3.5vw, var(--fs-4xl)); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; color: var(--text); }
.ds-h3 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.ds-h4 { font-size: var(--fs-lg); font-weight: 600; color: var(--text); }
.ds-lead { font-size: var(--fs-xl); color: var(--text-muted); }
.ds-muted { color: var(--text-muted); }
.ds-dim { color: var(--text-dim); }
.ds-small { font-size: var(--fs-sm); }
.ds-tiny { font-size: var(--fs-xs); }
.ds-mono { font-family: var(--font-mono); }
.ds-eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--cyan);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 10px 18px;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: var(--fs-base);
  letter-spacing: .01em;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all var(--t-base);
  white-space: nowrap;
  text-decoration: none;
}
.ds-btn:disabled { opacity: .5; cursor: not-allowed; }
.ds-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.ds-btn-primary {
  background: var(--cyan);
  color: var(--text-on-cyan);
  border-color: var(--cyan);
}
.ds-btn-primary:hover:not(:disabled) { background: var(--cyan-hover); transform: translateY(-1px); }

.ds-btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border-strong);
}
.ds-btn-secondary:hover:not(:disabled) { border-color: var(--cyan); color: var(--cyan); }

.ds-btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.ds-btn-ghost:hover:not(:disabled) { border-color: var(--cyan); color: var(--cyan); }

.ds-btn-danger {
  background: rgba(255, 93, 108, .1);
  color: var(--error);
  border-color: rgba(255, 93, 108, .35);
}
.ds-btn-danger:hover:not(:disabled) { background: rgba(255, 93, 108, .2); border-color: var(--error); }

.ds-btn-sm { padding: 6px 12px; font-size: var(--fs-sm); }
.ds-btn-lg { padding: 14px 24px; font-size: var(--fs-md); }
.ds-btn-block { display: flex; width: 100%; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.ds-form-group { margin-bottom: var(--sp-4); }
.ds-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}
.ds-input,
.ds-select,
.ds-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: var(--fs-md);
  transition: border-color var(--t-base);
  outline: none;
  font-family: inherit;
}
.ds-input:focus,
.ds-select:focus,
.ds-textarea:focus { border-color: var(--cyan); }
.ds-input::placeholder, .ds-textarea::placeholder { color: var(--text-dim); }
.ds-input[disabled], .ds-select[disabled], .ds-textarea[disabled] { opacity: .6; cursor: not-allowed; }
.ds-textarea { resize: vertical; min-height: 80px; }
.ds-input-error { border-color: var(--error); }
.ds-input-mono { font-family: var(--font-mono); font-size: var(--fs-base); }

.ds-input-group {
  display: flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-input);
  transition: border-color var(--t-base);
}
.ds-input-group:focus-within { border-color: var(--cyan); }
.ds-input-group .ds-input,
.ds-input-group .ds-select {
  border: 0;
  background: transparent;
  border-radius: 0;
}
.ds-input-group > * + * { border-left: 1px solid var(--border); }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.ds-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  transition: border-color var(--t-base);
}
.ds-card-hover:hover { border-color: var(--border-strong); }
.ds-card-elev {
  background: linear-gradient(180deg, var(--bg-card), var(--bg-elev));
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.ds-card-featured {
  border-color: rgba(0, 212, 255, .4);
  box-shadow: var(--shadow-glow);
}
.ds-card-compact { padding: var(--sp-4); }
.ds-card-title { font-size: var(--fs-md); font-weight: 700; margin-bottom: var(--sp-3); }
.ds-card-sub { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--sp-4); }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.ds-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, .05);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.ds-badge-success, .ds-badge-paid, .ds-badge-active { background: rgba(0, 230, 118, .12); color: var(--green); border-color: rgba(0, 230, 118, .3); }
.ds-badge-warn, .ds-badge-pending { background: rgba(255, 182, 72, .12); color: var(--warn); border-color: rgba(255, 182, 72, .3); }
.ds-badge-error, .ds-badge-failed, .ds-badge-cancelled, .ds-badge-suspended { background: rgba(255, 93, 108, .12); color: var(--error); border-color: rgba(255, 93, 108, .3); }
.ds-badge-info { background: rgba(0, 212, 255, .1); color: var(--cyan); border-color: rgba(0, 212, 255, .3); }
.ds-badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* ── Tables ─────────────────────────────────────────────────────────────── */
.ds-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.ds-table thead { background: var(--bg-elev); }
.ds-table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .08em;
  border-bottom: 1px solid var(--border);
}
.ds-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.ds-table tr:last-child td { border-bottom: 0; }
.ds-table tbody tr:hover { background: rgba(255, 255, 255, .02); }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.ds-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  overflow-x: auto;
  scrollbar-width: thin;
}
.ds-tab {
  padding: 12px 18px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--fs-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--t-base);
}
.ds-tab:hover:not(.active) { color: var(--text); }
.ds-tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.ds-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
.ds-modal-overlay.active { display: flex; }
.ds-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: var(--sp-8);
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.ds-modal-title { font-size: var(--fs-xl); font-weight: 700; margin-bottom: var(--sp-2); }
.ds-modal-sub { color: var(--text-muted); margin-bottom: var(--sp-6); }
.ds-modal-actions { display: flex; gap: var(--sp-3); justify-content: flex-end; margin-top: var(--sp-6); flex-wrap: wrap; }

/* ── Toast ──────────────────────────────────────────────────────────────── */
.ds-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}
.ds-toast {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--cyan);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: var(--fs-sm);
  color: var(--text);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  max-width: 380px;
  animation: ds-toast-in .2s ease;
}
.ds-toast-success { border-left-color: var(--green); }
.ds-toast-error { border-left-color: var(--error); }
.ds-toast-warn { border-left-color: var(--warn); }
@keyframes ds-toast-in { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Empty state ────────────────────────────────────────────────────────── */
.ds-empty {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
}
.ds-empty-icon { font-size: 32px; margin-bottom: var(--sp-3); opacity: .5; }
.ds-empty-title { color: var(--text); font-weight: 600; font-size: var(--fs-md); margin-bottom: var(--sp-2); }
.ds-empty-desc { font-size: var(--fs-sm); max-width: 360px; margin: 0 auto; }

/* ── Skeleton loader ────────────────────────────────────────────────────── */
.ds-skel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
}
.ds-skel::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .03), transparent);
  animation: ds-shimmer 1.4s infinite;
}
@keyframes ds-shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* ── Utilities ──────────────────────────────────────────────────────────── */
.ds-text-center { text-align: center; }
.ds-text-right { text-align: right; }
.ds-text-cyan { color: var(--cyan); }
.ds-text-success { color: var(--green); }
.ds-text-error { color: var(--error); }
.ds-text-warn { color: var(--warn); }
.ds-w-full { width: 100%; }
.ds-flex-1 { flex: 1; }
.ds-mt-0 { margin-top: 0 !important; }
.ds-mt-2 { margin-top: var(--sp-2); }
.ds-mt-4 { margin-top: var(--sp-4); }
.ds-mt-6 { margin-top: var(--sp-6); }
.ds-mb-2 { margin-bottom: var(--sp-2); }
.ds-mb-4 { margin-bottom: var(--sp-4); }
.ds-mb-6 { margin-bottom: var(--sp-6); }
.ds-gap-2 { gap: var(--sp-2); }
.ds-gap-3 { gap: var(--sp-3); }
.ds-gap-4 { gap: var(--sp-4); }
.ds-hidden { display: none !important; }

/* Status pill (dot + label, inline) */
.ds-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: 500;
}
.ds-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
}
.ds-status-ok::before { background: var(--green); box-shadow: 0 0 0 3px rgba(0, 230, 118, .15); }
.ds-status-warn::before { background: var(--warn); box-shadow: 0 0 0 3px rgba(255, 182, 72, .15); }
.ds-status-error::before { background: var(--error); box-shadow: 0 0 0 3px rgba(255, 93, 108, .15); }
.ds-status-info::before { background: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 212, 255, .15); }

/* Custom scrollbar (subtle) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .ds-container { padding: 0 var(--sp-4); }
  .ds-grid-2, .ds-grid-3, .ds-grid-4 { grid-template-columns: 1fr; }
  .ds-modal { padding: var(--sp-6); }
}
