/* Variables y Reset (Coinciden con Admin) */
:root {
  --bg-body: #f0f2f5;
  --bg-card: #ffffff;
  --text-main: #1a1a1a;
  --text-muted: #65676b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --border: #334155;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  -webkit-font-smoothing: antialiased;
}

/* Contenedor Central (Card Principal) */
.container {
  width: 100%;
  max-width: 480px;
  background-color: var(--bg-card);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  text-align: center;
  animation: slideUp 0.4s ease-out;
}

.container {
  position: relative;
}

.container > * {
  position: relative;
  z-index: 1;
}

/* Full-viewport bubble background */
.bubbles-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  transform: translateY(0);
  filter: blur(10px);
  mix-blend-mode: screen;
  animation: rise var(--d, 14s) linear infinite, drift var(--d, 14s) ease-in-out infinite;
  will-change: transform, left, opacity;
}

@keyframes rise {
  0% { transform: translateY(0) scale(0.8); opacity: 0; }
  8% { opacity: 0.85; }
  100% { transform: translateY(-140%) scale(1); opacity: 0; }
}

@keyframes drift {
  0% { left: var(--left); }
  50% { left: calc(var(--left) + 6%); }
  100% { left: var(--left); }
}

@media (prefers-reduced-motion: reduce) {
  .bubble { animation: none; }
}

/* Tipografía */
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

p {
  margin-bottom: 1.5rem;
}

.muted {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Formularios e Inputs */
input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--bg-body);
  color: var(--text-main);
  font-size: 1rem;
  transition: all 0.2s;
  margin-bottom: 0; /* Controlado por contenedores */
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background-color: var(--bg-card);
}

/* Botones */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-size: 1rem;
  background-color: var(--primary);
  color: white;
  width: 100%;
}

button:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Utilidades de Layout */
.row {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.row > input {
  flex: 1;
}

.row > button {
  width: auto; /* En row, el botón se ajusta */
  flex-shrink: 0;
}

.spaced {
  margin-top: 1.5rem;
}

.card {
  /* Para compatibilidad si se usa dentro del container, 
     aunque el container ya es una card en este layout */
  background: transparent;
  padding: 0;
  box-shadow: none;
  border: none;
}

/* Footer */
footer {
  margin-top: 2rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

footer a:hover {
  text-decoration: underline;
}

/* Mensajes de Error/Estado */
#errorMessage, #msg {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  animation: fadeIn 0.3s;
}

#errorMessage {
  color: var(--danger);
  background-color: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

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

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

/* Responsive */
@media (max-width: 480px) {
  .container {
    padding: 1.5rem;
    border: none;
    box-shadow: none;
    background-color: transparent;
  }
  
  .row {
    flex-direction: column;
  }
  
  .row > button {
    width: 100%;
  }
}