/* ============================================================
   BASE.CSS: VARIABLES, SISTEMA DE DISEÑO (ZINC / SLATE DARK)
   Samurott Enterprise SaaS Platform
   ============================================================ */

:root {
  /* Paleta Base Zinc / Slate */
  --bg-base: #09090b;
  --bg-surface: #121215;
  --bg-card: #18181b;
  --bg-card-hover: #202024;
  --bg-overlay: #1c1c21;
  --bg-surface-elevated: #222226;
  --bg-workspace: #09090b;

  /* Textos y Jerarquía */
  --text-main: #f4f4f5;
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-dark: #09090b;
  --text-dark-muted: #52525b;

  /* Acento Cohesivo: Azul Índigo / Cobalto Sobrio */
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.12);
  --primary-border: rgba(59, 130, 246, 0.35);

  --accent: #3b82f6;
  --accent-hover: #2563eb;

  /* Estados Funcionales */
  --success: #10b981;
  --success-hover: #059669;
  --success-subtle: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.3);

  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-subtle: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.3);

  --warning: #f59e0b;
  --warning-subtle: rgba(245, 158, 11, 0.12);

  /* Bordes Sutiles */
  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-light: rgba(255, 255, 255, 0.12);

  /* Tipografías */
  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-script: 'BiroScriptPlus', cursive;

  /* Sombras Difusas Elegantes */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.5), 0 4px 8px -4px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 40px -4px rgba(0, 0, 0, 0.65);
  --shadow-document: 0 20px 40px rgba(0, 0, 0, 0.6);
}

@font-face {
  font-family: 'BiroScriptPlus';
  src: url('../fonts/BiroScriptPlus.woff2') format('woff2'),
       url('../fonts/BiroScriptPlus.woff') format('woff'),
       url('../fonts/BiroScriptPlus.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'CaveatLocal';
  src: url('../fonts/BiroScriptPlus.woff2') format('woff2'),
       url('../fonts/BiroScriptPlus.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Caveat';
  src: url('../fonts/BiroScriptPlus.woff2') format('woff2'),
       url('../fonts/BiroScriptPlus.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

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

html {
  font-size: 14px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.main-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  background-color: var(--bg-base);
}

/* Scrollbars Sutiles Minimalistas */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ============================================================
   BOTONES DEL SISTEMA DE DISEÑO
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  font-family: inherit;
  line-height: 1.25;
  white-space: nowrap;
  user-select: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

/* Primario: Indigo / Cobalto Sobrio */
.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

/* Secundario: Superficie Slate Oscura */
.btn-secondary {
  background-color: var(--bg-overlay);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-hover);
  color: #ffffff;
}

/* Éxito Sobrio */
.btn-success {
  background-color: var(--success);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-success:hover:not(:disabled) {
  background-color: var(--success-hover);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

/* Peligro / Danger */
.btn-danger {
  background-color: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
}

/* Ghost / Outline */
.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-hover);
  color: var(--text-main);
}

.btn-outline-light {
  background: transparent;
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.btn-outline-light:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 0.78rem;
  border-radius: 6px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 0.95rem;
  border-radius: 10px;
}

.btn-arrow {
  display: inline-block;
  transition: transform 0.15s ease;
}

.btn:hover:not(:disabled) .btn-arrow {
  transform: translateX(2px);
}

/* Botones de Icono Cuadrados / Redondeados */
.icon-btn, .btn-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  line-height: 1;
}

.icon-btn:hover:not(:disabled), .btn-icon:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
  color: #ffffff;
  transform: scale(1.04);
}

.icon-btn:active, .btn-icon:active {
  transform: scale(0.96);
}

/* ============================================================
   BOTONES DE CERRAR (X) EN MODALES CON ALTO CONTRASTE
   ============================================================ */
.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #a1a1aa;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  line-height: 1;
  font-size: 1.1rem;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  transform: scale(1.05);
}

.modal-close-btn:active {
  transform: scale(0.95);
}

/* ============================================================
   MODALES GLASSMORPHISM DARK
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 0.18s ease-out forwards;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(24, 24, 27, 0.8);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.015em;
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.35;
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  background: rgba(24, 24, 27, 0.5);
}

/* ============================================================
   CONTROLES FORMULARIO: INPUTS, SELECTS, TEXTAREAS
   ============================================================ */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-main);
  background: #121215;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  outline: none;
  transition: all 0.15s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

select {
  cursor: pointer;
}

/* ============================================================
   SLIDERS REDISEÑADOS (TRACK FINO + THUMB MODERNO)
   ============================================================ */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  background: #27272a;
  border-radius: 9999px;
  outline: none;
  cursor: pointer;
  margin: 6px 0;
  transition: background 0.15s ease;
}

input[type="range"]:hover {
  background: #3f3f46;
}

/* Chrome / Safari / Edge Thumb */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

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

/* Firefox Thumb & Track */
input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.2);
  background: var(--primary-hover);
}

input[type="range"]::-moz-range-track {
  height: 5px;
  background: #27272a;
  border-radius: 9999px;
  border: none;
}

/* ============================================================
   CHECKBOXES ESTILIZADOS CON ACENTO
   ============================================================ */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: all 0.15s ease;
  vertical-align: middle;
  flex-shrink: 0;
}

input[type="checkbox"]:hover {
  border-color: rgba(255, 255, 255, 0.4);
}

input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

input[type="checkbox"]:checked::before {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg) translate(1px, -1px);
}

input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
}

/* ============================================================
   PATRÓN DE CUADRÍCULA DE TRANSPARENCIA PROFESIONAL
   Textura suave en grises sutiles (#1f1f23 y #27272a)
   ============================================================ */
.checkerboard-bg,
.transparency-grid {
  background-color: #1f1f23;
  background-image:
    linear-gradient(45deg, #27272a 25%, transparent 25%),
    linear-gradient(-45deg, #27272a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #27272a 75%),
    linear-gradient(-45deg, transparent 75%, #27272a 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
}

/* Badges y Pastillas */
.badge {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hidden-input,
.hidden {
  display: none !important;
}
