body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: center;
    background: url('board.png') no-repeat center center fixed;
    background-size: cover;
    color: #333;
    margin: 0;
    padding: 20px;
}

h1 {
    font-size: 2.5em;
    color: #ff6600;
}

.container {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    max-width: 500px;
    margin: 0 auto;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.form-group {
    margin-bottom: 20px;
}

/* --- LOGO TABS & GRID --- */
.logo-tabs {
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    text-align: left;
}

.tabs-header {
    display: flex;
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: bold;
    color: #888;
    transition: all 0.2s;
    font-size: 0.9em;
}

.tab-btn.active {
    background: #fff;
    color: #ff6600;
    border-bottom: 2px solid #ff6600;
}

.tab-content {
    display: none;
    padding: 15px;
}

.tab-content.active {
    display: block;
}

.upload-container {
    text-align: center;
    padding: 10px 0;
}

.upload-hint {
    font-size: 0.78em;
    color: #777;
    background: rgba(255, 102, 0, 0.06);
    border: 1px solid rgba(255, 102, 0, 0.15);
    border-radius: 6px;
    padding: 7px 10px;
    margin: 8px 0 2px;
    text-align: left;
    line-height: 1.5;
}

.upload-hint i {
    color: #ff6600;
    margin-right: 4px;
}

.logo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
    padding: 5px;
}

.logo-item {
    aspect-ratio: 1 / 1;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-color: #ff6600;
}

.logo-item.selected {
    border-color: #ff6600;
    background: #fff5ed;
    box-shadow: inset 0 0 0 1px #ff6600;
}

.divider::before, .divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background-color: #ddd;
}

.divider::before { left: 0; }
.divider::after { right: 0; }

#logoThumbnail {
    display: none; 
    max-width: 120px;
    max-height: 120px;
    margin: 15px auto 0;
    border: 2px dashed #ccc;
    border-radius: 8px;
    object-fit: contain;
    padding: 5px;
}

button {
    background-color: #ff6600;
    color: white;
    border: none;
    padding: 9px 18px;
    font-size: 1em;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

button:hover {
    background-color: #e65c00;
}

.ctrl-btn {
    width: 40px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 5px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ctrl-btn:hover {
    background-color: #555;
    transform: scale(1.05);
}

#previewArea {
    position: relative;
    width: 100%;
    max-width: 380px; 
    height: auto; 
    min-height: 300px;
    max-height: 480px; /* Evitar scroll excesivo */
    background-color: transparent; 
    margin: 20px auto 10px;
    display: flex; 
    justify-content: center;
    align-items: center; /* Centrado vertical */
    overflow: visible; 
    border-radius: 12px; 
    border: 1px solid rgba(0,0,0,0.05);
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(2px);
    padding: 20px 0;
}

#packagingWrapper {
    position: relative;
    width: 100%; /* Se escala vía JS */
    transition: width 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible; /* Permitir que la manija sobresalga */
}

#bagHandle {
    position: absolute;
    bottom: calc(100% - 2px); /* Pegado al borde superior de la bolsa */
    left: 50%;
    transform: translateX(-50%);
    width: 35%;
    height: 10.5%; /* Reducido un 20% adicional */
    min-height: 18px;
    border: 9px solid #b39671; /* Engrosado un 50% */
    border-bottom: none;
    border-radius: 40% 40% 0 0;
    z-index: -1; /* Va "atrás" de la bolsa para que parezca que sale de adentro */
    display: none;
    transition: all 0.3s ease;
}

#packagingBase {
    width: 100%;
    height: auto; 
    display: block;
    border-radius: 4px; 
    background-color: #d2b48c; /* Color Kraft */
    background-image: 
        repeating-linear-gradient(45deg, rgba(255,255,255,0.05) 0px, rgba(255,255,255,0.05) 1px, transparent 1px, transparent 2px),
        repeating-linear-gradient(-45deg, rgba(0,0,0,0.02) 0px, rgba(0,0,0,0.02) 1px, transparent 1px, transparent 2px);
    box-shadow: 
        0 5px 15px rgba(0,0,0,0.15),
        inset 0 0 15px rgba(0,0,0,0.05);
    border: 1px solid #c4a47c;
    transition: width 0.3s ease, aspect-ratio 0.3s ease;
}

#logoPlaceholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.4em;
    font-weight: 900;
    color: rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 2px;
    z-index: 5;
    pointer-events: none;
    user-select: none;
    text-align: center;
    width: 85%;
    line-height: 1.2;
    overflow: hidden;
}

#logoImg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(0deg);
    height: auto; 
    transition: width 0.2s ease, transform 0.3s ease;
    display: none; 
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none;
    
    /* EFECTO SELLO NEGRO */
    mix-blend-mode: multiply;
    opacity: 0.90; 
    filter: drop-shadow(0px 0px 1px rgba(0, 0, 0, 0.4)); 
}

#logoImg.dragging {
    cursor: grabbing; 
}

.info-text {
    background-color: rgba(255, 243, 230, 0.9);
    backdrop-filter: blur(4px);
    border: 1px solid #ffd1a3;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.95em;
    color: #444;
    margin: 15px auto;
    max-width: 380px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.info-text p {
    margin: 5px 0;
}

#controlsContainer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    margin-top: 20px;
}

.control-group {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 2px 0;
    width: 100%;
    max-width: 320px;
}

.control-group span {
    font-size: 0.9em;
    font-weight: bold;
    color: #555;
    text-transform: uppercase;
    flex: 1;
    text-align: left;
}

.btn-row {
    display: flex;
    gap: 12px;
}

#logoControls {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    align-items: center;
    transition: all 0.3s ease;
}

.radio-group {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* --- PRODUCT TABS --- */
.product-tabs {
    margin: 15px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    max-width: 440px;
    margin: 15px auto;
}

.prod-tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: bold;
    color: #888;
    transition: all 0.2s;
    font-size: 0.85em;
}

.prod-tab-btn.active {
    background: #fff;
    color: #ff6600;
    border-bottom: 2px solid #ff6600;
}

.prod-tab-content {
    display: none;
    padding: 12px;
}

.prod-tab-content.active {
    display: block;
}

.size-selection {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.size-selection label {
    padding: 6px 4px;
    background: rgba(0,0,0,0.03);
    border-radius: 4px;
    border: 1px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: bold;
}

.size-selection input:checked + label, .size-selection label:has(input:checked) {
    background: #fff5ed;
    border-color: #ff6600;
    color: #ff6600;
}

/* --- HIDE SPINNERS --- */
.no-spinners::-webkit-outer-spin-button,
.no-spinners::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.no-spinners {
  appearance: textfield;
  -moz-appearance: textfield;
}

.custom-size-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    letter-spacing: -0.5px;
    height: 32px; /* Altura fija para centrado vertical exacto */
    line-height: normal;
}

.custom-size-row input {
    width: 40px !important; /* Reducido un 20% */
    padding: 4px !important;
    font-size: 0.85em;
    height: 28px;
    box-sizing: border-box;
    margin: 0;
}

.custom-size-row span, .custom-size-row div {
    font-size: 0.85em;
    color: #666;
    display: flex;
    align-items: center;
    height: 100%;
}

.subtitle {
    color: #666;
    font-size: 1.1em;
    margin-top: -10px;
    margin-bottom: 30px;
}

footer {
    margin-top: 50px;
    padding: 40px 20px;
    background-color: #333;
    color: white;
    font-size: 0.9em;
}

.footer-container {
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.footer-container h3 {
    color: #ff6600;
    margin-bottom: 20px;
}

.footer-container ul {
    list-style: none;
    padding: 0;
    margin-bottom: 25px;
}

.footer-container ul li {
    margin: 8px 0;
}

.footer-container a {
    color: white;
    text-decoration: none;
}

.footer-container a:hover {
    text-decoration: underline;
}

.whatsapp-btn {
    display: inline-block;
    background-color: #25d366;
    color: white !important;
    padding: 11px 22px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1em;
    text-decoration: none !important;
    transition: transform 0.3s, background 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.whatsapp-btn:hover {
    background-color: #128c7e;
    transform: scale(1.05);
}

.download-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 9px 18px;
    font-size: 0.9em;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 20px;
    width: 100%;
    font-weight: bold;
}

.download-btn:hover {
    background-color: #0056b3;
}
