/* =========================================================
   DRIVE DEVBLK · GLOBAL
   Dark · Futurista · Cyberpunk
   ========================================================= */

:root {
  --app-bg: #05070a;
  --app-bg-soft: #080b10;

  --surface: #0b0f15;
  --surface-soft: #10151d;
  --surface-hover: #141b24;
  --surface-strong: #171f29;

  --text: #f2f6fa;
  --text-muted: #9aa6b4;
  --text-soft: #667382;
  --text-inverse: #001014;

  --line: #202832;
  --line-soft: #171d25;
  --line-strong: #303b48;
  --line-focus: #00e5ff;

  --accent: #00e5ff;
  --accent-hover: #37edff;
  --accent-active: #00bbd4;
  --accent-soft: rgba(0, 229, 255, 0.08);
  --accent-border: rgba(0, 229, 255, 0.34);

  --success: #43f5a5;
  --success-hover: #69f7b8;
  --success-soft: rgba(67, 245, 165, 0.08);
  --success-border: rgba(67, 245, 165, 0.34);

  --danger: #ff5263;
  --danger-hover: #ff7381;
  --danger-soft: rgba(255, 82, 99, 0.08);
  --danger-border: rgba(255, 82, 99, 0.35);

  --warning: #ffc857;
  --warning-hover: #ffd575;
  --warning-soft: rgba(255, 200, 87, 0.09);
  --warning-border: rgba(255, 200, 87, 0.34);

  --sidebar-width: 272px;
  --topbar-height: 82px;
  --content-max-width: 1800px;

  --sidebar-bg: #070a0f;
  --sidebar-surface: #0c1118;
  --sidebar-surface-hover: #111821;
  --sidebar-surface-active: rgba(0, 229, 255, 0.075);
  --sidebar-line: #1c242e;
  --sidebar-line-strong: #2a3541;
  --sidebar-text: #edf5fa;
  --sidebar-text-muted: #7f8c9b;

  --radius-xs: 6px;
  --radius-sm: 9px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  --transition:
    170ms
    cubic-bezier(
      0.22,
      1,
      0.36,
      1
    );

  --transition-slow:
    300ms
    cubic-bezier(
      0.22,
      1,
      0.36,
      1
    );
}

html {
  min-height: 100%;

  background: var(--app-bg);
}

body {
  min-height: 100vh;

  color: var(--text);

  background:
    radial-gradient(
      circle at 15% 0%,
      rgba(0, 229, 255, 0.035),
      transparent 26%
    ),
    linear-gradient(
      150deg,
      #05070a,
      #070a0e 52%,
      #040609
    );
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;

  content: "";
  pointer-events: none;

  opacity: 0.28;

  background-image:
    linear-gradient(
      rgba(255, 255, 255, 0.018) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.018) 1px,
      transparent 1px
    );

  background-size: 44px 44px;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -1;

  content: "";
  pointer-events: none;

  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 4px,
      rgba(255, 255, 255, 0.009) 5px
    );
}

body.modal-open,
body.sidebar-open {
  overflow: hidden;
}

#app {
  width: 100%;
  min-height: 100vh;
}

button,
input,
textarea,
select {
  color: var(--text);
}

button {
  border: 0;

  background: transparent;
}

input,
textarea,
select {
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-soft);
}

select {
  cursor: pointer;
}

a,
button,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline:
    2px solid
    rgba(0, 229, 255, 0.6);
  outline-offset: 2px;
}

/* =========================================================
   SCROLLBARS
   ========================================================= */

* {
  scrollbar-width: thin;
  scrollbar-color:
    var(--line-strong)
    transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: var(--radius-pill);

  background: var(--line-strong);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
  background-clip: padding-box;
}

/* =========================================================
   BOTONES
   ========================================================= */

.button {
  position: relative;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;

  min-height: 44px;
  padding: 0 17px;

  overflow: hidden;

  border: 1px solid transparent;
  border-radius: var(--radius-sm);

  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;

  transition:
    color var(--transition),
    border-color var(--transition),
    background-color var(--transition),
    opacity var(--transition),
    transform var(--transition);
}

.button::after {
  position: absolute;
  bottom: 0;
  left: 0;

  width: 0;
  height: 1px;

  content: "";

  background: currentColor;

  transition:
    width var(--transition-slow);
}

.button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.button:hover:not(:disabled)::after {
  width: 100%;
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.46;
}

.button svg {
  width: 17px;
  height: 17px;

  stroke-width: 1.9;
}

.button__scanline {
  position: absolute;
  top: 0;
  left: -110%;

  width: 80%;
  height: 100%;

  transform: skewX(-24deg);

  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(255, 255, 255, 0.28),
      transparent
    );

  transition:
    left 520ms ease;
}

.button:hover .button__scanline {
  left: 135%;
}

.button--primary {
  border-color: var(--accent);

  color: var(--text-inverse);

  background: var(--accent);
}

.button--primary:hover:not(:disabled) {
  color: var(--accent);

  background: #071217;
}

.button--secondary {
  border-color: var(--line-strong);

  color: var(--text);

  background: var(--surface);
}

.button--secondary:hover:not(:disabled) {
  border-color: var(--accent-border);

  color: var(--accent);

  background: var(--accent-soft);
}

.button--ghost {
  border-color: transparent;

  color: var(--text-muted);

  background: transparent;
}

.button--ghost:hover:not(:disabled) {
  border-color: var(--line);

  color: var(--text);

  background: var(--surface-soft);
}

.button--danger {
  border-color: var(--danger-border);

  color: var(--danger);

  background: var(--danger-soft);
}

.button--danger:hover:not(:disabled) {
  border-color: var(--danger);

  color: #ffffff;

  background: var(--danger);
}

.button--success {
  border-color: var(--success-border);

  color: var(--success);

  background: var(--success-soft);
}

.button--success:hover:not(:disabled) {
  border-color: var(--success);

  color: #00140d;

  background: var(--success);
}

/* =========================================================
   BOTONES DE ICONO
   ========================================================= */

.icon-button {
  position: relative;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;

  overflow: hidden;

  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);

  color: var(--text-muted);

  background:
    linear-gradient(
      145deg,
      var(--surface-soft),
      var(--surface)
    );

  transition:
    color var(--transition),
    border-color var(--transition),
    background-color var(--transition),
    opacity var(--transition),
    transform var(--transition);
}

.icon-button::after {
  position: absolute;
  inset: auto 0 0;

  height: 1px;

  content: "";

  transform: scaleX(0);

  background: var(--accent);

  transition:
    transform var(--transition);
}

.icon-button:hover:not(:disabled) {
  border-color: var(--accent-border);

  color: var(--accent);

  background: var(--accent-soft);

  transform: translateY(-1px);
}

.icon-button:hover:not(:disabled)::after {
  transform: scaleX(1);
}

.icon-button:disabled {
  opacity: 0.4;
}

.icon-button svg {
  width: 18px;
  height: 18px;

  stroke-width: 1.8;
}

/* =========================================================
   FORMULARIOS
   ========================================================= */

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;

  min-width: 0;
}

.form-field > label {
  color: var(--text);

  font-size: 11px;
  font-weight: 700;
}

.form-control {
  position: relative;

  display: flex;
  align-items: center;
  gap: 10px;

  width: 100%;
  min-height: 48px;
  padding: 0 14px;

  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);

  background: var(--surface);

  transition:
    border-color var(--transition),
    background-color var(--transition);
}

.form-control:hover {
  border-color: #45515f;
}

.form-control:focus-within {
  border-color: var(--accent-border);

  background: #0a1118;
}

.form-control > svg {
  width: 18px;
  min-width: 18px;
  height: 18px;

  color: var(--text-soft);
}

.form-control:focus-within > svg {
  color: var(--accent);
}

.form-control input,
.form-control textarea {
  width: 100%;
  min-width: 0;
  padding: 0;

  border: 0;
  outline: 0;

  color: var(--text);

  background: transparent;
}

.form-control input {
  height: 46px;
}

.form-control textarea {
  min-height: 110px;
  padding: 13px 0;
}

.form-select,
select.form-select {
  width: 100%;
  min-height: 46px;
  padding: 0 38px 0 13px;

  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);

  color: var(--text);

  background: var(--surface);
}

.form-select:hover,
select.form-select:hover {
  border-color: #45515f;
}

.form-select:focus,
select.form-select:focus {
  border-color: var(--accent-border);
}

.form-error {
  min-height: 15px;

  color: var(--danger);

  font-size: 10px;
  line-height: 1.35;
}

.form-help {
  color: var(--text-muted);

  font-size: 10px;
  line-height: 1.45;
}

/* =========================================================
   TARJETAS Y PANELES
   ========================================================= */

.card {
  position: relative;

  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);

  background:
    linear-gradient(
      145deg,
      rgba(16, 21, 29, 0.96),
      rgba(8, 11, 16, 0.98)
    );
}

.card::before {
  position: absolute;
  top: -1px;
  left: 18px;

  width: 46px;
  height: 1px;

  content: "";

  background: var(--accent);
}

.card__header {
  padding: 17px 18px;

  border-bottom: 1px solid var(--line);
}

.card__body {
  padding: 18px;
}

.card__footer {
  padding: 15px 18px;

  border-top: 1px solid var(--line);

  background: rgba(255, 255, 255, 0.012);
}

.panel {
  position: relative;

  min-width: 0;

  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);

  overflow: hidden;

  background:
    linear-gradient(
      145deg,
      rgba(15, 20, 27, 0.97),
      rgba(7, 10, 14, 0.99)
    );
}

/* =========================================================
   BADGES
   ========================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  min-height: 27px;
  padding: 0 9px;

  border: 1px solid var(--line);
  border-radius: var(--radius-xs);

  color: var(--text-muted);

  font-family:
    "SFMono-Regular",
    Consolas,
    monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;

  background: var(--surface-soft);
}

.badge--success {
  border-color: var(--success-border);

  color: var(--success);

  background: var(--success-soft);
}

.badge--danger {
  border-color: var(--danger-border);

  color: var(--danger);

  background: var(--danger-soft);
}

.badge--warning {
  border-color: var(--warning-border);

  color: var(--warning);

  background: var(--warning-soft);
}

/* =========================================================
   ESTADOS VACÍOS
   ========================================================= */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  min-height: 380px;
  padding: 32px;

  text-align: center;
}

.empty-state__icon {
  position: relative;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 68px;
  height: 68px;
  margin-bottom: 18px;

  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);

  color: var(--accent);

  background: var(--accent-soft);
}

.empty-state__icon::after {
  position: absolute;
  right: -4px;
  bottom: -4px;

  width: 10px;
  height: 10px;

  border: 2px solid var(--app-bg);
  border-radius: 50%;

  content: "";

  background: var(--accent);
}

.empty-state__icon svg {
  width: 30px;
  height: 30px;
}

.empty-state h2,
.empty-state h3 {
  color: var(--text);

  font-size: 22px;
  letter-spacing: -0.03em;
}

.empty-state p {
  max-width: 440px;
  margin-top: 8px;

  color: var(--text-muted);

  line-height: 1.6;
}

/* =========================================================
   TOAST
   ========================================================= */

.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 5000;

  display: flex;
  flex-direction: column;
  gap: 10px;

  width: min(390px, calc(100vw - 36px));

  pointer-events: none;
}

.toast {
  position: relative;

  display: grid;
  grid-template-columns:
    auto
    auto
    minmax(0, 1fr)
    auto;
  align-items: center;
  gap: 11px;

  min-height: 76px;
  padding: 13px 13px 13px 10px;

  overflow: hidden;

  border: 1px solid var(--line-strong);
  border-radius: 12px;

  opacity: 0;

  background:
    linear-gradient(
      145deg,
      rgba(15, 20, 27, 0.98),
      rgba(7, 10, 14, 0.99)
    );

  pointer-events: auto;

  transform:
    translateX(34px)
    scale(0.97);

  transition:
    opacity 240ms ease,
    transform 240ms ease,
    border-color 180ms ease;
}

.toast--visible {
  opacity: 1;

  transform:
    translateX(0)
    scale(1);
}

.toast--leaving {
  opacity: 0;

  transform:
    translateX(36px)
    scale(0.96);
}

.toast:hover {
  border-color: #46525f;
}

.toast__progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;

  height: 2px;

  transform-origin: left;

  background: currentColor;

  animation:
    toast-progress
    4.6s
    linear
    forwards;
}

.toast--paused .toast__progress {
  animation-play-state: paused;
}

.toast__indicator {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 8px;
}

.toast__indicator span {
  width: 6px;
  height: 6px;

  border-radius: 50%;

  background: currentColor;

  animation:
    toast-indicator
    1.8s
    ease-in-out
    infinite;
}

.toast__icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 38px;
  min-width: 38px;
  height: 38px;

  border: 1px solid currentColor;
  border-radius: 9px;

  background: rgba(255, 255, 255, 0.02);
}

.toast__icon {
  width: 18px;
  height: 18px;

  stroke-width: 1.8;
}

.toast__content {
  display: flex;
  flex-direction: column;
  gap: 3px;

  min-width: 0;
}

.toast__content strong {
  color: var(--text);

  font-size: 11px;
  font-weight: 750;
}

.toast__message {
  overflow: hidden;

  color: var(--text-muted);

  font-size: 10px;
  line-height: 1.45;
  text-overflow: ellipsis;
}

.toast__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;

  border: 1px solid transparent;
  border-radius: 7px;

  color: var(--text-soft);

  transition:
    color var(--transition),
    border-color var(--transition),
    background-color var(--transition);
}

.toast__close:hover {
  border-color: var(--line);

  color: var(--text);

  background: var(--surface-hover);
}

.toast__close svg {
  width: 15px;
  height: 15px;
}

.toast--success {
  color: var(--success);

  border-color: var(--success-border);
}

.toast--error {
  color: var(--danger);

  border-color: var(--danger-border);
}

.toast--warning {
  color: var(--warning);

  border-color: var(--warning-border);
}

.toast--info {
  color: var(--accent);

  border-color: var(--accent-border);
}

/* =========================================================
   ERROR FATAL
   ========================================================= */

.fatal-error {
  display: grid;
  place-items: center;

  min-height: 100vh;
  padding: 24px;

  background: var(--app-bg);
}

.fatal-error__card {
  position: relative;

  display: flex;
  flex-direction: column;
  align-items: center;

  width: min(520px, 100%);
  padding: 34px;

  border: 1px solid var(--danger-border);
  border-radius: var(--radius-xl);

  text-align: center;

  background:
    linear-gradient(
      145deg,
      var(--surface-soft),
      var(--surface)
    );
}

.fatal-error__card > svg {
  width: 42px;
  height: 42px;

  color: var(--danger);
}

.fatal-error__card h1 {
  margin-top: 18px;

  font-size: 26px;
  letter-spacing: -0.04em;
}

.fatal-error__card p {
  margin: 10px 0 24px;

  color: var(--text-muted);

  line-height: 1.6;
}

/* =========================================================
   ANIMACIONES
   ========================================================= */

@keyframes toast-progress {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

@keyframes toast-indicator {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.35;
    transform: scale(0.65);
  }
}