* {
  box-sizing: border-box;
}

body {
  margin: 0;
  margin-top: 60px;
  padding: 0;
  font-family: 'Inter', sans-serif;
  background-image: url('../assets/img/background.png');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  min-height: 100vh;
}

.logo-container {
  text-align: center;
  margin-bottom: 20px;
}

.logo-container img {
  max-width: 300px;
  height: auto;
}

.form-container {
  max-width: 1000px;
  margin: auto;
  background: #fff;
  padding: 3rem;
  border-radius: 2rem;
  box-shadow: 0 25px 50px rgba(0,0,0,0.15);
  position: relative;
  overflow: hidden;
}

.form-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #0078d4, #40e0d0, #ff6b6b, #ffd93d);
}

h1 {
  text-align: center;
  margin-bottom: 3rem;
  color: #2c3e50;
  font-size: 2.5rem;
  font-weight: 300;
  position: relative;
}

h1::after {
  content: '';
  display: block;
  width: 100px;
  height: 3px;
  background: linear-gradient(90deg, #0078d4, #40e0d0);
  margin: 1rem auto;
  border-radius: 2px;
}

fieldset {
  border: none;
  border-radius: 1.5rem;
  padding: 2rem;
  margin-bottom: 2rem;
  background: linear-gradient(145deg, #f8fafc, #e2e8f0);
  box-shadow: 0 8px 25px rgba(0,0,0,0.08);
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

fieldset:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(0,0,0,0.12);
}

legend {
  font-weight: 600;
  padding: 0.8rem 1.5rem;
  background: linear-gradient(135deg, #0078d4, #0056b3);
  color: white;
  border-radius: 2rem;
  font-size: 1.1rem;
  box-shadow: 0 4px 15px rgba(0,120,212,0.3);
  border: none;
}

h4 {
  color: #495057;
  font-weight: 600;
  margin: 2rem 0 1rem 0;
  font-size: 1.2rem;
  padding-left: 1rem;
  border-left: 4px solid #0078d4;
}

label {
  display: block;
  margin-top: 1.5rem;
  font-weight: 500;
  color: #495057;
  font-size: 1rem;
}

input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  padding: 1rem;
  margin-top: 0.5rem;
  border-radius: 1rem;
  border: 2px solid #e9ecef;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: #fff;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus {
  outline: none;
  border-color: #0078d4;
  box-shadow: 0 0 0 4px rgba(0,120,212,0.1);
  transform: translateY(-1px);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.radio-group,
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1rem;
}

.radio-group label,
.checkbox-group label {
  display: flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
  padding: 0.8rem 1.2rem;
  background: #fff;
  border: 2px solid #e9ecef;
  border-radius: 1rem;
  transition: all 0.3s ease;
  font-weight: 500;
}

.radio-group label:hover,
.checkbox-group label:hover {
  border-color: #0078d4;
  background: #f8fafc;
  transform: translateY(-1px);
}

.radio-group input[type="radio"],
.checkbox-group input[type="checkbox"] {
  margin-right: 0.8rem;
  transform: scale(1.2);
  accent-color: #0078d4;
}

.checkbox-group div {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  background: #fff;
  padding: 1rem;
  border-radius: 1rem;
  border: 2px solid #e9ecef;
  transition: all 0.3s ease;
  min-width: 200px;
}

.checkbox-group div:hover {
  border-color: #0078d4;
  box-shadow: 0 4px 15px rgba(0,120,212,0.1);
}

.checkbox-group div label {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
}

.cantidad-input {
  margin-top: 0.5rem !important;
  padding: 0.5rem !important;
  font-size: 0.9rem;
}

.specific-quantity-input {
  width: 90px !important;
  padding: 0.4rem !important;
  margin-top: 0.3rem !important;
  font-size: 0.85rem !important;
  text-align: center;
  display: block;
}

/* Contenedor con scroll para tablas */
.table-container {
  width: 100%;
  overflow-x: auto;
  margin-top: 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 8px 25px rgba(0,0,0,0.08);
  -webkit-overflow-scrolling: touch; /* Smooth scrolling en iOS */
}

table {
  width: 100%;
  min-width: 600px; /* Ancho mínimo para evitar que se comprima demasiado */
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 1rem;
  overflow: hidden;
  background: #fff;
}

th {
  background: linear-gradient(135deg, #0078d4, #0056b3);
  color: white;
  padding: 1rem 0.8rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
}

td {
  padding: 1rem 0.8rem;
  border-bottom: 1px solid #e9ecef;
  text-align: center;
  background: #fff;
  transition: background-color 0.3s ease;
  vertical-align: top;
}

tr:hover td {
  background: #f8fafc;
}

td:first-child {
  font-weight: 600;
  color: #495057;
  text-align: left;
  padding-left: 1.5rem;
}

table input[type="number"] {
  width: 80px;
  padding: 0.5rem;
  margin: 0;
  text-align: center;
}

table input[type="checkbox"] {
  transform: scale(1.3);
  accent-color: #0078d4;
}

button {
  background: linear-gradient(135deg, #0078d4, #0056b3);
  color: white;
  border: none;
  padding: 1.2rem 3rem;
  border-radius: 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(0,120,212,0.3);
  display: block;
  margin: 3rem auto 0;
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.6s;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(0,120,212,0.4);
}

button:hover::before {
  left: 100%;
}

button:active {
  transform: translateY(0);
}

.hidden {
  display: none;
}

/* Tooltip styles */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
  margin-left: 0.5rem;
  color: #0078d4;
  font-weight: bold;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 250px;
  background-color: #2c3e50;
  color: #fff;
  text-align: center;
  border-radius: 8px;
  padding: 10px;
  position: absolute;
  z-index: 1000;
  bottom: 130%;
  left: 50%;
  margin-left: -125px;
  opacity: 0;
  transition: all 0.3s ease;
  font-size: 0.85rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  pointer-events: none;
}

.tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #2c3e50 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
  transform: translateY(-5px);
}

/* Usos proyectados styles */
.usos-proyectados {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.usos-proyectados label {
  display: flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
  padding: 1rem;
  background: #fff;
  border: 2px solid #e9ecef;
  border-radius: 1rem;
  transition: all 0.3s ease;
  font-weight: 500;
}

.usos-proyectados label:hover {
  border-color: #0078d4;
  background: #f8fafc;
  transform: translateY(-1px);
}

.usos-proyectados input[type="checkbox"] {
  margin-right: 0.8rem;
  transform: scale(1.2);
  accent-color: #0078d4;
}

/* Responsive design */
@media (max-width: 768px) {
  .form-container {
    padding: 1.5rem;
    margin: 1rem;
  }

  h1 {
    font-size: 2rem;
  }

  fieldset {
    padding: 1.5rem;
  }

  .radio-group,
  .checkbox-group {
    flex-direction: column;
    gap: 1rem;
  }

  .checkbox-group div {
    min-width: auto;
  }

  .usos-proyectados {
    grid-template-columns: 1fr;
  }

  /* Mejorar visualización de tablas en móvil */
  .table-container {
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    border-radius: 0;
  }

  table {
    font-size: 0.85rem;
    min-width: 700px; /* Aumentar el ancho mínimo en móvil */
  }

  th, td {
    padding: 0.6rem 0.4rem;
    font-size: 0.8rem;
  }

  th {
    font-size: 0.75rem;
  }

  .specific-quantity-input {
    width: 70px !important;
    padding: 0.3rem !important;
    font-size: 0.75rem !important;
  }

  /* Indicador visual de scroll */
  .table-container::after {
    content: "← Desliza para ver más →";
    display: block;
    text-align: center;
    padding: 0.5rem;
    background: #f8fafc;
    color: #666;
    font-size: 0.75rem;
    border-top: 1px solid #e2e8f0;
  }
}

/* Animation for form sections */
fieldset {
  animation: slideInUp 0.6s ease forwards;
  opacity: 0;
  transform: translateY(30px);
}

fieldset:nth-child(1) { animation-delay: 0.1s; }
fieldset:nth-child(2) { animation-delay: 0.2s; }
fieldset:nth-child(3) { animation-delay: 0.3s; }

@keyframes slideInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #0078d4, #0056b3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #0056b3, #004494);
}