/**
 * v2-base.css — Reset, body, tipografía, inputs, animaciones, estados de carga
 * Usa solo tokens de v2-tokens.css.
 */

/* === Reset mínimo === */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--v2-font-family);
  font-size: var(--v2-font-size-base);
  line-height: var(--v2-line-height);
  color: var(--v2-text);
  background: var(--v2-bg-subtle);
  min-height: 100vh;
  padding: 0;
}

a {
  color: var(--v2-primary);
  text-decoration: none;
  transition: color var(--v2-transition-fast);
}
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: var(--v2-space-2);
  font-weight: 600;
}

p {
  margin-top: 0;
  margin-bottom: var(--v2-space-4);
}

/* === Inputs base === */
input,
select,
textarea {
  font-family: inherit;
  font-size: var(--v2-font-size-base);
  line-height: var(--v2-line-height);
  color: var(--v2-text);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-md);
  padding: var(--v2-space-2) var(--v2-space-3);
  transition: border-color var(--v2-transition-fast), box-shadow var(--v2-transition-fast);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--v2-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.18);
}

input[readonly] {
  background-color: var(--v2-bg-subtle);
  color: var(--v2-text-muted);
  cursor: not-allowed;
}

select[disabled],
textarea[readonly] {
  background: var(--v2-bg-lighter);
  color: var(--v2-text-muted);
  cursor: not-allowed;
}

/* === Accesibilidad: focus visible === */
:focus-visible {
  outline: 2px solid var(--v2-primary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* Transiciones suaves para elementos interactivos */
a, button, input, select, textarea {
  transition: all var(--v2-transition-fast);
}

/* === Animaciones === */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* === Spinners / Carga === */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(102, 126, 234, 0.3);
  border-radius: 50%;
  border-top-color: var(--v2-primary);
  animation: spin 0.6s linear infinite;
}
.spinner-large { width: 40px; height: 40px; border-width: 4px; }
.spinner-small { width: 16px; height: 16px; border-width: 2px; }

.loading {
  text-align: center;
  padding: 40px;
  color: var(--v2-primary);
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.loading-overlay .spinner { width: 50px; height: 50px; border-width: 5px; }

.loading-button {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}
.loading-button::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 20px; height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* === Scrollbar personalizado === */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--v2-bg-subtle); border-radius: var(--v2-radius-sm); }
::-webkit-scrollbar-thumb { background: var(--v2-primary); border-radius: var(--v2-radius-sm); }
::-webkit-scrollbar-thumb:hover { background: var(--v2-primary-hover); }

/* === Validación de formularios === */
input.error,
textarea.error,
select.error {
  border-color: var(--v2-danger) !important;
  background-color: #fef2f2;
}
input.valido,
textarea.valido,
select.valido {
  border-color: var(--v2-success) !important;
  background-color: #f0fdf4;
}
.error-mensaje {
  color: var(--v2-danger);
  font-size: var(--v2-font-size-xs);
  margin-top: var(--v2-space-1);
  display: block;
}
.required-indicator {
  color: var(--v2-danger);
  margin-left: var(--v2-space-1);
  font-weight: 700;
}

/* === Utilidades base === */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--v2-text-muted);
}
.empty-state-icon { font-size: 4em; margin-bottom: 20px; }

/* === Responsive base === */
@media (max-width: 768px) {
  body { padding: 10px; }
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  textarea,
  select { font-size: 16px; width: 100%; }
}
@media (max-width: 480px) {
  body { padding: 5px; }
}
