/* =============================================================================
   ESD LAB - página records (templates/records.html): selector de modo,
   formulario de subida (raw/processed), checkboxes de datatype, vista
   previa, crear proyecto. Movido tal cual desde static/styles.css
   (A7.6), sin cambiar ningún valor ni selector. El andamiaje de página
   y los campos de formulario genéricos (.records-container/-header/
   -section/-form-group/-label/-control/-help, .records-checkbox-group)
   NO están acá: son compartidos por calendar.html/project_detail.html/
   users.html, viven en static/css/components/index.css (encontrado
   con el chequeo inverso que A7.5 dejó como lección).
   ============================================================================= */

/* Selector de modo */
.records-mode-selector {
  margin-bottom: 2rem;
}

/* .records-mode-buttons/-btn/-btn-active: movidas a components/index.css
   (compartidas con calendar.html, selector de tipo de reserva). */

/* .records-section: movida a components/index.css en A7.6 (compartida
   con project_detail.html). */

.records-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

/* Formulario */
.records-form-wrapper {
  min-width: 0;
}

.records-feedback {
  margin-bottom: 1.5rem;
}

.records-upload-progress {
  margin-bottom: 1.5rem;
}

.records-upload-progress .progress {
  height: 0.75rem;
}

.records-form {
  background: var(--esd-surface-dark-2);
  border: 1px solid var(--esd-border-dark);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

/* .records-form-group/-label/-control/-help: movidas a
   components/index.css en A7.6 (compartidas con project_detail.html/
   users.html). */

.records-file-input {
  cursor: pointer;
}

.records-file-input:hover {
  border-color: var(--esd-orange);
}

/* Un grupo por tipo de dato tildado cuando hay 2+ (file-inputs.js) */
.records-file-input-group + .records-file-input-group {
  margin-top: 1rem;
}

.records-form-sublabel {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--esd-text-medium);
  margin-bottom: 0.35rem;
}

/* Lista de archivos elegidos por input, con botón "quitar" por archivo —
   para sacar un archivo puntual sin rehacer toda la selección. */
.records-file-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 12rem;
  overflow-y: auto;
}

.records-file-list:empty {
  display: none;
}

.records-file-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--esd-border-dark);
  border-radius: 8px;
  background: var(--esd-surface-dark-2);
  font-size: 0.85rem;
}

.records-file-list-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--esd-text-dark);
}

.records-file-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--esd-text-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.records-file-remove .material-symbols-rounded {
  font-size: 1rem;
}

.records-file-remove:hover,
.records-file-remove:focus-visible {
  background: rgba(220, 38, 38, 0.12);
  color: var(--esd-danger);
  outline: none;
}

/* Checkboxes mejorados (.records-checkbox-group: movida a
   components/index.css en A7.6, compartida con calendar.html) */
.records-checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Filas de checkbox: toda la fila es táctil (vivía suelta en FASE 2 del
   styles.css viejo, "Touch targets, formularios, modales... y
   tipografía móvil" — encontrada con un barrido sin anclar el grep,
   misma lección de A7.5/A7.6). */
@media (max-width: 767.98px) {
  .records-checkbox-item {
    min-height: var(--tap-min);
  }
}

.records-checkbox-input {
  width: 24px;
  height: 24px;
  cursor: pointer;
  border: 2px solid var(--esd-border-dark);
  border-radius: 6px;
  transition: all var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  position: relative;
  background: var(--esd-surface-dark-2);
  margin: 0;
  flex-shrink: 0;
}

.records-checkbox-input:checked {
  background-color: var(--esd-orange);
  border-color: var(--esd-orange);
  box-shadow: 0 0 0 2px rgba(61, 107, 150, 0.2);
}

.records-checkbox-input:checked::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  border-radius: 1px;
}

.records-checkbox-input:focus {
  box-shadow: 0 0 0 3px rgba(61, 107, 150, 0.15);
  outline: none;
}

.records-checkbox-input:hover {
  border-color: var(--esd-orange);
}

.records-checkbox-label {
  color: var(--esd-text-dark);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

/* Campos RAW */
.records-raw-fields {
  padding: 1.25rem;
  background: rgba(61, 107, 150, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(61, 107, 150, 0.15);
  margin-bottom: 1.5rem;
}

/* Botón de envío */
.records-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  font-weight: 700;
  border-radius: 12px;
  transition: all var(--transition-normal);
  width: 100%;
  justify-content: center;
}

.records-submit-btn .material-symbols-rounded {
  font-size: 20px;
}

/* Vista previa */
.records-preview-wrapper {
  position: sticky;
  top: 2rem;
  height: fit-content;
}

.records-preview-card {
  background: var(--esd-surface-dark-2);
  border: 1px solid var(--esd-border-dark);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.records-preview-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--esd-border-dark);
}

.records-preview-header .material-symbols-rounded {
  font-size: 28px;
  color: var(--esd-orange);
}

.records-preview-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--esd-text-dark);
  margin: 0;
}

.records-preview-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.records-preview-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.records-preview-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--esd-text-medium);
}

.records-preview-label .material-symbols-rounded {
  font-size: 18px;
  color: var(--esd-orange);
}

.records-preview-value {
  font-size: 1rem;
  color: var(--esd-text-dark);
  font-weight: 500;
  word-break: break-word;
  padding-left: 1.75rem;
}

.records-preview-badge {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  background: linear-gradient(135deg, var(--esd-orange) 0%, var(--esd-orange-light) 100%);
  color: white;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-left: 1.75rem;
}

/* Crear proyecto */
.records-create-project {
  background: var(--esd-surface-dark-2);
  border: 1px solid var(--esd-border-dark);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  max-width: 800px;
  margin: 0 auto;
}

.records-create-project-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--esd-border-dark);
}

.records-create-project-header .material-symbols-rounded {
  font-size: 28px;
  color: var(--esd-orange);
}

.records-create-project-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--esd-text-dark);
  margin: 0;
}

.records-create-project-form {
  margin-top: 1.5rem;
}

.records-create-project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.records-datatypes-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
}

.records-datatypes-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--esd-border-dark);
  color: var(--esd-text-dark);
}

.records-form-group-full {
  grid-column: 1 / -1;
}

/* Responsive */
@media (max-width: 991.98px) {
  .records-upload-grid {
    grid-template-columns: 1fr;
  }

  .records-preview-wrapper {
    position: static;
  }
}

@media (max-width: 767.98px) {
  .records-form {
    padding: 1.5rem;
  }

  .records-preview-card {
    padding: 1.5rem;
  }

  .records-create-project-grid {
    grid-template-columns: 1fr;
  }
}

/* .records-mode-buttons/-btn en móvil (≤575.98px): movida a
   components/index.css junto al resto de estas clases. */

/* =============================================================================
   FASE 4 (parte de records) - Records en móvil
   (la parte de "Projects" de la FASE 4 vieja, .projects-card-title
   a::after, sigue en styles.css: le toca a su propia sub-iteración)
   ============================================================================= */
/* Resumen en vivo sobre el botón Subir (reemplaza el card de preview en móvil) */
.records-mobile-summary {
  display: none;
}

@media (max-width: 991.98px) {
  /* El card de preview no aporta en móvil (queda bajo el submit): ocultar */
  .records-preview-wrapper {
    display: none;
  }

  .records-mobile-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--esd-border-dark);
    border-radius: 12px;
    font-size: 0.9rem;
    color: var(--esd-text-medium);
  }

  .records-mobile-summary-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
  }

  .records-mobile-summary-item .material-symbols-rounded {
    font-size: 18px;
    color: var(--esd-orange);
  }

  .records-mobile-summary-item > span:last-child {
    font-weight: 600;
    color: var(--esd-text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Checkboxes como chips toggle: movida a components/index.css (compartida
   con calendar.html), ya sin el gate de solo-móvil. */
@media (max-width: 767.98px) {
  /* Input de archivos con aspecto de drop-zone */
  .records-file-input {
    padding: 1.25rem 1rem;
    border-style: dashed;
    text-align: center;
  }

  .records-file-input::file-selector-button {
    margin-right: 0.75rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    background: var(--esd-orange);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
  }

  .records-file-remove {
    width: var(--tap-min);
    height: var(--tap-min);
  }
}
