/* =========================================================
   DESIGN SYSTEM — Persianas Hamano | Ecossistema 3D
   Dark Mode Premium · Glassmorphism · Micro-animations
   ========================================================= */

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

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --bg-void:        #080b14;
  --bg-deep:        #0d1117;
  --bg-surface:     #161b27;
  --bg-elevated:    #1e2535;
  --bg-glass:       rgba(30, 37, 53, 0.6);

  --accent-cyan:    #00d4ff;
  --accent-blue:    #3b82f6;
  --accent-purple:  #8b5cf6;
  --accent-green:   #10b981;
  --accent-amber:   #f59e0b;
  --accent-red:     #ef4444;
  --accent-orange:  #f97316;

  --text-primary:   #f0f4ff;
  --text-secondary: #8892a8;
  --text-muted:     #4a5568;
  --text-accent:    #00d4ff;

  --border-subtle:  rgba(255,255,255,0.06);
  --border-active:  rgba(0,212,255,0.3);
  --border-glow:    rgba(0,212,255,0.15);

  --shadow-sm:      0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:      0 8px 32px rgba(0,0,0,0.5);
  --shadow-lg:      0 20px 60px rgba(0,0,0,0.6);
  --shadow-glow:    0 0 40px rgba(0,212,255,0.15);

  --radius-sm:      6px;
  --radius-md:      12px;
  --radius-lg:      20px;
  --radius-xl:      28px;

  --font-sans:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono:      'JetBrains Mono', 'Consolas', 'Cascadia Code', 'Courier New', monospace;

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-void);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Background Ambient ──────────────────────────────────── */
.bg-ambient {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 20% 10%, rgba(0,212,255,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 80% 80%, rgba(139,92,246,0.05) 0%, transparent 60%),
    radial-gradient(ellipse 40% 50% at 50% 50%, rgba(59,130,246,0.03) 0%, transparent 70%),
    var(--bg-void);
}

/* ── Typography ──────────────────────────────────────────── */
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.8rem); font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: 0.95rem; font-weight: 600; }
p  { color: var(--text-secondary); }

.gradient-text {
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 50%, var(--accent-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Navigation ──────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8, 11, 20, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 2rem;
  display: flex; align-items: center; gap: 1.5rem;
  height: 60px;
}

.nav-brand {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 1rem; font-weight: 700;
  color: var(--text-primary); text-decoration: none;
  white-space: nowrap;
}

.nav-brand .dot { color: var(--accent-cyan); font-size: 1.3rem; line-height: 1; }

.nav-links {
  display: flex; gap: 0.25rem;
  list-style: none; margin-left: auto;
}

.nav-links a {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none; font-size: 0.85rem; font-weight: 500;
  transition: all var(--transition-fast);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.nav-links a.active { color: var(--accent-cyan); }

/* ── Card / Glass Panel ──────────────────────────────────── */
.card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.card:hover { border-color: var(--border-glow); box-shadow: var(--shadow-glow); }

.card-title {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* ── Form Controls ───────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }

.form-label {
  font-size: 0.8rem; font-weight: 500;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 0.3rem;
}

.form-input, .form-select {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 0.55rem 0.85rem;
  width: 100%;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.1);
}

.form-input.has-prefix { padding-left: 2.2rem; }

.input-wrap {
  position: relative;
}

.input-prefix {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  font-size: 0.8rem; color: var(--text-muted); pointer-events: none;
  font-weight: 600;
}

/* Range slider */
.range-wrap { display: flex; align-items: center; gap: 0.75rem; }

input[type="range"] {
  -webkit-appearance: none; flex: 1; height: 4px;
  background: var(--bg-elevated); border-radius: 99px; outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0,212,255,0.5);
  transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

.range-value {
  font-family: var(--font-mono); font-size: 0.85rem;
  color: var(--accent-cyan); font-weight: 500;
  min-width: 3.5rem; text-align: right;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans); font-size: 0.875rem; font-weight: 600;
  cursor: pointer; border: none; transition: all var(--transition-base);
  text-decoration: none; white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: var(--bg-void);
  box-shadow: 0 4px 15px rgba(0,212,255,0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,212,255,0.4);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  border-color: var(--border-active);
  color: var(--text-primary);
  background: var(--bg-elevated);
}

/* ── Stat / KPI Chip ─────────────────────────────────────── */
.stat {
  display: flex; flex-direction: column; gap: 0.2rem;
}

.stat-label {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-muted);
}

.stat-value {
  font-size: 1.6rem; font-weight: 800; line-height: 1;
  letter-spacing: -0.03em;
}

.stat-sub {
  font-size: 0.75rem; color: var(--text-secondary);
}

/* ── Badge / Tag ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 99px; font-size: 0.7rem; font-weight: 600;
}

.badge-green  { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-amber  { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-red    { background: rgba(239,68,68,0.15);  color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.badge-cyan   { background: rgba(0,212,255,0.1);   color: #00d4ff; border: 1px solid rgba(0,212,255,0.2); }
.badge-purple { background: rgba(139,92,246,0.15); color: #a78bfa; border: 1px solid rgba(139,92,246,0.3); }

/* ── Table ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%; border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  padding: 0.65rem 1rem;
  text-align: left; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-primary);
}

tbody tr:hover td { background: rgba(255,255,255,0.02); }

tbody tr:last-child td { border-bottom: none; }

.td-mono { font-family: var(--font-mono); font-size: 0.85rem; }

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  border: none; height: 1px;
  background: var(--border-subtle); margin: 1.5rem 0;
}

/* ── Section / Layout ────────────────────────────────────── */
.section { padding: 2rem; max-width: 1400px; margin: 0 auto; }

.section-header {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 2rem;
}

.section-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .section { padding: 1rem; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}

/* ── Progress Bar ────────────────────────────────────────── */
.progress-bar { height: 6px; background: var(--bg-elevated); border-radius: 99px; overflow: hidden; }
.progress-fill {
  height: 100%; border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Tooltip ─────────────────────────────────────────────── */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary); font-size: 0.72rem;
  padding: 0.35rem 0.6rem; border-radius: var(--radius-sm);
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: all var(--transition-fast); z-index: 50;
}

[data-tip]:hover::after { opacity: 1; transform: translateX(-50%) scale(1); }

/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes pulse-glow { 0%,100% { box-shadow: 0 0 0 0 rgba(0,212,255,0.2); } 50% { box-shadow: 0 0 0 8px rgba(0,212,255,0); } }
@keyframes spin { to { transform: rotate(360deg); } }

.fade-in { animation: fadeIn 0.4s ease both; }
.fade-in-delay { animation: fadeIn 0.5s 0.1s ease both; }

/* ── Modals ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.open { display: flex; }

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.25s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}
.btn-close-modal:hover { color: var(--text-primary); }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

