/* ==========================================================================
   VCHECK - Formulario de Inspección Vehicular
   ========================================================================== */

/* Variables de Color de Vcheck */
:root {
  --primary-color: #003366;      /* Azul oscuro de Vcheck */
  --secondary-color: #FF7B00;     /* Naranja vibrante de Vcheck */
  --success-color: #4caf50;
  --warning-color: #ff9800;
  --error-color: #e53935;
  --info-color: #2196f3;
  --bg-body: #f8f9fa;
  --bg-card: #ffffff;
  --text-main: #333333;
  --text-muted: #666666;
  --border-color: #e0e0e0;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset General */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Estilos Base */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 120px;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 30px;
  padding-top: 10px;
}

h1 {
  font-size: 1.8rem;
  color: var(--primary-color);
  margin-bottom: 15px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* Barra de Progreso */
.progress-bar {
  background-color: #e2e8f0;
  border-radius: 100px;
  height: 12px;
  margin: 25px 0;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress {
  background: linear-gradient(90deg, var(--primary-color));
  height: 100%;
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 51, 102, 0.3);
}

.progress-text {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 10px;
}

/* Tarjetas de Sección */
.form-section {
  display: none;
  background: var(--bg-card);
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 
              0 2px 4px -1px rgba(0, 0, 0, 0.06);
  margin-bottom: 100px;
  position: relative;
}

.form-section.active {
  display: block;
  animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
  from { 
    opacity: 0; 
    transform: translateY(20px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Títulos de Sección */
h2 {
  font-size: 1.5rem;
  margin-bottom: 25px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-main);
  padding-bottom: 12px;
  border-bottom: 2px solid #e2e8f0;
  font-weight: 700;
}

h2::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 28px;
  background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
  border-radius: 3px;
}

/* Subtítulos para Grupos */
.form-subtitle {
  font-size: 1.1rem;
  color: #4a5568;
  margin: 25px 0 15px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Tarjetas para Grupos de Campos */
.field-card {
  background: #f8fafc;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid #edf2f7;
  transition: var(--transition);
}

.field-card:hover {
  border-color: #cbd5e0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Grupos de Formulario */
.form-group {
  margin-bottom: 24px;
  position: relative;
}

/* Labels */
label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Campo Requerido */
label::after {
  content: '*';
  color: var(--error-color);
  margin-left: 4px;
  font-size: 1.1em;
  line-height: 1;
}

/* Labels Opcionales */
label.optional::after {
  content: '(opcional)';
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-left: 6px;
}

/* Inputs, Selects y Textareas */
input, select, textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  font-size: 16px;
  color: var(--text-main);
  background-color: #fff;
  transition: var(--transition);
  appearance: none;
}

/* Hover State */
input:hover, select:hover, textarea:hover {
  border-color: #a0aec0;
}

/* Focus State */
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(0, 51, 102, 0.15);
}

/* Validación Visual */
input:valid:not(:placeholder-shown),
select:valid:not([value=""]),
textarea:valid:not(:placeholder-shown) {
  border-color: var(--success-color);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

input:invalid:not(:placeholder-shown):not(:focus),
select:invalid:not([value=""]):not(:focus),
textarea:invalid:not(:placeholder-shown):not(:focus) {
  border-color: var(--error-color);
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.1);
}

/* Textarea */
textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

/* Mensajes de Ayuda */
.help-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
  display: block;
  font-style: italic;
}

.error-message {
  font-size: 0.85rem;
  color: var(--error-color);
  margin-top: 6px;
  display: none;
}

/* Filas de Formulario */
.form-row {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 200px;
}

/* Estilo para los Selects */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234a5568'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 18px;
  cursor: pointer;
}

/* Colores por Valor de Select */
select option[value="Bueno"],
select option[value="Presente"],
select option[value="Funciona"],
select option[value="Sin Fallas"],
select option[value="Sin daños"] {
  color: var(--success-color);
}

select option[value="Regular"],
select option[value="Deficiente"],
select option[value="Falla Media"],
select option[value="Daño leve"] {
  color: var(--warning-color);
}

select option[value="Malo"],
select option[value="No Presente"],
select option[value="No Funciona"],
select option[value="Falla Grave"],
select option[value="Daño moderado"],
select option[value="Daño grave"] {
  color: var(--error-color);
}

/* Navegación Fija */
.navigation-buttons {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  border-top: 1px solid #e2e8f0;
}

/* Botones */
button {
  flex: 1;
  padding: 16px 20px;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

#prev-btn {
  background-color: #edf2f7;
  color: var(--text-main);
}

#prev-btn:hover:not(:disabled) {
  background-color: #e2e8f0;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

#next-btn, #submit-btn {
  background: linear-gradient(135deg, var(--primary-color));
  color: white;
  box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
}

#next-btn:hover:not(:disabled),
#submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 51, 102, 0.4);
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
  margin-left: 6px;
}

.tooltip::before {
  content: 'ⓘ';
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: bold;
}

.tooltip .tooltip-text {
  visibility: hidden;
  width: 250px;
  background-color: var(--text-main);
  color: #fff;
  text-align: left;
  border-radius: 8px;
  padding: 10px;
  position: absolute;
  z-index: 1001;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.tooltip .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--text-main) transparent transparent transparent;
}

/* Indicador de Carga */
.loading::after {
  content: '↻';
  animation: spin 1s linear infinite;
  margin-left: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 600px) {
  .container {
    padding: 15px;
  }
  
  h1 {
    font-size: 1.5rem;
    margin-bottom: 10px;
  }
  
  h2 {
    font-size: 1.3rem;
  }
  
  .form-section {
    padding: 20px;
    border-radius: 15px;
  }
  
  input, select, textarea {
    padding: 12px 14px;
    font-size: 15px;
  }
  
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  
  .form-row .form-group {
    min-width: 100%;
  }
  
  button {
    padding: 14px;
    font-size: 0.95rem;
  }
  
  .navigation-buttons {
    padding: 15px;
    gap: 10px;
  }
  
  .progress-bar {
    height: 10px;
    margin: 15px 0;
  }
  
  .field-card {
    padding: 15px;
  }
}

/* Estilos para la Vista Final de Resumen */
.summary-section {
  background: var(--bg-card);
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 
              0 2px 4px -1px rgba(0, 0, 0, 0.06);
  margin-bottom: 100px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #e2e8f0;
}

.summary-item:last-child {
  border-bottom: none;
}

.summary-label {
  font-weight: 600;
  color: var(--text-main);
}

.summary-value {
  color: var(--text-muted);
  text-align: right;
}

/* Badges para estados */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-good {
  background-color: rgba(76, 175, 80, 0.15);
  color: var(--success-color);
}

.badge-warning {
  background-color: rgba(255, 123, 0, 0.15);
  color: var(--warning-color);
}

.badge-error {
  background-color: rgba(229, 57, 53, 0.15);
  color: var(--error-color);
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  flex-direction: column;
  gap: 20px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #e2e8f0;
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-message {
  font-size: 1.1rem;
  color: var(--text-main);
  font-weight: 600;
}

/* Success Message */
.success-message {
  background: linear-gradient(135deg, var(--success-color), #2e7d32);
  color: white;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  margin: 20px 0;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.success-message h3 {
  margin-bottom: 10px;
  font-size: 1.3rem;
}

/* Highlight para campos importantes */
.highlight {
  background-color: rgba(0, 51, 102, 0.05);
  border-left: 4px solid var(--primary-color);
  padding-left: 15px;
}

/* Estado de Guardado */
.save-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  background: var(--success-color);
  color: white;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 3000;
}

.save-indicator.show {
  opacity: 1;
  transform: translateY(0);
}

/* Iconos Emoji en Títulos */
h2 .emoji {
  font-size: 1.4rem;
  margin-right: 8px;
}

/* Estilos para el logo de Vcheck */
.vcheck-logo {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
  text-align: center;
  justify-content: center;
}

.logo-img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  flex-shrink: 0;
}

.vcheck-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.vcheck-text h1 {
  font-size: 2.2rem;
  color: var(--primary-color);
  font-weight: 800;
  margin: 0;
}

.vcheck-text .subtitle {
  font-size: 1.5rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Para dispositivos móviles */
@media (max-width: 600px) {
  .vcheck-logo {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  
  .logo-img {
    width: 50px;
    height: 50px;
  }
  
  .vcheck-text {
    align-items: center;
    text-align: center;
  }
  
  .vcheck-text h1 {
    font-size: 1.8rem;
  }
  
  .vcheck-text .subtitle {
    font-size: 1rem;
  }
}

/* ==========================================================================
   Estilos para Fotos por Sección
   ========================================================================== */

/* Contenedor de fotos por sección */
.photos-section {
  margin-top: 30px;
  padding-top: 25px;
  border-top: 2px dashed #e2e8f0;
}

.photos-section h3 {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

/* Contenedor de carga múltiple */
.photos-upload-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

/* Item individual de foto */
.photo-item {
  position: relative;
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 15px;
  text-align: center;
  background-color: #f8fafc;
  transition: var(--transition);
  cursor: pointer;
  min-height: 150px;
  aspect-ratio: 1;
}

.photo-item:hover {
  border-color: var(--primary-color);
  background-color: rgba(74, 144, 226, 0.05);
  transform: translateY(-2px);
}

.photo-item input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}

/* Vista previa de foto */
.photo-preview {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
}

/* Icono de cámara */
.photo-icon {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 8px;
  transition: var(--transition);
}

.photo-item:hover .photo-icon {
  transform: scale(1.2);
  color: var(--secondary-color);
}

/* Texto de carga */
.photo-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0;
  transition: var(--transition);
}

.photo-item:hover .photo-text {
  color: var(--primary-color);
}

/* Imagen cargada */
.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.photo-preview.has-image img {
  display: block;
}

/* Overlay sobre imagen */
.photo-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 5;
}

.photo-item:hover .photo-overlay {
  opacity: 1;
}

/* Botón de eliminar */
.btn-remove-photo {
  background: rgba(229, 57, 53, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  transition: var(--transition);
}

.btn-remove-photo:hover {
  background: var(--error-color);
  transform: scale(1.1);
}

/* Badge de número */
.photo-badge {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-main);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 700;
}

/* Indicador de error */
.photo-error {
  color: var(--error-color);
  font-size: 0.8rem;
  margin-top: 8px;
  display: none;
}

/* Responsive */
@media (max-width: 600px) {
  .photos-upload-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .photo-item {
    min-height: 120px;
  }
  
  .photo-icon {
    font-size: 2rem;
  }
  
  .photo-text {
    font-size: 0.75rem;
  }
}