body, html {
  min-height: 100vh;          /* Changed from height: 100% */
  margin: 0;                  /* Changed from 10px */
  padding: 10px;              /* Added instead of margin */
  display: flex;
  justify-content: flex-start; /* Changed from center */
  align-items: center;
  flex-direction: column;
  box-sizing: border-box;      /* Added for proper sizing */
  width: 100%;                /* Added for full width */
}

@media (max-width: 768px) {
  body, html {
    padding: 8px;             /* Smaller padding on tablets */
  }
}

@media (max-width: 480px) {
  body, html {
    padding: 5px;             /* Even smaller on mobile */
    justify-content: safe center; /* Prevents overflow */
  }
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 800px;
  min-height: 100vh; /* Changed from height to min-height */
  padding: 20px; /* Added for mobile safety */
  margin: 0 auto; /* Center the container */
  box-sizing: border-box; /* Include padding in width calculations */
}

/* Responsive adjustments */
  @media (max-width: 768px) {
    gap: 15px;
    padding: 15px;
  }

  @media (max-width: 480px) {
    gap: 10px;
    padding: 10px;
  }

.upper-div {
  text-align: center;
  padding: 20px;
  background-color: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 8px;
  width: 100%;
  max-width: 100%; /* Ensures it doesn't overflow its container */
  box-sizing: border-box; /* Includes padding in width calculation */
  z-index: 1005;

  /* Responsive adjustments */
  @media (max-width: 768px) {
    padding: 15px;
    border-radius: 6px;
  }

  @media (max-width: 480px) {
    padding: 12px;
    border-radius: 4px;
    border-width: 0.5px; /* Thinner border on small screens */
  }
}

.human-container {
  position: relative;
  width: 100%; /* Changed from fixed 800px */
  max-width: 800px; /* Maximum size */
  aspect-ratio: 2/1; /* Maintain 800/400 proportion (width/height) */
  margin: 40px auto 0; /* Replaces top:40px with proper centering */
}

.human-svg {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 37.5%; /* 300/800 = 37.5% of container */
  height: auto; /* Let it scale proportionally */
  aspect-ratio: 1/2; /* Maintain 300/600 proportion */
  cursor: pointer;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .human-container {
    max-width: 90vw; 
  }
}

@media (max-width: 600px) {
  .human-svg {
    width: 50%; 
  }
}

@media (max-width: 400px) {
  .human-container {
    aspect-ratio: 1/1; 
  }
  .human-svg {
    width: 60%; 
  }
}
        
        .dropdown {
  position: absolute;
  display: none;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  z-index: 1000;
  padding: 10px;
  min-width: 120px;
  max-width: 90vw; 
  width: max-content; 
  
  @media (max-width: 600px) {
    padding: 8px;
    min-width: 100px;
    transform: translateX(-20%); 
  }
  
  @media (max-width: 400px) {
    padding: 6px;
    min-width: 80px;
  }
}

.color-option {
  width: 30px;
  height: 30px;
  margin: 5px;
  display: inline-block;
  cursor: pointer;
  border: 2px solid transparent;
  touch-action: manipulation;
  
  @media (max-width: 768px) {
    width: 25px;
    height: 25px;
    margin: 4px;
  }
  
  @media (max-width: 480px) {
    width: 20px;
    height: 20px;
    margin: 3px;
    border-width: 1px;
  }
}

@media (max-width: 400px) {
  .dropdown {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }
  .color-option {
    flex: 0 0 calc(20% - 6px);
  }
}
        
        .color-option:hover {
            border-color: #333;
        }
        
        .instructions {
            /*position: absolute;*/
            bottom: 20px;
            width: 100%;
            text-align: center;
            color: #666;
            font-size: 14px;
            padding-top: 15px;
            font-family: system-ui;
        }
.color-labels-left, .color-labels-right {
    position: absolute;
    top: 0;
    width: clamp(120px, 20%, 150px);
}

.color-labels-left {
    left: 2%;
}

.color-labels-right {
    right: 2%;
}

.color-label {
    position: absolute;
    font-size: clamp(10px, 1.5vw, 9px);
    padding: 8px 10px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
    transform: translateY(-50%); 
}

.connector-line {
    position: absolute;
    background: #999;
    height: 1px;
    z-index: 1;
    transform-origin: left center;
}

@media (max-width: 768px) {
    .color-labels-left, .color-labels-right {
        width: clamp(100px, 25%, 120px);
    }
    
    .color-label {
        font-size: 12px;
        padding: 6px 8px;
    }
}

@media (max-width: 480px) {
    .color-labels-left, .color-labels-right {
        width: 80px;
    }
    
    .color-label {
        font-size: 10px;
        padding: 4px 6px;
    }
}
        .blur-background {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 999;
            display: none;
        }

.table {
  display: table;
  width: 100%;
  max-width: 800px;
  border-collapse: collapse;
  border: 2px solid #4a90e2;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  width: 100%;
}

.row {
  display: table-row;
}

.cell {
  display: table-cell;
  padding: 10px;
  border: 1px solid #e0e0e0;
  text-align: center;
  vertical-align: middle;
  font-size: 12px;
  font-family: system-ui;
  font-weight: 300;
}

.cell-social {
  display: table-cell;
  border: 1px solid #e0e0e0;
  text-align: center;
  vertical-align: middle;
  font-size: 12px;
  font-family: system-ui;
  font-weight: 300;
}

p {
  font-size: 12px;
  font-family: system-ui;
  font-weight: 300;
}

.header {
  background-color: #036096;
  color: white;
  font-weight: bold;
}

.header .cell {
  border-color: #357ab8;
}

.row:nth-child(even) {
  background-color: #f9f9f9;
}

/*.row:hover {*/
/*  background-color: #eaf2ff;*/
/*}*/

.subtotal {
  font-weight: bold;
  background-color: #f0f0f0;
}

.total {
  font-weight: bold;
  background-color: #d0d0d0;
}

.subtotal .cell, .total .cell {
  border-top: 2px solid #4a90e2;
}

.bold {
    font-weight: bold;
}

#loading {
    display: none; /* Hidden by default */
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1006;
    /* Flexbox Centering (MUST be here, not just in .active) */
    display: flex; /* ⚠️ Keep this even if using jQuery .show() */
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 20px;
    backdrop-filter: blur(2px);
}

/* Remove the .active class selector since we're using show() */
#loading::before {
    content: '';
    display: block;
    width: clamp(40px, 10vw, 50px);
    height: clamp(40px, 10vw, 50px);
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-left-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#loading::after {
    content: 'Generando la proforma en PDF. Espere por favor.';
    display: block;
    color: white;
    font-size: clamp(14px, 3vw, 16px);
    font-family: system-ui, -apple-system, sans-serif;
    font-weight: 300;
    max-width: 80vw;
    text-align: center;
    padding: 0 20px;
    line-height: 1.4;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #loading {
        gap: 15px;
    }
    
    #loading::after {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    #loading {
        gap: 12px;
        backdrop-filter: blur(1px);
    }
    
    #loading::before {
        width: 35px;
        height: 35px;
        border-width: 2px;
    }
    
    #loading::after {
        font-size: 14px;
        max-width: 90vw;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion) {
    #loading::before {
        animation: spin 2s linear infinite;
    }
}