/* Estilos comunes para todas las páginas - Mobile First */
/* Basado en el look de index.css (form/input/button/msg/spinner) para que todas las páginas se vean igual. */

:root {
  /* Layout */
  --panel-max-width: 100%;
  --panel-max-width-desktop: 500px;
  --panel-padding: 1.25rem;
  --panel-padding-desktop: 1.5rem;
  --radius: 10px;
  --shadow: 0 2px 6px rgba(0,0,0,.1);

  /* Tipografías (uniformes en todas las páginas) */
  --h1: clamp(1.5rem, 5vw, 2rem);
  --h1-desktop: clamp(1.75rem, 4vw, 2rem);
  --h2: clamp(1.25rem, 4vw, 1.5rem);
  --h2-desktop: clamp(1.35rem, 3.5vw, 1.5rem);
  --text: clamp(0.95rem, 3.5vw, 1rem);
  --text-desktop: clamp(0.95rem, 2.5vw, 1rem);
  --msg: clamp(0.9rem, 3.5vw, 1rem); /* como #msg de index */
  --msg-desktop: clamp(0.95rem, 2.5vw, 1rem); /* como #msg en desktop */

  /* Form controls */
  --input-font: clamp(16px, 4vw, 18px); /* min 16px previene zoom iOS */
  --input-font-desktop: clamp(16px, 2.5vw, 18px);
  --button-font: clamp(1rem, 4vw, 1.1rem);
  --button-font-desktop: clamp(1rem, 2.5vw, 1.1rem);

  /* Theme (por defecto: rojo del index) */
  --primary: #c62828;
  --primary-hover: #b71c1c;
  --primary-active: #b71c1c;
  --focus-border: #c62828;
  --focus-ring: rgba(198, 40, 40, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: #f6f6f6;
  padding: 1rem;
  text-align: center;
  margin: 0;
  min-height: 100vh;
  font-size: clamp(14px, 4vw, 16px);
}

/* Panel común (container/form/dashboard/error) */
.container,
form#form,
.dashboard-container {
  max-width: var(--panel-max-width);
  margin: 0 auto;
  background: white;
  padding: var(--panel-padding);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* En index se anima la opacidad del form */
form#form {
  transition: opacity 0.8s ease;
}

/* Tipografías comunes */
h1 {
  font-size: var(--h1);
  margin: 1rem 0;
  color: #2e7d32;
}

h2 {
  color: #2e7d32;
  margin-bottom: 1rem;
  font-size: var(--h2);
}

p {
  color: #666;
  line-height: 1.6;
  font-size: var(--text);
}

/* Formularios */
form label {
  display: block;
  margin-bottom: 0.5rem;
  color: #333;
  font-weight: bold;
  font-size: var(--text);
}

input[type="number"],
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 14px;
  margin: 10px 0;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: var(--input-font);
  transition: background-color 0.3s ease, border-color 0.3s ease;
  -webkit-appearance: none;
  appearance: none;
}

input[type="number"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--focus-border);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

input:disabled,
select:disabled,
textarea:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
  opacity: 0.7;
}

button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease;
  position: relative;
  width: 100%;
  min-height: 48px; /* Tamaño táctil mínimo recomendado */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: var(--button-font);
  font-weight: 600;
  margin-top: 8px;
  -webkit-tap-highlight-color: transparent;
}

button:active:not(:disabled) {
  background: var(--primary-active);
  transform: scale(0.98);
}

button:disabled {
  background: #9e9e9e;
  cursor: not-allowed;
  opacity: 0.7;
}

#msg {
  margin-top: 12px;
  font-weight: bold;
  color: #d32f2f;
  font-size: var(--msg);
  min-height: 20px;
}

/* Mensajes de estado (start.html) */
.status {
  margin-top: 1rem;
  padding: 0.5rem;
  border-radius: 5px;
  font-weight: bold;
  font-size: var(--msg);
}

.status.success {
  background: #e8f5e9;
  color: #2e7d32;
}

.status.error {
  background: #ffebee;
  color: #c62828;
}

/* Spinner de carga (index.html) */
.spinner {
  border: 2px solid #ffffff;
  border-top: 2px solid transparent;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  animation: spin 0.8s linear infinite;
}

/* Spinner grande para QR */
.qr-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 256px;
}

.spinner-large {
  border: 4px solid #e0e0e0;
  border-top: 4px solid #2e7d32;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Media queries para pantallas más grandes (misma base para todas las páginas) */
@media (min-width: 768px) {
  body {
    padding: 2rem;
  }

  .container,
  form#form,
  .dashboard-container {
    max-width: var(--panel-max-width-desktop);
    padding: var(--panel-padding-desktop);
  }

  h1 {
    font-size: var(--h1-desktop);
    margin: 1.5rem 0;
  }

  h2 {
    font-size: var(--h2-desktop);
  }

  p {
    font-size: var(--text-desktop);
  }

  input[type="number"],
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="url"],
  input[type="search"],
  select,
  textarea {
    padding: 12px;
    font-size: var(--input-font-desktop);
  }

  button {
    /*width: auto;*/
    min-width: 140px;
    padding: 12px 24px;
    font-size: var(--button-font-desktop);
  }

  button:hover:not(:disabled) {
    background: var(--primary-hover);
  }

  #msg {
    font-size: var(--msg-desktop);
  }

  .status {
    font-size: var(--msg-desktop);
  }
}

