/* ================================================================
   INKX — Estilos base globales
   app.css  →  reset + tipografía + utilidades + componentes base
   ================================================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: var(--leading-normal);
  color: var(--white);
  background: var(--black);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .055;
  z-index: 20;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

img, video, svg { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-400); }
::-webkit-scrollbar-thumb:hover { background: var(--black); }

/* ── Selección ───────────────────────────────────────────────── */
::selection {
  background: var(--crimson);
  color: var(--white);
}

/* ── Contenedor ──────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

/* ── Tipografía base ─────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 300;
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  color: var(--white);
}

h1 { font-size: clamp(40px, 5vw, 72px); }
h2 { font-size: clamp(30px, 3.5vw, 52px); }
h3 { font-size: clamp(22px, 2.5vw, 34px); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); font-family: var(--font-body); font-weight: 500; }

p { line-height: var(--leading-loose); }

.display-title {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 300;
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--crimson);
  margin-bottom: var(--space-6);
}
.section-tag::before {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: var(--crimson);
  flex-shrink: 0;
}

/* ── Botones ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: all var(--duration-base) var(--ease);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn-sm  { padding: 8px 18px;  font-size: 10px; }
.btn-md  { padding: 11px 24px; }
.btn-lg  { padding: 14px 36px; font-size: 13px; }
.btn-xl  { padding: 18px 48px; font-size: 14px; }
.btn-full { width: 100%; }

/* Variantes */
.btn-black {
  background: var(--black);
  color: var(--white);
}
.btn-black:hover { background: var(--gray-700); }

.btn-crimson {
  background: var(--crimson);
  color: var(--white);
}
.btn-crimson:hover { background: var(--crimson-dk); }

.btn-white {
  background: var(--white);
  color: var(--black);
}
.btn-white:hover { background: var(--gray-100); }

.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: all var(--duration-base);
}
.btn-outline:hover {
  background: rgba(182, 27, 51, 0.2);
  color: #ffffff;
  border-color: #ff3355;
  box-shadow: 0 0 15px rgba(182, 27, 51, 0.35);
}

.btn-outline-white {
  background: transparent;
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.35);
}
.btn-outline-white:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--white);
}

.btn-ghost {
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  border: none;
  padding-left: 0;
  padding-right: 0;
  letter-spacing: 0.05em;
  text-transform: none;
  font-size: var(--text-sm);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--duration-base);
}
.btn-ghost:hover {
  color: #ff4d67;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Formularios ─────────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-6); }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin-bottom: 4px;
}

.form-control {
  width: 100%;
  padding: 10px 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 300;
  color: var(--white);
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  border-radius: 0;
  outline: none;
  transition: all var(--duration-fast);
  appearance: none;
}

.form-control:focus {
  border-bottom-color: var(--white);
  box-shadow: 0 1px 0 var(--white);
}

.form-control::placeholder { color: var(--gray-400); }

select option,
select.form-control option {
  background: #181818 !important;
  background-color: #181818 !important;
  color: #ffffff !important;
}

select optgroup {
  background: #111111 !important;
  color: rgba(255, 255, 255, 0.5) !important;
}

.form-control.is-invalid {
  border-bottom-color: var(--crimson);
}

.form-control.is-invalid:focus {
  box-shadow: 0 1px 0 var(--crimson);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--crimson);
  margin-top: var(--space-1);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--gray-500);
  margin-top: var(--space-1);
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
  line-height: var(--leading-loose);
}

select.form-control {
  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='%23888884' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* ── Checkbox chips / Pills de estilos ───────────────────────── */
.styles-checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.style-checkbox {
  display: inline-block;
  cursor: pointer;
  user-select: none;
  margin: 0;
}
.style-checkbox input[type="checkbox"] {
  display: none !important;
}
.style-checkbox span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 40px;
  font-size: 13px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.75);
  transition: all var(--duration-fast, 0.15s) ease;
  cursor: pointer;
}
.style-checkbox:hover span {
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--white, #ffffff);
  background: rgba(255, 255, 255, 0.06);
}
.style-checkbox input[type="checkbox"]:checked + span {
  background: var(--crimson, #8F1325) !important;
  border-color: var(--crimson, #8F1325) !important;
  color: var(--white, #ffffff) !important;
  box-shadow: 0 4px 15px rgba(143, 19, 37, 0.35);
  font-weight: 400;
}


/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--gray-800);
  border: 1px solid var(--line);
}

.card-body { padding: var(--space-6); }
.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: var(--border);
  font-weight: 500;
}
.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: var(--border);
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  line-height: 1.4;
}

.badge-black    { background: var(--black);   color: var(--white); }
.badge-crimson  { background: var(--crimson); color: var(--white); }
.badge-gray     { background: var(--gray-100); color: var(--gray-700); }
.badge-success  { background: var(--success-bg); color: var(--success); }
.badge-warning  { background: var(--warning-bg); color: var(--warning); }
.badge-danger   { background: var(--crimson-xs); color: var(--crimson); }
.badge-info     { background: var(--info-bg); color: var(--info); }

/* ── Alertas flash ───────────────────────────────────────────── */
.alert {
  padding: var(--space-4) var(--space-5);
  border-left: 3px solid currentColor;
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error   { background: var(--crimson-xs); color: var(--crimson); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-info    { background: var(--info-bg);    color: var(--info); }

/* ── Divisores ───────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  color: var(--gray-400);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: var(--space-8) 0;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

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

table.inkx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.inkx-table th {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-500);
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border);
  text-align: left;
  white-space: nowrap;
}
.inkx-table td {
  padding: var(--space-4);
  border-bottom: var(--border);
  vertical-align: middle;
  color: var(--gray-700);
}
.inkx-table tr:last-child td { border-bottom: none; }
.inkx-table tr:hover td { background: var(--gray-50); }

/* ── Paginación ──────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-8);
}
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: var(--text-sm);
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
  transition: all var(--duration-fast);
}
.page-link:hover { border-color: var(--black); color: var(--black); }
.page-link.active {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

/* ── Utilidades ──────────────────────────────────────────────── */
.text-crimson  { color: var(--crimson); }
.text-muted    { color: var(--gray-500); }
.text-sm       { font-size: var(--text-sm); }
.text-xs       { font-size: var(--text-xs); }
.text-display  { font-family: var(--font-display); }
.text-italic   { font-style: italic; }
.text-bold     { font-weight: 700; }
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.text-upper    { text-transform: uppercase; letter-spacing: 0.08em; }

.mt-0  { margin-top: 0; }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }

.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.w-full  { width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Animaciones de scroll reveal ───────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity   var(--duration-slower) var(--ease),
    transform var(--duration-slower) var(--ease);
}
.reveal.visible         { opacity: 1; transform: translateY(0); }
.reveal-delay-1         { transition-delay: 100ms; }
.reveal-delay-2         { transition-delay: 200ms; }
.reveal-delay-3         { transition-delay: 300ms; }
.reveal-delay-4         { transition-delay: 400ms; }

/* ── Spinner de carga ────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--black);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root {
    --container-pad: 32px;
  }
}

@media (max-width: 768px) {
  :root {
    --container-pad: 20px;
    --nav-height: 60px;
  }
}

@media (max-width: 480px) {
  :root {
    --container-pad: 16px;
    --nav-height: 58px;
  }
}

/* ── Reglas globales anti-desborde para móvil y PWA ──────────── */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100%;
}

@supports (padding: env(safe-area-inset-bottom)) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (max-width: 640px) {
  .btn-lg {
    padding: 12px 20px;
    font-size: 13px;
    letter-spacing: 0.04em;
  }
  .form-control {
    font-size: 14px;
  }
}
