:root {
    --brand: #6366f1;
    --brand-dark: #4f46e5;
    --bg-app: #f1f5f9;
    --card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg-app); color: var(--text-main); }

.app-container { display: flex; height: 100vh; overflow: hidden; }

/* Estilo para el contenedor del selector */
.product-selector {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-selector label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: default; /* El texto de la etiqueta no suele llevar puntero */
}

/* Estilo del Select */
#tipo-producto {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer; /* Aquí activamos el puntero */
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%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 12px center;
    background-size: 16px;
}

/* Aplicamos puntero a las opciones y grupos para navegadores que lo soporten */
#tipo-producto option, 
#tipo-producto optgroup {
    cursor: pointer;
    padding: 10px;
}

#tipo-producto:hover {
    border-color: var(--brand);
    background-color: #fcfcff; /* Un ligero cambio de fondo al pasar el ratón */
}

#tipo-producto:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Sidebar & Upload Area */
.sidebar { width: 400px; background: white; border-right: 1px solid #e2e8f0; display: flex; flex-direction: column; padding: 24px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; margin-bottom: 30px; }
.logo span span { color: var(--brand); }

.upload-area:hover { border-color: var(--brand); background: #f5f3ff; }
.upload-area i { font-size: 48px; color: var(--brand); margin-bottom: 12px; }

/* Donde aparecen todas las imágenes */
.file-manager {
    margin-top: 10%;
}

/* Boton para descartar imagenes */

.btn-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #f1f5f9;
    color: #64748b;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    font-size: 16px;
}

.btn-remove:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* File List Cards */
.file-list-container { margin-top: 20px; overflow-y: auto; flex-grow: 1; }
.app-container .file-card { 
    background: white; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px; 
    margin-bottom: 12px; display: flex; gap: 12px; align-items: center; position: relative;
}
.file-card.warning {
    border-left: 4px solid #f59e0b;
}
.file-card img { width: 50px; height: 50px; object-fit: cover; border-radius: 6px; }
.file-info h5 { font-size: 13px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.file-info p { font-size: 11px; color: var(--text-muted); }
.status-badge {
    display: inline-block;
    height: auto;
    line-height: 1.4;
    padding: 6px 12px;
    margin-top: 5px;
    border-radius: 15px;
}
.status-success { background: #dcfce7; color: var(--success); }
.status-error { background: #fee2e2; color: var(--error); }
.app-container .status-warning {
    background: #fef3c7;
    color: #d97706;
}

/* Main Content & Canvas */
.main-content { flex-grow: 1; display: flex; flex-direction: column; padding: 24px; gap: 24px; }
.canvas-preview { 
    flex-grow: 1; background: #e2e8f0; border-radius: 20px; position: relative; 
    display: flex; flex-direction: column; overflow: hidden;
}
.canvas-header { padding: 12px 24px; background: #334155; color: white; display: flex; justify-content: space-between; font-size: 12px; }
/* El contenedor actúa como la mesa/rollo de impresión */
.visual-pliego { 
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 20px 0; /* Quitamos padding lateral para ceñirnos a los 57cm */
    display: flex; 
    flex-direction: column; 
    align-items: center; /* Centra los diseños en el rollo */
    gap: 10px; 
    
    /* Simulamos el rollo de DTF (57cm = 570px) */
    width: 570px; 
    margin: 0 auto; 
    background: #ffffff; /* Color del film */
    border-left: 2px dashed #94a3b8; /* Bordes del rollo */
    border-right: 2px dashed #94a3b8;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

/* La caja de la imagen individual */
.pliego-item { 
    background: transparent; 
    border: 1px dashed var(--brand); /* Para ver el límite transparente del PNG */
    /* El ancho y alto ahora los inyecta el JS dinámicamente */
}

/* Checkout Card */
.checkout-card { 
    background: white; padding: 24px; border-radius: 20px; display: flex; align-items: center; 
    justify-content: space-between; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

/* Estadísticas en parte inferior */
.stats { display: flex; gap: 40px; }
.stat-item label { display: block; font-size: 18px; color: var(--text-muted); margin-bottom: 4px; } 
.stat-item strong { font-size: 24px; color: var(--text-main); }
.btn-primary { 
    background: var(--brand); color: white; border: none; padding: 16px 32px; 
    border-radius: 12px; font-weight: bold; cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 8px;
}

/* Estilo unificado para botones primarios (verde) */
.btn-primary { 
    background: var(--success); /* Usamos el verde definido en tus variables */
    color: white; 
    border: none; 
    padding: 16px 32px; 
    border-radius: 12px; 
    font-weight: bold; 
    cursor: pointer; 
    transition: 0.2s; 
    display: flex; 
    align-items: center; 
    gap: 8px;
    font-size: 15px;
    justify-content: center;
}

.btn-primary:hover:not(:disabled) { 
    filter: brightness(0.9); /* Oscurece ligeramente el verde al pasar el ratón */
    transform: translateY(-2px); 
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* Botón de subida con el estilo de 'Comprar' pero siempre activo */
.btn-upload {
    background: var(--success) !important; /* Forzamos el verde */
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}

.btn-upload:hover {
    filter: brightness(0.9);
    transform: translateY(-2px);
}

/* Ajustes para el área de subida y centrado del botón */
/* Área de subida como contenedor flexible */
.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center; /* Centrado horizontal */
    justify-content: center;
    gap: 20px;
    padding: 40px;
    border: 2px dashed #cbd5e1;
    background: #fafafa;
    border-radius: 16px;
    cursor: pointer;
}

/* Cuando el archivo está sobre el área */
.upload-area.highlight {
    border-color: var(--brand);
    background-color: #f5f3ff;
    transform: scale(1.02);
    transition: all 0.2s ease;
}

.upload-actions {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

/* Aseguramos que el botón de comprar mantenga su ancho en la card inferior */
.checkout-card .btn-primary {
    min-width: 200px;
}